@event4u/agent-config 8.8.0 → 8.9.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 (131) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +109 -274
  3. package/README.md +2 -2
  4. package/dist/agent-src/commands/agent-handoff.md +39 -2
  5. package/dist/agent-src/commands/research/deep.md +8 -0
  6. package/dist/agent-src/commands/research/report.md +7 -0
  7. package/dist/agent-src/commands/roadmap/create.md +12 -0
  8. package/dist/agent-src/commands/roadmap/process-full.md +31 -5
  9. package/dist/agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +30 -1
  10. package/dist/agent-src/contexts/execution/orchestration-telemetry.md +21 -5
  11. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +37 -0
  12. package/dist/agent-src/contexts/execution/subagent-topologies.md +34 -0
  13. package/dist/agent-src/contexts/execution/verification-mechanics.md +9 -9
  14. package/dist/agent-src/rules/agent-authority.md +1 -1
  15. package/dist/agent-src/rules/communication-through-line.md +1 -1
  16. package/dist/agent-src/rules/delegation-policy.md +5 -0
  17. package/dist/agent-src/rules/direct-answers.md +1 -1
  18. package/dist/agent-src/rules/downstream-changes.md +1 -0
  19. package/dist/agent-src/rules/external-code-graph-interop.md +65 -0
  20. package/dist/agent-src/rules/git-history-discipline.md +18 -0
  21. package/dist/agent-src/rules/lethal-trifecta-guard.md +6 -1
  22. package/dist/agent-src/rules/minimal-safe-diff.md +58 -10
  23. package/dist/agent-src/rules/non-destructive-by-default.md +3 -0
  24. package/dist/agent-src/rules/question-not-instruction.md +76 -0
  25. package/dist/agent-src/rules/senior-engineering-discipline.md +1 -1
  26. package/dist/agent-src/rules/think-before-action.md +1 -0
  27. package/dist/agent-src/rules/tool-safety.md +8 -0
  28. package/dist/agent-src/rules/untrusted-input-defense.md +87 -22
  29. package/dist/agent-src/scripts/update_roadmap_progress.ts +2 -1
  30. package/dist/agent-src/skills/accessibility-auditor/SKILL.md +19 -0
  31. package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +10 -3
  32. package/dist/agent-src/skills/code-review/SKILL.md +2 -0
  33. package/dist/agent-src/skills/command-writing/SKILL.md +53 -40
  34. package/dist/agent-src/skills/dcf-modeling/evals/domain-truth.json +29 -0
  35. package/dist/agent-src/skills/deep-reading-analyst/SKILL.md +1 -0
  36. package/dist/agent-src/skills/design-intelligence/SKILL.md +49 -12
  37. package/dist/agent-src/skills/design-review/SKILL.md +29 -15
  38. package/dist/agent-src/skills/design-system-capture/SKILL.md +63 -24
  39. package/dist/agent-src/skills/forecasting/evals/domain-truth.json +29 -0
  40. package/dist/agent-src/skills/frontend-render-security/SKILL.md +2 -2
  41. package/dist/agent-src/skills/markitdown/SKILL.md +1 -0
  42. package/dist/agent-src/skills/mcp/SKILL.md +24 -0
  43. package/dist/agent-src/skills/mcp-builder/SKILL.md +9 -1
  44. package/dist/agent-src/skills/memory-consolidation/SKILL.md +55 -4
  45. package/dist/agent-src/skills/roadmap-writing/SKILL.md +39 -5
  46. package/dist/agent-src/skills/runway-cognition/evals/domain-truth.json +29 -0
  47. package/dist/agent-src/skills/scenario-modeling/evals/domain-truth.json +29 -0
  48. package/dist/agent-src/skills/secrets-management/SKILL.md +7 -0
  49. package/dist/agent-src/skills/skill-writing/SKILL.md +12 -3
  50. package/dist/agent-src/skills/subagent-orchestration/SKILL.md +27 -33
  51. package/dist/agent-src/skills/supply-chain-intake/SKILL.md +12 -0
  52. package/dist/agent-src/skills/testing-anti-patterns/SKILL.md +29 -0
  53. package/dist/agent-src/skills/ui-component-architect/SKILL.md +9 -0
  54. package/dist/agent-src/skills/unit-economics-modeling/evals/domain-truth.json +40 -0
  55. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  56. package/dist/agent-src/templates/roadmaps.md +36 -0
  57. package/dist/cli/registry.js +3 -0
  58. package/dist/cli/registry.js.map +1 -1
  59. package/dist/discovery/deprecation-report.md +1 -1
  60. package/dist/discovery/discovery-manifest.json +90 -48
  61. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  62. package/dist/discovery/discovery-manifest.summary.md +4 -4
  63. package/dist/discovery/orphan-report.md +1 -1
  64. package/dist/discovery/packs.json +11 -9
  65. package/dist/discovery/trust-report.md +2 -2
  66. package/dist/discovery/workspaces.json +9 -7
  67. package/dist/install/install.mjs +136 -1
  68. package/dist/mcp/registry-manifest.json +3 -3
  69. package/dist/router.json +1 -1
  70. package/dist/scripts/_lib/claude_builtin_names.js +145 -0
  71. package/dist/scripts/_lib/claude_builtin_names.js.map +1 -0
  72. package/dist/scripts/condense.js +14 -0
  73. package/dist/scripts/condense.js.map +1 -1
  74. package/docs/CLAIMS.md +34 -6
  75. package/docs/architecture.md +2 -2
  76. package/docs/archive/CHANGELOG-pre-8.9.0.md +306 -0
  77. package/docs/benchmark.md +113 -0
  78. package/docs/catalog.md +20 -7
  79. package/docs/contracts/command-clusters.md +18 -0
  80. package/docs/contracts/design-artifact-verification.md +124 -0
  81. package/docs/contracts/injected-block-authenticity-model.md +66 -0
  82. package/docs/contracts/mcp-tool-inventory.md +28 -28
  83. package/docs/decisions/ADR-061-corpus-grounding-layer.md +13 -0
  84. package/docs/decisions/ADR-116-memory-tripwire-activation-path.md +9 -0
  85. package/docs/getting-started-by-role.md +1 -1
  86. package/docs/getting-started.md +1 -1
  87. package/docs/governance-advantage.md +1 -1
  88. package/docs/guidelines/agent-infra/asking-and-brevity-examples.md +27 -0
  89. package/docs/guidelines/agent-infra/emphasis-budget.md +45 -0
  90. package/docs/guidelines/agent-infra/simplicity-and-goal-demos.md +151 -0
  91. package/docs/guidelines/agent-infra/tool-description-as-policy.md +35 -0
  92. package/docs/guidelines/design-canon.md +1 -0
  93. package/docs/proof.md +36 -21
  94. package/docs/second-brain-scope.md +69 -26
  95. package/package.json +1 -1
  96. package/src/agent-src/scripts/update_roadmap_progress.ts +2 -1
  97. package/src/scripts/_dispatch.bash +27 -0
  98. package/src/scripts/_lib/claude_builtin_names.ts +148 -0
  99. package/src/scripts/_lib/file_slicer.ts +117 -0
  100. package/src/scripts/_lib/lexical_index.ts +155 -0
  101. package/src/scripts/_lib/orchestration_record.ts +170 -0
  102. package/src/scripts/_lib/orchestration_savings.ts +62 -9
  103. package/src/scripts/_lib/retrieval_sanitize.ts +71 -0
  104. package/src/scripts/_lib/security_lint.ts +1 -0
  105. package/src/scripts/_lib/stat_index.ts +98 -0
  106. package/src/scripts/benchmark.ts +122 -0
  107. package/src/scripts/build_proof.ts +30 -17
  108. package/src/scripts/check_memory.ts +2 -0
  109. package/src/scripts/check_quality_regression.ts +51 -0
  110. package/src/scripts/check_roadmap_trackable.ts +3 -2
  111. package/src/scripts/condense.ts +14 -0
  112. package/src/scripts/discovery_graph.ts +0 -0
  113. package/src/scripts/external_sources_denylist.json +4 -1
  114. package/src/scripts/generate_index.ts +5 -2
  115. package/src/scripts/install-hooks.sh +25 -0
  116. package/src/scripts/install.ts +35 -2
  117. package/src/scripts/learning_sidecar.ts +0 -0
  118. package/src/scripts/lint_agent_skill_names.ts +29 -0
  119. package/src/scripts/lint_knowledge_scale.ts +4 -3
  120. package/src/scripts/lint_roadmap_complexity.ts +124 -0
  121. package/src/scripts/lint_versioned_cache.ts +195 -0
  122. package/src/scripts/mcp_server/consumer_tool_catalog.json +2 -1
  123. package/src/scripts/mcp_server/tools.ts +24 -1
  124. package/src/scripts/measure_lexical_ranking.ts +173 -0
  125. package/src/scripts/memory_lookup.ts +0 -0
  126. package/src/scripts/orchestration_record.ts +140 -0
  127. package/src/scripts/orchestration_savings_report.ts +29 -5
  128. package/src/scripts/schemas/skill.schema.json +4 -0
  129. package/src/scripts/score_domain_truth.ts +192 -0
  130. package/src/scripts/second_brain_retrieval.ts +278 -0
  131. package/src/scripts/second_brain_run.ts +341 -0
