omp packages

@kvidzibo/pi-model-rules0.2.0

Per-model rules for Pi: add instructions to the system prompt only when a matching model is active.

GitHub Actions Published 5 days ago MIT ~285 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

Pi Model Rules

Per-model rules for Pi: like AGENTS.md, but each file applies only while a matching model is active. Inspect them with /pi-model-rules.

npm · GitHub · Pi package gallery

Install

Requires Pi 1.6.1 or newer and Node 22.19 or newer.

pi install npm:@kvidzibo/pi-model-rules

Restart Pi, or run /reload in an existing session.

Write rules

Put Markdown files in the rules folder, ~/.pi/agent/model-rules/ by default. The file name, without .md, is a pattern for the models the file applies to:

File Applies to
claude-fable-5-2.md model ID claude-fable-5-2 on any provider
claude-*.md every model ID starting with claude-
anthropic__claude-*.md the same models, on provider anthropic only
openrouter__anthropic__*.md OpenRouter models with IDs starting anthropic/
*.md every model
  • * matches any run of characters; matching is case-sensitive.
  • __ stands for /. A pattern containing it is matched against provider/model-id; any other pattern is matched against the model ID alone.
  • All matching files apply. They are joined least specific first — fewer literal characters, then more wildcards — so the most specific file comes last. For this ordering a pattern without a provider counts as */pattern.
  • Only regular .md files count, including symlinks to them. Files without rules are ignored.

Each file is a flat list with one rule per - or * bullet:

- Keep answers under five lines unless asked for detail.
- When the `delegate` tool is available, spawn `recon` before exploring
  unfamiliar code.
  • Indented lines continue the rule above, so long rules can wrap. Nested bullets are folded into their parent rule.
  • Blank lines are ignored. Headings and other unindented text are not allowed: the rules land in a flat list with no grouping, so write any condition into the rule itself and name the tool a rule is about.

The rules are added to the <rules> section of Pi's system prompt, after the tool rules. Pi drops a rule identical to one already listed. A custom system prompt has no <rules> section, so there they go in a <model_rules> section instead.

Files are read at the start of every run, so edits and model switches take effect on the next prompt without /reload. Switching to a model with no matching file removes the rules.

Rules also apply in print, JSON and RPC modes, and in any child Pi process that loads this package.

Example

examples/delegation.md is a real rule file, saved as claude-fable-*.md. It counters one model family's habit of doing work itself instead of delegating it. It refers to a delegate tool with recon and implement roles from a separate extension, so adapt the names to your own tools rather than copying it unchanged.

Inspect and configure

Run /pi-model-rules to see:

  • the current model and how many rule files are active for it;
  • every rule file, how many available models it matches, and whether it is active — files that match no available model are easy to spot;
  • a file's pattern, matched models and a preview, by selecting it.

Select Rules folder to point the package at another folder, such as one in a dotfiles repository. Enter an absolute or ~/ path; submit a blank value to return to the default. The setting is global and stored in ~/.pi/agent/pi-model-rules.json.

Limitations

  • Rules are global; there is no per-project rules folder.
  • Rule files are trusted instructions. Only point the rules folder at a location you control.
  • If the config, a custom rules folder or a rule file cannot be read, or a rule file contains anything but rules, Pi shows a warning once and runs without model rules. /pi-model-rules shows the cause and still lets you change the folder.
  • Windows file names cannot contain *, so only exact-ID rule files work on a native Windows filesystem.

Development

npm install
npm test

License

MIT