
Built a reusable rules system for Pi (and other coding agents)
One thing I kept running into with Pi was instruction management.
Every project slowly accumulates a huge AGENTS.md (or similar) full of rules that aren't always relevant to the task at hand.
You also end up copying the same instructions between repositories over and over.
So I built ai-rules.
The idea is simple: instead of maintaining one giant instruction file, you create small, reusable personal rules as Markdown files and only inject the ones that match each task.
Examples of rules you might capture:
- Go error handling
- Rust safety
- testing philosophy
- commit message conventions
- architecture preferences
- documentation standards
- personal coding habits
Then only the rules that actually matter for what you're asking Pi to do get compiled into a compact contract — not the whole rulebook every time.
In Pi (after setup):
/create-rule no fetch in React components
/airules Add UserCard data loading
From the terminal:
ai-rules run "Implement data loading in UserCard.tsx"
ai-rules doctor
Rules live in ~/.config/ai-rules/rules/. Local-first, plain Markdown + YAML frontmatter, versionable if you want.
Install:
npx u/therealsalzdevs/ai-rules setup
Early beta — Pi and OpenCode only right now (not Cursor / Claude Code / Codex).
Repo:
https://github.com/SalzDevs/ai-rules
I'd love feedback from people using Pi:
- How are you managing your AI instructions today?
- Do you keep everything in one AGENTS.md, or have you built another workflow?
- Does /create-rule + /airules feel better than repeating prefs each session?