fix(pi): scope the runtime config and agent identity to the checkout - #110
Merged
Merged
Conversation
`scripts/sync_pi_config.py` defaulted to `~/.pi/agent`, so the nine SOC servers were installed globally: every pi session on the machine — unrelated repos included — paid for their tool schemas in context and spawned nine `uv` subprocesses at startup. f0_pentest already ships project-scoped for exactly this reason; this brings f0_sectools in line. - Default `--pi-home` is now `<checkout>/.pi`, created on demand for a fresh clone. `--pi-home ~/.pi/agent` is the opt-in for a global install and still errors if that directory is missing, since that means pi is not installed. - Add a root `AGENTS.md`, modelled on f0_pentest's: pi and opencode read the first context file per directory, so `AGENTS.md` is read *instead of* `CLAUDE.md` rather than alongside it. It routes between developing the repo and operating a SOC instead of being an operator persona itself. - Project scope no longer writes an `AGENTS.md` beside the rendered `mcp.json`: pi reads context files from `~/.pi/agent` and from cwd upward, never from `<cwd>/.pi/`, so that copy was one pi never loaded. A global install still links the identity, having no repo root to carry one. - Report "created" vs "updated, previous saved as .bak" honestly — the old message named a backup it had not written on a first install. - Ignore `/.pi/`, matching f0_pentest. Verified end to end: pi started in the checkout loads the router and the nine servers; started anywhere else it loads no context file and only `f0-library`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Claude finished @ubercylon8's task in 1m 56s —— View job Security review — PR #110
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What & why
scripts/sync_pi_config.pydefaulted to~/.pi/agent, so the nine SOC serverswere installed globally: every pi session on the machine — unrelated repos
included — paid for their tool schemas in context and spawned nine
uvsubprocesses at startup.
f0_pentestalready ships project-scoped for exactlythis reason; this brings
f0_sectoolsin line, and adds the rootAGENTS.mdentry point that repo already has.
The default is now
<checkout>/.pi, created on demand for a fresh clone;--pi-home ~/.pi/agentis the opt-in for a global install.pi-mcp-extensionreads
<cwd>/.pi/mcp.jsonand lets it win over the global config, so theservers load only when pi is started from the checkout root (it matches
<cwd>exactly and does not walk up).
Two things this exposed and fixed along the way:
AGENTS.mdsymlink written beside the renderedmcp.jsonwas never readby anything — pi loads context files from
~/.pi/agentand from cwd upward,never from
<cwd>/.pi/. Project scope now skips it and the rootAGENTS.mdcarries the identity instead; a global install still links it, having no repo
root above it to carry one.
previous saved as .bakwithout having writtena backup.
Note for anyone syncing an existing install: after this, run
uv run python scripts/sync_pi_config.pyonce and remove the repo's serversfrom
~/.pi/agent/mcp.jsonby hand — the script deliberately does not reachinto a pi home it was not pointed at.
Verified end to end on a live install: pi started in the checkout loads the
router and all nine servers; started anywhere else it loads no context file and
only the unrelated
f0-libraryserver.Checklist (mirrors the Critical Rules in CLAUDE.md)
core/— untouched.AGENTS.md,.gitignore.uv run pytest(1089 passed, 1 skipped) anduv run ruff check .pass.🤖 Generated with Claude Code