← Catalog

pi-mdc-rules

MDC rules extension for pi-coding-agent - loads and enforces rules from Markdown files

Extension

Install

Install with PiG

pig install npm:pi-mdc-rules

Install with Pi

pi install npm:pi-mdc-rules
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 1.1.1 (README.md). PiG does not review it.

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:

  1. What the rule should enforce
  2. Which trigger type to use
  3. Which files to match (if glob)
  4. 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...