pi-remove-docs0.1.0
Pi extension that removes the built-in <docs> system-prompt section to shrink the startup context.
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.
Reports 0
No reports yet.
Readme
pi-remove-docs
A Pi extension that removes the
built-in <docs> section from the system prompt — the block that points the
model at Pi's own README, docs, and examples:
<docs>
Pi documentation (read only when the user asks about the harness itself, its SDK, extensions, themes, skills, or TUI):
- Main documentation: /path/to/pi/README.md
- Additional docs: /path/to/pi/docs
- Examples: /path/to/pi/examples (extensions, custom tools, SDK)
...
</docs>
The preamble and every other generated section (<tools>, <rules>,
<project_context>, <skills>, <cwd>, and any custom sections) are left
exactly as Pi built them.
Why
The docs section is useful, but it is included in every request and is only relevant when you ask the agent about Pi itself. Removing it trims a fixed chunk of the startup context. This extension is for people who already know where the Pi docs live, or who would rather not pay for that pointer on every turn.
Install
pi install npm:pi-remove-docs
Verify with pi list. Update later with pi update npm:pi-remove-docs
(or pi update --extensions for every package).
Usage
The <docs> section is removed by default. To keep it, launch Pi with the flag:
pi --keep-docs
Or toggle it for the current session:
| Command | Description |
|---|---|
/remove-docs |
Show the current state (removed/kept), the launch flag, and the session override |
/remove-docs on |
Remove the <docs> section from the next turn on |
/remove-docs off |
Keep the <docs> section from the next turn on |
/remove-docs reset |
Drop the session override and follow --keep-docs again |
While active, the footer shows pi docs removed (−N chars).
How it works
Pi builds <docs> inside its default system-prompt branch, next to <tools>
and <rules>. Because it is generated rather than supplied through
systemPromptOptions.sections, an extension cannot delete it by editing those
options. This extension instead runs in before_agent_start, matches the
rendered <docs>…</docs> block, and returns the whole prompt with that block
removed.
The match is anchored on the Pi documentation ( line, so a different <docs>
section contributed by another extension is never touched. If no built-in
section is present — for example because SYSTEM.md, --system-prompt, or
another extension already replaced the prompt — the extension leaves the prompt
unchanged and warns once.
The output is deterministic, so provider prompt caching is unaffected after the first turn.
Notes
- Removal replaces the run's system prompt (
forceSystemPrompt). Extensions that add sections after this one in load order will not see their modifications in the same turn.pi-custom-preambleuses the same technique. - The section is only ever removed from what is sent to the model; the session transcript still records Pi's structured prompt sections.
License
MIT