@arbiterforge/ca-pi 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +558 -0
- package/package.json +35 -0
- package/plugins/ca-pi/CHANGELOG.md +1030 -0
- package/plugins/ca-pi/COMMANDS.md +90 -0
- package/plugins/ca-pi/ORCHESTRATOR.md +159 -0
- package/plugins/ca-pi/SKILLS.md +47 -0
- package/plugins/ca-pi/SPRINT.md +142 -0
- package/plugins/ca-pi/agents/INDEX.md +31 -0
- package/plugins/ca-pi/agents/architecture-drift-reviewer.md +86 -0
- package/plugins/ca-pi/agents/auth-crypto-reviewer.md +60 -0
- package/plugins/ca-pi/agents/backend-author.md +60 -0
- package/plugins/ca-pi/agents/checkpoint-aggregator.md +111 -0
- package/plugins/ca-pi/agents/coverage-auditor.md +71 -0
- package/plugins/ca-pi/agents/decision-challenger.md +116 -0
- package/plugins/ca-pi/agents/dependency-reviewer.md +79 -0
- package/plugins/ca-pi/agents/design-quality-reviewer.md +80 -0
- package/plugins/ca-pi/agents/finding-triage.md +86 -0
- package/plugins/ca-pi/agents/frontend-author.md +64 -0
- package/plugins/ca-pi/agents/grader.md +173 -0
- package/plugins/ca-pi/agents/infra-author.md +64 -0
- package/plugins/ca-pi/agents/map-deps.md +35 -0
- package/plugins/ca-pi/agents/map-structure.md +37 -0
- package/plugins/ca-pi/agents/migration-reviewer.md +65 -0
- package/plugins/ca-pi/agents/scout.md +127 -0
- package/plugins/ca-pi/agents/security-reviewer.md +72 -0
- package/plugins/ca-pi/agents/tribunal-lens-reviewer.md +65 -0
- package/plugins/ca-pi/extensions/codearbiter-child.js +1885 -0
- package/plugins/ca-pi/extensions/codearbiter.js +9802 -0
- package/plugins/ca-pi/generated/command-catalog.json +197 -0
- package/plugins/ca-pi/generated/roles.json +213 -0
- package/plugins/ca-pi/helpers/windows-supervisor.js +205 -0
- package/plugins/ca-pi/hooks/_activationlib.py +196 -0
- package/plugins/ca-pi/hooks/_arbiterstatelib.py +208 -0
- package/plugins/ca-pi/hooks/_babysitlib.py +76 -0
- package/plugins/ca-pi/hooks/_bashguardlib.py +1667 -0
- package/plugins/ca-pi/hooks/_boxlib.py +131 -0
- package/plugins/ca-pi/hooks/_colorlib.py +304 -0
- package/plugins/ca-pi/hooks/_durabilitylib.py +186 -0
- package/plugins/ca-pi/hooks/_entrylib.py +41 -0
- package/plugins/ca-pi/hooks/_fmtlib.py +161 -0
- package/plugins/ca-pi/hooks/_gitexec.py +45 -0
- package/plugins/ca-pi/hooks/_githooks.py +920 -0
- package/plugins/ca-pi/hooks/_gitlib.py +110 -0
- package/plugins/ca-pi/hooks/_hooklib.py +595 -0
- package/plugins/ca-pi/hooks/_host.py +115 -0
- package/plugins/ca-pi/hooks/_intentlib.py +242 -0
- package/plugins/ca-pi/hooks/_ledgerlib.py +1035 -0
- package/plugins/ca-pi/hooks/_metricslib.py +709 -0
- package/plugins/ca-pi/hooks/_pathnorm.py +74 -0
- package/plugins/ca-pi/hooks/_planfilelib.py +664 -0
- package/plugins/ca-pi/hooks/_previewlib.py +193 -0
- package/plugins/ca-pi/hooks/_protectedlib.py +312 -0
- package/plugins/ca-pi/hooks/_protectedstatelib.py +411 -0
- package/plugins/ca-pi/hooks/_provenancelib.py +971 -0
- package/plugins/ca-pi/hooks/_prunelib.py +1398 -0
- package/plugins/ca-pi/hooks/_prunepolicy.py +235 -0
- package/plugins/ca-pi/hooks/_readinjectlib.py +1080 -0
- package/plugins/ca-pi/hooks/_releaselib.py +2657 -0
- package/plugins/ca-pi/hooks/_scopelib.py +262 -0
- package/plugins/ca-pi/hooks/_segmentslib.py +278 -0
- package/plugins/ca-pi/hooks/_sensitivelib.py +270 -0
- package/plugins/ca-pi/hooks/_sessionlib.py +78 -0
- package/plugins/ca-pi/hooks/_sloplib.py +244 -0
- package/plugins/ca-pi/hooks/_standuplib.py +214 -0
- package/plugins/ca-pi/hooks/_subagentslib.py +219 -0
- package/plugins/ca-pi/hooks/_taskboardlib.py +1088 -0
- package/plugins/ca-pi/hooks/_updatelib.py +278 -0
- package/plugins/ca-pi/hooks/babysit.py +47 -0
- package/plugins/ca-pi/hooks/boardsync.py +129 -0
- package/plugins/ca-pi/hooks/doctor.py +420 -0
- package/plugins/ca-pi/hooks/git-enforce.py +325 -0
- package/plugins/ca-pi/hooks/hostapi.py +460 -0
- package/plugins/ca-pi/hooks/init-codearbiter.py +225 -0
- package/plugins/ca-pi/hooks/metrics.py +62 -0
- package/plugins/ca-pi/hooks/migration-pass.py +129 -0
- package/plugins/ca-pi/hooks/pi-bridge.py +543 -0
- package/plugins/ca-pi/hooks/post-write-edit.py +231 -0
- package/plugins/ca-pi/hooks/pre-bash.py +90 -0
- package/plugins/ca-pi/hooks/pre-edit.py +284 -0
- package/plugins/ca-pi/hooks/pre-read.py +81 -0
- package/plugins/ca-pi/hooks/pre-write.py +217 -0
- package/plugins/ca-pi/hooks/preview.py +69 -0
- package/plugins/ca-pi/hooks/prune-transcript.py +232 -0
- package/plugins/ca-pi/hooks/releasehash.py +216 -0
- package/plugins/ca-pi/hooks/security-pass.py +139 -0
- package/plugins/ca-pi/hooks/session-start.py +1218 -0
- package/plugins/ca-pi/hooks/statusline.py +736 -0
- package/plugins/ca-pi/hooks/taskwrite.py +351 -0
- package/plugins/ca-pi/hooks/update-refresh.py +51 -0
- package/plugins/ca-pi/hooks/wire-statusline.py +435 -0
- package/plugins/ca-pi/includes/anti-slop-design/INDEX.md +55 -0
- package/plugins/ca-pi/includes/anti-slop-design/color.md +43 -0
- package/plugins/ca-pi/includes/anti-slop-design/core.md +244 -0
- package/plugins/ca-pi/includes/anti-slop-design/images.md +32 -0
- package/plugins/ca-pi/includes/anti-slop-design/layout.md +45 -0
- package/plugins/ca-pi/includes/anti-slop-design/medium-cli.md +39 -0
- package/plugins/ca-pi/includes/anti-slop-design/medium-dataviz.md +43 -0
- package/plugins/ca-pi/includes/anti-slop-design/medium-diagram.md +35 -0
- package/plugins/ca-pi/includes/anti-slop-design/medium-documents.md +70 -0
- package/plugins/ca-pi/includes/anti-slop-design/medium-slides.md +30 -0
- package/plugins/ca-pi/includes/anti-slop-design/medium-web.md +39 -0
- package/plugins/ca-pi/includes/anti-slop-design/typography.md +51 -0
- package/plugins/ca-pi/includes/author-tdd-workflow.md +14 -0
- package/plugins/ca-pi/includes/compaction-charter.md +16 -0
- package/plugins/ca-pi/includes/cut-docs.md +16 -0
- package/plugins/ca-pi/includes/dev-mode.md +30 -0
- package/plugins/ca-pi/includes/farm.md +237 -0
- package/plugins/ca-pi/includes/fresh-verification.md +14 -0
- package/plugins/ca-pi/includes/harvest.md +69 -0
- package/plugins/ca-pi/includes/maturity-coverage.md +102 -0
- package/plugins/ca-pi/includes/pi-host-notes.md +69 -0
- package/plugins/ca-pi/includes/redirect.md +69 -0
- package/plugins/ca-pi/includes/reference-map.md +22 -0
- package/plugins/ca-pi/includes/review-matrix.md +14 -0
- package/plugins/ca-pi/includes/reviewer-contract.md +53 -0
- package/plugins/ca-pi/includes/routing-table.md +47 -0
- package/plugins/ca-pi/includes/security-gate-record.md +22 -0
- package/plugins/ca-pi/includes/smarts/core.md +90 -0
- package/plugins/ca-pi/includes/smarts/decision-log-format.md +56 -0
- package/plugins/ca-pi/routines/INDEX.md +32 -0
- package/plugins/ca-pi/routines/brainstorming/SKILL.md +122 -0
- package/plugins/ca-pi/routines/commit-gate/SKILL.md +151 -0
- package/plugins/ca-pi/routines/context-check/SKILL.md +85 -0
- package/plugins/ca-pi/routines/context-creation/SKILL.md +171 -0
- package/plugins/ca-pi/routines/crypto-compliance/SKILL.md +41 -0
- package/plugins/ca-pi/routines/debug/SKILL.md +99 -0
- package/plugins/ca-pi/routines/decision-lifecycle/SKILL.md +104 -0
- package/plugins/ca-pi/routines/decision-lifecycle/references/adr-template.md +74 -0
- package/plugins/ca-pi/routines/decision-variance/SKILL.md +147 -0
- package/plugins/ca-pi/routines/decompose/SKILL.md +168 -0
- package/plugins/ca-pi/routines/dispatching-parallel-agents/SKILL.md +76 -0
- package/plugins/ca-pi/routines/executing-plans/SKILL.md +83 -0
- package/plugins/ca-pi/routines/finishing-a-development-branch/SKILL.md +91 -0
- package/plugins/ca-pi/routines/post-merge-cleanup/SKILL.md +233 -0
- package/plugins/ca-pi/routines/refactor/SKILL.md +91 -0
- package/plugins/ca-pi/routines/release/SKILL.md +315 -0
- package/plugins/ca-pi/routines/secret-handling/SKILL.md +67 -0
- package/plugins/ca-pi/routines/security-architecture/SKILL.md +63 -0
- package/plugins/ca-pi/routines/skill-author/SKILL.md +108 -0
- package/plugins/ca-pi/routines/skill-author/references/skill-template.md +58 -0
- package/plugins/ca-pi/routines/subagent-driven-development/SKILL.md +149 -0
- package/plugins/ca-pi/routines/subagent-driven-development/references/farm-dispatch.md +145 -0
- package/plugins/ca-pi/routines/tdd/SKILL.md +139 -0
- package/plugins/ca-pi/routines/tribunal/SKILL.md +109 -0
- package/plugins/ca-pi/routines/tribunal/references/ai-markers.md +29 -0
- package/plugins/ca-pi/routines/tribunal/references/cost-and-models.md +64 -0
- package/plugins/ca-pi/routines/tribunal/references/finding-record.md +27 -0
- package/plugins/ca-pi/routines/tribunal/references/issue-filing.md +47 -0
- package/plugins/ca-pi/routines/tribunal/references/lenses/appsec.md +22 -0
- package/plugins/ca-pi/routines/tribunal/references/lenses/architecture.md +23 -0
- package/plugins/ca-pi/routines/tribunal/references/lenses/coverage.md +20 -0
- package/plugins/ca-pi/routines/tribunal/references/lenses/infra.md +24 -0
- package/plugins/ca-pi/routines/tribunal/references/lenses/migration.md +22 -0
- package/plugins/ca-pi/routines/tribunal/references/lenses/observability.md +21 -0
- package/plugins/ca-pi/routines/tribunal/references/lenses/performance.md +22 -0
- package/plugins/ca-pi/routines/tribunal/references/lenses/reliability.md +23 -0
- package/plugins/ca-pi/routines/tribunal/references/lenses/secrets-supply.md +22 -0
- package/plugins/ca-pi/routines/tribunal/references/lenses/test-fidelity.md +24 -0
- package/plugins/ca-pi/routines/tribunal/references/lenses/typesafety.md +21 -0
- package/plugins/ca-pi/routines/tribunal/references/report.md +19 -0
- package/plugins/ca-pi/routines/tribunal/references/schemas.md +58 -0
- package/plugins/ca-pi/routines/tribunal/references/telemetry.md +28 -0
- package/plugins/ca-pi/routines/tribunal/references/triage.md +53 -0
- package/plugins/ca-pi/routines/using-git-worktrees/SKILL.md +85 -0
- package/plugins/ca-pi/routines/writing-plans/SKILL.md +129 -0
- package/plugins/ca-pi/routines/writing-plans/references/farm-plan.md +50 -0
- package/plugins/ca-pi/skills/ca-add-dep/SKILL.md +88 -0
- package/plugins/ca-pi/skills/ca-adr/SKILL.md +30 -0
- package/plugins/ca-pi/skills/ca-adr-status/SKILL.md +30 -0
- package/plugins/ca-pi/skills/ca-arbiter/SKILL.md +36 -0
- package/plugins/ca-pi/skills/ca-audit/SKILL.md +51 -0
- package/plugins/ca-pi/skills/ca-btw/SKILL.md +23 -0
- package/plugins/ca-pi/skills/ca-checkpoint/SKILL.md +50 -0
- package/plugins/ca-pi/skills/ca-chore/SKILL.md +58 -0
- package/plugins/ca-pi/skills/ca-cleanup/SKILL.md +55 -0
- package/plugins/ca-pi/skills/ca-commands/SKILL.md +21 -0
- package/plugins/ca-pi/skills/ca-commit/SKILL.md +27 -0
- package/plugins/ca-pi/skills/ca-conflict/SKILL.md +61 -0
- package/plugins/ca-pi/skills/ca-context-check/SKILL.md +32 -0
- package/plugins/ca-pi/skills/ca-create-context/SKILL.md +32 -0
- package/plugins/ca-pi/skills/ca-debug/SKILL.md +42 -0
- package/plugins/ca-pi/skills/ca-decompose/SKILL.md +30 -0
- package/plugins/ca-pi/skills/ca-dev/SKILL.md +42 -0
- package/plugins/ca-pi/skills/ca-doctor/SKILL.md +44 -0
- package/plugins/ca-pi/skills/ca-feature/SKILL.md +105 -0
- package/plugins/ca-pi/skills/ca-fix/SKILL.md +42 -0
- package/plugins/ca-pi/skills/ca-init/SKILL.md +56 -0
- package/plugins/ca-pi/skills/ca-metrics/SKILL.md +80 -0
- package/plugins/ca-pi/skills/ca-new-skill/SKILL.md +34 -0
- package/plugins/ca-pi/skills/ca-override/SKILL.md +72 -0
- package/plugins/ca-pi/skills/ca-pr/SKILL.md +61 -0
- package/plugins/ca-pi/skills/ca-preview/SKILL.md +86 -0
- package/plugins/ca-pi/skills/ca-prune/SKILL.md +100 -0
- package/plugins/ca-pi/skills/ca-reconcile/SKILL.md +43 -0
- package/plugins/ca-pi/skills/ca-refactor/SKILL.md +43 -0
- package/plugins/ca-pi/skills/ca-release/SKILL.md +57 -0
- package/plugins/ca-pi/skills/ca-review/SKILL.md +63 -0
- package/plugins/ca-pi/skills/ca-spike/SKILL.md +41 -0
- package/plugins/ca-pi/skills/ca-sprint/SKILL.md +44 -0
- package/plugins/ca-pi/skills/ca-standup/SKILL.md +112 -0
- package/plugins/ca-pi/skills/ca-status/SKILL.md +56 -0
- package/plugins/ca-pi/skills/ca-task/SKILL.md +61 -0
- package/plugins/ca-pi/skills/ca-threat-model/SKILL.md +45 -0
- package/plugins/ca-pi/skills/ca-tribunal/SKILL.md +44 -0
- package/plugins/ca-pi/skills/ca-watch/SKILL.md +78 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: commit-gate
|
|
3
|
+
description: The only path to a commit. Routed to when the user invokes /commit or otherwise instructs codeArbiter to persist staged changes. Nine gated phases — permission, branch, classification, verification (test/lint/secrets), behavioral proof, diff review, selective stage, message, commit. Nothing reaches version control without clearing every gate; "it looks good" is not authorization.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# commit-gate
|
|
7
|
+
|
|
8
|
+
The only permitted path to a commit. Bypassing it is a hard-rule violation. Routed to when the user invokes `/commit` or any equivalent instruction to persist staged changes.
|
|
9
|
+
|
|
10
|
+
## Pre-flight
|
|
11
|
+
|
|
12
|
+
Read these, or STOP and surface the gap — never guess a command:
|
|
13
|
+
|
|
14
|
+
- `<project-root>/.codearbiter/tech-stack.md` — test, lint, and secrets-scan invocations. Stop if missing; do not guess.
|
|
15
|
+
- A git repository must be present and `git status` available.
|
|
16
|
+
- The `tdd` skill must have cleared all six phases for any new or modified feature code in the staged set. If `tdd` is incomplete, STOP and surface the gap.
|
|
17
|
+
|
|
18
|
+
## Phase 1 — Permission · gate: BLOCK
|
|
19
|
+
|
|
20
|
+
Confirm the user explicitly authorized this commit. Speculative commits are prohibited.
|
|
21
|
+
|
|
22
|
+
Explicit instructions: "commit", "commit this", "go ahead and commit", "create the commit". Ambiguous signals — "looks good", "that should work" — are NOT authorization. Record the instruction text for the report.
|
|
23
|
+
|
|
24
|
+
Gate: explicit user authorization is on record. Inferred or assumed permission does not pass.
|
|
25
|
+
|
|
26
|
+
## Phase 2 — Branch · gate: BLOCK
|
|
27
|
+
|
|
28
|
+
Run `git branch --show-current`. If the branch is `main`, `master`, or any protected branch, STOP and instruct the user to create a feature branch. Record the branch name for the report.
|
|
29
|
+
|
|
30
|
+
Gate: the working branch is not protected.
|
|
31
|
+
|
|
32
|
+
## Phase 3 — Classification · gate: BLOCK
|
|
33
|
+
|
|
34
|
+
Read the staged set (`git diff --cached --name-only` and `--stat`). Classify the change into a commit type:
|
|
35
|
+
|
|
36
|
+
- `feat` — new capability or behavior
|
|
37
|
+
- `fix` — corrects a defect
|
|
38
|
+
- `test` — tests only
|
|
39
|
+
- `refactor` — restructures without behavior change
|
|
40
|
+
- `docs` — documentation only
|
|
41
|
+
- `chore` — build, tooling, dependency updates
|
|
42
|
+
- `ci` — pipeline changes
|
|
43
|
+
|
|
44
|
+
Derive the scope from the staged paths. If the staged set spans more than one type, split it — stage and commit each type separately.
|
|
45
|
+
|
|
46
|
+
Flag any staged **database migration** (per `_hooklib.is_migration_path`) here — it carries a mandatory migration-review routing in Phase 4 (the H-14 gate), independent of the commit type.
|
|
47
|
+
|
|
48
|
+
Gate: the staged set is type-homogeneous with a single type and scope.
|
|
49
|
+
|
|
50
|
+
## Phase 4 — Verification · gate: BLOCK
|
|
51
|
+
|
|
52
|
+
Read the test, lint, and secrets-scan commands from `tech-stack.md`. Then:
|
|
53
|
+
|
|
54
|
+
- Run the test command. ALL tests green. Any failure blocks.
|
|
55
|
+
- Run lint, and the type-check if the project is statically typed. Zero errors.
|
|
56
|
+
- Run the secrets scan on ALL staged files, regardless of commit type. Any finding blocks.
|
|
57
|
+
- **Security gates (mandatory routing):** if the staged diff touches crypto/TLS or secret patterns, route it through `crypto-compliance` (`<plugin-root>/routines/crypto-compliance/SKILL.md`) and/or `secret-handling` (`<plugin-root>/routines/secret-handling/SKILL.md`) — they scan against `security-controls.md` and, on pass, record the diff-bound marker `.codearbiter/.markers/security-gate-passed` (via `hooks/security-pass.py`). This is not optional: the PreToolUse commit hook **H-09b/H-10b blocks the commit** until that gate pass is recorded AND covers every sensitive line being committed.
|
|
58
|
+
- **Migration gate (mandatory routing):** if the staged set contains a database migration (Phase 3 flags it; the detection rule is `_hooklib.is_migration_path` — default migration globs, extendable/narrowable via a `migration-paths` block in `security-controls.md`), dispatch the `migration-reviewer` agent (`<plugin-root>/agents/migration-reviewer.md`). **On a genuine PASS only**, record the content-bound marker `.codearbiter/.markers/migration-gate-passed` by resolving the interpreter once by presence — `PY=python3; { command -v python3 >/dev/null 2>&1 && python3 --version >/dev/null 2>&1; } || PY=python` — never `python3 X || python X`, which reruns X on any nonzero exit (#577) — and running `"$PY" "<plugin-root>/hooks/migration-pass.py"`. This is not optional: the PreToolUse commit hook **H-14 blocks the commit** until the pass is recorded AND covers every migration file being committed (by content digest, no freshness window — an edit to a reviewed migration re-blocks). This closes the bare-`/commit` / small-lane gap from issue #77. On a BLOCK, do not record the pass.
|
|
59
|
+
- **CI/deploy review (mandatory routing, no marker gate):** if the staged set touches a CI/CD workflow (`_hooklib.is_ci_path` — defaults extendable via a `ci-paths` block in `security-controls.md`) or a deployment/IaC manifest (`_hooklib.is_deploy_path` — `deploy-paths` block), dispatch the `security-reviewer` agent (`<plugin-root>/agents/security-reviewer.md`). This is the enforcement point the advisory `post-write-edit` reminders **H-15/H-16** point to, and it closes the bare-`/commit` / small-lane gap for CI/deploy (the `/review`, `/pr`, `/checkpoint`, and sprint lanes already dispatch it). Unlike crypto/secret/migration there is **no commit-block marker** — a CI workflow runs only once merged and IaC bites only on apply, so a BLOCK-level finding halts the commit via Phase 6 review, but routine CI/deploy edits are not gated per-commit. Act on the findings by severity; do not record a marker.
|
|
60
|
+
|
|
61
|
+
Record each result (PASS / BLOCK) for the report.
|
|
62
|
+
|
|
63
|
+
Gate: test, lint, secrets scan, and (when crypto/secret is touched) the security gate all PASS. Any failure halts the commit until fixed and re-run.
|
|
64
|
+
|
|
65
|
+
## Phase 5 — Behavioral proof · gate: BLOCK
|
|
66
|
+
|
|
67
|
+
Apply the shared fresh-run discipline in `<plugin-root>/includes/fresh-verification.md`, with
|
|
68
|
+
**the spec's acceptance criterion** as the target — prove the behavior against the spec, not against a
|
|
69
|
+
self-report.
|
|
70
|
+
|
|
71
|
+
- Identify the proving command or observable: the acceptance criterion from `<project-root>/.codearbiter/specs/<slug>.md` (or the task's verification in the plan). If none exists, derive the smallest command that exercises the claimed behavior.
|
|
72
|
+
- Run it fresh in this phase, read its output and exit code, and confirm the observed behavior matches the spec's acceptance criteria. A mismatch, or an unverifiable claim, blocks.
|
|
73
|
+
|
|
74
|
+
**Stakes:** a behavioral-proof mismatch means the change does not do what the spec claims — state what would ship broken if this passed ("the retry path never fires; a transient error would hang the caller"), not just "proof mismatch." That gap is exactly what a green-looking suite hides.
|
|
75
|
+
|
|
76
|
+
Gate: the change is proven to do what it claimed by fresh evidence — command output and exit code read in this phase. A self-reported "it works" does not pass.
|
|
77
|
+
|
|
78
|
+
## Phase 5.5 — Provenance auto-heal (conditional)
|
|
79
|
+
|
|
80
|
+
Compute the heal worklist from the staged set via `_provenancelib.heal_worklist(staged_paths, provenance, current_hashes)` — the subset of staged paths that are `drift_trigger:true` provenance entries whose recorded hash has diverged or is absent. **Empty worklist → skip this phase entirely; most commits pay nothing** (cost guarantee: ordinary commits touching no provenance source do zero re-scout work).
|
|
81
|
+
|
|
82
|
+
Non-empty worklist → run an **incremental re-scout scoped to those paths only** (not the full repo). For each path, re-examine whether the claims in the backing doc still hold:
|
|
83
|
+
|
|
84
|
+
- **Claim still holds → silently re-baseline.** Call `_provenancelib.rebaseline` to update the stored hash in `.codearbiter/.provenance/<doc>.json` and stage that file by explicit path so the re-baselined record rides THIS commit (ADR-0008 ride-along pattern — nothing is surfaced to the user). After staging, re-run the secrets scan from `tech-stack.md` over the newly-staged path(s) — any file staged after Phase 4 must still pass the automated secrets scan before the commit proceeds.
|
|
85
|
+
- **Claim changed → route to the existing Phase 6 diff-review.** The doc or code-map edit required to reflect the changed claim is proposed in diff review — the user reviews it as part of the normal diff; nothing is silently rewritten.
|
|
86
|
+
|
|
87
|
+
## Phase 6 — Diff review · gate: BLOCK
|
|
88
|
+
|
|
89
|
+
Read the complete staged diff (`git diff --cached`). Flag as blocking:
|
|
90
|
+
|
|
91
|
+
- Unexpected files — not discussed in the session.
|
|
92
|
+
- Credentials, tokens, API keys, or any secret — belt-and-suspenders to Phase 4.
|
|
93
|
+
- Incomplete changes — TODO markers, placeholder values, dead commented-out code, partial stubs.
|
|
94
|
+
- Tests disabled or skipped that were not intentionally disabled.
|
|
95
|
+
- Scope creep — changes outside the agreed feature or fix boundary.
|
|
96
|
+
|
|
97
|
+
**Board-edit exemption (ADR-0008):** an edit to `open-tasks.md` where `_taskboardlib.classify_board_diff(old, new)` returns a clean transition (done-flip `[~]`→`[x]`, start-flip `[ ]`→`[~]` with its optional minted dotted ID, or a single queued-add `[ ]`) is **expected and RETAINED** — it is not scope creep and MUST NOT be unstaged. Any other `open-tasks.md` change — a reworded or deleted entry, or an arbitrary content edit — does not classify as a transition and still flags as scope creep.
|
|
98
|
+
|
|
99
|
+
**Provenance re-baseline exemption (ADR-0008):** a `.codearbiter/.provenance/<doc>.json` file written by the Phase 5.5 auto-heal re-baseline is likewise **expected and RETAINED** — it is not scope creep and MUST NOT be unstaged. A heal-proposed doc or code-map edit (the claim-changed path from Phase 5.5) appears in the diff for normal review; treat it as any other finding. This exemption waives the scope-creep flag only; the secrets check is not waived — the automated re-scan in Phase 5.5 covers the provenance file.
|
|
100
|
+
|
|
101
|
+
On any blocking finding, unstage the affected files, surface the finding, and STOP. An out-of-scope change that should not be lost gets an inline `[NEEDS-TRIAGE]` marker before it is set aside.
|
|
102
|
+
|
|
103
|
+
**Stakes:** name what the finding would have cost if committed — a leaked credential is live the moment it lands and must be rotated; a scope-creep file ships untested behavior the review waved through. State that consequence on a credential or scope finding, not just "out of scope."
|
|
104
|
+
|
|
105
|
+
Gate: the diff is clean — zero blocking findings.
|
|
106
|
+
|
|
107
|
+
## Phase 7 — Selective stage · gate: BLOCK
|
|
108
|
+
|
|
109
|
+
**First, run the follow-up harvest — before staging anything.** Run the follow-up harvest (`<plugin-root>/includes/harvest.md`) over any Phase 6 `[NEEDS-TRIAGE]` set-asides — promote discovered follow-ups to `open-tasks.md` (work) or `open-questions.md` (decision) via the existing harvest procedure. Running this before the commit means raised board tasks are staged and ride the work commit in the same payload.
|
|
110
|
+
|
|
111
|
+
**Atomicity rule:** a raised task riding the work commit is a **contingent default** — if the PR/branch is abandoned, the board additions are abandoned with it (self-correcting, ADR-0008). A follow-up that **must survive** PR abandonment is filed as a **GitHub issue**, not the board.
|
|
112
|
+
|
|
113
|
+
Then selectively stage: if files were unstaged in Phase 6, re-stage only the clean files by explicit path: `git add path/to/file`. When a clean task-board transition was retained by the Phase 6 board-edit exemption, include `open-tasks.md` in the selective stage by explicit path (`git add open-tasks.md`) alongside the work files, so the flip rides the same commit. Include any `open-tasks.md` additions produced by the harvest step in the same explicit-path stage. When Phase 5.5 produced a re-baselined provenance record, include the affected `.codearbiter/.provenance/<doc>.json` file(s) by explicit path in the same selective stage so the re-baselined record rides the work commit. Re-run `git diff --cached --name-only` and confirm the staged list matches the intended set exactly — no extra files. Unstage any extra and report the discrepancy.
|
|
114
|
+
|
|
115
|
+
Gate: the staged set contains exactly the intended files. MUST NOT use `git add -A`, `git add .`, or any wildcard.
|
|
116
|
+
|
|
117
|
+
## Phase 8 — Message · gate: BLOCK
|
|
118
|
+
|
|
119
|
+
Compose a Conventional Commits message:
|
|
120
|
+
|
|
121
|
+
- Subject: `<type>(<scope>): <imperative summary>`, MUST NOT exceed 72 characters.
|
|
122
|
+
- Blank line, then a body explaining WHY — not a restatement of what changed.
|
|
123
|
+
- For `feat` and `fix`, add a `CHANGELOG:` footer summarizing the user-visible impact.
|
|
124
|
+
- If the commit closes an issue or references a decision, add the footer (`Closes #NN`, `Ref: ADR-NNNN`).
|
|
125
|
+
- No content-free subjects — "fix bug", "update code", "changes" do not pass.
|
|
126
|
+
|
|
127
|
+
Gate: subject ≤ 72 chars, a body is present, and any `feat`/`fix` carries a `CHANGELOG:` footer.
|
|
128
|
+
|
|
129
|
+
## Phase 9 — Commit · gate: BLOCK
|
|
130
|
+
|
|
131
|
+
Commit with the approved message via `-m` or heredoc with proper quoting — never an interactive editor. Capture the resulting SHA.
|
|
132
|
+
|
|
133
|
+
If a pre-commit hook fails: read its output in full, fix the issue, re-stage by explicit path (Phase 7 rules apply), and create a NEW commit. MUST NOT `--amend` after a hook failure.
|
|
134
|
+
|
|
135
|
+
After a successful commit, run `git status` to confirm the tree is clean. Deliver the report: SHA, branch, explicit file list, gate results (test / lint / secrets), and the message used.
|
|
136
|
+
|
|
137
|
+
Gate: the commit lands and `git status` is clean. Unexpected uncommitted changes after the commit block closure — report the discrepancy.
|
|
138
|
+
|
|
139
|
+
## Hard rules
|
|
140
|
+
|
|
141
|
+
- MUST NOT commit without explicit user authorization. "It looks good" is not permission.
|
|
142
|
+
- MUST NOT commit to `main`, `master`, or any protected branch.
|
|
143
|
+
- MUST NOT run `git add -A`, `git add .`, or any wildcard staging.
|
|
144
|
+
- MUST NOT commit while any test is failing, any lint error stands, or any secret is present.
|
|
145
|
+
- MUST NOT accept a self-reported "it works" — prove the behavior against the spec with a fresh command run (Phase 5) before committing.
|
|
146
|
+
- MUST NOT skip, disable, or work around any automated gate.
|
|
147
|
+
- MUST NOT commit a staged database migration without a recorded migration-review pass — the H-14 hook blocks it until `migration-reviewer` passes and `hooks/migration-pass.py` records the content-bound marker.
|
|
148
|
+
- MUST NOT `--amend` after a pre-commit hook failure — create a new commit.
|
|
149
|
+
- MUST NOT guess the test, lint, or secrets-scan command — read `tech-stack.md` or STOP.
|
|
150
|
+
- MUST NOT silently rewrite a doc's claims — a claim-change edit proposed by Phase 5.5 goes through diff review (Phase 6), never through the silent re-baseline path. The re-baseline path is strictly for claims that still hold; the Phase 5.5 re-baseline MUST ride the work commit (staged by explicit path in Phase 7).
|
|
151
|
+
- MUST, **at Phase 7 before staging**, run the follow-up harvest (`<plugin-root>/includes/harvest.md`) over any Phase 6 `[NEEDS-TRIAGE]` set-aside — promote to `open-tasks.md` (work) or `open-questions.md` (decision) so raised tasks ride the work commit. A follow-up that must survive PR abandonment is filed as a GitHub issue, not the board.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context-check
|
|
3
|
+
description: Optional manual drift audit — report stale provenance-tracked docs (via _provenancelib drift detection across .codearbiter/.provenance/), then per stale doc offer re-scout / re-baseline / defer. Not the daily loop; commit-gate auto-heal owns routine maintenance.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# context-check
|
|
7
|
+
|
|
8
|
+
An optional, on-demand drift audit for bypass cases: a merge or an external
|
|
9
|
+
edit drifted a tracked source file you are not about to commit, so commit-gate's
|
|
10
|
+
Phase 5.5 auto-heal did not fire. This skill reports stale docs and lets you
|
|
11
|
+
act on each one individually.
|
|
12
|
+
|
|
13
|
+
This skill is NOT in the daily loop. Commit-gate auto-heal (Phase 5.5,
|
|
14
|
+
`heal_worklist`) owns the routine maintenance path. Invoke this only when drift
|
|
15
|
+
was introduced outside a commit (e.g. a direct push, a merge you did not
|
|
16
|
+
author, a manual file edit).
|
|
17
|
+
|
|
18
|
+
## Pre-flight
|
|
19
|
+
|
|
20
|
+
Read these before computing drift:
|
|
21
|
+
|
|
22
|
+
1. `.codearbiter/.provenance/` — the per-doc provenance records. Load all
|
|
23
|
+
records via `load_provenance_dir` from
|
|
24
|
+
`<plugin-root>/hooks/_provenancelib.py`.
|
|
25
|
+
2. `.codearbiter/code-map.md` — coarse concern map; read to orient on which
|
|
26
|
+
modules the stale docs govern.
|
|
27
|
+
|
|
28
|
+
## Flow
|
|
29
|
+
|
|
30
|
+
### Step 1 — Compute drift
|
|
31
|
+
|
|
32
|
+
Use `_provenancelib` helpers in this order:
|
|
33
|
+
|
|
34
|
+
1. `load_provenance_dir(root + "/.codearbiter/.provenance/")` — returns the
|
|
35
|
+
provenance map `{doc: record}`.
|
|
36
|
+
2. Collect all `drift_trigger: true` paths across all records.
|
|
37
|
+
3. `batch_hash(paths, runner)` — hash every existing path in one git call.
|
|
38
|
+
4. `compute_drift(provenance_map, current_hashes)` — returns a drift report
|
|
39
|
+
`{doc: [{path, kind}]}` for docs that have stale sources.
|
|
40
|
+
|
|
41
|
+
Alternatively reuse the same logic as `startup_drift_line` by calling it for
|
|
42
|
+
a human-readable summary, then inspecting `compute_drift` directly for detail.
|
|
43
|
+
|
|
44
|
+
If the drift report is empty: report "no stale docs — provenance is fresh"
|
|
45
|
+
and exit. No further action required.
|
|
46
|
+
|
|
47
|
+
### Step 2 — Report stale docs
|
|
48
|
+
|
|
49
|
+
For each doc in the drift report, call `changed_scope(doc_provenance, drift)`
|
|
50
|
+
to list its drifted paths. Present a concise report before offering actions:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
Stale docs (N):
|
|
54
|
+
<doc>: <path1>, <path2> (changed | missing)
|
|
55
|
+
...
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Step 3 — Per-doc action loop
|
|
59
|
+
|
|
60
|
+
For each stale doc, present three choices and wait for the user to select one:
|
|
61
|
+
|
|
62
|
+
**re-scout** — dispatch an incremental re-scout of the drifted paths for this
|
|
63
|
+
doc, scoped to those paths only (like commit-gate Phase 5.5 heal but manually
|
|
64
|
+
invoked). The scout re-reads the changed paths and reports whether claims still
|
|
65
|
+
hold. If claims still hold: silently re-baseline the hashes via `rebaseline`.
|
|
66
|
+
If claims changed: surface the proposed doc edits for the user to accept before
|
|
67
|
+
re-baselining.
|
|
68
|
+
|
|
69
|
+
**re-baseline** — acknowledge the drift without re-scouting: call
|
|
70
|
+
`rebaseline(provenance, current_hashes)` to update the stored hashes silently.
|
|
71
|
+
Use this when the source change is cosmetic (formatting, comments, whitespace)
|
|
72
|
+
and the derived doc claims are still accurate.
|
|
73
|
+
|
|
74
|
+
**defer** — do nothing for this doc now. The drift line will reappear at the
|
|
75
|
+
next SessionStart. Use when the change is in-progress and the doc update should
|
|
76
|
+
wait for a later commit.
|
|
77
|
+
|
|
78
|
+
After processing all stale docs, summarize which docs were re-scouted,
|
|
79
|
+
re-baselined, or deferred.
|
|
80
|
+
|
|
81
|
+
## Hard rule
|
|
82
|
+
|
|
83
|
+
This skill MUST NOT commit. If re-scout or re-baseline produces updated
|
|
84
|
+
`.codearbiter/.provenance/` records, those file changes ride the next
|
|
85
|
+
user-initiated commit through commit-gate normally. No staging, no commits here.
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context-creation
|
|
3
|
+
description: The brownfield back-fill. Routed to by /create-context, and by startup when .codearbiter/CONTEXT.md lacks the <!--INITIALIZED--> body marker but source code exists. Six gated phases — pre-flight, scout dispatch, synthesis, gap interview, write, lock. Reads the existing codebase through parallel scouts, drafts every surviving project-state doc, resolves gaps with the user, and locks the project as initialized.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# context-creation
|
|
7
|
+
|
|
8
|
+
Wrap an existing codebase in project state, without guessing. Routed to by `/create-context`, and by startup when `.codearbiter/CONTEXT.md` exists but carries no `<!--INITIALIZED-->` body marker and meaningful source code is present. When no meaningful source exists, this is the wrong skill — route to `decompose` instead.
|
|
9
|
+
|
|
10
|
+
This back-fills from existing source. It complements `/ca-init`, which scaffolds an empty `.codearbiter/` for a fresh project; here the docs are derived from what is already on disk.
|
|
11
|
+
|
|
12
|
+
## Pre-flight
|
|
13
|
+
|
|
14
|
+
Read these, or STOP and surface the gap — never guess project identity or a command:
|
|
15
|
+
|
|
16
|
+
- `<project-root>/.codearbiter/CONTEXT.md` — if it already carries `<!--INITIALIZED-->`, context exists. Stop and route to normal operation.
|
|
17
|
+
- The repository root listing (one level deep) — the source surface this skill extracts from.
|
|
18
|
+
|
|
19
|
+
The excluded set (not "meaningful source"): `.git/`, `.codearbiter/`, `.claude/`, `AGENTS.md`, `CLAUDE.md`, `README.md`, `LICENSE`, `.gitignore`, `.gitmodules`, and standard tooling dotfiles (`.editorconfig`, `.prettierrc`, etc.). Meaningful source MUST exist beyond it.
|
|
20
|
+
|
|
21
|
+
## Phase 1 — Pre-flight confirmation · gate: BLOCK
|
|
22
|
+
|
|
23
|
+
Confirm the repository is a brownfield codebase safe for scout-based extraction:
|
|
24
|
+
|
|
25
|
+
1. Confirm `<!--INITIALIZED-->` is absent from `CONTEXT.md`.
|
|
26
|
+
2. Confirm meaningful source code is present beyond the excluded set.
|
|
27
|
+
3. Identify the primary source directories (`src/`, `backend/`, `frontend/`, `lib/`, `app/`, or equivalent).
|
|
28
|
+
|
|
29
|
+
State the finding to the user: existing source detected, beginning scout-based extraction.
|
|
30
|
+
|
|
31
|
+
Gate: `<!--INITIALIZED-->` absent AND meaningful source present. If the marker is present, stop and route to normal operation. If no meaningful source exists, stop and route to `decompose`. Neither condition met → do not proceed.
|
|
32
|
+
|
|
33
|
+
## Phase 2 — Scout dispatch · gate: BLOCK
|
|
34
|
+
|
|
35
|
+
A **scout** is a restricted, read-only role, not an unconstrained
|
|
36
|
+
`general-purpose` agent. A scout reads one targeted slice of the codebase and
|
|
37
|
+
returns a structured findings report — file paths, line numbers, and named
|
|
38
|
+
values only, never raw code excerpts. Scouts are internal to this skill; they
|
|
39
|
+
are never invoked from a command.
|
|
40
|
+
|
|
41
|
+
Dispatch six isolated `scout` subagents simultaneously. If the active host
|
|
42
|
+
cannot provide isolated subagents, BLOCK context creation and report the host
|
|
43
|
+
capability gap. The general inline-role fallback does not apply here: this
|
|
44
|
+
skill's report-only synthesis contract depends on the orchestrator never
|
|
45
|
+
loading the scouts' raw source into its own context.
|
|
46
|
+
Each reads only its assigned slice:
|
|
47
|
+
|
|
48
|
+
- **Scout A — Tech stack.** Read `package.json`, lockfiles, `pyproject.toml`, `requirements.txt`, `go.mod`, `Cargo.toml`, `*.gemspec`, `Gemfile`. Report languages, runtime versions, frameworks, key dependencies, the dependency manager, license fields. Additionally report, at the repository root only: which of `package.json` / `pyproject.toml` / `Cargo.toml` / `composer.json` carry a version field (candidate release manifests), which of `CHANGELOG.md` / `CHANGES.md` / `HISTORY.md` are present (candidate changelogs), and any existing tag naming convention visible in the repo (e.g. a `v*` tag) — the inputs Phase 3/5 use to draft `.codearbiter/release-targets.md`.
|
|
49
|
+
- **Scout B — Infrastructure.** Read CI/CD config (`.github/workflows/`, `.gitlab-ci.yml`, `Jenkinsfile`, `.circleci/config.yml`), `Dockerfile*`, `docker-compose*.yml`, `Makefile`, `*.tf`, IaC. Report CI/CD platform, build/test/lint commands, deployment targets, environment names, containerization, IaC tool.
|
|
50
|
+
- **Scout C — Architecture.** Read the source tree (names and structure only), entry points (`main.ts`, `index.ts`, `app.py`, `server.go`), and imports in entry points only. Report component list, entry points, module boundaries, architectural pattern, public interfaces.
|
|
51
|
+
- **Scout D — Security posture.** Read auth files (`auth*`, `middleware*`, `guard*`, `jwt*`, `session*`, `oauth*`), crypto import lines, secret-loading sites (`process.env`, `os.environ`, vault/KMS call sites — paths and line numbers only, never values), `.env.example` (never `.env`). Report auth mechanism, crypto libraries, secret-loading patterns (paths + lines, no values), vault/KMS integration, hardcoded-secret risk files (paths only).
|
|
52
|
+
- **Scout E — Testing.** Read test files and test config (`vitest.config.*`, `jest.config.*`, `pytest.ini`, Makefile test flags), coverage config. Report test framework, runner command, coverage tool, coverage thresholds in config, naming convention, approximate test count by type, fixtures.
|
|
53
|
+
- **Scout F — Data model.** Read migration files (`migrations/`, `drizzle/`, `alembic/`, `db/migrate/`), schema definitions (`schema.ts`, `*.prisma`, `*.sql`, `models/`), ORM config, DB connection config (keys only, never credentials). Report database type, ORM/query builder, entity names, migration tool, approximate entity count, multi-tenancy patterns.
|
|
54
|
+
|
|
55
|
+
The orchestrator reads only the scout reports in later phases — never the raw source — to preserve working context. A scout that finds nothing returns an explicit "not found" report, never silence.
|
|
56
|
+
|
|
57
|
+
**Content hashes:** Scouts additionally emit a `git hash-object <path>` content oid per cited file in the hash field of their evidence entry. The scout already Read those files — no additional pass is needed, and no raw content is forwarded to the orchestrator.
|
|
58
|
+
|
|
59
|
+
Gate: all six scout reports returned. A missing report is a blocking gap — do not proceed with an incomplete picture. Re-dispatch a failing scout before Phase 3.
|
|
60
|
+
|
|
61
|
+
## Phase 3 — Synthesis · gate: BLOCK
|
|
62
|
+
|
|
63
|
+
Draft every surviving project-state doc from the six reports, working only from the reports. Map source to destination:
|
|
64
|
+
|
|
65
|
+
| Scout source | Destination |
|
|
66
|
+
|---|---|
|
|
67
|
+
| A (tech stack), B (build/test/lint commands), E (test runner) | `tech-stack.md` |
|
|
68
|
+
| C (architecture), E (structure) | `coding-standards.md` |
|
|
69
|
+
| D (security) | `security-controls.md` (thin) |
|
|
70
|
+
| A (candidate manifest, candidate changelog, tag convention) | `.codearbiter/release-targets.md` |
|
|
71
|
+
| All scouts | `CONTEXT.md` (project identity, purpose, scope, NOT-building) |
|
|
72
|
+
|
|
73
|
+
Classify every finding by confidence:
|
|
74
|
+
|
|
75
|
+
- **HIGH** — directly and unambiguously in a report (e.g., `"jest"` in `package.json`). Write it as fact.
|
|
76
|
+
- **MEDIUM** — inferred from an indirect signal (directory layout implies layered architecture, no explicit config). Write it with a note: inferred from [signal], verify before relying on it.
|
|
77
|
+
- **LOW** — no signal, or conflicting signals. Write a `[CONFIRM-NN]` placeholder.
|
|
78
|
+
|
|
79
|
+
Every `[CONFIRM-NN]` carries: a sequential ID, one sentence on what is unknown, why it matters, and what would resolve it. IDs are sequential with `open-questions.md`.
|
|
80
|
+
|
|
81
|
+
**`.codearbiter/release-targets.md` is HIGH-confidence only when Scout A found exactly one candidate manifest and exactly one candidate changelog at the repository root.** Draft the row then, in the grammar `<plugin-root>/hooks/_releaselib.py`'s module docstring declares — a single-target project needs only `prefix`, `manifest`, `changelog`, `payload`:
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
<!-- release-targets -->
|
|
85
|
+
[app]
|
|
86
|
+
prefix: v
|
|
87
|
+
manifest: package.json
|
|
88
|
+
changelog: CHANGELOG.md
|
|
89
|
+
payload: .
|
|
90
|
+
latest-eligible: true
|
|
91
|
+
<!-- /release-targets -->
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
(`prefix` defaults to `v` unless Scout A found a different existing tag convention; `payload` is `.` for a single-package repository.) Zero, or more than one, candidate manifest or changelog is LOW confidence — the same "no signal, or conflicting signals" rule above — and gets a `[CONFIRM-NN]` instead of a guessed row; this doc is never scaffolded from an ambiguous scan, and the file is simply not written until the gap is resolved in Phase 4.
|
|
95
|
+
|
|
96
|
+
**`latest-eligible: true` is not cosmetic.** `/release`'s own back-fill detector (`detect_candidate_target`) emits it for this exact single-target shape, so a project drafted here and one back-filled through `/release` must agree — omitting it here would default the row's Phase-3 publish to `--latest=false`, and the same project would get different release behavior depending on which lane happened to declare it first.
|
|
97
|
+
|
|
98
|
+
Gate: every surviving doc drafted; every low-confidence inference carries a `[CONFIRM-NN]`. No silent omission. A domain with no scout signal gets a doc with a `[CONFIRM-NN]` for the whole section — never an empty file.
|
|
99
|
+
|
|
100
|
+
## Phase 4 — Gap interview · gate: BLOCK
|
|
101
|
+
|
|
102
|
+
Resolve `[CONFIRM-NN]` items with the user. Ask only what the scouts could not answer with HIGH confidence.
|
|
103
|
+
|
|
104
|
+
1. Present the `[CONFIRM-NN]` list grouped by category — gaps the scan could not resolve.
|
|
105
|
+
2. Ask ONE targeted question per item. No compound questions. Do not re-ask anything scouts answered with HIGH confidence.
|
|
106
|
+
3. Per answer: if it resolves the gap, replace the placeholder with content; if the user explicitly defers, keep the placeholder, mark it deferred with the date, and record it in `open-questions.md`; if the answer is vague, challenge it and demand a concrete answer before recording anything.
|
|
107
|
+
|
|
108
|
+
Gate: every `[CONFIRM-NN]` has exactly one outcome — resolved (replaced with content) or explicitly deferred (marked and recorded in `open-questions.md`). No item is silently dropped. Do not proceed with unacknowledged gaps.
|
|
109
|
+
|
|
110
|
+
## Phase 5 — Project-state write · gate: BLOCK
|
|
111
|
+
|
|
112
|
+
Write the surviving docs to `<project-root>/.codearbiter/`. Every doc carries actual content — no unresolved placeholder may remain where a value was determined:
|
|
113
|
+
|
|
114
|
+
| File | Content |
|
|
115
|
+
|---|---|
|
|
116
|
+
| `CONTEXT.md` | Project identity, purpose, scope, primary users, NOT-building. Frontmatter MUST include `arbiter: enabled` (the activation flag the SessionStart hook keys on) and `stage:` set to a single maturity number (default `1`; the user may raise it if the project is further along). |
|
|
117
|
+
| `tech-stack.md` | Languages, frameworks, test runner, lint command, build command, coverage command, issue-tracker command (e.g. `gh issue create`). |
|
|
118
|
+
| `coding-standards.md` | Structural patterns, naming conventions, style rules. |
|
|
119
|
+
| `security-controls.md` | Thin: auth mechanism, banned crypto primitives, secret-loading stance. Only what a security boundary actually requires. |
|
|
120
|
+
| `open-questions.md` | Every deferred `[CONFIRM-NN]` in `CONFIRM-NN: <description>` form. |
|
|
121
|
+
| `open-tasks.md` | Create the file with its heading only. **Every task goes in through the board helper, one call per item — `python3 "<plugin-root>/hooks/taskwrite.py" add "<task>"` — never by writing entries into the file directly** (B-18). The helper owns the board schema the SessionStart hook and the statusline parse, so a backlog seeded this way cannot drift from it; and once `open-tasks.md` is enrolled in the protected-state registry, a direct write is refused outright, which would leave a Write-tool instruction here unfollowable. If scouts found no backlog, the heading-only file stands as the stub. |
|
|
122
|
+
| `overrides.log` | Empty append-only audit log, created so `/override` has a sink. |
|
|
123
|
+
| `release-targets.md` | Conditional, unlike every other row above: written ONLY when Phase 3 drafted it at HIGH confidence (exactly one candidate manifest, exactly one candidate changelog) or Phase 4 resolved its `[CONFIRM-NN]` to a concrete row. Left unwritten otherwise — `/release`'s own back-fill lane (or a later `context-creation` run, once the ambiguity resolves) is the sanctioned way to create it, never a guess made here. **This file is marker-gated protected state; it needs the authoring marker below, unlike every other row in this table.** |
|
|
124
|
+
|
|
125
|
+
**Authoring marker — required for `release-targets.md` only.** That path is enrolled in the protected-state registry as `marker-gated` (hook `H-22`), so a Write against it is refused unless a fresh authoring marker exists. This lane is a sanctioned author of it, so it mints one immediately before the write and removes it immediately after — the same one-pass shape `/release`'s back-fill lane uses:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
mkdir -p "$(git rev-parse --show-toplevel)/.codearbiter/.markers"
|
|
129
|
+
touch "$(git rev-parse --show-toplevel)/.codearbiter/.markers/release-targets-authoring"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Write the file, then:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
rm -f "$(git rev-parse --show-toplevel)/.codearbiter/.markers/release-targets-authoring"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Skip both commands entirely when this run is not writing `release-targets.md` — a marker minted for a write that never happens is a 30-minute window nothing needed. No other file in the table above is enrolled, so none of them take a marker.
|
|
139
|
+
|
|
140
|
+
If scouts found existing decision records (`docs/decisions/`, `adr/`), summarize them as entries under `.codearbiter/decisions/` in the standard ADR format. If a record cannot be fully parsed, summarize what is known, flag the uncertainty, and note the source path for review.
|
|
141
|
+
|
|
142
|
+
**Provenance and code-map (small addition, not a Phase 5 rebuild):**
|
|
143
|
+
|
|
144
|
+
- Write ONE provenance file per derived doc to `.codearbiter/.provenance/<doc>.json` via `_provenancelib.write_provenance` and `new_record`. Each entry carries: `path` (repo-relative), `hash` (the scout's `git hash-object` oid), `drift_trigger` (from `_provenancelib.classify_source(path)`), and the `claims` array with `lines`, `claim`, and `confidence` drawn from the scout evidence.
|
|
145
|
+
- Synthesize `.codearbiter/code-map.md` (concern → path → ≤1-line role) from Scout C (architecture) evidence. Use concern headings (`## <concern>`) and column-0 bullets (`- \`path\` — role`). Keep it coarse — module/concern granularity only, no full file listing.
|
|
146
|
+
|
|
147
|
+
Do NOT scaffold any cut doc — see `<plugin-root>/includes/cut-docs.md` for the canonical never-scaffold list. Maturity lives in the `stage:` frontmatter of `CONTEXT.md`, not a separate file.
|
|
148
|
+
|
|
149
|
+
Gate: every surviving doc written; `CONTEXT.md` frontmatter carries `arbiter: enabled` and `stage:`; no resolved value left as a placeholder. Deferred `[CONFIRM-NN]` items are acceptable only in `open-questions.md`.
|
|
150
|
+
|
|
151
|
+
## Phase 6 — Initialization lock · gate: BLOCK
|
|
152
|
+
|
|
153
|
+
Lock the project state as initialized and return to normal orchestration:
|
|
154
|
+
|
|
155
|
+
1. Write the `<!--INITIALIZED-->` marker into the body of `CONTEXT.md`.
|
|
156
|
+
2. List `.codearbiter/` and display the populated tree.
|
|
157
|
+
3. Confirm each required file is present and non-empty: `CONTEXT.md` (with `arbiter: enabled` frontmatter and the `<!--INITIALIZED-->` body marker), `tech-stack.md`, `coding-standards.md`, `security-controls.md`, `open-questions.md`, `open-tasks.md`, `overrides.log`.
|
|
158
|
+
4. State the return to normal operation: extraction complete, project state initialized and locked, `/ca-feature` available to begin work. Deferred questions live in `open-questions.md`.
|
|
159
|
+
|
|
160
|
+
Gate: `arbiter: enabled` set and `<!--INITIALIZED-->` present in `CONTEXT.md`; every required file present and non-empty. Do not close this skill without confirming both markers are written.
|
|
161
|
+
|
|
162
|
+
## Hard rules
|
|
163
|
+
|
|
164
|
+
- MUST NOT write `<!--INITIALIZED-->` while any `[CONFIRM-NN]` is unaddressed — every gap must be resolved or explicitly deferred to `open-questions.md` first.
|
|
165
|
+
- MUST NOT resolve a `[CONFIRM-NN]` by guessing — surface the question to the user or defer it.
|
|
166
|
+
- MUST NOT proceed past Phase 2 with fewer than six scout reports.
|
|
167
|
+
- MUST NOT run Phase 2 inline — isolated scout subagents are required for the report-only synthesis boundary.
|
|
168
|
+
- MUST NOT load raw source into the orchestrator context after Phase 1 — synthesize from scout reports only.
|
|
169
|
+
- MUST NOT record a scout finding that exposes a secret value — paths and line numbers only.
|
|
170
|
+
- MUST NOT scaffold a cut doc — see `<plugin-root>/includes/cut-docs.md` for the canonical never-scaffold list. Maturity is the `stage:` frontmatter number in `CONTEXT.md`.
|
|
171
|
+
- MUST NOT run when `CONTEXT.md` already carries `<!--INITIALIZED-->` — stop and route to normal operation.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: crypto-compliance
|
|
3
|
+
description: The banned-primitive gate. Routed to when changed code hashes, signs, encrypts, derives keys, generates security-relevant randomness, configures TLS, or imports a crypto library. Rejects broken primitives, disabled TLS verification, and home-rolled crypto; the approved-primitive list lives in security-controls.md. The auth-crypto-reviewer agent is dispatched as the reviewer.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# crypto-compliance
|
|
8
|
+
|
|
9
|
+
The banned-primitive gate. Routed to when changed code uses cryptography, hashing, signing, key derivation, security-relevant random generation, or TLS configuration.
|
|
10
|
+
|
|
11
|
+
## Pre-flight
|
|
12
|
+
|
|
13
|
+
Read these, or STOP and surface the gap — never guess the policy:
|
|
14
|
+
|
|
15
|
+
- `<project-root>/.codearbiter/security-controls.md` — the project's approved and forbidden primitives, key requirements, and TLS minimum. If this file is unreadable, BLOCK; do not infer the policy.
|
|
16
|
+
|
|
17
|
+
## Phase 1 — Banned-primitive scan · gate: BLOCK
|
|
18
|
+
|
|
19
|
+
Scan every crypto operation in the changed code against `security-controls.md`. Apply the project's forbidden list; where it is silent, the following BLOCK unconditionally:
|
|
20
|
+
|
|
21
|
+
- **Broken primitives** — `md5`, `sha1`/`sha-1` (including in HMAC or "just for IDs"), `des`, `3des`, `rc4`, and RSA keys below 2048 bits.
|
|
22
|
+
- **Disabled TLS verification** — `rejectUnauthorized: false`, `verify: false`, or any disabling of certificate peer verification, on any connection.
|
|
23
|
+
- **Home-rolled crypto** — a hand-built cipher, AEAD, KDF, signature scheme, or any reimplementation of a primitive in userland instead of a vetted, approved one.
|
|
24
|
+
- **Unapproved primitive or library** — any algorithm, mode, key size, or crypto library not on the approved list in `security-controls.md`.
|
|
25
|
+
|
|
26
|
+
Dispatch the `auth-crypto-reviewer` agent (`<plugin-root>/agents/auth-crypto-reviewer.md`) to confirm these findings against `security-controls.md`.
|
|
27
|
+
|
|
28
|
+
Gate: no banned or unapproved primitive, no disabled TLS verification, and no home-rolled crypto in the changed code.
|
|
29
|
+
|
|
30
|
+
**On pass — record the gate:** follow `<plugin-root>/includes/security-gate-record.md` (the shared record mechanism). For this gate the relevant commit hook is **H-09b** (crypto/TLS). On any BLOCK, do NOT record the pass.
|
|
31
|
+
|
|
32
|
+
**Out-of-scope finding:** do not act on it and do not author an ADR (ADRs are user-attributed, via `/adr` only). Mark it inline with `[NEEDS-TRIAGE]`; never silently drop it.
|
|
33
|
+
|
|
34
|
+
## Hard rules
|
|
35
|
+
|
|
36
|
+
- MUST read `security-controls.md` before scanning — BLOCK if it cannot be read.
|
|
37
|
+
- MUST NOT use MD5, SHA1, DES, 3DES, RC4, or RSA below 2048 bits — even for non-security checksums or IDs.
|
|
38
|
+
- MUST NOT set `verify: false` or `rejectUnauthorized: false`, or otherwise disable certificate verification, on any TLS connection.
|
|
39
|
+
- MUST NOT use a home-rolled or userland-reimplemented cryptographic primitive.
|
|
40
|
+
- MUST NOT use any primitive, key size, or crypto library not on the approved list in `security-controls.md`.
|
|
41
|
+
- MUST record the `security-gate-passed` marker (via `hooks/security-pass.py`) ONLY when the gate genuinely passes — the marker is what unblocks the commit (hook H-09b), so a premature or unconditional recording defeats the gate.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debug
|
|
3
|
+
description: "Investigate-then-decide root-cause analysis for a defect whose cause is unknown (distinct from /fix, which assumes a known bug). Five gated phases: capture, hypothesize, gather, decide, hand off. Investigation only, no code changes; exits to /fix, /adr, or a no-action close."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# debug
|
|
7
|
+
|
|
8
|
+
Find the cause first, fix it never. `debug` investigates and routes; it does not touch code. It drives one closed loop — **reproduce** (Phase 1) → confirm by cited evidence (Phases 2–3) → hand `/fix` a regression test that re-runs the repro and must pass (**verify**). The minimal repro is the anchor that closes the loop; code changes belong to `/fix`.
|
|
9
|
+
|
|
10
|
+
## Pre-flight
|
|
11
|
+
|
|
12
|
+
Read these, or STOP and surface the gap — never guess a log path, trace tool, or test runner:
|
|
13
|
+
|
|
14
|
+
- `<project-root>/.codearbiter/tech-stack.md` — log paths, trace tooling, test runner conventions. The evidence sources.
|
|
15
|
+
- `<project-root>/.codearbiter/CONTEXT.md` — domain vocabulary, system structure, and the `stage:` frontmatter (the maturity value; higher demands more rigorous evidence before exit).
|
|
16
|
+
- `<project-root>/.codearbiter/security-controls.md` — only when the symptom touches a security boundary (auth, crypto, secrets). Optional; absent on most defects.
|
|
17
|
+
|
|
18
|
+
The user MUST supply at least a one-sentence symptom. If absent, ask for one — do not guess the symptom.
|
|
19
|
+
|
|
20
|
+
## Phase 1 — Symptom capture · gate: BLOCK
|
|
21
|
+
|
|
22
|
+
Record the symptom with enough fidelity that another operator reproduces it without further questions:
|
|
23
|
+
|
|
24
|
+
- **Observed** — one sentence: what the system did. Not the suspected cause; causes belong to Phase 2.
|
|
25
|
+
- **Expected** — one sentence. If the user cannot state expected behavior, that itself may be a design/behavior ambiguity — flag it for Phase 4.
|
|
26
|
+
- **Minimal repro** — exact command/request/action, required input and state, environment (local/staging/prod/test) and maturity value, frequency (every time / intermittent / one-time).
|
|
27
|
+
- **Evidence in hand** — error messages, stack traces, log excerpts; cite the source of each (log path + timestamp, request ID).
|
|
28
|
+
|
|
29
|
+
If no minimal repro exists, derive one with the user before continuing. An intermittent issue still has a trigger condition (an input pattern, a load condition, a timing window) — capture that.
|
|
30
|
+
|
|
31
|
+
Gate: a minimal repro, or a documented intermittent-trigger profile. A symptom without one cannot be debugged, only speculated about. Every piece of evidence MUST cite its source.
|
|
32
|
+
|
|
33
|
+
## Phase 2 — Hypothesis generation · gate: BLOCK
|
|
34
|
+
|
|
35
|
+
Produce at least three distinct candidate causes, ranked by likelihood, before gathering any evidence against them. Distinct means different subsystems, mechanisms, or failure modes — not three rewordings of one suspicion.
|
|
36
|
+
|
|
37
|
+
For each candidate write: a one-sentence hypothesis, the subsystem/boundary involved, and the mechanism by which it produces the observed symptom. Number them H1, H2, H3… for Phase 3.
|
|
38
|
+
|
|
39
|
+
Rank by recency of relevant changes (recent commits to the suspect subsystem raise rank), symptom specificity (a symptom pointing narrowly at one mechanism raises it), and historical pattern.
|
|
40
|
+
|
|
41
|
+
Include at least one **boring** hypothesis — environmental drift, dependency version change, config mismatch, stale cache, operator error. List it even if ranked last. Confirmation bias toward exotic causes is the recurring debug failure mode.
|
|
42
|
+
|
|
43
|
+
Gate: three or more distinct hypotheses, one of them boring. Single-hypothesis lock-in is the single most common cause of misdiagnosis — the gate forces breadth before depth.
|
|
44
|
+
|
|
45
|
+
## Phase 3 — Evidence gathering · gate: BLOCK
|
|
46
|
+
|
|
47
|
+
For each hypothesis, identify what would confirm or refute it, then gather that evidence by reading existing artifacts only. No code is modified in this phase.
|
|
48
|
+
|
|
49
|
+
For each H1…HN write the CONFIRM signal, the REFUTE signal, and the source where each lives (log file, trace tool, commit range, metric dashboard). Then read:
|
|
50
|
+
|
|
51
|
+
- Application logs and traces at the paths/tools in `tech-stack.md`.
|
|
52
|
+
- Recent commits (`git log`, `git diff`) on suspect paths.
|
|
53
|
+
- Configuration, environment variables, feature flags (read-only).
|
|
54
|
+
|
|
55
|
+
Annotate each hypothesis CONFIRMED, REFUTED, or INCONCLUSIVE, with a cited source. Do not collapse INCONCLUSIVE to CONFIRMED or REFUTED by inference — state what additional evidence is needed and where it lives. New hypotheses that emerge are added and gathered against; Phase 2 is a floor, not a ceiling.
|
|
56
|
+
|
|
57
|
+
Gate: no code change of any kind — no edit, no refactor, no "try a fix." A hypothesis testable only by changing code becomes a Phase 4 finding (exit (a), with a regression test obligation), not a change here. No INCONCLUSIVE evidence promoted to CONFIRMED without a cited source.
|
|
58
|
+
|
|
59
|
+
## Phase 4 — Root-cause decision · gate: BLOCK
|
|
60
|
+
|
|
61
|
+
Walk the evidence ledger and pick exactly one exit. "We'll figure it out later" is not an exit.
|
|
62
|
+
|
|
63
|
+
- **(a) Confirmed bug → `/fix`.** One hypothesis is CONFIRMED by cited evidence and the disposition is a code change. Carry: the hypothesis ID and statement, the cited confirming evidence, and a named **regression test obligation** — a one-sentence description of the test `/fix` MUST write (and watch fail) before any fix code. It MUST encode the Phase 1 minimal repro, so the exact condition that reproduced the defect becomes the test that proves it fixed — this is what closes the reproduce→fix→verify loop. `/fix` refuses to proceed without it.
|
|
64
|
+
- **(b) Behavior/design ambiguity → `/adr`.** The system behaves as currently specified, but the specification itself is in question. Carry: the hypothesis ID and statement, a one-sentence statement of the ambiguity, and the symptom record plus evidence ledger as context. An ADR is authored only via `/adr` with explicit user attribution — surface the question to the user and obtain attribution; never author the ADR autonomously as the disposition of a debug session.
|
|
65
|
+
- **(c) No-action close.** The symptom is non-reproducible, was a one-time environmental event, or was already resolved by an unrelated commit. Carry: a one-sentence rationale, the cited evidence supporting "no action," and a note appended to the symptom record.
|
|
66
|
+
|
|
67
|
+
If a finding is real but out of scope for any of the three exits, mark it inline with `[NEEDS-TRIAGE]` and continue — do not stall on it.
|
|
68
|
+
|
|
69
|
+
If no exit can be chosen — all hypotheses INCONCLUSIVE — loop back to Phase 3 for more evidence, or take exit (b) and surface the open question. "No decision" is not a valid exit.
|
|
70
|
+
|
|
71
|
+
Gate: exactly one of (a) / (b) / (c) is named. Exit (a) carries a regression test obligation. Exit (b) carries the ambiguity statement and user attribution before any `/adr`. No exit closes on "more investigation needed" without either looping to Phase 3 or selecting (b).
|
|
72
|
+
|
|
73
|
+
## Phase 5 — Handoff · gate: BLOCK
|
|
74
|
+
|
|
75
|
+
Emit a summary downstream skills can consume without re-reading the session, then route:
|
|
76
|
+
|
|
77
|
+
- **Summary block:** symptom (one sentence), reproduction profile, hypotheses considered (count + one-line list), evidence ledger summary (CONFIRMED / REFUTED / INCONCLUSIVE per hypothesis), the Phase 4 exit and rationale, and the handoff target.
|
|
78
|
+
- **Exit (a):** route to `/fix` with the confirmed bug statement, cited evidence, and named regression test obligation. The orchestrator routes `/fix` to the `tdd` skill in bug-fix variant, where that test becomes the Phase 1 obligation that must fail before fix code. `debug` does not pre-write the test.
|
|
79
|
+
- **Exit (b):** surface the chosen `/adr` with the ambiguity statement, symptom record, and evidence ledger attached as context, with user attribution.
|
|
80
|
+
- **Exit (c):** record a queued entry **through the board helper, never by appending to the file** — `python3 "<plugin-root>/hooks/taskwrite.py" add "<symptom>" --desc "<no-action rationale>"` (add `--id debug.note` to mint a dotted ID; optional for a debug note). The helper owns the schema the SessionStart hook parses, so a note recorded this way cannot drift from it, and it is the only writer that `.codearbiter/open-tasks.md`'s protected-state class admits. This keeps the note in the in-flight count as an open item to revisit rather than a bare bullet. No further handoff.
|
|
81
|
+
|
|
82
|
+
Surface the summary and the handoff to the user before the skill exits.
|
|
83
|
+
|
|
84
|
+
Gate: the handoff is routed. Exit (a) carries an explicit regression test obligation. Exit (c) is recorded before close.
|
|
85
|
+
|
|
86
|
+
## Hard rules
|
|
87
|
+
|
|
88
|
+
- MUST NOT modify, refactor, or "try a fix" on any code during Phases 1–5. Code changes belong to `/fix`.
|
|
89
|
+
- MUST NOT proceed past Phase 1 without a minimal repro or a documented intermittent-trigger profile.
|
|
90
|
+
- MUST NOT proceed past Phase 2 with fewer than three distinct hypotheses, or with three rewordings of one suspicion.
|
|
91
|
+
- MUST include at least one boring environmental / configuration / dependency hypothesis in Phase 2.
|
|
92
|
+
- MUST NOT promote INCONCLUSIVE evidence to CONFIRMED or REFUTED without a cited source.
|
|
93
|
+
- MUST cite the source of every piece of evidence — log path + timestamp, commit SHA, trace ID.
|
|
94
|
+
- MUST exit Phase 4 with exactly one of (a) confirmed bug → `/fix`, (b) ambiguity → `/adr`, or (c) no-action close.
|
|
95
|
+
- MUST NOT route to `/fix` for a bug not yet confirmed by cited evidence — `/fix` is for known bugs.
|
|
96
|
+
- MUST NOT exit (a) without a named regression test obligation for `/fix` to carry into its TDD Phase 1.
|
|
97
|
+
- MUST tie the exit-(a) regression test obligation to the Phase 1 minimal repro — the repro is the test that closes the loop.
|
|
98
|
+
- MUST NOT author an ADR autonomously as the disposition of a debug session — exit (b) obtains user attribution and routes through `/adr`.
|
|
99
|
+
- MUST NOT guess a log path, trace tool, or test command — read `tech-stack.md` or STOP.
|