@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,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tribunal
|
|
3
|
+
description: The deep, rarely-convened whole-codebase audit lane. Routed to when the user invokes /ca-tribunal. Seven gated phases — cost/model, map, roster dispatch, triage, report, approval+filing, telemetry. Costs on the order of millions of tokens; proceeds only after the user acknowledges the estimate; never a required gate; nothing filed or sent without explicit authorization.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# tribunal
|
|
7
|
+
|
|
8
|
+
The deepest, most expensive review codeArbiter offers — convened rarely, on demand, never as a gate. Routed to when the user invokes `/ca-tribunal`. Eleven specialist lenses judge the codebase; every finding persists to its own file (plus append-only triage/run logs) under a run dir that survives compaction and disconnects, so the run resumes from disk.
|
|
9
|
+
|
|
10
|
+
## Pre-flight
|
|
11
|
+
|
|
12
|
+
Read these, or STOP and surface the gap — never guess a command or a path:
|
|
13
|
+
|
|
14
|
+
- `<project-root>/.codearbiter/tech-stack.md` — stack, async model, concurrency primitives, test/lint/secrets commands, and, when documented, the tracker command. Stop if the test/lint/secrets commands are missing; do not guess.
|
|
15
|
+
- `<project-root>/.codearbiter/CONTEXT.md` — the `stage:` maturity value and domain vocabulary.
|
|
16
|
+
- `<project-root>/.codearbiter/coding-standards.md` — the conventions lenses judge against.
|
|
17
|
+
- `<project-root>/.codearbiter/security-controls.md` — trust boundaries, approved crypto/secret stores; feeds the appsec and secrets lenses. Absent on some repos — proceed without the security lenses' control-file checks if so.
|
|
18
|
+
- A git repository must be present.
|
|
19
|
+
- The reference set under `<plugin-root>/routines/tribunal/references/` — each is cited at its phase, loaded on demand. Do not preload them.
|
|
20
|
+
|
|
21
|
+
## Phase 0 — Cost, model & resume · gate: STOP
|
|
22
|
+
|
|
23
|
+
This lane is expensive. Orient and get explicit go-ahead before dispatching anything.
|
|
24
|
+
|
|
25
|
+
- **Resume check.** Scan `.codearbiter/reports/` for the most recent run dir matching the current scope-slug, any date — never just today's. If none, skip to sizing. If found, check completion: incomplete (no `report-written` event in its `run.jsonl`) means either resumable or stale, judged by that run dir's latest `run.jsonl` timestamp. A run whose `run.jsonl` carries `run-aborted` is terminal — never offered for resume; a fresh run starts. Younger than 7 days → recover position with the cheap cursor scan in `references/schemas.md` (grep the last `wave-triaged`, do not read finding bodies) and offer to resume at the first un-triaged wave instead of restarting; skip the estimate. Older than 7 days → STOP and ask the user to resume anyway or start fresh — the codebase may have drifted under the findings, and stale-tree findings must not silently merge with fresh ones. Complete → start a fresh run.
|
|
26
|
+
- **Abandon.** If the user tells the orchestrator to abandon the run, log a `run-aborted` event to `run.jsonl` before stopping.
|
|
27
|
+
- **Cost acknowledgment.** Size the job, compute the token band, recommend the model (highest-reasoning available, high effort), and offer the cost-control levers. Present the band plainly; nothing dispatches until the user acknowledges it and confirms the model.
|
|
28
|
+
- Establish `RUN_ID` = `<UTC-date>-<scope-slug>` on a fresh run; create `.codearbiter/reports/<run-id>/`; open `run.jsonl`. On resume, reuse the existing `RUN_ID` as-is — the date is the run's creation date and never changes on resume.
|
|
29
|
+
- Procedure: `references/cost-and-models.md` — load now.
|
|
30
|
+
|
|
31
|
+
Gate: the user has acknowledged the estimated cost and confirmed the model. An unacknowledged run does not pass.
|
|
32
|
+
|
|
33
|
+
## Phase 1 — Map + judgment overlay · gate: BLOCK
|
|
34
|
+
|
|
35
|
+
Map before reviewing; the map decides what gets scrutiny.
|
|
36
|
+
|
|
37
|
+
- Produce the inventory (inline, or on a large repo dispatch the optional cheap mappers per `references/cost-and-models.md`): file tree, language breakdown, entry points/routes, core-logic and shared-utility locations, dependency and integration surface. Write `inventory.md`.
|
|
38
|
+
- Apply the judgment overlay in `references/ai-markers.md`: risk-rank directories (untrusted input, money, auth, PII, churn = highest), mark trust boundaries, record AI-authorship markers and an iteration-depth estimate. High-marker / high-iteration areas carry a scrutiny boost and a small severity prior.
|
|
39
|
+
- Choose the active lenses — the roster IS the set of cards under `references/lenses/`; the active set is that roster minus any lens whose concern is absent from scope (no migrations → drop the migration lens). Record launched/skipped as `run.jsonl` events.
|
|
40
|
+
- Choose the wave partition — the default in `references/cost-and-models.md`, or a repartition for cause — and record it in the `run-started` event (`references/schemas.md`); resume reads this recorded partition, never re-derives it.
|
|
41
|
+
|
|
42
|
+
Gate: `inventory.md` written with the risk/boundary/marker overlay, and the active-lens set recorded.
|
|
43
|
+
|
|
44
|
+
## Phase 2 — Roster dispatch (dual output: finding files + summary) · gate: BLOCK
|
|
45
|
+
|
|
46
|
+
Dispatch one `tribunal-lens-reviewer` per active lens, in the wave partition recorded at Phase 1 (default in `references/cost-and-models.md`) at the concurrency from `references/cost-and-models.md` (≤5 in flight). Each dispatch carries the assignment block from the agent's Assignment Format — its FIRST line is the title `Tribunal lens: <lens-slug> — <scope summary>` — naming the lens slug, the scope slice, the run dir, and the findings dir, on the model/effort from `references/cost-and-models.md`. The agent itself reads its own mandate (`references/lenses/<lens>.md`, including that card's Required-reading docs) and the finding contract (`references/finding-record.md`), and loads neither the other lenses' mandates nor the orchestrator schemas. The orchestrator reads `references/finding-record.md` to read findings at triage, and consults a lens mandate only to adjudicate that lens's finding.
|
|
47
|
+
|
|
48
|
+
- Each dispatched lens reviewer writes each finding to its own file `findings/<lens>/<finding-id>.json` the moment it is found — one file per finding, never a batched write at the end (write contract: `references/finding-record.md`).
|
|
49
|
+
- **Evidence-or-drop.** Every finding cites a concrete `path:line` and the minimal snippet. An absence claim — "no handler", "no teardown", "missing validation" — requires reading the whole unit, never a truncated window.
|
|
50
|
+
- Specialists never dispatch further subagents. Update each wave's status in `run.jsonl` as it flushes.
|
|
51
|
+
- When a lens's summary returns, record a `lens-completed` event in `run.jsonl` with `surface_seen`/`findings`/`model` taken from the agent's summary, plus `tokens` when the orchestrator can observe that lens's spend.
|
|
52
|
+
|
|
53
|
+
Gate: every active lens has flushed its `findings/<lens>/` files, and each wave's status is recorded.
|
|
54
|
+
|
|
55
|
+
## Phase 3 — Triage & per-wave planning · gate: BLOCK
|
|
56
|
+
|
|
57
|
+
Triage per wave from disk as soon as it flushes; do not wait for the whole run.
|
|
58
|
+
|
|
59
|
+
- **Calibrate independently.** Set `final_severity`/`final_confidence` from the evidence yourself — the lens's values are provisional input; every critical/high carries a `counter_argument`.
|
|
60
|
+
- **Decide per finding, logged.** Each finding gets one decision from the vocabulary, appended as one line to `triage.jsonl`. Below the confidence gate after calibration → `investigate` (medium/low) or `decision-required` (critical/high) — never dropped silently.
|
|
61
|
+
- **Plan the wave.** Write `plans/phase-<n>.md` for its kept (`keep`/`combine`) work.
|
|
62
|
+
- Procedure: `references/triage.md` — load now.
|
|
63
|
+
|
|
64
|
+
Gate: every wave's findings triaged into `triage.jsonl` and a `plans/phase-<n>.md` written for its kept work.
|
|
65
|
+
|
|
66
|
+
## Phase 4 — Report · gate: BLOCK
|
|
67
|
+
|
|
68
|
+
Regenerate `report.md` and `manifest.yaml` from the two logs per `references/report.md` — projections, never hand-authored. Task-list-structured (not prose): findings grouped by **calibrated** severity then type, each with id, `path:line`, one-line description, remediation shape, triage decision, and a link to its phase plan; `decision-required` in its own section; a launched/skipped-lens summary; an investigate appendix. Apply `<plugin-root>/includes/anti-slop-design/` (`core` + `medium-documents`) to the prose.
|
|
69
|
+
|
|
70
|
+
State plainly that critical/high are blocking-severity findings — work that should block shipping the affected code — but that this lane is not itself a gate and blocks nothing.
|
|
71
|
+
|
|
72
|
+
Gate: `report.md` regenerated from the logs and presented. No issues created.
|
|
73
|
+
|
|
74
|
+
## Phase 5 — Approval & issue filing · gate: BLOCK
|
|
75
|
+
|
|
76
|
+
Findings become GitHub issues only on explicit selection and authorization. Silence or ambiguity → file nothing; "looks good" is not authorization.
|
|
77
|
+
|
|
78
|
+
- **Dedup first.** Skip findings already carrying an `issue_ref` in `triage.jsonl`, then dedup against the tracker — this lane reruns over time and will re-find the same issues.
|
|
79
|
+
- **Default is hand-off.** Write and print `issue-commands.sh`; execute only on explicit approval, writing each `issue_ref` back into `triage.jsonl`.
|
|
80
|
+
- Findings file as GitHub issues, never `open-tasks.md` — a periodic-review finding must survive PR abandonment.
|
|
81
|
+
- Procedure: `references/issue-filing.md` — load now.
|
|
82
|
+
|
|
83
|
+
Gate: either `issue-commands.sh` written and printed, or — on approval — issues filed with the id→result table and `issue_ref` recorded. Nothing filed without explicit selection; no duplicates against the tracker.
|
|
84
|
+
|
|
85
|
+
## Phase 6 — Telemetry · gate: STOP
|
|
86
|
+
|
|
87
|
+
Optional, opt-in KPI feedback to refine the skill and the estimator — off by default, sent only on explicit per-run authorization.
|
|
88
|
+
|
|
89
|
+
- **Scrub.** The payload is aggregates and per-lens exposure counts only — no code, paths, or finding text; no repo identity unless the user adds `--tag`.
|
|
90
|
+
- **Show before send.** Write the payload to the run dir and show it in full; state plainly that it posts publicly to the codeArbiter repo. Default: hand the user the ready command; post only on explicit approval.
|
|
91
|
+
- Procedure: `references/telemetry.md` — load now.
|
|
92
|
+
|
|
93
|
+
Gate: the payload is shown, and it is either handed to the user as a command or — on approval — posted. No telemetry leaves without per-run authorization.
|
|
94
|
+
|
|
95
|
+
## Hard rules
|
|
96
|
+
|
|
97
|
+
- MUST NOT proceed past Phase 0 without the user acknowledging the estimated token cost — this lane can cost millions of tokens.
|
|
98
|
+
- MUST NOT edit, refactor, format, or commit project code — writes are confined to `.codearbiter/reports/<run-id>/` until the filing gate.
|
|
99
|
+
- MUST NOT act as a required gate or block a merge, commit, or other workflow — critical/high are blocking-severity findings, not a pipeline halt.
|
|
100
|
+
- MUST NOT record a finding without a concrete `path:line` and a minimal evidence snippet.
|
|
101
|
+
- MUST NOT assert an absence without reading the whole relevant unit — partial-window absence claims do not pass.
|
|
102
|
+
- MUST NOT let a lens's provisional severity/confidence stand as final — calibrate at triage; every critical/high carries a `counter_argument`.
|
|
103
|
+
- MUST NOT mutate the append-only logs — `manifest.yaml`, `report.md`, and `plans/` are regenerated from them, never hand-edited.
|
|
104
|
+
- MUST NOT file an issue below the confidence gate or without explicit selection and authorization; findings file as GitHub issues, never `open-tasks.md`.
|
|
105
|
+
- MUST NOT create a duplicate issue — skip findings carrying an `issue_ref`, and dedup against the tracker by `dedup_key`/title before filing.
|
|
106
|
+
- MUST NOT author or scaffold an ADR — `decision-required` findings file as a discussion issue; ADRs are authored only via `/ca-adr` with user attribution.
|
|
107
|
+
- MUST NOT send telemetry without explicit per-run authorization, and MUST NOT include code, file paths, finding text, or repo identity (absent an explicit `--tag`) in the payload — KPI aggregates only.
|
|
108
|
+
- MUST NOT guess the test, lint, or secrets-scan command — read `tech-stack.md` or STOP. For the tracker: use `tech-stack.md` if it documents one; else default to `gh issue create` on a GitHub origin; else STOP.
|
|
109
|
+
- MUST NOT dispatch a subagent from within a dispatched specialist — only the orchestrator dispatches.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# AI-authorship markers & judgment overlay
|
|
2
|
+
|
|
3
|
+
The orchestrator's Phase 1 overlay on the raw inventory. These signals risk-rank scope and set severity priors; they are not findings themselves.
|
|
4
|
+
|
|
5
|
+
## Structural map
|
|
6
|
+
|
|
7
|
+
For each module, record what it exports, imports, and is called by. Flag modules importing from >5 sources (likely god module) and modules imported by >10 consumers (critical shared dependency — highest audit priority).
|
|
8
|
+
|
|
9
|
+
## AI-authorship markers
|
|
10
|
+
|
|
11
|
+
Signals that raise scrutiny on a file or directory:
|
|
12
|
+
|
|
13
|
+
- Excessive inline comments narrating trivial logic.
|
|
14
|
+
- Stale `TODO:`/`FIXME:` never resolved.
|
|
15
|
+
- Near-duplicate functions separated by 100+ lines (lost-context duplication).
|
|
16
|
+
- Convention switches mid-file — camelCase to snake_case, a pattern used then abandoned.
|
|
17
|
+
- Naming-convention drift within a unit.
|
|
18
|
+
|
|
19
|
+
## Iteration-depth estimate
|
|
20
|
+
|
|
21
|
+
Inspect git history. A large surface with few commits, or long runs of AI commits without human edits, indicates high AI-generation ratio and a higher feedback-loop-degradation prior — code more secure at step 1 than at the final state. Identify AI commits via `Co-Authored-By: Claude` / AI-tool trailers and characteristic generated message shapes (uniform conventional-commit bodies with bullet lists) — a heuristic signal, not proof. Raise scrutiny on the highest-iteration areas.
|
|
22
|
+
|
|
23
|
+
## Risk ranking & trust boundaries
|
|
24
|
+
|
|
25
|
+
Rank directories: highest = untrusted input, money movement, auth, PII, high churn. Mark trust boundaries explicitly — these feed the appsec lens directly.
|
|
26
|
+
|
|
27
|
+
## Effect on triage
|
|
28
|
+
|
|
29
|
+
A finding in a high-marker or high-iteration area carries a small upward severity prior at calibration. The prior never manufactures a finding — it only adjusts one that already cleared evidence-or-drop.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Cost estimate, model recommendation & concurrency
|
|
2
|
+
|
|
3
|
+
## Sizing commands
|
|
4
|
+
|
|
5
|
+
Prefer `tokei` or `cloc` if present; else `git ls-files | xargs wc -l`. Capture total LOC, file count, and the top languages. Read `tech-stack.md` for the language set first.
|
|
6
|
+
|
|
7
|
+
## v0 token estimate (crude, self-calibrating)
|
|
8
|
+
|
|
9
|
+
An order-of-magnitude band, not a quote. Refined over runs by the `tokens_estimated`/`tokens_actual` telemetry pair.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
repo_tokens = LOC * 10 # ~8-12 tokens/line; 10 default
|
|
13
|
+
per_lens = repo_tokens * 0.5 * 3 # 0.5 coverage fraction * 3 read+reason+write on high-reasoning
|
|
14
|
+
lenses_total = per_lens * active_lens_count
|
|
15
|
+
mapping = repo_tokens * 1.2
|
|
16
|
+
total_point = mapping + lenses_total
|
|
17
|
+
band = [total_point * 0.5, total_point * 2]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Present the band, the inputs, and that high-reasoning output tokens dominate. On a large repo this is routinely millions of tokens — say so.
|
|
21
|
+
|
|
22
|
+
## Model recommendation (state at Phase 0)
|
|
23
|
+
|
|
24
|
+
Drive this lane with the highest-reasoning model available at high effort. A cheap model inflates false positives, and this lane files real issues. Every lens runs the same agent (`tribunal-lens-reviewer`); the tier varies per LENS at dispatch time:
|
|
25
|
+
|
|
26
|
+
| Lens (or role) | Model | Effort |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| orchestrator (the skill) | Opus 4.8 | high |
|
|
29
|
+
| appsec | Opus 4.8 | high |
|
|
30
|
+
| reliability | Opus 4.8 | high |
|
|
31
|
+
| architecture | Opus 4.8 | high |
|
|
32
|
+
| secrets-supply | Sonnet 5 | high |
|
|
33
|
+
| migration | Sonnet 5 | high |
|
|
34
|
+
| test-fidelity | Sonnet 5 | high |
|
|
35
|
+
| performance | Sonnet 5 | medium |
|
|
36
|
+
| observability | Sonnet 5 | medium |
|
|
37
|
+
| typesafety | Sonnet 5 | medium |
|
|
38
|
+
| coverage | Sonnet 5 | medium |
|
|
39
|
+
| infra | Sonnet 5 | medium |
|
|
40
|
+
| optional mappers (`map-structure`, `map-deps`) | Haiku 4.5 | low |
|
|
41
|
+
|
|
42
|
+
Advisory only: `tribunal-lens-reviewer` ships `model: inherit`; a dispatch-time override takes an alias (`haiku`/`sonnet`/`opus`/`fable`), not a pinned ID, and there is no per-dispatch effort control. This table guides the orchestrator's dispatch choices — it is not mechanically enforced.
|
|
43
|
+
|
|
44
|
+
API strings: `claude-opus-4-8`, `claude-sonnet-5`, `claude-haiku-4-5-20251001` — as of authoring; substitute the current flagship. `claude-fable-5` now sits above Opus as the highest-reasoning flagship. On proprietary code all tiers must be approved (Anthropic) models — never an external worker.
|
|
45
|
+
|
|
46
|
+
## Default wave partition
|
|
47
|
+
|
|
48
|
+
The default dispatch order (Phase 2), aligned with the model tiers above:
|
|
49
|
+
|
|
50
|
+
| Wave | Lenses |
|
|
51
|
+
|---|---|
|
|
52
|
+
| 1 | appsec, architecture, reliability |
|
|
53
|
+
| 2 | secrets-supply, migration, test-fidelity |
|
|
54
|
+
| 3 | coverage, infra, observability, performance, typesafety |
|
|
55
|
+
|
|
56
|
+
A lens dropped from the roster at Phase 1 (scope-inapplicable) is simply absent from its wave — no renumbering. Phase 0/1 MAY choose a different partition for cause (e.g. a migration-heavy repo pulling `migration` into wave 1), but whichever partition is used MUST be recorded in `run-started` (`schemas.md`) — resume reads the recorded partition, never re-derives it.
|
|
57
|
+
|
|
58
|
+
## Concurrency & cost control
|
|
59
|
+
|
|
60
|
+
Concurrency ≤5 lenses in flight regardless of roster size — the roster is a budget, not a simultaneous-dispatch target. Cost levers offered at Phase 0: narrow scope to a subtree; trim the Tier-2 lenses (`performance`, `observability`, `typesafety`); lower concurrency.
|
|
61
|
+
|
|
62
|
+
## Optional mappers
|
|
63
|
+
|
|
64
|
+
On a large/sprawling repo, offload raw file-reading to two cheap mapper subagents so it stays out of the orchestrator's retained context: `map-structure` (tree, languages, entry points, core/shared/test locations, churn) and `map-deps` (manifests, lockfiles, integration surface, env/secret-usage surface). On a small repo, map inline and skip them. Either way, produce the same `inventory.md`. These are the only subagents beyond the lens reviewer, and they carry no `tribunal-` prefix because they are generic extractors, not judges.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Finding record — the agent write contract
|
|
2
|
+
|
|
3
|
+
Every tribunal lens agent emits findings in this format; the orchestrator reads them at triage. This is the only schema an agent needs — triage/run schemas are orchestrator-only (`schemas.md`).
|
|
4
|
+
|
|
5
|
+
## Write rule
|
|
6
|
+
|
|
7
|
+
Write each finding as its own file — `findings/<lens>/<finding-id>.json` (e.g. `findings/appsec/appsec-001.json`), one `finding/v1` JSON object per file — in the run directory the orchestrator gives you, the moment it is found. Never a batched write at the end. Durability comes from the one-file-one-finding layout: a process killed mid-write risks only the file being written; every previously written finding is already safe on disk. (There is no append tool; a read-then-rewrite of a shared per-lens jsonl would put the lens's whole findings file at risk on every write — that layout is rejected.)
|
|
8
|
+
|
|
9
|
+
**Mechanism:** use `Write` only. Never use a Bash shell command to write finding content — arbitrary `evidence` text (quotes, backticks, embedded newlines) will corrupt a shell-escaped write. Never `Write` over an existing finding file. This is safe without locking: you are the only writer under `findings/<lens>/` — no other agent touches your lens's directory.
|
|
10
|
+
|
|
11
|
+
**Numbering on (re-)dispatch:** before your first write, Glob `findings/<lens>/` — files may already exist if a prior attempt at this lens died partway. Continue numbering from the highest existing `NNN`; never renumber, rewrite, or delete an existing finding file. Prior findings stand; the orchestrator's triage dedups any overlap.
|
|
12
|
+
|
|
13
|
+
## finding/v1
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{"schema":"finding/v1","id":"<lens>-NNN","lens":"<lens>","title":"<imperative,specific>","category":"security|reliability|performance|architecture|observability|maintainability|testing|dependency|migration","severity":"critical|high|medium|low","confidence":0.0,"observed":true,"locations":[{"path":"src/...","lines":"42-58"}],"evidence":"<minimal snippet + 1-2 sentences>","impact":"<what breaks / cost>","recommendation":"<remediation shape, not a patch>","acceptance_criteria":["<verifiable close condition>"],"effort":"S|M|L","depends_on":["<id>"],"dedup_key":"<lens>:<normalized-path>:<slug>","created_at":"<iso8601>"}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Minimum required: `locations` (path + lines), `evidence`, `recommendation`. Set `lens` to your own lens name; set `category` to the finding's class, which may differ from your lens (the secrets-supply lens may file a `dependency` finding). `severity`/`confidence` are **provisional** — the orchestrator recalibrates at triage; do not treat your own scores as final. `observed` is `true` when the failure/behavior was directly observed or reproduced (test run, executed path, live config) and `false` when inferred from reading code; triage weighs observed findings above inferred ones at the same confidence.
|
|
20
|
+
|
|
21
|
+
## id & dedup_key
|
|
22
|
+
|
|
23
|
+
`id`: `<lens>-NNN`, sequential per lens (`appsec-001`, `appsec-002`, …). `dedup_key`: `<lens>:<path-normalized-to-repo-root>:<short-slug-of-title>` — the orchestrator dedups on this plus overlapping `locations`, and it rides into any filed issue body as a searchable comment.
|
|
24
|
+
|
|
25
|
+
## Evidence discipline
|
|
26
|
+
|
|
27
|
+
Concrete `path:line` + minimal snippet on every finding. An absence claim — "no handler", "no teardown", "missing validation" — requires reading the whole relevant unit, never a truncated window.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Issue filing
|
|
2
|
+
|
|
3
|
+
Findings become GitHub issues only on explicit selection and authorization. Use the tracker command documented in `tech-stack.md` if present; otherwise default to `gh issue create` on a GitHub origin; otherwise STOP. This lane reruns over time, so filing is **idempotent** — never create a duplicate.
|
|
4
|
+
|
|
5
|
+
## Selection
|
|
6
|
+
|
|
7
|
+
File only findings the user explicitly selects ("all keep+combine critical/high", or specific ids). Silence or ambiguity → file nothing. Offer `decision-required` findings as a **separate** opt-in (discussion issues), so design questions don't masquerade as fix tickets.
|
|
8
|
+
|
|
9
|
+
## What is eligible
|
|
10
|
+
|
|
11
|
+
`keep` (one issue each) and `combine` groups (one issue per `group_id`), only above the confidence gate (defined in `triage.md`). `duplicate` / `false-positive` / `defer` / `accept-risk` / `investigate` never file. `decision-required` files as a discussion/ADR-candidate issue framed as a question — never a fix ticket, and **never by authoring an ADR** (ADRs come only from `/ca-adr`, user-attributed).
|
|
12
|
+
|
|
13
|
+
## Dedup — before generating any body
|
|
14
|
+
|
|
15
|
+
1. Skip any finding already carrying an `issue_ref` in `triage.jsonl` (filed on a prior run recorded in this log).
|
|
16
|
+
2. For every remaining selected finding, search the tracker for an open issue carrying its `dedup_key` or matching title (e.g. `gh issue list --search "<dedup_key>"`). The `dedup_key` rides in each body as an HTML comment, so it is searchable. If found, skip and record it as a duplicate in the filing report — do not re-file.
|
|
17
|
+
|
|
18
|
+
## Body — `bodies/<finding-id>.md`, generated lazily, approved-only
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
# <title>
|
|
22
|
+
|
|
23
|
+
**Severity:** <final_severity> | **Confidence:** <final_confidence> | **Effort:** <effort>
|
|
24
|
+
|
|
25
|
+
**Where:** <path:lines, one per line>
|
|
26
|
+
|
|
27
|
+
**Evidence:** <minimal snippet + what is observed>
|
|
28
|
+
|
|
29
|
+
**Impact:** <what breaks / what it costs>
|
|
30
|
+
|
|
31
|
+
**Recommendation:** <remediation shape>
|
|
32
|
+
|
|
33
|
+
**Acceptance criteria:**
|
|
34
|
+
- <verifiable close condition>
|
|
35
|
+
|
|
36
|
+
<!-- dedup_key: <dedup_key> · finding: <id> -->
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`decision-required` variant: frame as **Question / Options / Evidence** — the decision and its trade-offs, not a remediation. Anti-slop applies (no em-dash sentence separators, no filler, no fabricated precision).
|
|
40
|
+
|
|
41
|
+
## Filing procedure
|
|
42
|
+
|
|
43
|
+
- **Default (no execution):** write `issue-commands.sh` with one line per issue: `gh issue create --title "<title>" --label "<final_severity>" --body-file bodies/<finding-id>.md` (`decision-required` labelled distinctly, e.g. `--label discussion`). Print the list. Stop.
|
|
44
|
+
- **On explicit approval:** run each command; capture the issue URL; write it to `triage.jsonl` as `issue_ref`.
|
|
45
|
+
- **Report** a table: finding/group id → created URL, or skipped (duplicate), or failed (with the error). Never silently drop a failure.
|
|
46
|
+
|
|
47
|
+
Findings file as GitHub issues, never `open-tasks.md` — a periodic-review finding must survive PR abandonment.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# appsec — lens mandate
|
|
2
|
+
|
|
3
|
+
Executed by `tribunal-lens-reviewer` under the `appsec` assignment. Write contract + evidence discipline: `finding-record.md` — every finding needs `path:line` evidence; write it the moment it's found.
|
|
4
|
+
|
|
5
|
+
## Scope emphasis
|
|
6
|
+
The assigned path slice, weighted to trust-boundary crossings and request handlers.
|
|
7
|
+
|
|
8
|
+
## Required reading
|
|
9
|
+
- `<project-root>/.codearbiter/security-controls.md` — trust boundaries and approved patterns; and `inventory.md` in the run dir for marked trust boundaries.
|
|
10
|
+
|
|
11
|
+
## Checklist
|
|
12
|
+
- Injection surface: user-controlled input reaching SQL (string concatenation, CWE-89), shell execution, filesystem path resolution, HTML/template rendering (XSS, CWE-79), or deserialization. Concatenating input into any query or command is critical regardless of how "clean" the input looks.
|
|
13
|
+
- Resource-level authorization: for every route/endpoint, is the authenticated user verified to own *this* resource? Missing resource-level authz (IDOR) is the highest-yield critical class and near-invisible to SAST.
|
|
14
|
+
- Missing input boundary validation (CWE-20): inputs used without null/type/range checks at boundaries.
|
|
15
|
+
- JWT: signature, expiry, issuer, and algorithm validated; no algorithm confusion.
|
|
16
|
+
- CORS: wildcard `*` origins. SSRF: server-side fetches of user-controlled URLs.
|
|
17
|
+
|
|
18
|
+
## Exposure
|
|
19
|
+
Count of sink sites inspected (query construction, command exec, path resolution, HTML/template render, deserialization).
|
|
20
|
+
|
|
21
|
+
## Out of scope
|
|
22
|
+
Secrets/crypto/deps (secrets-supply); generic error handling (reliability).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# architecture — lens mandate
|
|
2
|
+
|
|
3
|
+
Executed by `tribunal-lens-reviewer` under the `architecture` assignment. Write contract + evidence discipline: `finding-record.md`.
|
|
4
|
+
|
|
5
|
+
## Scope emphasis
|
|
6
|
+
The assigned path slice plus the `inventory.md` import/caller map. Coupling, dead code, abstraction quality, module sizing.
|
|
7
|
+
|
|
8
|
+
## Required reading
|
|
9
|
+
- `<plugin-root>/routines/tribunal/references/ai-markers.md` — the structural thresholds the lens checklist cites.
|
|
10
|
+
- `<project-root>/.codearbiter/coding-standards.md` — the conventions structure is judged against; `inventory.md` in the run dir — the import/caller map.
|
|
11
|
+
|
|
12
|
+
## Checklist
|
|
13
|
+
- Orphan/dead modules: zero active callers; a module tested but never called in production is dead code masquerading as live.
|
|
14
|
+
- Pattern consistency: identify the primary pattern and verify it holds across all modules; deviating modules are typically later-added where context was lost.
|
|
15
|
+
- Cosmetic abstractions: an interface/abstract class whose removal changes no behavior, or with a single implementation adding no isolation. The diagnostic is whether it *encapsulates* complexity or merely *relocates* it — relocation creates leaky layers that force consumers to know internals.
|
|
16
|
+
- Dead code paths: unreachable branches, functions whose return is never consumed, imported symbols never referenced.
|
|
17
|
+
- God modules, over-consumed shared dependencies — structural thresholds: `ai-markers.md`. Monolith accretion in oversized files.
|
|
18
|
+
|
|
19
|
+
## Exposure
|
|
20
|
+
Count of modules in the import/caller map (`inventory.md`).
|
|
21
|
+
|
|
22
|
+
## Out of scope
|
|
23
|
+
Conformance to accepted ADRs — that is `architecture-drift-reviewer`, a different agent. Do not re-flag ADR drift.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# coverage — lens mandate
|
|
2
|
+
|
|
3
|
+
Executed by `tribunal-lens-reviewer` under the `coverage` assignment. Write contract + evidence discipline: `finding-record.md`.
|
|
4
|
+
|
|
5
|
+
## Scope emphasis
|
|
6
|
+
Source-and-test pairs on risk paths in the assigned slice (auth, money, data-mutation, error handling).
|
|
7
|
+
|
|
8
|
+
## Required reading
|
|
9
|
+
- `<project-root>/.codearbiter/tech-stack.md` — test and coverage invocations; `inventory.md` in the run dir — the risk overlay.
|
|
10
|
+
|
|
11
|
+
## Checklist
|
|
12
|
+
- Coverage gaps on risk paths (auth, money, data-mutation, error handling).
|
|
13
|
+
- Missing edge-case/property coverage; the empty/null/single-item and zero-value cases.
|
|
14
|
+
- Tests asserting implementation detail rather than observable behavior.
|
|
15
|
+
|
|
16
|
+
## Exposure
|
|
17
|
+
Count of risk paths examined (`inventory.md` risk overlay).
|
|
18
|
+
|
|
19
|
+
## Out of scope
|
|
20
|
+
Tests validating fiction (test-fidelity); the underlying bug itself (reliability).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# infra — lens mandate
|
|
2
|
+
|
|
3
|
+
Executed by `tribunal-lens-reviewer` under the `infra` assignment. Write contract + evidence discipline: `finding-record.md`.
|
|
4
|
+
|
|
5
|
+
## Scope emphasis
|
|
6
|
+
CI workflows, Dockerfiles/compose, IaC and deploy manifests, release automation in the assigned slice.
|
|
7
|
+
|
|
8
|
+
## Required reading
|
|
9
|
+
- `<project-root>/.codearbiter/security-controls.md` — trust boundaries and approved secret stores; `<project-root>/.codearbiter/tech-stack.md` — deploy targets and CI conventions.
|
|
10
|
+
|
|
11
|
+
## Checklist
|
|
12
|
+
- CI/CD workflows: untrusted input (PR titles, branch names, comments) interpolated into `run:` steps; excessive workflow/token `permissions`; third-party actions pinned to tags, not SHAs; fork-writable cache keys (poisoning); artifacts promoted without provenance; masked failures (swallowed exit codes) ahead of a publish step.
|
|
13
|
+
- Container posture: base image unpinned or of unvetted provenance; running as root; secrets baked into layers or build args.
|
|
14
|
+
- IaC/deploy manifests: drift between environments; missing resource limits; services exposed wider than intended.
|
|
15
|
+
- Release automation: publish/tag steps ungated by branch or tag protections.
|
|
16
|
+
|
|
17
|
+
## Categories & severity
|
|
18
|
+
`security` for exploitable pipeline issues (injection, token overreach, cache poisoning); `dependency` for provenance/pinning; `reliability` for deploy-config correctness. Exploitable-from-fork is critical/high.
|
|
19
|
+
|
|
20
|
+
## Exposure
|
|
21
|
+
Count of workflows + Dockerfiles/compose files + IaC/deploy manifests examined.
|
|
22
|
+
|
|
23
|
+
## Out of scope
|
|
24
|
+
Supply-chain risk of app dependencies (secrets-supply) — this lens owns the pipeline and deploy surface itself.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# migration — lens mandate
|
|
2
|
+
|
|
3
|
+
Executed by `tribunal-lens-reviewer` under the `migration` assignment. Write contract + evidence discipline: `finding-record.md`.
|
|
4
|
+
|
|
5
|
+
## Scope emphasis
|
|
6
|
+
Migration files in the assigned slice, cross-referenced against schema and query code.
|
|
7
|
+
|
|
8
|
+
## Required reading
|
|
9
|
+
- `<project-root>/.codearbiter/security-controls.md` — data-classification categories; `<project-root>/.codearbiter/tech-stack.md` — ORM/schema conventions.
|
|
10
|
+
|
|
11
|
+
## Checklist
|
|
12
|
+
- Reversibility: rollback/down path present; destructive ops (DROP, TRUNCATE) guarded; NOT NULL added without DEFAULT/backfill; single-step rename that breaks queries mid-deploy.
|
|
13
|
+
- Data-classification annotation present for tables holding sensitive data (PII, credentials, payment, audit).
|
|
14
|
+
- Immutability: edits to an already-committed migration (schema divergence across environments).
|
|
15
|
+
- Index concurrency on large tables; locks that block production traffic.
|
|
16
|
+
- Schema-to-code drift, backfill correctness, operation ordering, unguarded destructive operations.
|
|
17
|
+
|
|
18
|
+
## Exposure
|
|
19
|
+
Count of migration files reviewed.
|
|
20
|
+
|
|
21
|
+
## Out of scope
|
|
22
|
+
Application-level data handling (appsec/secrets).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# observability — lens mandate
|
|
2
|
+
|
|
3
|
+
Executed by `tribunal-lens-reviewer` under the `observability` assignment. Write contract + evidence discipline: `finding-record.md`.
|
|
4
|
+
|
|
5
|
+
## Scope emphasis
|
|
6
|
+
The assigned path slice, weighted to critical paths and boundaries.
|
|
7
|
+
|
|
8
|
+
## Required reading
|
|
9
|
+
- `<project-root>/.codearbiter/tech-stack.md` — logging/tracing/metrics stack; `inventory.md` in the run dir — the boundary map.
|
|
10
|
+
|
|
11
|
+
## Checklist
|
|
12
|
+
- Missing or inconsistent structured logging on critical paths.
|
|
13
|
+
- Absent tracing / correlation IDs across service or async boundaries.
|
|
14
|
+
- No metrics on critical paths; audit-trail gaps for security-relevant events.
|
|
15
|
+
- Sensitive-data-in-logs is flagged once, by the secrets lens — do not double-report it here.
|
|
16
|
+
|
|
17
|
+
## Exposure
|
|
18
|
+
Count of boundary crossings / critical paths inspected (`inventory.md` boundary map).
|
|
19
|
+
|
|
20
|
+
## Out of scope
|
|
21
|
+
Whether the logged operation is itself correct (reliability).
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# performance — lens mandate
|
|
2
|
+
|
|
3
|
+
Executed by `tribunal-lens-reviewer` under the `performance` assignment. Write contract + evidence discipline: `finding-record.md`; flag a signature only where the path is plausibly hot — no speculative micro-optimization.
|
|
4
|
+
|
|
5
|
+
## Scope emphasis
|
|
6
|
+
The assigned path slice, weighted to hot paths and data access.
|
|
7
|
+
|
|
8
|
+
## Required reading
|
|
9
|
+
- `<project-root>/.codearbiter/tech-stack.md` — data layer, ORM, and cache conventions.
|
|
10
|
+
|
|
11
|
+
## Checklist
|
|
12
|
+
- N+1 queries and per-iteration IO in loops.
|
|
13
|
+
- Redundant hot-path work; recomputation that could be hoisted or memoized.
|
|
14
|
+
- Query/index shape: filters/sorts on unindexed columns; over-fetching.
|
|
15
|
+
- Missing or incorrect caching; cache keys that never invalidate or collide.
|
|
16
|
+
- Blocking IO on latency-critical paths.
|
|
17
|
+
|
|
18
|
+
## Exposure
|
|
19
|
+
Count of hot-path/data-access sites inspected.
|
|
20
|
+
|
|
21
|
+
## Out of scope
|
|
22
|
+
Correctness of the logic itself (reliability).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# reliability — lens mandate
|
|
2
|
+
|
|
3
|
+
Executed by `tribunal-lens-reviewer` under the `reliability` assignment. Write contract + evidence discipline: `finding-record.md`.
|
|
4
|
+
|
|
5
|
+
## Scope emphasis
|
|
6
|
+
The assigned path slice: async correctness, error propagation, races, resource lifecycle, boundary conditions, orphan state.
|
|
7
|
+
|
|
8
|
+
## Required reading
|
|
9
|
+
- `<project-root>/.codearbiter/tech-stack.md` — async model and concurrency primitives.
|
|
10
|
+
|
|
11
|
+
## Checklist
|
|
12
|
+
- Async inventory: every `await`, `Promise`, and `.then()` chain has a `.catch`/`try-catch`.
|
|
13
|
+
- Error-propagation trace: for every `catch`, what happens next. Acceptable — rethrow, typed fallback, central handler, or a state update notifying the caller. Unacceptable — log-and-return-`undefined`, or swallow entirely. Flag every catch that does not propagate a meaningful signal.
|
|
14
|
+
- Race surface: two+ async operations writing shared state (component state, globals, filesystem, DB rows) without locking/serialization; handlers that fire before a prior invocation completes; polling loops without cancellation; message handlers mutating state without queueing.
|
|
15
|
+
- Resource lifecycle: every subscription, listener, connection, or timer set up in an init hook has a teardown in cleanup/unmount.
|
|
16
|
+
- Boundary conditions: empty, null, single-item collections; zero-value numerics; null API responses.
|
|
17
|
+
- Orphan state: state written conditionally but read unconditionally; mutation after unmount (stale closure).
|
|
18
|
+
|
|
19
|
+
## Exposure
|
|
20
|
+
Count of async sites (await/Promise/then) inspected.
|
|
21
|
+
|
|
22
|
+
## Out of scope
|
|
23
|
+
Performance (performance); injection/authz (appsec).
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# secrets-supply — lens mandate
|
|
2
|
+
|
|
3
|
+
Executed by `tribunal-lens-reviewer` under the `secrets-supply` assignment. Write contract + evidence discipline: `finding-record.md`.
|
|
4
|
+
|
|
5
|
+
## Scope emphasis
|
|
6
|
+
Source, config, `.env*`, and dependency manifests/lockfiles in the assigned slice.
|
|
7
|
+
|
|
8
|
+
## Required reading
|
|
9
|
+
- `<project-root>/.codearbiter/security-controls.md` — approved secret store and crypto; `<project-root>/.codearbiter/tech-stack.md` — dependency manifests.
|
|
10
|
+
|
|
11
|
+
## Checklist
|
|
12
|
+
- Literal secrets in source or `.env.example` — JWT/signing keys, API keys, DB connection strings, OAuth secrets, passwords (CWE-798). `.env.example` populated with real values is a common AI regression.
|
|
13
|
+
- Weak/misused crypto (CWE-327): MD5/SHA-1 for password hashing; `Math.random()` for tokens instead of a CSPRNG.
|
|
14
|
+
- Cleartext transmission: HTTP where HTTPS is required; credentials in query strings or bodies.
|
|
15
|
+
- Secrets/PII in logs; debug flags active without an environment gate.
|
|
16
|
+
- Supply chain: hallucinated/slopsquatted package names; dependency overuse (large trees from small features); pins current at training time but now deprecated or vulnerable.
|
|
17
|
+
|
|
18
|
+
## Exposure
|
|
19
|
+
Count of dependencies examined + config/secret-bearing files scanned.
|
|
20
|
+
|
|
21
|
+
## Out of scope
|
|
22
|
+
Injection/authz (appsec).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# test-fidelity — lens mandate
|
|
2
|
+
|
|
3
|
+
Executed by `tribunal-lens-reviewer` under the `test-fidelity` assignment. Write contract + evidence discipline: `finding-record.md`. Report observable state only; do not assert "written because the producer was absent" unless a comment says so.
|
|
4
|
+
|
|
5
|
+
## Scope emphasis
|
|
6
|
+
Test files and fixtures in the assigned slice. Doubles, fabricated literals, escape hatches, temporariness confessions.
|
|
7
|
+
|
|
8
|
+
## Required reading
|
|
9
|
+
- `<project-root>/.codearbiter/tech-stack.md` — mock patterns, fixture/factory conventions, the real producers (serializers, DTOs, queries).
|
|
10
|
+
|
|
11
|
+
## Checklist
|
|
12
|
+
- Tests validating fiction: mocks/stubs/fabricated literals that should now be sourced from a real producer. Signals: `vi.mock`/`jest.mock`, `mockReturnValue`/`mockResolvedValue`/`mockImplementation`, `sinon.stub`, manual doubles, large inline domain-typed literals in fixtures/`beforeEach`.
|
|
13
|
+
- Type-escape hatches hiding drift from the compiler: the typesafety lens's escape-hatch list (`typesafety.md`), scoped to test code.
|
|
14
|
+
- Temporariness confessions: `TODO`/`FIXME`/`HACK`, "stub until X exists/ready/implemented".
|
|
15
|
+
- Cross-reference: does a real producer now exist (factory/builder, serializer/DTO, query/seed, the real module behind the mock)? Side-by-side drift evidence — missing now-required field, stale enum, wrong nullability — raises confidence.
|
|
16
|
+
|
|
17
|
+
## Category
|
|
18
|
+
`maintainability` by default; rises to `reliability` if the drift could let a real defect through — a test validating fiction actively masks regressions.
|
|
19
|
+
|
|
20
|
+
## Exposure
|
|
21
|
+
Count of test doubles/fixtures examined.
|
|
22
|
+
|
|
23
|
+
## Out of scope
|
|
24
|
+
Coverage gaps (coverage).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# typesafety — lens mandate
|
|
2
|
+
|
|
3
|
+
Executed by `tribunal-lens-reviewer` under the `typesafety` assignment. Write contract + evidence discipline: `finding-record.md`. Skip entirely if the language has no static type system.
|
|
4
|
+
|
|
5
|
+
## Scope emphasis
|
|
6
|
+
The assigned path slice, weighted to public interfaces and module boundaries. Skip entirely if the language has no static type system.
|
|
7
|
+
|
|
8
|
+
## Required reading
|
|
9
|
+
- `<project-root>/.codearbiter/coding-standards.md` — typing conventions; `<project-root>/.codearbiter/tech-stack.md` — whether the project is statically typed.
|
|
10
|
+
|
|
11
|
+
## Checklist
|
|
12
|
+
- Footgun public interfaces: easy to call wrong, no defaults, silent coercion.
|
|
13
|
+
- Weak/implicit typing where the language supports better; `any` where a real type exists.
|
|
14
|
+
- Type-escape hatches: `as any`, `as unknown as X`, `@ts-ignore`, `@ts-expect-error`, untyped fixtures.
|
|
15
|
+
- Unhelpful error messages; undocumented invariants; naming-convention drift within a unit.
|
|
16
|
+
|
|
17
|
+
## Exposure
|
|
18
|
+
Count of public interfaces / exported signatures inspected.
|
|
19
|
+
|
|
20
|
+
## Out of scope
|
|
21
|
+
Test-double typing drift (test-fidelity).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Report projection
|
|
2
|
+
|
|
3
|
+
`report.md` is a projection of the logs, regenerated in Phase 4 — never hand-authored, never a source of truth. Rebuild it fully from `findings/*/*.json` + `triage.jsonl` on every run and on resume; it is deterministic from the logs. Task-list-structured, not prose.
|
|
4
|
+
|
|
5
|
+
## Structure
|
|
6
|
+
|
|
7
|
+
- **Header** — run-id, scope, date, models used (from `run.jsonl`), the token estimate from Phase 0 vs. actuals (summed from `lens-completed` `tokens` in `run.jsonl` when present; best-effort, since the orchestrator cannot always observe subagent spend), and a launched/skipped-lens summary with the skip reason per lens.
|
|
8
|
+
- **Findings** — grouped by **calibrated** `final_severity` (critical to low), then by lens/type within each severity. Each entry on one line: `id` · `path:line(s)` · one-line description · remediation shape · triage `decision` · link to `plans/phase-<n>.md`. Only `keep`/`combine` findings appear here.
|
|
9
|
+
- **Decisions needed** — a separate section for `decision-required` findings, each as its question + options. These need a decision, not a fix; do not fold them into the severity list.
|
|
10
|
+
- **Investigate appendix** — medium/low findings below the confidence gate after calibration (defined in `triage.md`; below-gate critical/high land in Decisions needed instead); `id` + `path:line` + one terse line each. Preserved, not filed.
|
|
11
|
+
- **Blocking-severity note** — one line: critical/high should block shipping the affected code, but this lane is not a gate and blocks nothing.
|
|
12
|
+
|
|
13
|
+
## Anti-slop
|
|
14
|
+
|
|
15
|
+
Apply `core` (no em-dash sentence separators, no filler/AI cadence, no fabricated precision) and `medium-documents`. Every count comes from the logs — never invent a number to make the report "feel precise."
|
|
16
|
+
|
|
17
|
+
## Relationship to `manifest.yaml`
|
|
18
|
+
|
|
19
|
+
`manifest.yaml` is the machine-readable run snapshot (a projection of `run.jsonl`); `report.md` is the human view. Both regenerate from the logs; neither is edited by hand.
|