Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/steipete/agent-rules/swift-observationgit clone --depth 1 https://github.com/steipete/agent-rulesWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.03447 |
| Opus 5 | $0.00000 | $0.01724 |
| Sonnet 5 | $0.00000 | $0.00689 |
| Haiku 4.5 | $0.00000 | $0.00345 |
Grade A, and why
swift-observation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 680 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Swift Observation Framework
The Observation framework provides a robust implementation of the observer design pattern in Swift, introduced in iOS 17, macOS 14, tvOS 17, and watchOS 10 (Swift 5.9+).
Overview
The Observation framework centers around the @Observable macro, which automatically tracks changes to properties and notifies observers. This framework represents a significant improvement over the older ObservableObject protocol, offering better performance and a cleaner API.
Key Benefits
- Fine-grained observation: SwiftUI views only update when observed properties actually change, not when any property on the object changes
- Cleaner code: No need for
@Publishedproperty wrappers on every property - Better performance: Views track dependencies at the property level, minimizing unnecessary view updates
- Simpler syntax: Less boilerplate compared to
ObservableObject
Using @Observable
To make a type observable, simply apply the @Observable macro to the class declaration:
import Observation
@Observable
class GameState {
var score: Int = 0
var level: Int = 1
var playerName: String = ""
// Private or computed properties work normally
private var internalState: String = ""
var displayName: String {
"Player: \(playerName)"
}
}
The @Observable macro automatically:
- Adds conformance to the
Observableprotocol - Instruments property accessors to track reads and writes
- Manages observer registration and notification
SwiftUI Integration
Using Observable Objects in Views
With @Observable, you use @State instead of @StateObject:
import SwiftUI
struct GameView: View {
@State private var game = GameState()
var body: some View {
VStack {
Text("Score: \(game.score)")
Text("Level: \(game.level)")
Button("Increase Score") {
game.score += 10
}
}
}
}
Important: Only the specific properties read in the view's body will trigger updates. If body only reads game.score, changes to game.level won't cause a re-render.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 680 lines · 0 tokens per session scan A 3ba20e8ca295
swift-observation is a cursor rule published in the GitHub repository steipete/agent-rules (5,695 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,447 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
android_unit_testing_bdd
Unit testing best practices with BDD style.
android_general_rules
For every Kotlin Android code you generate or refactor.
android_integration_testing
Android Integration Testing best practices for multi-layer testing.
android_workmanager_best_practices
Best practices for WorkManager usage in background tasks.
react_hooks
React Hooks best practices for frontend package.
general_clean_code_principles
Clean code principles for better readability.