pi-mdc-rules
v1.1.1
Published
MDC rules extension for pi-coding-agent - loads and enforces rules from Markdown files
Readme
pi-mdc-rules
Rules extension for pi-coding-agent.
Loads rules from .agents/rules/*.md and applies them based on frontmatter.
Install
npm install pi-mdc-rulesUsage
pi --extension pi-mdc-rulesRules are re-read from disk on every turn, so changes are picked up immediately.
Commands
/mdc
Create a new rule interactively with AI assistance. Run /mdc inside pi and it will ask:
- What the rule should enforce
- Which trigger type to use
- Which files to match (if
glob) - A name for the rule file
The AI then generates and writes the rule to .agents/rules/<name>.md.
Writing rules
Rules are Markdown files in .agents/rules/ with a YAML frontmatter block. The trigger field controls when the rule is applied.
trigger: always_on
Injected into the system prompt on every turn.
---
trigger: always_on
---
Always use TypeScript strict mode. Never use `any`.trigger: glob
Blocks read/write/edit on matching files until the agent has read the rule. Use globs to specify which files trigger it.
---
trigger: glob
globs: "*.py"
description: Python file conventions
---
Add an author comment at the top of every Python file. If you don't know the author, ask the user.globs accepts a single pattern, a comma-separated list, or a YAML array:
globs: "*.ts, *.tsx"globs:
- "*.ts"
- "*.tsx"trigger: model_decision
Listed in the system prompt as available guidance. The agent reads it on demand when relevant.
---
trigger: model_decision
description: Guidelines for writing database migrations
---
All migrations must be reversible. Include both `up` and `down` steps...