integration · diff

git:20260818.6945463 to git:20260821.1a05a80

24 added, 82 removed. Audit A to A.

---
name: integration
description: |
Adapter over `codemap-py integrate` — audit, plan, source-wire, locally sync, and demonstrate the
codemap-py integration with its supported consumers. Trigger with `/codemap-py:integration
audit|plan|apply|sync|demo [--runtime {claude,codex,both}] ...`. Default (no args) is `audit`.
Skip for: running a structural query (use `/codemap-py:query-code`); explicit standalone index
rebuild (use `/codemap-py:scan-codebase`).
argument-hint: "audit [--runtime {claude,codex,both}] [--json] [--since YYYY-MM-DD] | plan [--runtime ...] [--consumers <csv>] [--source {local-candidate,release}] [--out <artifact>] | apply --plan <artifact> --approve <sha256> | sync --source {local-candidate,release} --plan <artifact> --approve <sha256> [--runtime ...] | demo [--runtime ...]"
effort: medium
allowed-tools: Bash, AskUserQuestion
model: sonnet
---
<objective>
- Runtime adapter over the `codemap-py integrate` engine (`src/codemap_py/integration.py`). Claude Code
- can target Claude Code, Codex, or both; this skill never invokes the other runtime's model, only its
- native plugin-manager CLI.
+ Runtime adapter over `codemap-py integrate` engine (`src/codemap_py/integration.py`). Targets Claude Code, Codex, or both. Never invokes another runtime's model; uses only its native plugin-manager CLI.
- Five modes, matching the pinned CLI surface exactly (the retired `check` mode is removed):
+ Five exact pinned CLI modes; retired `check` removed:
| Mode | Args | Mutation | Exit |
| --- | --- | --- | --- |
| `audit` | `[--runtime {claude,codex,both}] [--json] [--since YYYY-MM-DD]` | none | 0 pass/warn; 1 fail; 2 bad syntax |
| `plan` | `[--runtime ...] [--consumers <csv>] [--source {local-candidate,release}] [--out <artifact>]` | report artifact only | 0; 2 bad syntax |
| `apply` | `--plan <artifact> --approve <sha256>` | verified source checkout only | 0; 1 drift/fs; 2 bad approve/syntax |
| `sync` | `--source {local-candidate,release} --plan <artifact> --approve <sha256> [--runtime ...]` | local runtime plugin state | 0; 1 partial-fail/journal; 2 bad approve |
| `demo` | `[--runtime ...]` | disposable evidence only | 0; 1 fail |
- `--approve` is valid only with an explicit mutation mode (`apply`/`sync`), a saved plan artifact, and
- the SHA-256 shown to the user for that plan. It never authorizes new targets, remote publication, Git
- history/remote mutation, marketplace-file editing, user instruction-file editing, or data deletion.
+ `--approve` requires explicit mutation mode (`apply`/`sync`), saved plan artifact, and its user-shown SHA-256. It never authorizes new targets, remote publication, Git history/remote mutation, marketplace or user instruction-file edits, or data deletion.
- Closed integration/reinstall set: Claude consumers `foundry`, `oss`, `develop`, `research` (provider
- `codemap-py`); Codex consumer `codex-rig` (provider `codemap-py`). This is an explicit mapping
- cross-checked against both marketplace manifests and plugin manifests before any mutation — not a
- discovery/extension registry. `--runtime codex` scopes to the `codex-rig` consumer only; `--runtime
- claude` to the four Claude consumers; `--runtime both` (or omitted) to all five.
+ Closed integration/reinstall set: Claude consumers `foundry`, `oss`, `develop`, `research` (provider `codemap-py`); Codex consumer `codex-rig` (provider `codemap-py`). Explicit mapping, not discovery/extension registry; cross-check both marketplace and plugin manifests before mutation. `--runtime codex`: only `codex-rig`; `--runtime claude`: four Claude consumers; `--runtime both` or omitted: all five.
- Safety invariants (enforced by the shared engine, not this skill — surfaced here so the user sees the
- contract):
+ Shared-engine safety invariants:
- - `plan` records schema/protocol version, op ID, exact targets, before-state hashes, desired
- versions/refs/hashes, exact argv, ordered ops, rollback identities, expected post-state, and a plan
- SHA-256.
- - Every mutation revalidates target + before-state immediately before acting; drift invalidates the
- approval.
- - Source writes use before-images and atomic per-file replace; `apply` refuses foreign/modified
- markers, path escapes, symlinks, installed-cache roots, dirty working-tree overlap, and unverified
- product identity.
- - `sync` refuses applying a plan whose source isn't actually built into the selected candidate, whose
- installed bytes don't match the selected hash, or that names a mutable/default-branch source as
- release/rollback evidence. No implicit "latest".
- - First-target success + second-target failure stops immediately; rollback only performs actions the
- approved plan already contains. Completion and rollback are both claimed only after a post-state
- hash verification.
- - "Push" here means two local operations only: (1) updating allowlisted, version-controlled consumer
- source integration from the `codemap-py.integration.v2` contract, and (2) installing/reinstalling
- those built plugin versions in the user's local runtime(s) via native CLI operations. It never means
- `git push`, remote marketplace mutation, release publication, or direct installed-cache edits.
+ - `plan` records schema/protocol version, op ID, exact targets, before-state hashes, desired versions/refs/hashes, exact argv, ordered ops, rollback identities, expected post-state, and plan SHA-256.
+ - Every mutation revalidates target + before-state immediately before action; drift invalidates approval.
+ - Source writes use before-images + atomic per-file replace; `apply` refuses foreign/modified markers, path escapes, symlinks, installed-cache roots, dirty working-tree overlap, and unverified product identity.
+ - `sync` refuses plans whose source is absent from selected candidate, installed bytes mismatch selected hash, or release/rollback evidence names mutable/default-branch source. No implicit "latest".
+ - First-target success + second-target failure stops immediately. Rollback performs only approved-plan actions. Claim completion/rollback only after post-state hash verification.
+ - "Push" means only (1) updating allowlisted version-controlled consumer source integration from `codemap-py.integration.v2`, and (2) installing/reinstalling those built plugin versions locally via native runtime CLI. Never `git push`, remote marketplace mutation, release publication, or direct installed-cache edits.
- NOT for: running a structural query (use `/codemap-py:query-code`); explicit standalone index rebuild
- (use `/codemap-py:scan-codebase`).
+ NOT for: structural queries (use `/codemap-py:query-code`); standalone index rebuilds (use `/codemap-py:scan-codebase`).
</objective>
<inputs>
- - **$ARGUMENTS**: optional — one of:
- - Omitted or `audit` — inspect provider, consumer, managed-block, index, runtime-log, and usage
- evidence; zero-write.
- - `plan` — persist a report artifact (targets, argv, hashes, rollback identities, plan SHA-256);
- never mutates.
- - `apply` — atomically update current-version managed blocks in allowlisted consumer source files
- from an approved plan.
- - `sync` — install/reinstall the approved plan's targets in local runtime(s) via native plugin-
- manager CLIs.
+ - **$ARGUMENTS**: optional:
+ - Omitted or `audit` — zero-write inspection of provider, consumer, managed-block, index, runtime-log, and usage evidence.
+ - `plan` — persist report artifact (targets, argv, hashes, rollback identities, plan SHA-256); no mutation.
+ - `apply` — atomically update current-version managed blocks in allowlisted consumer source from approved plan.
+ - `sync` — install/reinstall approved targets locally via native plugin-manager CLIs.
- `demo` — run `audit` plus representative plain-vs-structural-context workflows; disposable evidence only.
</inputs>
<workflow>
## Step 1: Resolve mode
- Parse `$ARGUMENTS` (case-insensitive): starts with `audit` or empty → audit mode; `plan` → plan mode;
- `apply` → apply mode; `sync` → sync mode; `demo` → demo mode. Anything else → `AskUserQuestion`:
- "Unrecognized command `$ARGUMENTS`. Which of the five modes did you mean?" Options: (a) `audit`, (b)
- `plan`, (c) `apply`, (d) `sync`, (e) `demo` — wait for the reply before proceeding.
+ Parse `$ARGUMENTS` case-insensitively: empty or starts `audit` → audit; `plan` → plan; `apply` → apply; `sync` → sync; `demo` → demo. Otherwise ask `AskUserQuestion`: "Unrecognized command `$ARGUMENTS`. Which of the five modes did you mean?" Options: (a) `audit`, (b) `plan`, (c) `apply`, (d) `sync`, (e) `demo`. Wait for reply.
## Step 2: Run the mode
```bash
"${CLAUDE_PLUGIN_ROOT:-plugins/codemap-py}/bin/codemap-py" integrate audit [--runtime <r>] [--json] [--since YYYY-MM-DD] # timeout: 15000
```
- **`audit`** — performs a bounded read-only inspection of provider/consumer versions, observed provider
- content identity, managed blocks, index identity, runtime-scoped logs, usage, and findings. It reports
- `pass`, `warn`, or `fail` and never invokes `plan`, `apply`, `sync`, `index`, query self-heal, native
- plugin-manager mutation, or global-instruction installation. A same-version content mismatch is a
- high-severity drift finding; a native listing without session provenance is reported as
- `session_catalog: unobservable`. Codex contributes runtime-scoped CLI and tool shards but has no
- skill-start hook, and host hooks expose no token usage, so audit reports evidence limits rather than
- claiming live fresh-session activation or token savings. `--json` emits schema 2
- (`codemap-py.integration.v2`); `--since` filters telemetry by date. Print text by default; use JSON
- when the result feeds further reasoning.
+ **`audit`** — bounded read-only inspection: provider/consumer versions, observed provider content identity, managed blocks, index identity, runtime-scoped logs, usage, findings. Reports `pass`, `warn`, or `fail`; never invokes `plan`, `apply`, `sync`, `index`, query self-heal, native plugin-manager mutation, or global-instruction installation. Same-version content mismatch = high-severity drift; native listing without session provenance = `session_catalog: unobservable`. Codex supplies runtime-scoped CLI/tool shards but no skill-start hook; host hooks expose no token usage. Report these evidence limits; never claim live fresh-session activation or token savings. `--json` emits schema 2 (`codemap-py.integration.v2`); `--since` filters telemetry by date. Default text; JSON for downstream reasoning.
```bash
"${CLAUDE_PLUGIN_ROOT:-plugins/codemap-py}/bin/codemap-py" integrate plan [--runtime <r>] [--consumers <csv>] [--source <s>] [--out <artifact>] # timeout: 15000
```
- **`plan`** — writes a report artifact only; no mutation. The CLI prints the artifact path, op count,
- and plan SHA-256 to stdout — relay all three to the user verbatim; do not paraphrase the hash.
+ **`plan`** — writes report artifact only. Relay CLI stdout artifact path, op count, and plan SHA-256 verbatim; never paraphrase hash.
```bash
"${CLAUDE_PLUGIN_ROOT:-plugins/codemap-py}/bin/codemap-py" integrate apply --plan <artifact> --approve <sha256> # timeout: 30000
```
- **`apply`** — requires `--plan` and `--approve <sha256>` matching the plan just shown. Before running
- it, print the plan summary and SHA-256 in chat and call `AskUserQuestion`: "Apply this plan? (targets:
- <consumers>, plan SHA-256: <sha256>)" — options (a) Approve — run `apply` with this exact SHA-256, (b)
- Cancel. Never construct or pass `--approve` on the user's behalf without this explicit confirmation.
- Maintainer/source-checkout operation — an end user installing immutable releases normally uses
- `audit`, `sync`, and `demo`; `apply` never runs the native reinstall commands it reports, and `sync`
- never rewrites consumer source.
+ **`apply`** — requires `--plan` + `--approve <sha256>` matching shown plan. Before execution, print plan summary + SHA-256; call `AskUserQuestion`: "Apply this plan? (targets: <consumers>, plan SHA-256: <sha256>)" Options: (a) Approve — run `apply` with exact SHA-256, (b) Cancel. Never construct/pass `--approve` without explicit confirmation. Maintainer/source-checkout operation; immutable-release users normally use `audit`, `sync`, `demo`. `apply` never runs reported native reinstall commands; `sync` never rewrites consumer source.
```bash
"${CLAUDE_PLUGIN_ROOT:-plugins/codemap-py}/bin/codemap-py" integrate sync --source <s> --plan <artifact> --approve <sha256> [--runtime <r>] # timeout: 60000
```
- **`sync`** — same approval gate as `apply` (print plan summary + SHA-256, `AskUserQuestion` before
- passing `--approve`), plus `--source {local-candidate,release}`. After a successful sync that
- installs/reinstalls a Claude consumer or `codemap-py` itself, tell the user: "Run `/reload-plugins` (or
- start a fresh session) before relying on the updated plugin — this session's tool list was resolved
- before the update." When `--runtime` included `codex` and `codex-rig`/`codemap-py` were synced, add the
- Codex-specific note: "Start a new Codex session before relying on the updated plugin there too."
+ **`sync`** — same gate as `apply`: print plan summary + SHA-256; use `AskUserQuestion` before passing `--approve`. Also requires `--source {local-candidate,release}`. After successful Claude-consumer or `codemap-py` install/reinstall, say: "Run `/reload-plugins` (or start a fresh session) before relying on the updated plugin — this session's tool list was resolved before the update." If `--runtime` included `codex` and synced `codex-rig`/`codemap-py`, add: "Start a new Codex session before relying on the updated plugin there too."
```bash
"${CLAUDE_PLUGIN_ROOT:-plugins/codemap-py}/bin/codemap-py" integrate demo [--runtime <r>] # timeout: 20000
```
- **`demo`** — runs `audit` plus representative plain-vs-structural-context workflows and records the
- protocol/version/evidence used; disposable unless the user separately approves a mutation. The
- contrast between the plain and structural runs is the evidence — a single structural query alone does
- not satisfy this mode. Print the report path the CLI returns.
+ **`demo`** — runs `audit` + representative plain-vs-structural-context workflows; records protocol/version/evidence. Disposable unless user separately approves mutation. Evidence requires contrast between plain and structural runs; one structural query is insufficient. Print returned report path.
## Step 3: Report
- Print exit code meaning plainly: `0` success, `1` runtime/filesystem failure or partial-sync journal
- state (see the mode table), `2` bad syntax or invalid approval. On `1` during `sync`, report the
- journaled state (`planned → approved → applying:<t> → verified:<t> → complete`, or
- `rollback-started → rollback-succeeded|rollback-failed → recovery-required`) and, for
- `recovery-required`, the bounded manual recovery commands the engine reported — never invent recovery
- steps beyond what was reported.
+ Report exit meaning: `0` success; `1` runtime/filesystem failure or partial-sync journal (see table); `2` bad syntax or approval. For `sync` exit `1`, report journal state (`planned → approved → applying:<t> → verified:<t> → complete`, or `rollback-started → rollback-succeeded|rollback-failed → recovery-required`). For `recovery-required`, relay only engine-reported bounded manual recovery commands; invent none.
</workflow>