package/docs/proof.md CHANGED
@@ -28,18 +28,22 @@ evidence pointer, or `task check-claims` fails the build.
28
28
  |---|---|---|---|
29
29
  | The release process is documented as an inheritable runbook + succession doc, and the project's bus-factor (trailing-90-day distinct human reviewers) is tracked and reported truthfully — currently 1, not implied to be more. | qual | `docs/succession.md#trailing 90 days` | ✅ |
30
30
  | 172 commands. | quant | `src/scripts/check_artefact_count_messaging.ts#Artefact-count messaging gate` | ✅ |
31
+ | The retrieval economy cuts always-loaded context tokens ~65.6% measured against the FULL always-loaded projection — 98,529 → 33,897 tokens (eager rule load + skill/command descriptions + MCP schemas, thin-flipped). Method: `agent-config benchmark` over the pinned token baseline; the baseline is the honest "what the user pays if everything loads eagerly", NOT a synthetic full-corpus strawman (council Q4). | quant | `internal/bench/reports/token-baseline.json#eager_rule_load` | ✅ |
31
32
  | On a weak host (claude-haiku-4-5) the package produces a significant, placebo-controlled discipline lift on scope/downstream traps; on a strong host the same measurement is a published null — the package transplants discipline a weak model lacks, not model intelligence. | quant | `docs/benchmark.md#weak-host-specific` | ✅ |
32
33
  | The non-coding domain skills (finance/founder/ops/content) are forged on TS/PHP and labeled unvalidated until they pass a sourced domain-truth fixture; no public prose implies proven domain correctness, and the validated count is CI-ratcheted. | qual | `src/scripts/domain_soundness_status.ts#checkRatchet` | ✅ |
33
34
  | On the READ-ONLY FAN-OUT slice family, tier-downshifted subagent dispatch (lite/haiku vs session-tier-proxy sonnet) nets a ≥30% USD-weighted token-cost reduction at held quality — measured 2026-07-08 (n=10 paired live dispatches, 20 telemetry lines): 10/10 exact-match on BOTH arms, 29.4% fewer raw tokens, 76.5% USD-weighted cost reduction at the 3x haiku↔sonnet price ratio. FAMILY-SCOPED — the mechanical-edit family is unmeasured and its downshift (incl. the deferred tier downgrades of existing units) stays gated. Negative control held: an open-ended synthesis/unknown slice never resolves below the session tier (inferSliceTier → medium/inherit, never lite). | quant | `internal/bench/routing-downshift/results-2026-07-08.md#FAMILY-SCOPED PROVE` | ✅ |
34
35
  | The lift-carrying essential cut (kernel + downstream-changes) keeps a significant weak-host discipline lift at a fraction of the full load's tokens, and the lift is FAMILY- and HOST-SCOPED — measured on three hosts: claude-haiku-4-5 (weak) shows the family-scoped lift (trapE 0.533→1.000, 7/7 discordant, corpus cost 1.71x); claude-sonnet-4-6 (strong) is a ceiling null; gpt-5-mini (non-Claude weak, codex prompt-prepend surface) FAILED replication with headroom (corpus Δ=+0.024 p=0.70, capability trend n.s. — no harm claimed, injection-surface confound documented). Therefore discipline_profile: auto enables the lift only where measured (vendor-granular unknown_defaults). Non-claims — the balanced router profile was removed after a NULL measurement (p=0.81, n=24); no full-tier recommendation exists; no cross-vendor lift is claimed. | quant | `docs/benchmark.md#REPLICATION FAILED` | ✅ |
35
36
  | Behavioural-eval coverage is measured per tier and CI-ratcheted so it can only rise; the current coverage and its gap are published, never implied as "264 evaluated skills". | qual | `src/scripts/skill_eval_coverage.ts#checkRatchet` | ✅ |
37
+ | A hand-rolled, dependency-free BM25 + trigram lexical index resolves the "recalls but does not rank" gap: on the retrieval-precision corpus (9 keyword-overlapping-confuser tasks) it drives the mean top tie-set from 3.333 (the `_score` bucket scorer) to 1.0 — every needed decision uniquely top-ranked — with precision@1 and precision@5 unchanged at 1.0. Method: deterministic, model-free re-ranking of the SAME retrieved entry set; both scorers measured over the identical store via `measure_lexical_ranking.ts`. | quant | `internal/bench/reports/lexical-ranking.json` | ✅ |
36
38
  | The whole layer is compiled into host agents with zero runtime daemon. | qual | `docs/contracts/no-runtime-boundary.md#file-first, no-runtime suite` | ✅ |
37
- | 100 governed rules. | quant | `src/scripts/check_artefact_count_messaging.ts#Artefact-count messaging gate` | ✅ |
38
- | The second-brain substrate ships as continuity convenience; its cross-session task lift is unmeasured. A deterministic recall scorer + corpus exist (the rig), but no paired run has measured a lift, so no "second brain" capability claim is made until a backed lift entry exists. | qual | `docs/second-brain-scope.md#no measured task-lift` | ✅ |
39
+ | 102 governed rules. | quant | `src/scripts/check_artefact_count_messaging.ts#Artefact-count messaging gate` | ✅ |
40
+ | On a deterministic multi-session recall corpus, the memory substrate produces a measured, placebo-controlled recall lift — memory-on 27/27 vs no-memory 10/27 and vs equal-byte placebo 9/27 (claude-haiku-4-5, n=9 tasks x 3 seeds, sign test p=0.031 for BOTH pairings). Scoped honestly: this is the context-value upper bound (perfect retrieval on a one-fact-per-task corpus), not retrieval precision under a large store. | quant | `internal/bench/reports/second-brain-delta.json` | ✅ |
41
+ | Removing the perfect-retrieval assumption, the substrate's REAL keyword retrieval recalls the needed decision into the top-5 under keyword-overlapping confusers (precision@5 9/9) and the model disambiguates it from the co-injected confusers — retrieval-on 27/27 vs no-memory 5/27 and vs equal-count placebo 5/27 (claude-haiku-4-5, 9 tasks x 3 seeds, sign test p=0.008 both). Named limit: retrieval RECALLS but does not RANK (mean tie-set 3.3, ties broken by store order, not relevance) — the discrimination gap that motivates the SQLite-FTS5 activation path (ADR-116) at larger scale. | quant | `internal/bench/reports/second-brain-retrieval.json` | ✅ |
42
+ | Every artifact the package ships — source AND the condensed projection that reaches consumers — is machine-scanned in CI for hidden-Unicode, mixed-script-confusable, and instruction-smuggling payloads (the rules-file-backdoor class); a finding blocks the release before `npm publish`, not just the merge. | qual | `.github/workflows/publish-npm.yml#lint_agent_security` | ✅ |
39
43
  | 267 skills (README hero + feature list). | quant | `src/scripts/check_artefact_count_messaging.ts#Artefact-count messaging gate` | ✅ |
40
44
  | Removes only its own keys from a shared host config (matched by JSON-pointer + SHA-256), never a neighbour tool's entries. | qual | `docs/contracts/install-layout.md#JSON-pointer` | ✅ |
41
45
 
42
- **12 backed claim(s)** — all evidence pointers resolve in CI.
46
+ **16 backed claim(s)** — all evidence pointers resolve in CI.
43
47
 
44
48
  Artefact counts in public prose (skills, commands, governed rules,
45
49
  guidelines, personas) are **generated from source and CI-drift-checked**:
@@ -74,25 +78,36 @@ deliberately, not overnight.
74
78
  runway, RICE, incident command, messaging), but the skills are forged on
75
79
  TS/PHP — "promising, not proven" off those stacks. A disclaimer floor
76
80
  bounds *liability*, not *correctness*: a skill can be format-correct,
77
- disclaimered, and still embed a wrong domain assumption. Today **0 of 20**
81
+ disclaimered, and still embed a wrong domain assumption. Today **5 of 20**
78
82
  default-surface domain skills carry a sourced `domain-truth` fixture
79
- (`./scripts-run src/scripts/domain_soundness_status`); all are labeled
80
- `unvalidated` and the validated count is CI-ratcheted. Authoring the
81
- answer keys needs domain competence (a cited method, not the skill's own
82
- output), so validation lands deliberately — the gap is published, never
83
- implied away.
84
-
85
- **Second-brain substrate — continuity convenience, task-lift unmeasured.**
86
- The memory substrate is built (working-memory continuity across
87
- compaction, promotable knowledge cards, contradiction surfacing), but
88
- whether it beats a no-memory baseline on a reproducible task is **not yet
89
- measured**. The measurement rig exists — a deterministic multi-session
90
- recall corpus + scorer (`./scripts-run src/scripts/second_brain_score
91
- --dry-run`, no model-in-the-loop grading) — but the paired
92
- `memory-on`/`off`/`placebo` run is spend-bearing and pending. So no
93
- "second brain" capability claim is made anywhere; the substrate ships as
94
- continuity convenience until a paired run backs a lift. Boundary vs a
95
- human PKM is stated in [`docs/second-brain-scope.md`](second-brain-scope.md).
83
+ (`./scripts-run src/scripts/domain_soundness_status`); the rest are labeled
84
+ `unvalidated` and the validated count is CI-ratcheted. The fixtures landed
85
+ so far are the **deterministic** targets (runway, unit-economics, DCF,
86
+ forecasting, scenario band/sensitivity), whose answer keys are computed
87
+ from cited standard formulas — never the skill's own output; the
88
+ **rubric** targets (incident command, messaging, fundraising, editorial)
89
+ need domain-competent grounding and remain unvalidated, so validation
90
+ lands deliberately — the gap is published, never implied away.
91
+
92
+ **Second-brain substrate — measured recall lift, honestly bounded.** On a
93
+ deterministic multi-session recall corpus, the memory substrate beats a
94
+ no-memory baseline AND an equal-byte placebo: memory-on **27/27** vs
95
+ no-memory **10/27** vs placebo **9/27** (claude-haiku-4-5, 9 tasks × 3
96
+ seeds, sign test **p = 0.031** for both pairings) — a real,
97
+ placebo-controlled lift (`internal/bench/reports/second-brain-delta.json`).
98
+ Scoped, not oversold: this is the context-value upper bound (perfect
99
+ retrieval on a one-fact-per-task corpus), NOT retrieval precision under a
100
+ large store; the lift concentrates exactly where memory is the only source
101
+ and ties where the prompt self-contains the fact. Boundary vs a human PKM,
102
+ and why the Obsidian export stays declined, are in
103
+ [`docs/second-brain-scope.md`](second-brain-scope.md).
104
+
105
+ A follow-up removed the perfect-retrieval assumption: against a store of
106
+ keyword-overlapping confusers the REAL retrieval recalls the needed
107
+ decision into the top-5 (9/9) and the model disambiguates it — retrieval-on
108
+ **27/27** vs no-memory **5/27** and vs placebo **5/27** (p=0.008 both). The
109
+ honest limit: the keyword scorer recalls but does not rank (mean tie-set
110
+ 3.3), which is the SQLite-FTS5 activation signal (ADR-116) at scale.
96
111
 
97
112
  ## 3. Known limits (published, witness-tested)
98
113
 
@@ -9,35 +9,70 @@
9
9
  > Roadmap: `road-to-second-brain-delta-proof`. Verdict of record:
10
10
  > `agents/settings/contexts/second-brain-delta-verdict.md` (council 2026-07-07).
11
11
 
12
- ## The honest status (2026-07-08)
12
+ ## The honest status (2026-07-09 — measured PASS, bounded)
13
13
 
14
14
  The substrate is **built** (typed knowledge dirs, INDEX generator, retrieval
15
15
  protocol, `hot_context_hook` working-memory continuity across compaction,
16
- `fold_intake`, contradiction surfacing). What is **not yet measured** is the
17
- *delta*: whether agent-facing memory beats a no-memory baseline on a
18
- reproducible multi-session task.
16
+ `fold_intake`, contradiction surfacing), and the cross-session recall *delta*
17
+ is now **measured** — a real, placebo-controlled lift, honestly scoped.
19
18
 
20
- - **The measurement rig exists** — a deterministic multi-session recall corpus
19
+ - **The measurement rig** — a deterministic multi-session recall corpus
21
20
  (`internal/bench/second-brain/corpus/`) + a scorer
22
- (`src/scripts/second_brain_score.ts`) with no model-in-the-loop grading. It
23
- dry-runs correctly and discriminatingly on hand-written transcripts.
24
- - **The paired run does not** — the 3-arm `memory-on` / `memory-off` /
25
- `placebo` measurement (Phase 2) is spend-bearing and has not been run. So
26
- there is **no measured task-lift**, and therefore **no "second brain"
27
- capability claim** is made anywhere in public prose. This is the
28
- falsifiability lock: the marker never outruns the evidence.
21
+ (`src/scripts/second_brain_score.ts`) with no model-in-the-loop grading.
22
+ - **The paired run (Phase 2)** — `memory-on` / `memory-off` / `placebo` on a
23
+ fixed host (claude-haiku-4-5), 9 tasks × 3 seeds (81 calls). Result:
24
+ memory-on **27/27**, no-memory **10/27**, equal-byte placebo **9/27**;
25
+ memory-on beats BOTH, sign test **p = 0.031** for each pairing → **PASS**.
26
+ Full report: `internal/bench/reports/second-brain-delta.json`
27
+ (claim `second-brain-recall-lift`).
28
+ - **Where the lift lives** — it concentrates on the retrieval-accuracy tasks
29
+ where the prior fact is available ONLY from memory (memory-on 3/3, baseline
30
+ 0/3). It **ties** on the three tasks whose k+1 prompt already self-contains
31
+ the signal (a correction stated in-prompt, or a contradiction the prompt
32
+ names) — exactly where memory is not the only source. memory-on never loses.
29
33
 
30
- Until the paired run backs a lift, the substrate is documented as **continuity
31
- convenience** — it carries working memory across sessions and compaction — not
32
- a proven task-accuracy multiplier.
34
+ ### The scoping caveat (stated, not buried)
33
35
 
34
- ## What it IS (by design; task-lift unmeasured)
36
+ The Phase-2 delta is the **context-value upper bound**: the corpus is
37
+ one-fact-per-task, so memory-on injects the exact fact (perfect retrieval). It
38
+ shows that **the right prior fact, surfaced, lets the model answer — and that
39
+ this beats both no memory and equal-byte noise** (the placebo isolates mechanism
40
+ from mere extra context).
41
+
42
+ **The retrieval-precision follow-up removed the perfect-retrieval assumption**
43
+ (2026-07-09, claim `second-brain-retrieval-precision`,
44
+ `internal/bench/reports/second-brain-retrieval.json`). Against a populated store
45
+ whose distractors deliberately share query keywords with the needed decision,
46
+ the REAL `memory_lookup` retrieval recalls the needed decision into the top-5 in
47
+ **9/9** cases, and the model disambiguates it from the co-injected confusers —
48
+ **retrieval-on 27/27 vs no-memory 5/27 and vs equal-count placebo 5/27**
49
+ (sign test p=0.008 both). **Named limit (honest):** the keyword scorer
50
+ **recalls but does not rank** — mean tie-set 3.3 entries share the top score,
51
+ ties broken by store order, not relevance. So recall into the top-k holds *at
52
+ this scale*; once more than k entries share a keyword it would degrade — which
53
+ is exactly the discrimination gap the SQLite-FTS5 activation path (ADR-116)
54
+ exists to close. The public claims are scoped to exactly this.
55
+
56
+ **Second named limit (separator recall, found 2026-07-10 in a labelled replay
57
+ of real maintainer queries):** `_score()` matches raw substrings, so a query
58
+ key whose token separator differs from the stored field misses entirely —
59
+ `ai_council`, `roadmap-progress`, `force-push` score 0 against space-normalized
60
+ `key` fields that spaced variants (`ai council`) hit at 0.8. The precision
61
+ measurement above did not probe this class (its confusers share exact
62
+ keywords), so it is scoped OUT of the precision claim. Deliberately not
63
+ hot-fixed: naive scoring is locked until the scale tripwire (the archived
64
+ retrieval-economy roadmap's D5), and the FTS5 unicode61 tokenizer splits on
65
+ separators, closing this structurally at activation time. Reproduce:
66
+ `memory_lookup --types product-rules --key "ai_council"` vs `--key "ai council"`
67
+ against any populated store.
68
+
69
+ ## What it IS (measured lift, bounded as above)
35
70
 
36
71
  | Capability | What it does | Evidence status |
37
72
  |---|---|---|
38
- | Working-memory continuity | `hot_context_hook` re-injects a bounded, deterministic cache across session boundaries and Claude Code compaction | mechanism shipped; task-lift **unmeasured** |
39
- | Promotable knowledge cards/pages | typed dirs + INDEX + retrieval protocol, with redaction + team-share gate | mechanism shipped; task-lift **unmeasured** |
40
- | Contradiction surfacing | a session that contradicts a prior decision is flagged on promote | mechanism shipped; catch-rate **unmeasured** |
73
+ | Working-memory continuity | `hot_context_hook` re-injects a bounded, deterministic cache across session boundaries and Claude Code compaction | mechanism shipped; recall lift **measured (bounded PASS)** |
74
+ | Promotable knowledge cards/pages | typed dirs + INDEX + retrieval protocol, with redaction + team-share gate | mechanism shipped; recall lift **measured (bounded PASS)** |
75
+ | Contradiction surfacing | a session that contradicts a prior decision is flagged on promote | mechanism shipped; ties in-prompt, lift where memory is the only source |
41
76
 
42
77
  ## What it is NOT
43
78
 
@@ -52,15 +87,23 @@ a proven task-accuracy multiplier.
52
87
  link-density, hybrid human-facing retrieval — is a *different product* for a
53
88
  *different consumer* (a person, not an agent). This package writes
54
89
  agent-facing memory; it does not serve a human graph browser.
55
- - **Not a measured accuracy multiplier** — see the honest status above.
90
+ - **Not an unbounded accuracy multiplier** — the recall lift is measured but
91
+ scoped to the context-value upper bound (see honest status), not proven
92
+ retrieval precision under a large store.
56
93
 
57
- ## Interop, not competition (gated on a measured lift)
94
+ ## Interop, not competition (export declined, on the record)
58
95
 
59
- If — and only if — the Phase-2 paired run shows a real lift, the sanctioned
60
- next step is a **one-way export** (promoted cards → plain Obsidian-compatible
61
- Markdown + wikilinks), positioning agent-config as the *writer* and a human PKM
62
- as the *reader*: complementary, never a replacement. Absent a measured lift,
63
- the exporter is not built.
96
+ The Phase-2 paired run did show a real (bounded) lift, which unlocks the
97
+ optional one-way export (promoted cards → Obsidian-compatible Markdown). It is
98
+ **deliberately not built**: the delta-verdict of record
99
+ (`agents/settings/contexts/second-brain-delta-verdict.md`, council 2026-07-07)
100
+ **rejected** Obsidian compatibility — the dual-write hazard (an external edit
101
+ that never commits silently diverges the INDEX + recurrence counters) outweighs
102
+ the browsing convenience, and the measured lift is a bounded context-value
103
+ result, not a retrieval-precision proof that would justify a new external
104
+ surface. If a human-PKM bridge is ever wanted, the sanctioned path is a
105
+ read-only static render, not an editable vault. Positioning stays: agent-config
106
+ writes agent-facing memory; it does not replace a human PKM.
64
107
 
65
108
  ## Verify
66
109
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@event4u/agent-config",
3
- "version": "8.8.0",
3
+ "version": "8.9.0",
4
4
  "description": "Universal AI Agent OS — audited skills, governance rules, commands, and templates for AI coding tools (Claude Code, Cursor, Windsurf, Copilot).",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -67,8 +67,9 @@ const _require = createRequire(import.meta.url);
67
67
  // CHECKBOX_RE = re.compile(r"^\s*[-*]\s+\[([ xX~\-])\]\s", re.MULTILINE)
68
68
  const CHECKBOX_RE = /^[ \t\n\r\f\v]*[-*][ \t\n\r\f\v]+\[([ xX~\-])\][ \t\n\r\f\v]/gm;
69
69
  // PHASE_RE (MULTILINE) — H2/H3 "Phase <id>" with optional separator + name.
70
+ // Numeric ids accept dotted sub-phases ("1.0", "4.1", "2.3.1").
70
71
  const PHASE_RE =
71
- /^(#{2,3})[ \t\n\r\f\v]+Phase[ \t\n\r\f\v]+(\d+[a-z]?|[IVX]+|[A-Z](?:\d+)?)(?:[\s:—\-]+([\s\S]*?))?[ \t\f\v\r]*$/gm;
72
+ /^(#{2,3})[ \t\n\r\f\v]+Phase[ \t\n\r\f\v]+(\d+(?:\.\d+)*[a-z]?|[IVX]+|[A-Z](?:\d+)?)(?:[\s:—\-]+([\s\S]*?))?[ \t\f\v\r]*$/gm;
72
73
  // TITLE_RE = re.compile(r"^#\s+(?:Roadmap:\s*)?(.+?)\s*$", re.MULTILINE)
73
74
  const TITLE_RE = /^#[ \t\n\r\f\v]+(?:Roadmap:[ \t\n\r\f\v]*)?(.+?)[ \t\f\v\r]*$/m;
74
75
  const EXCLUDE_NAMES: ReadonlySet<string> = new Set([
@@ -167,6 +167,12 @@ Tier 2 — maintenance / internal (hooks, MCP, memory, telemetry):
167
167
  mcp:run Run the built-in MCP server over stdio
168
168
  (requires `mcp:setup` first; see docs/mcp-server.md)
169
169
  (experimental — beta gates: docs/contracts/mcp-beta-criteria.md)
170
+ affected Show artefacts related to <artefact> via the discovery
171
+ relation-graph (relation-filtered BFS). Flags: --depth N
172
+ graph-explain Seed on a <concept>, expand 2 hops over the discovery
173
+ relation-graph with a node budget. Flags: --budget N
174
+ benchmark Report context-token reduction vs the full always-loaded
175
+ projection (from the pinned token baseline). Flags: --format
170
176
  roadmap:progress Regenerate agents/roadmaps-progress.md from open roadmaps
171
177
  roadmap:progress-check Fail if agents/roadmaps-progress.md is stale (for CI)
172
178
  roadmap:archive Archive completed roadmaps (branch-touched by default;
@@ -431,6 +437,24 @@ cmd_mcp_render() {
431
437
  exec_ts "$script" "$@"
432
438
  }
433
439
 
440
+ cmd_affected() {
441
+ local script
442
+ script="$(resolve_script "src/scripts/discovery_graph.ts")"
443
+ exec_ts "$script" affected "$@"
444
+ }
445
+
446
+ cmd_graph_explain() {
447
+ local script
448
+ script="$(resolve_script "src/scripts/discovery_graph.ts")"
449
+ exec_ts "$script" explain "$@"
450
+ }
451
+
452
+ cmd_benchmark() {
453
+ local script
454
+ script="$(resolve_script "src/scripts/benchmark.ts")"
455
+ exec_ts "$script" "$@"
456
+ }
457
+
434
458
  cmd_mcp_check() {
435
459
  local script
436
460
  script="$(resolve_script "src/scripts/mcp_render.ts")"
@@ -1031,6 +1055,9 @@ main() {
1031
1055
  mcp:setup) cmd_mcp_setup "$@" ;;
1032
1056
  mcp:run) cmd_mcp_run "$@" ;;
1033
1057
  use) cmd_use "$@" ;;
1058
+ affected) cmd_affected "$@" ;;
1059
+ graph-explain) cmd_graph_explain "$@" ;;
1060
+ benchmark) cmd_benchmark "$@" ;;
1034
1061
  roadmap:progress) cmd_roadmap_progress "$@" ;;
1035
1062
  roadmap:progress-check) cmd_roadmap_progress_check "$@" ;;
1036
1063
  roadmap:archive) cmd_roadmap_archive "$@" ;;
@@ -0,0 +1,148 @@
1
+ // Claude Code built-in command / bundled-skill names — the reserved namespace.
2
+ //
3
+ // A user- or project-scope skill (or flat command) whose name equals a
4
+ // built-in Claude Code slash command SHADOWS the built-in: typing `/mcp`
5
+ // then opens the package's skill instead of Claude Code's MCP auth dialog
6
+ // (observed 2026-07-10). The suite's contract is to complement the host,
7
+ // never to overlay or degrade it — so no Claude-facing projection may claim
8
+ // one of these names.
9
+ //
10
+ // Enforced at three layers:
11
+ // 1. `condense.ts::generate_claude_commands` — project-scope `.claude/skills/`
12
+ // command entries skip reserved slugs.
13
+ // 2. `install.ts::_apply_claude_flat_command_wrappers` — user-scope
14
+ // `~/.claude/` deploys neither a skill wrapper nor a flat command file
15
+ // for a reserved slug (nested `/cluster:sub` commands are unaffected —
16
+ // built-ins carry no `:`).
17
+ // 3. `lint_agent_skill_names.ts` — a skill in `src/skills/` (or a domain
18
+ // pack) with a reserved name fails CI unless it opts out of slash
19
+ // registration with `user-invocable: false` (Claude may still load it
20
+ // automatically; the built-in keeps the `/name`).
21
+ //
22
+ // Source: https://code.claude.com/docs/en/commands (fetched 2026-07-10),
23
+ // plus a small legacy set still present in older Claude Code versions.
24
+ // Refresh trigger: a package artefact stops appearing in Claude Code, or a
25
+ // release-notes entry adds a new built-in command.
26
+
27
+ const _CURRENT = [
28
+ 'add-dir',
29
+ 'advisor',
30
+ 'agents',
31
+ 'autofix-pr',
32
+ 'background',
33
+ 'batch',
34
+ 'branch',
35
+ 'btw',
36
+ 'cd',
37
+ 'chrome',
38
+ 'claude-api',
39
+ 'clear',
40
+ 'code-review',
41
+ 'color',
42
+ 'compact',
43
+ 'config',
44
+ 'context',
45
+ 'copy',
46
+ 'cost',
47
+ 'dataviz',
48
+ 'debug',
49
+ 'deep-research',
50
+ 'design-login',
51
+ 'design-sync',
52
+ 'desktop',
53
+ 'diff',
54
+ 'doctor',
55
+ 'effort',
56
+ 'exit',
57
+ 'export',
58
+ 'fast',
59
+ 'feedback',
60
+ 'fewer-permission-prompts',
61
+ 'focus',
62
+ 'fork',
63
+ 'goal',
64
+ 'heapdump',
65
+ 'help',
66
+ 'hooks',
67
+ 'ide',
68
+ 'init',
69
+ 'insights',
70
+ 'install-github-app',
71
+ 'install-slack-app',
72
+ 'keybindings',
73
+ 'login',
74
+ 'logout',
75
+ 'loop',
76
+ 'mcp',
77
+ 'memory',
78
+ 'mobile',
79
+ 'model',
80
+ 'passes',
81
+ 'permissions',
82
+ 'plan',
83
+ 'plugin',
84
+ 'powerup',
85
+ 'pr-comments',
86
+ 'privacy-settings',
87
+ 'radio',
88
+ 'recap',
89
+ 'release-notes',
90
+ 'reload-plugins',
91
+ 'reload-skills',
92
+ 'remote-control',
93
+ 'remote-env',
94
+ 'rename',
95
+ 'resume',
96
+ 'review',
97
+ 'rewind',
98
+ 'run',
99
+ 'run-skill-generator',
100
+ 'sandbox',
101
+ 'schedule',
102
+ 'scroll-speed',
103
+ 'security-review',
104
+ 'setup-bedrock',
105
+ 'setup-vertex',
106
+ 'simplify',
107
+ 'skills',
108
+ 'stats',
109
+ 'status',
110
+ 'statusline',
111
+ 'stickers',
112
+ 'teleport',
113
+ 'thinking',
114
+ 'trust',
115
+ 'upgrade',
116
+ 'usage',
117
+ 'verify',
118
+ 'vim',
119
+ 'web',
120
+ 'whats-new',
121
+ 'workflow',
122
+ 'workflows',
123
+ 'worktree',
124
+ ] as const;
125
+
126
+ // Retired from the current docs but still registered by older Claude Code
127
+ // versions users may run — reserving them costs nothing (no package artefact
128
+ // uses these names) and avoids version-dependent shadowing.
129
+ const _LEGACY = [
130
+ 'bashes',
131
+ 'bug',
132
+ 'migrate-installer',
133
+ 'output-style',
134
+ 'terminal-setup',
135
+ 'theme',
136
+ 'todos',
137
+ ] as const;
138
+
139
+ /** Lowercase names a Claude-facing `/name` projection must never claim. */
140
+ export const CLAUDE_CODE_BUILTIN_NAMES: ReadonlySet<string> = new Set<string>([
141
+ ..._CURRENT,
142
+ ..._LEGACY,
143
+ ]);
144
+
145
+ /** True when `slug` would shadow a Claude Code built-in command or bundled skill. */
146
+ export function is_claude_builtin_name(slug: string): boolean {
147
+ return CLAUDE_CODE_BUILTIN_NAMES.has(slug.toLowerCase());
148
+ }
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Deterministic document slicer for oversized knowledge ingest
3
+ * (road-to-retrieval-substrate-hardening B8).
4
+ *
5
+ * Splits a large markdown document into bounded slices at the cleanest
6
+ * available boundary — heading > paragraph (blank line) > line — while
7
+ * guaranteeing three invariants a downstream re-assembler can rely on:
8
+ *
9
+ * 1. GAP-FREE + NON-OVERLAPPING — slices cover contiguous line ranges over
10
+ * the whole document, in order.
11
+ * 2. CONCAT == ORIGINAL — joining every slice's `text` in order reproduces
12
+ * the input byte-for-byte (slices are exact offset ranges).
13
+ * 3. PARENTED — every slice carries its source `parentPath` (when given) and
14
+ * its `[startLine, endLine)` range, so a chunk can point home.
15
+ *
16
+ * Deterministic: identical input + budget → identical slices.
17
+ */
18
+
19
+ export interface Slice {
20
+ parentPath: string | null;
21
+ index: number;
22
+ startLine: number; // 0-based, inclusive
23
+ endLine: number; // 0-based, exclusive
24
+ text: string;
25
+ }
26
+
27
+ /** Default per-slice character budget. */
28
+ export const DEFAULT_MAX_CHARS = 2000;
29
+
30
+ function _lineStartOffsets(text: string): number[] {
31
+ const starts = [0];
32
+ for (let i = 0; i < text.length; i++) {
33
+ if (text[i] === '\n') starts.push(i + 1);
34
+ }
35
+ return starts; // one entry per line; starts[k] = offset where line k begins
36
+ }
37
+
38
+ function _isHeading(line: string): boolean {
39
+ return /^#{1,6}\s/.test(line);
40
+ }
41
+ function _isBlank(line: string): boolean {
42
+ return line.trim() === '';
43
+ }
44
+
45
+ /**
46
+ * Slice `text` into ≤ `maxChars` pieces (best-effort — a single over-long line
47
+ * is emitted whole rather than split mid-line, preserving invariant 2).
48
+ * `parentPath` is stamped on every slice.
49
+ */
50
+ export function sliceDocument(
51
+ text: string,
52
+ opts: { maxChars?: number; parentPath?: string } = {},
53
+ ): Slice[] {
54
+ const maxChars = opts.maxChars ?? DEFAULT_MAX_CHARS;
55
+ const parentPath = opts.parentPath ?? null;
56
+ if (text === '') return [];
57
+
58
+ const starts = _lineStartOffsets(text);
59
+ const nLines = starts.length;
60
+ // lineAt(k) = the raw text of line k INCLUDING its trailing newline (if any).
61
+ const lineEnd = (k: number): number => (k + 1 < nLines ? starts[k + 1]! : text.length);
62
+ const lines: string[] = [];
63
+ for (let k = 0; k < nLines; k++) lines.push(text.slice(starts[k]!, lineEnd(k)));
64
+
65
+ const slices: Slice[] = [];
66
+ let sliceStartLine = 0;
67
+ let idx = 0;
68
+ const flush = (endLine: number): void => {
69
+ if (endLine <= sliceStartLine) return;
70
+ const from = starts[sliceStartLine]!;
71
+ const to = endLine < nLines ? starts[endLine]! : text.length;
72
+ slices.push({ parentPath, index: idx++, startLine: sliceStartLine, endLine, text: text.slice(from, to) });
73
+ sliceStartLine = endLine;
74
+ };
75
+
76
+ let curChars = 0;
77
+ for (let k = 0; k < nLines; k++) {
78
+ const lineLen = lines[k]!.length;
79
+ const wouldExceed = curChars + lineLen > maxChars && k > sliceStartLine;
80
+ // Cut BEFORE a heading that opens a new section (clean boundary), or
81
+ // when the budget would overflow — preferring a preceding blank line.
82
+ const headingBoundary = _isHeading(lines[k]!) && k > sliceStartLine;
83
+ if (headingBoundary || wouldExceed) {
84
+ // Prefer to end the previous slice at the last blank line in-range,
85
+ // so a slice ends on a paragraph boundary when one is available.
86
+ let cut = k;
87
+ if (wouldExceed && !headingBoundary) {
88
+ for (let b = k - 1; b > sliceStartLine; b--) {
89
+ if (_isBlank(lines[b]!)) {
90
+ cut = b + 1;
91
+ break;
92
+ }
93
+ }
94
+ }
95
+ flush(cut);
96
+ curChars = 0;
97
+ for (let j = sliceStartLine; j <= k; j++) curChars += lines[j]!.length;
98
+ } else {
99
+ curChars += lineLen;
100
+ }
101
+ }
102
+ flush(nLines);
103
+ return slices;
104
+ }
105
+
106
+ /** True iff the slices reproduce `text` exactly, gap-free and non-overlapping. */
107
+ export function verifySlices(text: string, slices: readonly Slice[]): boolean {
108
+ if (slices.length === 0) return text === '';
109
+ let expectedLine = 0;
110
+ const parts: string[] = [];
111
+ for (const s of slices) {
112
+ if (s.startLine !== expectedLine) return false; // gap or overlap
113
+ expectedLine = s.endLine;
114
+ parts.push(s.text);
115
+ }
116
+ return parts.join('') === text;
117
+ }