integration · diff
git:20260818.6945463 to git:20260821.1a05a80
19 added, 30 removed. Audit A to A.
---
name: integration
description: "Codemap integration: audit|plan|apply|sync|demo; skip query/index rebuilds."
---
NOT for: structural queries (`$codemap-py:query-code`) or index rebuilds (`$codemap-py:scan-codebase`).
# Integration
- Runtime adapter over the `codemap-py integrate` engine (`src/codemap_py/integration.py`). Either host runtime — Claude Code or Codex — can target Claude Code, Codex, or both; this skill never invokes the other runtime's model, only its native plugin-manager CLI.
-
- Five modes, matching the pinned CLI surface exactly; the legacy `check` mode is removed without an alias:
+ Adapter for `codemap-py integrate` (`src/codemap_py/integration.py`). Claude Code or Codex may target Claude, Codex, or both; this skill runs only native plugin-manager CLIs, never another runtime's model. `check` is removed with no alias.
| 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 `apply`/`sync`, a saved plan, and its displayed SHA-256. It never authorizes new targets, remote publication, Git mutation, marketplace/instruction edits, or 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 set: Claude `foundry`, `oss`, `develop`, `research`; Codex `codex-rig`; provider `codemap-py`. Cross-check both marketplace and plugin manifests before mutation. `--runtime codex` selects only `codex-rig`, `claude` selects the four Claude consumers, and omitted/`both` selects all five. This is explicit mapping, not discovery.
- Safety invariants (enforced by the shared engine, not this skill — surfaced here so the user sees the contract):
+ ## 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 protocol/schema, operation ID, targets, before hashes, desired identity, argv, ordered operations, rollback identity, expected state, and SHA-256.
+ - Mutation revalidates target and before state immediately; drift invalidates approval. Source writes are atomic with before-images and reject foreign/modified markers, escapes, symlinks, installed caches, dirty overlap, and unverified identity.
+ - `sync` rejects unbuilt candidate sources, installed-byte/hash mismatch, and mutable/default-branch release or rollback identity; never assumes latest.
+ - On later-target failure, stop; rollback only approved operations. Claim completion/rollback only after post-state hashes verify.
+ - "Push" means local allowlisted source wiring plus native local runtime installation. Never `git push`, marketplace mutation, release publication, or direct installed-cache edit.
## Runtime note
- Codex has no `bin/` PATH entry and no `$CLAUDE_PLUGIN_ROOT`-equivalent environment variable. Resolve this skill's installed plugin-root path once, substitute it for `PLUGIN_ROOT` below, and keep it in reasoning — shell state does not persist across tool calls. Codex has no `AskUserQuestion` tool: every approval gate below means "print the plan summary and SHA-256 in chat, then wait for the user's next message before running `apply`/`sync`."
+ Codex has no `bin/` PATH entry or plugin-root variable. Resolve its installed root once, substitute `PLUGIN_ROOT`, and retain it in reasoning. Codex has no `AskUserQuestion`: print plan summary and SHA-256, then wait for the next user message before `apply`/`sync`.
- Codex-specific runtime CLI discovery: when `--runtime` includes `codex`, discover the active `codex-rig` installation with the native Codex CLI, never by editing config by hand:
+ When `--runtime` includes Codex (`codex`, `both`, or omitted), discover the active `codex-rig` via native CLI, never hand-edit config:
```bash
codex plugin marketplace list --json
codex plugin list --marketplace borda-ai-rig --json
```
- If a documented `--json` option is unavailable for the installed Codex CLI version, fall back to the text form and mark structured comparison unavailable rather than inventing a flag.
-
- Codex-specific fresh-session instruction: Codex requires a fresh app/session boundary to reliably re-discover an installed or updated plugin (verified runtime fact — plan §3). After any `sync` that installs or reinstalls `codex-rig` or `codemap-py` itself, tell the user explicitly: "Start a new Codex session before relying on the updated plugin — this session's tool list was resolved before the update."
+ If installed Codex lacks documented `--json`, use text output and mark structured comparison unavailable. After `sync` installs/reinstalls `codex-rig` or `codemap-py`, say: "Start a new Codex session before relying on the updated plugin — this session's tool list was resolved before the update."
## Workflow
- ### Step 1: Resolve mode
+ ### 1. Resolve mode
- Parse the invocation text (case-insensitive): starts with `audit` or is empty → audit mode; `plan` → plan mode; `apply` → apply mode; `sync` → sync mode; `demo` → demo mode. Anything else → ask in chat which of the five modes was intended and wait for the reply.
+ Case-insensitive: empty or starting with `audit` → audit; otherwise `plan`, `apply`, `sync`, or `demo`. Any other input: ask which of those five modes and wait.
- ### Step 2: Run the mode
+ ### 2. Run it
```bash
PLUGIN_ROOT/bin/codemap-py integrate audit [--runtime <r>] [--json] [--since YYYY-MM-DD]
PLUGIN_ROOT/bin/codemap-py integrate plan [--runtime <r>] [--consumers <csv>] [--source <s>] [--out <artifact>]
PLUGIN_ROOT/bin/codemap-py integrate apply --plan <artifact> --approve <sha256>
PLUGIN_ROOT/bin/codemap-py integrate sync --source <s> --plan <artifact> --approve <sha256> [--runtime <r>]
PLUGIN_ROOT/bin/codemap-py integrate demo [--runtime <r>]
```
- **`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.
-
- **`plan`** — writes a report artifact only; no mutation. Print the artifact path, the recorded targets, and the plan SHA-256.
-
- **`apply`** — requires `--plan` and `--approve <sha256>` matching the plan just shown. Before running it, print the plan summary and SHA-256 in chat and wait for explicit approval — do not pass `--approve` on the user's behalf.
-
- **`sync`** — same approval gate as `apply`, plus `--source {local-candidate,release}`. After a successful sync, apply the Codex fresh-session instruction above when `codex-rig` or `codemap-py` was among the synced targets.
+ `audit`: bounded read-only provider/consumer/version/content/managed-block/index/log/usage inspection. It never runs `plan`, `apply`, `sync`, index, query self-heal, native mutation, or global-instruction installation. Same-version content mismatch is high-severity drift; a native listing without provenance is `session_catalog: unobservable`. Codex has CLI/tool shards but no skill-start hook; host hooks provide no token usage, so report evidence limits, not fresh-session activation or savings. `--json` uses schema 2 (`codemap-py.integration.v2`); `--since` filters telemetry.
- **`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.
+ `plan`: write only; print artifact, targets, and SHA-256. `apply`: require matching shown SHA-256 and explicit user approval. `sync`: same gate plus explicit source; give the fresh-session instruction above if applicable. `demo`: audit plus representative plain-vs-structural-context workflows; evidence is disposable unless a mutation is separately approved.
- ### Step 3: Report
+ ### 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.
+ Explain `0` success, `1` runtime/filesystem failure or partial-sync journal, and `2` syntax/approval failure. On `sync` exit `1`, report state (`planned → approved → applying:<t> → verified:<t> → complete`, or `rollback-started → rollback-succeeded|rollback-failed → recovery-required`); for `recovery-required`, give only engine-reported bounded recovery commands.