pi-mdc-rules
MDC rules extension for pi-coding-agent - loads and enforces rules from Markdown files
Package details
Install pi-mdc-rules from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-mdc-rules- Package
pi-mdc-rules- Version
1.1.1- Published
- Feb 24, 2026
- Downloads
- 39/mo · 11/wk
- Author
- mlevif
- License
- MIT
- Types
- extension
- Size
- 19 KB
- Dependencies
- 1 dependency · 1 peer
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
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-rules
Usage
pi --extension pi-mdc-rules
Rules 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...