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.
git clone --depth 1 https://github.com/steipete/agent-rulesWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/steipete/agent-rules/swift-observation)<a href="https://agentmods.dev/rules/steipete/agent-rules/swift-observation"><img src="https://agentmods.dev/badge/rules/steipete/agent-rules/swift-observation/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/steipete/agent-rules/swift-observation"><img src="https://agentmods.dev/badge/rules/steipete/agent-rules/swift-observation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What 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.1 | $0.00000 | $0.03447 |
| Opus 5.5 | $0.00000 | $0.01379 |
| Sonnet 5.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 1mo 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.
- 1mo 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,677 stars, last pushed 5mo 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_general_rules
For every Kotlin Android code you generate or refactor.
android_workmanager_best_practices
Best practices for WorkManager usage in background tasks.
kotlin-rules
You are a Senior Kotlin programmer with experience in the Android framework and a preference for clean programming and design patterns.
flutter-rules
You are an expert in Flutter, Dart, Riverpod, Freezed, Flutter Hooks, and Supabase.
kotlin-ktor-development-cursorrules-prompt-file
Cursor rules for Kotlin development with Ktor integration.
kotlin-springboot-best-practices-cursorrules-prompt-file
Cursor rules for Kotlin Springboot Best Practices.