Skip to content

Deploy the shared agent rules to pi - #32

Draft
nonreagent wants to merge 1 commit into
mainfrom
pi-harness-support
Draft

Deploy the shared agent rules to pi#32
nonreagent wants to merge 1 commit into
mainfrom
pi-harness-support

Conversation

@nonreagent

Copy link
Copy Markdown
Collaborator

Problem

Pi (pi.dev) is installed on this machine — the host provisions ~/.local/bin/pi plus an exe-dev extension — and the manifest has never known it exists. So pi sessions run with the skills and none of the rules: no communication register, no git/PR hygiene, no model-selection guidance.

Pi already discovers ~/.agents/skills natively and follows symlinked skill directories, so skills reach it for free. That's the .agents-as-source-of-truth decision paying off unprompted — pi's author picked the same cross-harness convention independently. Context files are the whole gap: pi loads exactly one global file, ~/.pi/agent/AGENTS.md, with no @-imports and no rules directory. Neither the Claude mechanism (@rules/… imports) nor the Copilot one (per-file symlinks) transfers.

Motivation

The repo already treats "a rule rename silently stops reaching a harness" as a build-breaking bug — that's why check-copilot-instructions exists. Pi is the fourth consumer of the same config and currently the only one getting none of it, which is exactly the failure that guard was written to prevent, one harness over.

Proposed Solution

  • scripts/build-pi-agents.sh concatenates home/.agents/rules/*.md into home/.pi/agent/AGENTS.md, each rule preceded by an HTML comment naming its source file. Deterministic order, idempotent, refuses to write a header-only file if the rules dir comes up empty.
  • make check-pi-agents regenerates locally and prints "please commit"; under CI it fails instead. Same contract as check-copilot-instructions, wired into ci.yml.
  • One manifest entry, tool=pi-conditioned: home/.pi/agent/AGENTS.md → ~/.pi/agent/AGENTS.md.
  • home/.pi/.gitignore is a default-deny allowlist, matching home/.claude/.gitignore.
  • test_manifest_covers_link_dotfiles learns about partially-linked roots: .pi needs an entry underneath it, not one for the directory.

Linking all of home/.pi → ~/.pi the way .claude/.copilot/.gemini are linked was rejected — deploy.sh would back up the host's live ~/.pi and replace it, and pi's sessions/ (full transcripts), trust.json (private workspace paths — the Antigravity trustedWorkspaces problem again) and auth.json (credentials) would land inside a public repo.

Verified live rather than inferred: paths were read out of the installed pi binary, and a cheap model run confirmed both halves — the agent quoted a rule sentence verbatim and named home/.agents/rules/improvement.md from its provenance comment, and listed 13 skills out of ~/.agents/skills (the other 14 carry disable-model-invocation: true and are correctly withheld).

Design, evidence, and the rest of the rejected options: docs/superpowers/specs/2026-08-21-pi-harness-support-design.md.

Feedback

  1. Committing ~18KB of derived Markdown. The alternative — generate at deploy time and gitignore it — was rejected because a fresh ./deploy.sh apply would hard-fail on a missing source, and deploy.sh staying symlink-only is a parked decision. Worth confirming that trade is the one you want.
  2. All eight rules, including macos-interactions.md. Mirrors what Copilot gets; costs a few hundred tokens on Linux. Say the word if pi should get a subset.
  3. No settings.json shipped. Theme, default model, thinking level, telemetry opt-out are all available — every one of them looked like a preference rather than a fix, so nothing speculative went in.
  4. ~/.pi/agent/APPEND_SYSTEM.md is the machine-private layer for identity.md / exe.md, deliberately not automated. Setting it up on each machine is a manual step; tell me if you'd rather it be scripted.
  5. Not deployed anywhere yet. This clone isn't the live one, so the symlink lands when this reaches ~/.dotfiles and you run make deploy.

Pi is installed on this machine but the manifest never knew about it, so pi
sessions ran with the skills and none of the rules. Pi already discovers
~/.agents/skills natively -- symlinked skill directories included -- but it
loads exactly one global context file and supports no @-imports, so the rules
can't be mirrored per-file the way home/.copilot/instructions does it.

Generate home/.pi/agent/AGENTS.md from home/.agents/rules/*.md and link that
one file into ~/.pi/agent, guarded by make check-pi-agents on the same
self-heal-locally / fail-in-CI contract as the copilot mirror.

Linking the whole directory instead would pull pi's sessions, trust.json and
auth.json into a public repo and clobber the host's own ~/.pi provisioning, so
.pi is the manifest's first partially-linked root and
test_manifest_covers_link_dotfiles now requires an entry underneath it rather
than one for it.

Design, verification, and rejected alternatives:
docs/superpowers/specs/2026-08-21-pi-harness-support-design.md

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@nonreagent
nonreagent requested a review from nonrational August 21, 2026 10:07
@nonreagent

Copy link
Copy Markdown
Collaborator Author

Self-review of my own diff. Two things I'd want a reviewer to look at, neither blocking, plus what I didn't verify.

check-pi-agents isn't in make test. Edit a rule locally, run make test, get a green result, push, and CI is the first thing that tells you the pi copy went stale. That's not new — check-copilot-instructions has the same shape — but this PR makes it two guards living outside the suite instead of one. A make checks aggregate that runs all four might be worth it later. Non-blocking, and deliberately out of scope here.

The @rules/ import list in ~/.claude/CLAUDE.md has drifted. It imports four of the eight files in home/.agents/rules/language, workflow, markdown, improvement. Copilot mirrors all eight, and after this PR so does pi. queue.md, macos-interactions.md, and skill-authoring.md aren't in the import list at all; prudence.md reached this session by some route other than that list, which I didn't chase down. So Claude is currently the harness getting the least of your rules, which is probably backwards. Separate from this PR and it touches a file this repo doesn't track, so I left it alone — but it's the more interesting bug of the two.

What I verified: pi's discovery paths read out of the installed binary rather than the docs; make test plus every check target green locally and on both CI runners; a sandboxed-$HOME deploy.sh apply + audit round trip; and one live model run confirming the file actually lands in context (it quoted a rule sentence verbatim and named the source file from the provenance comment).

What I didn't: deploy it. This clone isn't the live one, so pointing ~/.pi/agent/AGENTS.md here would aim it at the wrong checkout. The symlink lands when this reaches ~/.dotfiles and you run make deploy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant