baldart 4.99.0 → 5.0.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +1 -0
  3. package/VERSION +1 -1
  4. package/framework/.claude/agents/CHANGELOG.md +82 -0
  5. package/framework/.claude/agents/REGISTRY.md +3 -1
  6. package/framework/.claude/agents/code-reviewer.md +84 -400
  7. package/framework/.claude/agents/codebase-architect.md +71 -356
  8. package/framework/.claude/agents/coder.md +131 -291
  9. package/framework/.claude/agents/doc-reviewer.md +126 -450
  10. package/framework/.claude/agents/plan-auditor.md +137 -436
  11. package/framework/.claude/agents/qa-sentinel.md +59 -313
  12. package/framework/.claude/agents/skill-improver.md +60 -4
  13. package/framework/.claude/agents/ui-expert.md +104 -591
  14. package/framework/.claude/hooks/agent-discovery-gate.js +2 -2
  15. package/framework/.claude/hooks/agent-discovery-info.sh +1 -0
  16. package/framework/.claude/skills/new/CHANGELOG.md +11 -0
  17. package/framework/.claude/skills/new/SKILL.md +1 -1
  18. package/framework/.claude/skills/new/references/codex-gate.md +25 -11
  19. package/framework/.claude/skills/new/references/implement.md +43 -3
  20. package/framework/.claude/skills/new/references/review-cycle.md +16 -4
  21. package/framework/.claude/skills/new/scripts/build-review-bundle.mjs +104 -0
  22. package/framework/.claude/skills/new/scripts/doc-invariants.mjs +163 -0
  23. package/framework/.claude/skills/new2/CHANGELOG.md +4 -0
  24. package/framework/.claude/skills/new2/SKILL.md +5 -1
  25. package/framework/.claude/workflows/new2-resolve.js +10 -3
  26. package/framework/.claude/workflows/new2.js +51 -3
  27. package/framework/agents/agent-operating-protocol.md +152 -0
  28. package/framework/agents/doc-audit-protocol.md +227 -0
  29. package/framework/agents/index.md +4 -0
  30. package/framework/agents/review-protocol.md +207 -0
  31. package/framework/routines/finding-mine.routine.yml +56 -0
  32. package/framework/routines/index.yml +11 -0
  33. package/package.json +1 -1
  34. package/src/commands/configure.js +15 -0
  35. package/src/commands/doctor.js +69 -2
  36. package/src/utils/agent-slots.js +109 -0
  37. package/src/utils/overlay-merger.js +17 -8
  38. package/src/utils/symlinks.js +93 -33
package/CHANGELOG.md CHANGED
@@ -5,6 +5,81 @@ All notable changes to BALDART will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [5.0.0] - 2026-07-03
9
+
10
+ **The agent-spine major.** Measured driver (1,934 subagent runs / 191 sessions on the
11
+ `mayo` consumer, one month, deduplicated by API-call id): 5.0B context tokens, of which
12
+ coder 53% and the whole review chain ~10%; the fixed per-spawn preamble (~45k, agent
13
+ definition 6–10k of it) is re-paid on EVERY API call; Read results are 66–75% of
14
+ tool_result bytes with the same hot files re-read at every chain link; the top-10
15
+ monster runs (200–440 calls) alone are 14% of total spend. 5.0 restructures the core
16
+ agents and the `/new` pipeline around those numbers — no gate is removed anywhere.
17
+
18
+ - **MAJOR — agents install as generated files when slot-bearing.** Core agent
19
+ definitions are restructured to 3 layers: core inline (I/O contracts + 1-line binding
20
+ rules) + shared protocol modules read on demand + `{{#flag}}` install-time slots
21
+ resolved per-consumer from EXISTING `baldart.config.yml` keys (a consumer ships ONE
22
+ `stack.database` variant, not four). A slot-bearing agent is GENERATED per-consumer
23
+ (`.baldart/generated/agents/` + symlink, marker gains trailing `config_sha`,
24
+ byte-stable rewrites); slotless agents stay plain symlinks; H2 headings stay stable
25
+ (no-op body when a flag is off) so existing overlays keep matching. First
26
+ `baldart update` after 5.0 flips the affected agents symlink→generated in one
27
+ auto-committed reconcile (allowlist already covers it). Machinery:
28
+ `src/utils/agent-slots.js` (new) + `symlinks.js` slot detection (fill → overlay-merge
29
+ → marker → transpile) + doctor `generatedAgentsStale` probe / `regenerate-agents`
30
+ action + `configure` re-merge after config writes. NO new config key (schema-change
31
+ propagation rule: N/A). Codex parity: adapter-generated — the TOML transpile consumes
32
+ the config-effective markdown, so Codex agents get the same resolved variant.
33
+ - **7 core agents restructured** (`coder`, `code-reviewer`, `doc-reviewer`,
34
+ `plan-auditor`, `qa-sentinel`, `codebase-architect`, `ui-expert`) — source cuts
35
+ 30–49% with ZERO normative loss (two independent adversarial verification passes:
36
+ no LOST, no WEAKENED rules). All carry `version:` frontmatter (own SemVer line,
37
+ history in the new `framework/.claude/agents/CHANGELOG.md` — NOT installed, excluded
38
+ from every agent enumerator incl. the discovery hooks) and ≤2-line descriptions (the
39
+ old multi-example descriptions were paid by the orchestrator every session). Codex
40
+ parity: adapter-generated (transpiler unchanged, consumes the effective markdown).
41
+ - **3 new protocol modules** (`agents/agent-operating-protocol.md`,
42
+ `agents/review-protocol.md`, `agents/doc-audit-protocol.md`) — the deduplicated SSOT
43
+ of the shared operating blocks (injection guard / retrieval / memory / tool budget),
44
+ the reviewer verification engine (Challenge+Actionability / Simulation diff+plan /
45
+ CoVe / absolute risk scoring / specialist-spawn discipline incl. the new
46
+ `specialist_dispatch` orchestrated-mode suppression), and doc-reviewer's audit-mode
47
+ procedures (read ONLY without card context). `SECTION=` dispatch — agents read only
48
+ the matching section. Codex parity: portable (markdown modules).
49
+ - **`/new` pipeline wave (skill `new` 2.0.0, `new2` 1.4.0)** — six additive mechanisms,
50
+ each with pre-5.0 graceful degradation and `check-new-parity.mjs` tripwire rules
51
+ (16 total): review bundle (`build-review-bundle.mjs` — deterministic per-card
52
+ handoff + binding anti-re-read phrase in every reviewer briefing, Hot-File Map
53
+ honored downstream); doc-invariants PASS-fast (`doc-invariants.mjs` — the invariant
54
+ table as executable rules; zero blocking rows + no doc signals + non-deep → per-card
55
+ doc-reviewer spawn skipped, Final F.3 backstop unchanged; measured headroom: 84/127
56
+ per-card runs returned PASS); cap-and-handoff (soft 80 / hard 100 tool calls,
57
+ checkpoint + fresh continuation ×2 — attacks the monster-run tail); explicit i18n
58
+ fill pass (step 7c, `i18n-translator` BY NAME — closes the measured general-purpose
59
+ leakage); fix-pass model routing A/B (fix-pass coder → `model: sonnet` best-effort,
60
+ overlay kill-switch `## [OVERRIDE] Fix-pass model`, `model=` in Fix Application Log
61
+ for recurrence telemetry; initial builds and specialists untouched). Codex parity:
62
+ scripts portable (.mjs), prose additive; the new2 workflow mirrors are Claude-only
63
+ with the /new prose as the inline fallback.
64
+ - **`finding-mine` routine (monthly) + `skill-improver` 2.0.0 `MODE: miner`** — the
65
+ anticipatory loop: 30 days of pooled findings / QA reports / batch trackers /
66
+ reviewer memories distilled into CLASSIFIED proposals (author-time coder rules,
67
+ never-demote rows, deterministic-gate candidates, card-schema proposals —
68
+ proposal-only, upstream candidates consolidated). Routine count 8 → 9. Codex parity:
69
+ adapter-generated (3 routine backends; agent transpiled).
70
+ - **`scripts/agent-telemetry.mjs` (maintainer tool)** — fleet-level per-family
71
+ telemetry (calls p50/p90/max, ctx, read-share, verdicts, rework ratio, cap-hit rate,
72
+ fix-pass models) with `--baseline save|compare`; the pre-5.0 baseline is saved.
73
+ Dedup by `message.id` keeping the LAST record (the JSONL double-count trap). Codex
74
+ parity: N/A (maintainer-only, Claude transcripts).
75
+ - **Post-release measurement plan** (2 weeks on a live consumer, vs the saved
76
+ baseline): coder ctx/run −30%+, Read-share <66%, p100 calls down, doc-reviewer
77
+ PASS-fast rate ≈ measured headroom, fix-pass recurrence sonnet ≤ opus, reviewer
78
+ verdict distributions unchanged.
79
+
80
+ MAJOR — changes the on-disk layout of installed agents (symlink → generated file for
81
+ slot-bearing agents). No new `baldart.config.yml` keys anywhere in the release.
82
+
8
83
  ## [4.99.0] - 2026-07-03
