← Catalog

pi-rules

PI extension that injects markdown rules for any pi tool, including custom registered tools

ExtensionPrompt

Install

Install with PiG

pig install npm:pi-rules

Install with Pi

pi install npm:pi-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.

{
  "skills": [
    "./dist/skills"
  ],
  "extensions": [
    "./dist/index.js"
  ]
}

README

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

pi-rules

PI extension that loads markdown rules from .pi/rules/ and .claude/rules/ and injects matching rule bodies into tool_result output for any PI tool, including tools registered by other extensions.

Install

pi install npm:pi-rules

Rule format

---
description: TypeScript style
tools: "*"
paths:
  - "src/**/*.ts"
inputPaths:
  - path
includeErrors: false
dedupe: session
---
Prefer named exports. Avoid `any` unless unavoidable.

Rules are discovered from ~/.pi/rules/, ~/.claude/rules/, <project>/.pi/rules/, and <project>/.claude/rules/.

If tools is omitted, compatibility mode matches read, edit, and write. Use tools: "*" to match every built-in and custom tool. If paths is omitted, the rule is tool-scoped and does not need a target path.

Path-scoped rules match project-relative targets and absolute targets outside the current PI cwd. For outside-cwd absolute paths, generic suffix globs such as **/*.go match by basename/absolute path; directory-specific globs should include a leading **/ when they must match anywhere, e.g. **/internal/**/*.go.

Runtime API

import { registerInjectionRule, registerToolAdapter } from "pi-rules/runtime";

registerToolAdapter({
  id: "my-extension.my_tool.paths",
  tools: "my_tool",
  inputPaths: ["target.path", "extraFiles[]"],
});

registerInjectionRule({
  id: "my-extension.my_tool.instructions",
  description: "Instructions for my_tool",
  tools: "my_tool",
  body: "When using my_tool, validate inputs and summarize side effects.",
});

Diagnostics

Run /tool-rules doctor inside PI to list filesystem rules, runtime rules, adapters, parse errors, skipped files, symlink escapes, and invalid glob warnings.