Plan: Move canopy’s agent scaffolding from claude-quickstart to gadhs/pi (#2988)

Status: Done (2026-10-25) — !1776
Epic: &137
Issues: #2988 (parent) · #2989 U1 (w5) · #2990 U2 (w3) · #2991 U3 (w2) · #2992 U4 (w3) · #2993 U5 (w3)
Branches: chore/pi-cutover, chore/pi-retire-checkdocs, docs/pi-owned-standards, chore/pi-rehome-gates, chore/pi-delete-claude

This is a Design + Scope plan: GitLab owns tracking, the child issues carry the implementer brief, and the plan freezes when U1 starts.

Context

The team is moving from Claude Code to gadhs/pi (gadhs/standard/package/pi, the @gadhs/pi distribution). The analysis behind this plan is the 2026-10-24 note on #2988.

pi works differently from claude-quickstart:

  • Rules. pi injects LLM-agnostic rules into every session (pi-guidance: global.md plus a per-language profile such as lang/rust.md). It syncs nothing into the repository.

  • Project map. pi reads AGENTS.md.

  • Commit review. pi reviews every commit at the tool layer: its own J1–J8, plus up to nine repository rules, R1–R9. It reads those from the ## Code Review Rules section of the committed HEAD:AGENTS.md.

  • Attribution. pi appends the Co-Authored-By and Reflection-Review trailers itself.

  • Governing decision. pi’s ADR-003 puts all agent configuration in @gadhs/pi. claude-quickstart narrows to Rust bootstrapping, and the pre-commit token protocol is superseded. ADR-003 also leaves container operations with the template, so pi does not supply them.

canopy is tied to claude-quickstart in several places:

  • 15 synced .claude/rules digests, which Claude Code auto-loads;

  • six synced standards pages, plus three more synced only by the upstream manifest;

  • three managed git hooks and managed config blocks;

  • the checkdocs crate, pinned by git tag in xtask/Cargo.toml and run only as pre-push step 4, with a network fetch;

  • .claude/CLAUDE.md, .claude/settings.json and .claude/sync-*.toml;

  • xtask gates that read .claude/: visibility, mandatory-content, plan-lint’s scratch directory, audit-memory, init, and the quality-budgets prune list.

pi does not handle the PRECOMMIT_TOKEN gate in .githooks/pre-commit, so every pi commit in canopy is refused today.

Scope

In scope:

  • An AGENTS.md project map with canopy’s overrides and review rules.

  • Canopy-owned hooks, with no token protocol.

  • Retiring the checkdocs engine and the sync configuration.

  • A canopy-owned standards module.

  • The visibility gate, re-homed on compliance/visibility.toml.

  • Retiring the Claude-only tooling and deleting the tracked .claude/ scaffolding.

Out of scope:

  • pi’s own behaviour. Gaps found here go upstream in U5’s batched comment.

  • canopy’s product code.

Design

Decisions (the maintainer’s, 2026-10-24):

  • The standards module is frozen as canopy-owned. The sync headers and the claude-quickstart-only passages go, as do claude-md-skeleton.adoc and migration-runbook.adoc. The 15 xref:standards: links keep working. Unlike pi’s own never-edited snapshots, canopy edits its pages.

  • Cutover first. U1 drops the token gate and the sync step, and rewrites every instruction that requires the token protocol. pi commits from U1 on. Claude Code keeps working until U5: it reads AGENTS.md through an import and loses only the J1–J8 ritual.

  • The visibility exception lives in compliance/visibility.toml. The gate parses that file and checks that the exception issue is still open, as the security-baseline rule requires. Today’s gate never checks this, and it hardcodes gadhs/standard/claude-policy, which returns 404 from here.

  • Plan review moves to pi. pi’s plan mode and the integrated second-vendor review replace "round 1 a fresh subagent, round 2 a human-run other vendor".

  • Push and merge are guarded per user. pi ships no push or merge guard by default and has no repository-level permission layer. contributor-workflow.adoc documents a per-user highConsequence overlay (U1), verified against pi’s matcher. U5 asks pi for a repository-level layer.

Units (weights by complexity) — U1 → U2 → (U3 ‖ U4) → U5

Weights: 1 trivial · 2 small · 3 medium · 5 large · 8 very large. One unit = one independently shippable MR = one child issue.

U1 (w5) — Cut over: AGENTS.md, owned hooks, no token protocol, no sync step

Files: AGENTS.md (new), .claude/CLAUDE.md, .claude/rules/{commit-authoring,pre-commit-token-protocol}.md, .githooks/*, xtask/src/cmd/identity/matrix/tests.rs, CONTRIBUTING.adoc, docs/modules/standards/pages/git-workflow.adoc, ROOT developer-guide, coding-conventions, contributor-workflow, project-conventions and testing.

  1. AGENTS.md, committed first. pi’s review reads the committed file, so it must land before the hook change. U1’s commits up to and including the hook change are made under the existing token protocol (Claude Code or a human), since pi cannot commit before it lands. It holds:

    • the project content ported from .claude/CLAUDE.md: repository and license; AsciiDoc and SPDX; the target and services pointers; the "where project knowledge lives" table; the documentation-homes override; "feature MRs update Antora, not this file"; and the standards and overlay pointers;

    • "Read before you edit":

      • Rust, Cargo.toml and xtask/**: standards:coding-conventions and ROOT coding-conventions;

      • tests: standards:testing and ROOT testing;

      • Dockerfiles and CI: standards:coding-conventions (Container Runtime, CI/CD Runners, Task Runner);

      • delivery: standards:git-workflow, gitlab-workflow and delivery-protocol, plus ROOT contributor-workflow;

      • security: standards:security-baseline and security;

    • Feature Status: a pointer to roadmap.adoc and GitLab;

    • Conventions — Project Overrides: entries dated the day U1 lands, each with a one-line rationale, through pi’s mechanism for dated non-security overrides (global.md line 5). The last three record the maintainer’s direction, which until now lived only in agent memory:

      • infra tests panic under CANOPY_TEST_INFRA=required and are never #[ignore];

      • literal DHS runner tags;

      • CI runs the unit lane, audits, quality-budgets and plan-lint;

      • the 201-Created override;

      • merge on a green pre-push battery while CI is broken;

      • source .env.local (PUSH_TOKEN, GITLAB_TOKEN) before a push or glab api;

      • use the devstack only via cargo xtask dev, never from a worktree; the battery needs the test-clock and test-fault features;

      • floating image tags (#2631);

      • no legal or SME gate before 1.0;

      • pack values follow the pinned local manual; a policy question is a rules question, answered best effort in the pack, and only unclear law that shapes the source goes to the maintainer;

    • ## Code Review Rules, each under 300 characters:

      • R1: a wrapping_* or saturating_* call carries a justifying comment; the default is checked_* plus ?;

      • R2: a new private-item doc comment states non-obvious intent;

      • R3: no newly commented-out code;

      • R4: no sleep or retry that masks a race.

  2. .claude/CLAUDE.md becomes @../AGENTS.md, so Claude Code keeps working.

  3. Every instruction that requires the token protocol is retired. Importing AGENTS.md does not unload the remaining digests, so:

    • delete pre-commit-token-protocol.md;

    • rewrite commit-authoring.md: the trailer comes from pi’s commit guard, hooks validate the subject, and --no-verify is never used;

    • rewrite these to say that pi reviews every commit and the hook runs the mechanical checks: CONTRIBUTING.adoc line 10, standards:git-workflow Pre-Commit, developer-guide lines 112–118, ROOT coding-conventions § Pre-commit token gate, contributor-workflow line 91 and project-conventions line 12.

  4. Hooks.

    • Remove the claude-quickstart:managed markers and stamps.

    • pre-commit runs SPDX, debt markers and the CHANGELOG reminder on every commit, with no token.

    • pre-push drops step 4 (check-docs).

    • Point the git-workflow.md citations at docs/modules/standards/pages/git-workflow.adoc.

    • The identity-matrix step follows a canopy anchor line, # --- canopy: identity matrix (last pre-push step) ---. The test in xtask/src/cmd/identity/matrix/tests.rs splits on that line instead of the managed marker.

  5. The push and merge overlay, documented in contributor-workflow.adoc (auto mode highConsequence). pi’s globs are case-insensitive, * spans anything, and the command is read as bash reads it (modes.adoc lines 908–925).

    • git push* asks on every push, including one with an implicit destination. A push already runs the battery, so one confirmation costs little.

    • glab mr merge*.

    • *merge_requests/*merge* covers canopy’s documented glab api projects/<P>/merge_requests/<N>/merge -X PUT, its merge-when-pipeline-succeeds (MWPS) cancel …/merge_requests/<N>/cancel_merge_when_pipeline_succeeds -X POST, and a curl to either endpoint.

    • Verify in a pi session, recording the results in the MR. Each of these must queue an ask: git push, git push -u origin <branch>, git push origin HEAD:main, glab mr merge N, the API merge (also with an env prefix), and the cancel call.

    • The U1 MR carries a one-line note for the maintainer: main accepts direct pushes from Maintainers today, and setting its push access to "No one" would keep MR merges working.

  6. Tests:

    • the identity-matrix hook test;

    • a new #[cfg(test)] module, xtask/src/githooks_tests.rs, declared in xtask/src/main.rs. It initialises a temporary git repository, copies .githooks/pre-commit, and runs it with no PRECOMMIT_TOKEN. A staged .rs without SPDX makes it exit 1; with SPDX it exits 0.

U2 (w3) — Retire the checkdocs engine and the sync config

Files: xtask/src/{main.rs,cmd/mod.rs,cmd/check_docs.rs,cmd/validate.rs,cmd/plan_lint.rs,cmd/plan_done.rs,devstack_guard.rs}, xtask/src/doc_content.rs (new), xtask/Cargo.toml, Cargo.lock, deny.toml, .claude/sync-{manifest,overrides}.toml, Cargo.toml, rust-toolchain.toml, .config/nextest.toml, .gitattributes, clippy.toml.

  • Remove the engine: the check-docs command, and the checkdocs dependency with its deny.toml allow-git entry and the image-clone note (an ADR-047 erratum).

  • Port checkdocs::doc_content into xtask/src/doc_content.rs. Keep is_filled's behaviour and its negative tests: empty, whitespace-only, heading-only, comment-only (//, ////, <!-- -→) and stub-shaped pages are not filled; real prose and source blocks are. Rename the sentinel to canopy:placeholder; no tracked page carries the old one.

  • Mandatory-content gate: a constant list of the four pages (architecture, services, security, local-dev), each checked with the ported is_filled, and no template-repo exemption.

  • Exit codes: a local 0/3/1 outcome enum replaces checkdocs::Outcome in plan-lint and plan-done.

  • Sync config: delete the sync manifest and overrides. Each override’s rationale moves into the file it concerns, and Cargo.toml loses its managed markers.

  • Budget: re-lock B6, the duplicate-dependency-version budget (quality-budgets --write-lock), if the count drops.

  • Docs: the check-docs and sync mentions in developer-guide (lines 62 and 159), testing (lines 106, 343, 430 and 1010), ROOT coding-conventions (line 230) and the xtask catalog.

U3 (w2) — The standards module becomes canopy-owned

Files: docs/modules/standards/pages/*.adoc, docs/antora.yml, docs/modules/ROOT/pages/plans/_template.adoc, xtask/src/cmd/docs/stray_backticks.rs.

  • Standards pages.

    • Drop the sync headers.

    • Rewrite the passages on .claude/, CLAUDE.md fields, check-docs and template updates, CQS_CONTRIBUTION_TOKEN and template feedback, the J1–J8 subagent, and a hand-written Co-Authored-By. Point each at pi’s review and trailer, or at AGENTS.md. The security-baseline visibility passage is U4’s, since U4 creates compliance/visibility.toml.

    • Plan Lifecycle and Plan Authoring describe pi’s plan mode and the integrated review.

    • Context Hygiene describes pi’s governed memory.

    • index.adoc drops its dangling ADR reference.

    • Delete claude-md-skeleton.adoc and migration-runbook.adoc.

  • Plan template: the Review log keeps its columns (plan_done.rs prints them). Round 1 becomes pi’s plan review and round 2 the integrated second-vendor review.

  • Lint coverage: remove the docs/modules/standards exclusion from project_pages in the stray-backtick test, so it checks the owned pages, and fix what it finds.

U4 (w3) — Re-home the gates; retire Claude-only tooling

Files: compliance/visibility.toml (new), xtask/src/cmd/{validate.rs,audit_memory.rs,init.rs,mod.rs,plan_lint.rs,quality_budgets.rs}, xtask/src/main.rs, xtask/src/cargo_child.rs, xtask/src/cargo_child/path_var_lint.rs, xtask/src/walk.rs, docs/modules/standards/pages/security-baseline.adoc.

  • compliance/visibility.toml: visibility = "public". A private repository adds:

    • policy_repo: a non-empty GitLab project path;

    • exception_ref: an issue IID in that project, so an issue from a foreign repository cannot be named;

    • exception_expires: a TOML date;

    • exception_reason: a non-empty string.

  • The visibility gate:

    • Parse the file with serde (deny_unknown_fields) and compare it with glab project view.

    • For a private repository, refuse unless the exception issue in policy_repo is open (glab api projects/<policy>/issues/<iid>, state == "opened") and unexpired.

    • Skip when glab is unavailable, as today.

    • Make the decision a pure function and unit-test it: public; private with a valid exception; a closed issue; an expired exception; a missing or empty field; a file that disagrees with GitLab. Fail-open when glab is unavailable is unchanged.

  • Retire: audit-memory and init. Rename the CLAUDE_MEMORY_DIR test fixtures in cargo_child to neutral names.

  • Small edits: drop plan-lint’s .claude/plans warning; add .pi to the quality-budgets prune list.

U5 (w3) — Delete .claude/ and finish

Files: .claude/** (deleted), .gitignore, .dockerignore, CODEOWNERS, README.adoc, SECURITY.adoc, ADRs 013/021/022/023/026/030/047, plans/{backlog-cleanup-campaign,code-quality-gating}.adoc, troubleshooting.adoc, roadmap.adoc, .gitlab-ci.yml, and the code comments listed below.

  • Before deleting, map every digest. The MR carries a table from each of the 15 digests to its owned home: an Antora page, AGENTS.md, or pi. Container ops, for example, map to standards:coding-conventions (Container Runtime, CI Runners, Task Runner), and read-conventions-first maps to AGENTS.md "Read before you edit".

  • Delete the tracked .claude/ files.

  • Keep, and widen, the exclusions. .gitignore today ignores .pi/, .claude/settings.local.json and .claude/scheduled_tasks.lock; replace the two .claude entries with .claude/. .dockerignore keeps .claude/, and .claude stays in the quality-budgets prune list. Other checkouts still hold ignored local agent state, and Dockerfile.integration copies the whole directory.

  • CODEOWNERS: drop .claude/; add AGENTS.md and compliance/visibility.toml.

  • Errata for ADR-013, -021, -022, -023, -026, -030 and -047, and for the frozen plans backlog-cleanup-campaign and code-quality-gating.

  • Edits: README.adoc, SECURITY.adoc, troubleshooting, roadmap, and the stale "validate runs check-docs" comments. Code comments citing .claude/rules/, .claude/docs/ or rule names point at Antora instead.

  • Upstream to pi: one batched comment covering:

    • $PI_MODEL is documented but no code reads it;

    • pages ADR-003 calls removed are still shipped;

    • J1–J8 has no overflow question;

    • there is no repository-level permission layer and no default push or merge guard;

    • some comments are stale.

Final check (U5): the following prints nothing. It checks tracked files only; the excluded paths are history (each ADR and frozen plan carries an erratum), this plan, and the retained local-state exclusions.

git grep -I -i -l -E 'claude|quickstart|CQS_' -- . ':!CHANGELOG.adoc' \
  ':!docs/modules/ROOT/pages/plans/archive/' ':!docs/modules/ROOT/pages/adrs/' \
  ':!docs/modules/ROOT/pages/plans/backlog-cleanup-campaign.adoc' \
  ':!docs/modules/ROOT/pages/plans/code-quality-gating.adoc' \
  ':!docs/modules/ROOT/pages/plans/pi-transition.adoc' \
  ':!.gitignore' ':!.dockerignore' ':!xtask/src/cmd/quality_budgets.rs'

Verification

  1. Every unit passes the full pre-push battery.

  2. U1:

    • a pi session commits with no token, and the commit carries both trailers;

    • R1–R4 appear in the review (pi reads them only in a project it trusts);

    • every supported push and merge form queues an ask;

    • a Claude Code session still loads AGENTS.md, and no remaining rule asks for a token.

  3. U2:

    • cargo tree -p xtask | grep checkdocs is empty;

    • the ported doc_content tests pass, and an emptied mandatory page fails validate;

    • pre-push makes no claude-quickstart fetch.

  4. U3: the stray-backtick test covers standards/ and passes, and the Antora build reports no unresolved xref:standards: target.

  5. U4: the visibility gate passes on canopy, and a mutation (an expired or closed exception) refuses.

  6. U5: the final check prints nothing.

Documentation Updates

  • AGENTS.md (U1), contributor-workflow.adoc, developer-guide.adoc, testing.adoc, ROOT coding-conventions.adoc

  • The standards module, made canopy-owned (U3); the xtask catalog (U2, U4); security.adoc (U4)

  • ADR errata (U2, U5); CHANGELOG.adoc under == Unreleased, every unit

Review log

round vendor resolved model verdict

1

Anthropic

Claude Opus 5.5, a fresh subagent given only the plan and the rules

no-ship (2026-10-24), 2 blockers, both fixed: the merge pattern now covers the MWPS cancel call; the final check no longer meets the plan’s own nav entry. Advisories applied where they corrected a fact or removed ambiguity. Round 2 ran on the draft before round 1, so there is no round 3

2

OpenAI, run by the maintainer

GPT-6 Astra

no-ship on the draft (2026-10-24), 8 findings (P2 ×6, P3 ×2), all resolved in this revision: the push and merge overlay covers canopy’s documented forms; the mandatory-content port keeps is_filled; U1 retires every token instruction; AGENTS.md gets "Read before you edit"; the stray-backtick test covers the owned standards; the local-state exclusions stay; the per-repository override claim is dropped; the final check is scoped

Errata

  • Erratum (2026-10-25): U5 added errata only where a statement had become false: ADR-013, ADR-030, code-quality-gating, backlog-cleanup-campaign, and worker-portal-redesign, whose verification line named check-docs. ADR-021, -022, -023 and -026 mention .claude only as dated history that stays true; ADR-047’s erratum came with U2; troubleshooting.adoc needed no edit. U5 also reworded the remaining "synced" descriptions of the hooks and standards pages, which its list did not name.

  • Erratum (2026-10-25): re-checked against pi main (93328e97), the upstream comment (pi#11) dropped two items. pi’s ADR-003 keeps its standards pages rather than calling them removed, and the stale-comment list could not be re-verified after sixteen upstream commits.

Edit this page · default