9
84
 
10
85
  **Consumer-lessons wave: four recurring failure patterns surfaced by mayo's nightly/weekly routine reports (20260628-skill-improve + 20260701-doc-graph-align) upstreamed into the base framework.** The consumer had fixed each locally via overlays, but three of the four root causes live in the base payload — every future consumer would have re-discovered them. The overarching meta-defect (#2) is that the lesson pipeline itself had no upstream channel: overlay fixes died in the consumer.
package/README.md CHANGED
@@ -328,6 +328,7 @@ drift-detection loops actually run. Ship-bundled routines:
328
328
  | `ds-drift` | weekly Mon 03:00 UTC | doc-reviewer | Design-system drift check (optional) |
329
329
  | `full-sweep` | weekly Sun 03:00 UTC | doc-reviewer | Full SSOT audit (optional) |
330
330
  | `i18n-align` | weekly Mon 04:00 UTC | i18n-translator | Translates target languages, lints, commits direct to trunk (optional, needs `has_i18n`) |
331
+ | `finding-mine` | monthly 1st 03:00 UTC | skill-improver | Deep 30-day mining of pooled findings/QA/trackers/reviewer memories into classified improvement proposals (`MODE: miner`, v5.0.0) |
331
332
 
332
333
  Three backend adapters are bundled:
333
334
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 4.99.0
1
+ 5.0.0
@@ -0,0 +1,82 @@
1
+ # Changelog — agent definitions
2
+
3
+ Per-agent version history (the `version:` frontmatter each agent carries since
4
+ framework v5.0.0). This file is NOT installed into consumers (excluded from the
5
+ per-item agent merge, the doctor probes, and the discovery hooks — like
6
+ `REGISTRY.md` it is framework metadata living beside the agents).
7
+
8
+ Formato: [Keep a Changelog](https://keepachangelog.com/) · per-agent SemVer.
9
+
10
+ ## [coder v2.0.0] · [code-reviewer v2.0.0] · [doc-reviewer v2.0.0] · [plan-auditor v2.0.0] · [qa-sentinel v2.0.0] · [codebase-architect v2.0.0] · [ui-expert v2.0.0] · [skill-improver v2.0.0] — 2026-07-03 (framework v5.0.0)
11
+
12
+ **The 3-layer restructuring** (core inline + shared modules + install-time slots).
13
+ The pre-5.0 monoliths are implicitly `1.x`. Every normative rule survives — either
14
+ inline as a 1-line binding rule, in a shared module the core cites
15
+ (`agents/agent-operating-protocol.md`, `agents/review-protocol.md`,
16
+ `agents/doc-audit-protocol.md`), or in a pre-existing SSOT — verified by two
17
+ independent adversarial passes (zero LOST, zero WEAKENED).
18
+
19
+ Common changes (all 8):
20
+ - `version:` frontmatter added; `description` trimmed to ≤2 lines (inline examples
21
+ removed — they were paid by the ORCHESTRATOR's context every session).
22
+ - Shared operating blocks (injection guard, doc-retrieval, persistent-memory
23
+ hygiene, tool budget) deduplicated into `agent-operating-protocol.md`;
24
+ reviewer verification passes (Challenge/Actionability, Simulation, CoVe, risk
25
+ scoring, specialist-spawn discipline) into `review-protocol.md`. Cores keep
26
+ 1-line binding versions + `SECTION=` cites.
27
+ - Conditional content became `{{#flag}}` install-time slots resolved from
28
+ EXISTING `baldart.config.yml` keys (features.*, stack.database → `db_*`,
29
+ `fw_nextjs`, `deploy_vercel`, `e2e_playwright`). H2 headings stay STABLE with a
30
+ one-line no-op body when a flag is off (overlay `[OVERRIDE]/[APPEND]` targets
31
+ keep matching).
32
+ - I/O contracts stayed VERBATIM inline: completion report, verdict lines, pooled
33
+ findings YAML, TARGET TAG table, QA report format, 10-section FULL output,
34
+ Return Contracts, QUICK mode.
35
+
36
+ Per-agent highlights:
37
+ - **coder**: 4 DB variants → one `{{#db_*}}` slot; Reference-Aliasing lore → 1-line
38
+ + `coding-standards.md` cite; NEW `## Tool-Call Budget & Checkpoint` (cap-and-
39
+ handoff, `[CAP-HANDOFF]` marker); completion report ALSO persisted to
40
+ `/tmp/completion-<CARD-ID>.md`; deterministic DTCG token lookup (never grep the
41
+ CSS); Linked Skills conditional on stack.
42
+ - **code-reviewer**: DS compliance compressed under `{{#has_design_system}}`
43
+ (protocol module is the SSOT); NEW review-bundle-first scope rule; NEW
44
+ `specialist_dispatch` orchestrated-mode suppression (records
45
+ `dispatch_deferred:<agent>`).
46
+ - **doc-reviewer**: split by mode — per-card core stays; audit-mode procedures
47
+ (drift validators, DocAgent topological, epistemic metadata, SCIP, schema/
48
+ registry drift, coverage gauges) moved to `doc-audit-protocol.md`, read ONLY
49
+ without card context; NEW deterministic-first invariant check (consumes
50
+ `/tmp/docinv-<CARD-ID>.json` when present).
51
+ - **plan-auditor**: 4-example description → 2 lines; persistence checks →
52
+ `{{#db_*}}`; QUICK mode, checklist A–H, ADR delta, high-risk triggers, TARGET
53
+ TAG table, YAML schema, 10-section output all inline; NEW dispatch suppression.
54
+ - **qa-sentinel**: 3-example description → 2 lines; i18n gate / ds-gate /
55
+ toolchain resolution under their flags; review-bundle `files_changed`+`gate_logs`
56
+ as authoritative inputs.
57
+ - **codebase-architect**: 4-example description → 2 lines; LSP/graph escalations
58
+ under `{{#has_lsp_layer}}`/`{{#has_code_graph}}`; investigation engine, terse
59
+ contract (incl. Hot-File Map) and architect-specific memory hygiene (TTL,
60
+ archived/, cleanup) kept verbatim-compressed.
61
+ - **ui-expert**: i18n under `{{#has_i18n}}`; Design Reference (code-first) and
62
+ build-with-eyes kept intact; expertise/delegations/red-flags compressed with no
63
+ category dropped; deterministic token lookup.
64
+ - **skill-improver**: NEW `## MODE: miner` (monthly deep pass → classified
65
+ proposals; consumed by the `finding-mine` routine) + COMPACT return contract.
66
+
67
+ **Heading map (old → new) for consumer overlays** — overlay sections targeting a
68
+ heading that moved/merged are appended as trailing sections with a warning (never
69
+ lost); re-point them to:
70
+
71
+ | Old H2 (pre-5.0) | Now |
72
+ |---|---|
73
+ | `## Prompt Injection Guard` (code-reviewer, plan-auditor) | `## Operating Protocol` (1-line) + module `SECTION=injection-guard` |
74
+ | `## Memory Retrieval Step` / `## MEMORY RETRIEVAL STEP` | `## Operating Protocol` + module `SECTION=memory` |
75
+ | `## Retrieval Protocol Consumption` (all) | `## Operating Protocol` / `## Retrieval Protocol` + module `SECTION=retrieval` |
76
+ | `## Search discipline` (all) | `## Operating Protocol` (cite `code-search-protocol.md`) |
77
+ | `## Challenge Pass` / `## Diff Simulation Pass` / `## Chain-of-Verification Pass` / `## Quantified Risk Scoring` | `## Verification Passes` + `review-protocol.md` sections |
78
+ | `## Specialist Auto-Spawn` | same name; suppression clause added (matrix unchanged) |
79
+ | `## Reference-Aliasing Mutation Hazards` (coder) | 1-line in `## Code Standards & Author-Time Simplicity Discipline` + `coding-standards.md` |
80
+ | `## Database Index Invariant` variants (coder) / `### Persistence-Specific` (plan-auditor) | same heading, body is now the single `{{#db_*}}` variant |
81
+ | doc-reviewer `## Audit Process`, `## Drift Validator Suite`, `## Dependency-Aware Generation Protocol`, `## Epistemic Metadata Protocol`, `## SCIP Code Reference Protocol`, `## Schema Field-Level Drift Detection`, `## Canonical API registries`, `## Endpoint Count Reconciliation`, `## Coverage Gauges` | `agents/doc-audit-protocol.md` (agent keeps `## Audit Mode` dispatch) |
82
+ | `# Persistent Agent Memory` boilerplate tails | compressed under `# Persistent Agent Memory` + module `SECTION=memory` |
@@ -6,7 +6,9 @@ Quick-reference for all custom agents. Use this to route tasks to the right spec
6
6
 
7
7
  > **Codex-native (since v4.80.0)**: every agent here is portable to Codex. The same `<name>.md` is **transpiled** to `.codex/agents/<name>.toml` on install/update (`name`/`description` → same, body → `developer_instructions`, `effort` → `model_reasoning_effort`, `model` omitted). Authoring stays single-source: drop a `.md`, it auto-installs for both tools. Keep `name`+`description` frontmatter, put behaviour in the body, and don't rely on an agent spawning a further agent (Codex `agents.max_depth: 1`). Design: [`framework/docs/CODEX-AGENTS.md`](../../docs/CODEX-AGENTS.md).
8
8
 
9
- > **Machine-readable source of truth (since v3.20.0)**: the filesystem directory `framework/.claude/agents/` is authoritative for the list of BALDART agents. The `agent-discovery-gate.js` PreToolUse hook, the `agent-discovery-info.sh` SessionStart hook, and `baldart doctor` enumerate the directory directly (every `<name>.md` except this file is an agent — no manifest JSON is shipped). Adding a new agent means dropping `<name>.md` here; no other touchpoint.
9
+ > **Machine-readable source of truth (since v3.20.0)**: the filesystem directory `framework/.claude/agents/` is authoritative for the list of BALDART agents. The `agent-discovery-gate.js` PreToolUse hook, the `agent-discovery-info.sh` SessionStart hook, and `baldart doctor` enumerate the directory directly (every `<name>.md` except this file and `CHANGELOG.md` is an agent — no manifest JSON is shipped). Adding a new agent means dropping `<name>.md` here; no other touchpoint.
10
+
11
+ > **3-layer structure + versioning + slots (since v5.0.0)**: the core agents follow a 3-layer authoring contract. (1) **Core inline** — role boundary, gating, I/O contracts (verdict lines, pooled findings YAML, completion reports) and every always-applicable rule as a 1-line BINDING statement. (2) **Modules on demand** — shared procedures live in `agents/agent-operating-protocol.md` (injection guard / retrieval / memory / tool budget) and `agents/review-protocol.md` (Challenge / Simulation / CoVe / risk scoring / specialist-spawn discipline), cited as `SECTION=<name>`; **reading the cited section when the procedure applies is normative**, and degrade is safe (the 1-line rule still binds; contracts never live in modules). (3) **Install-time slots** — `{{#flag}}` conditionals resolved per-consumer from existing `baldart.config.yml` keys (see `src/utils/agent-slots.js`); a slot-bearing agent installs as a GENERATED file (marker + `config_sha`), H2 headings stay stable with a no-op body when the flag is off (overlays keep matching). Every agent carries a `version:` frontmatter (its own SemVer line); bump it + add an entry to `framework/.claude/agents/CHANGELOG.md` (NOT installed) in the same edit. Keep frontmatter `description` ≤2 lines — it is paid by the orchestrator's context every session.
10
12
 
11
13
  > **Return contract (since v4.59.0)**: every orchestrator-facing subagent bounds its **final message** so a long body doesn't flood the spawning context — COMPACT return (headline/verdict + `path:line` findings + disk pointer), long form persisted to disk. Agents already structured this way are the exemplars (`qa-sentinel` Return Protocol, `visual-fidelity-verifier` JSON, the verdict+pooled-YAML reviewers — `code-reviewer` / `security-reviewer` / `api-perf-cost-auditor`); free-form analysts carry an explicit `## Return Contract` block (`codebase-architect`, `doc-reviewer`, `plan-auditor`, `senior-researcher`). When adding a new analysis/audit/research agent, paste the block from `framework/templates/agent-return-contract.snippet.md`. Protocol: `framework/agents/return-contract-protocol.md`.
12
14