@mmerterden/multi-agent-pipeline 20.40.0 → 20.41.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 (76) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +4 -1
  3. package/README.tr.md +4 -1
  4. package/docs/adr/0019-product-tree.md +143 -0
  5. package/docs/adr/README.md +1 -0
  6. package/docs/ecosystem.md +9 -9
  7. package/docs/facts.json +4 -4
  8. package/docs/features.md +6 -0
  9. package/install/claude.mjs +12 -3
  10. package/install/templates/claude-hooks.json +12 -1
  11. package/manifest.json +79 -60
  12. package/package.json +2 -2
  13. package/pipeline/commands/multi-agent/review-analysis/SKILL.md +1 -1
  14. package/pipeline/contract/types/index.d.ts +53 -49
  15. package/pipeline/lib/context-budget.mjs +5 -42
  16. package/pipeline/lib/hook-registration.mjs +5 -0
  17. package/pipeline/lib/md2confluence-v3.py +12 -4
  18. package/pipeline/lib/tiered-budget.mjs +87 -0
  19. package/pipeline/multi-agent-refs/analysis/review.md +23 -1
  20. package/pipeline/multi-agent-refs/features/code-graph.md +11 -1
  21. package/pipeline/multi-agent-refs/features/doctor.md +32 -1
  22. package/pipeline/multi-agent-refs/features/product-tree.md +68 -0
  23. package/pipeline/multi-agent-refs/features/unattended-security.md +88 -1
  24. package/pipeline/multi-agent-refs/features/usage-reporting.md +31 -0
  25. package/pipeline/multi-agent-refs/help/en.md +1 -0
  26. package/pipeline/multi-agent-refs/help/tr.md +1 -0
  27. package/pipeline/multi-agent-refs/knowledge.md +58 -0
  28. package/pipeline/multi-agent-refs/phases/phase-0-init.md +4 -0
  29. package/pipeline/multi-agent-refs/phases/phase-1-plan.md +4 -0
  30. package/pipeline/multi-agent-refs/phases/phase-5-report.md +2 -0
  31. package/pipeline/office/index.html +13 -7
  32. package/pipeline/office/toolkit.json +1 -1
  33. package/pipeline/preferences-template.json +1 -0
  34. package/pipeline/schemas/learnings-ledger.schema.json +35 -2
  35. package/pipeline/schemas/office-archive.schema.json +225 -128
  36. package/pipeline/schemas/prefs.schema.json +83 -0
  37. package/pipeline/schemas/product-tree-overlay.schema.json +57 -0
  38. package/pipeline/schemas/product-tree.schema.json +136 -0
  39. package/pipeline/schemas/toolkit-path-params.json +1 -1
  40. package/pipeline/scripts/_eval-stats.mjs +182 -0
  41. package/pipeline/scripts/_guard_rules.py +130 -1
  42. package/pipeline/scripts/_learnings-promotion.mjs +229 -0
  43. package/pipeline/scripts/_locate.mjs +539 -0
  44. package/pipeline/scripts/_memory-policy.mjs +213 -14
  45. package/pipeline/scripts/_product-tree-extract.mjs +761 -0
  46. package/pipeline/scripts/_product-tree.mjs +923 -0
  47. package/pipeline/scripts/_retrieval.mjs +13 -2
  48. package/pipeline/scripts/_stack-routing.mjs +1 -0
  49. package/pipeline/scripts/_user_guard_rules.py +744 -0
  50. package/pipeline/scripts/agent-guard.py +61 -5
  51. package/pipeline/scripts/agent-guard.sh +8 -1
  52. package/pipeline/scripts/doctor.mjs +157 -1
  53. package/pipeline/scripts/graph-query.mjs +257 -17
  54. package/pipeline/scripts/learnings-ledger.mjs +664 -43
  55. package/pipeline/scripts/note-mcp-failure.mjs +356 -0
  56. package/pipeline/scripts/note-mcp-failure.sh +19 -0
  57. package/pipeline/scripts/note-skill-use.mjs +93 -23
  58. package/pipeline/scripts/office-archive.mjs +23 -10
  59. package/pipeline/scripts/office-memory.mjs +4 -1
  60. package/pipeline/scripts/persona-walk-anchors.mjs +443 -0
  61. package/pipeline/scripts/product-tree-eval.mjs +685 -0
  62. package/pipeline/scripts/product-tree.mjs +544 -0
  63. package/pipeline/skills/.skill-manifest.json +11 -7
  64. package/pipeline/skills/.skills-index.json +12 -1
  65. package/pipeline/skills/shared/README.md +4 -3
  66. package/pipeline/skills/shared/core/google-play-compliance/references/examples.md +1 -1
  67. package/pipeline/skills/shared/core/multi-agent-review-analysis/SKILL.md +1 -1
  68. package/pipeline/skills/shared/external/backlog/SKILL.md +1 -1
  69. package/pipeline/skills/shared/external/localization-reuse-map/SKILL.md +1 -1
  70. package/pipeline/skills/shared/external/spec-persona-walk/SKILL.md +118 -0
  71. package/pipeline/skills/shared/external/spec-persona-walk/evals/evals.json +50 -0
  72. package/pipeline/skills/shared/external/spec-persona-walk/scripts/persona-walk-anchors.mjs +443 -0
  73. package/pipeline/skills/shared/external/storekit/SKILL.md +1 -1
  74. package/pipeline/skills/shared/external/swiftdata/SKILL.md +1 -1
  75. package/pipeline/skills/skill-copies.json +5 -1
  76. package/pipeline/skills/skills-index.md +2 -1
@@ -11,6 +11,7 @@
11
11
  - [7. The half-configured case](#7-the-half-configured-case)
12
12
  - [8. Where it is NOT called](#8-where-it-is-not-called)
13
13
  - [9. Local skill usage is not reporting](#9-local-skill-usage-is-not-reporting)
14
+ - [10. Local MCP failures are not reporting](#10-local-mcp-failures-are-not-reporting)
14
15
  <!-- /toc -->
15
16
 
16
17
  Reporting needs three things: `usageLog.enabled` true, a token that resolves,
@@ -373,3 +374,33 @@ local-only, never offered to a phone).
373
374
 
374
375
  Codex CLI has no Skill tool call to hook, it reads skill files directly, and the
375
376
  pipeline installs no Copilot CLI hooks, so on those hosts nothing is counted.
377
+
378
+ ## 10. Local MCP failures are not reporting
379
+
380
+ A third record stays on this machine too: `note-mcp-failure.sh`, a Claude Code
381
+ PostToolUseFailure hook on `mcp__.*` that `install` registers, appends one row
382
+ per failed MCP tool call to `~/.claude/logs/multi-agent/mcp-failures.jsonl`.
383
+
384
+ | Field | Value |
385
+ | --- | --- |
386
+ | `server` | the server part of `mcp__<server>__<tool>`, kept only when it matches `[A-Za-z0-9][A-Za-z0-9._-]`, at most 96 characters, with no credential pattern; otherwise the call is dropped |
387
+ | `tool` | the tool part, under the same rule |
388
+ | `ts` | when the hook ran |
389
+ | `errorClass` | one of `denied`, `timeout`, `rate-limit`, `auth`, `connection`, `invalid-input`, `not-found`, `server-error`, `interrupted`, `other`, chosen from the error text: a JSON-RPC error code first (`-32603` and the implementation range `-32000..-32099` are the server's, with the MCP SDK's `-32000` read as connection and `-32001` as timeout; `-32602`, `-32600` and `-32700` are the caller's input; `-32601` and `-32002` are not found), then a message that opens with `invalid` or `validation` (the caller's input), then an HTTP status written as a status rather than a number in a path, a bare three-digit number counting only after `HTTP`, `status` or a request line, or before a reason phrase (5xx server, 401 and 403 auth, 404 not found, 429 rate limit), then fixed wording patterns that try the server-side classes before `invalid-input`; `denied` is kept for a refusal by the user or the permission layer |
390
+ | `v` | the row format version, a constant (`1.0.0`) |
391
+
392
+ The arguments, the output and the error text are never written; the text is
393
+ only read to choose the class. No server is probed. The log is written by the
394
+ same code as the skill-usage log, so it has the same 1 MiB cap and `.1`
395
+ generation, and rotates under its own `mcp-failures.jsonl.lock`: the two logs
396
+ never wait on each other. Both are opened without following a symlink and
397
+ without blocking, and a row is dropped when the path is not a regular file.
398
+ `mcpFailures.enabled: false` stops it and so does `usageLog.optOut: true`; it
399
+ also stays off while the preferences file exists but does not parse, since an
400
+ opt-out in it cannot be read.
401
+
402
+ `node ~/.claude/scripts/note-mcp-failure.mjs summary [--hours N] [--json]`
403
+ counts failed calls per server, per tool and per class in the window (default
404
+ 24 hours). `doctor`'s `mcp-failures` check lights INFO for a server with five or
405
+ more failures there; `invalid-input`, `denied` and `interrupted` are the
406
+ caller's or the user's and never count toward it.
@@ -249,6 +249,7 @@ Key Features:
249
249
  Issue Safety Never auto-closes issues (4 approvals, GitHub + Jira)
250
250
  Store Compliance /multi-agent:test "store-ready" - 18-rule iOS audit (ITMS, Privacy Manifest, signing, debug leaks, IPv6, SDK) + 21-rule Android audit
251
251
  Bilingual EN + TR - outputLanguage toggles assistant explanations; promptLanguage is locked en
252
+ Global Learnings On request only: learnings-ledger.mjs promote --candidates lists learnings recurring in 2+ repos; --accept <P:id> promotes one, approved by you (never in autopilot); --retract <G:id> --reason "..." takes one back everywhere; feedback --id G:<id> --outcome dead_end hides one in this repo
252
253
 
253
254
  Quality & Telemetry (advisory, on by default - flip prefs.global.* to disable):
254
255
 
@@ -248,6 +248,7 @@ Temel Özellikler:
248
248
  Issue Safety Issue'lar asla auto-close edilmez (GitHub + Jira için 4 onay gerekir)
249
249
  Store Compliance /multi-agent:test "store-ready" - iOS 18 kurallık audit (ITMS / Privacy Manifest / signing / debug leak / IPv6 / SDK) + Android 21 kurallık audit
250
250
  Bilingual EN + TR - outputLanguage assistant açıklamasını değiştirir; promptLanguage en kilitli
251
+ Global Learnings Yalnızca istenince: learnings-ledger.mjs promote --candidates 2+ repoda tekrar eden öğrenilenleri listeler; --accept <P:id> senin onayınla birini genel öğrenilenlere ekler (autopilot'ta asla); --retract <G:id> --reason "..." birini her yerden geri alır; feedback --id G:<id> --outcome dead_end birini yalnızca bu repoda gizler
251
252
 
252
253
  Quality & Telemetry (advisory, default açık - prefs.global.* ile kapatılabilir):
253
254
 
@@ -61,6 +61,7 @@ mechanically has its own store and its own Phase 1 injection:
61
61
  | `memory/multi-agent/<repo>/learnings-ledger.jsonl` | `learnings-ledger.mjs from-triage`, by `capture-flush.sh` at every phase boundary | `learnings-ledger.mjs profile` and `brief` (Step 1) |
62
62
  | `memory/multi-agent/<repo>/triage-corpus.jsonl` | `triage-memory.mjs ingest`, by `capture-flush.sh` at every phase boundary | `triage-memory.mjs query` (prior findings) |
63
63
  | `knowledge/<repo>/code-graph.json`, `GRAPH_REPORT.md` | `graph-build.mjs`, `graph-report.mjs`, in Phase 1 and after Phase 5 | `graph-query.mjs` / `graph-affected.mjs`, when `codeGraph.enabled` |
64
+ | `knowledge/<repo>/product-tree.json`, `product-tree-overlay.jsonl` | `product-tree.mjs build`, Phase 0 Step 7.65; overlay rows by `propose` (model) and `agree` (a person) | `.pipeline/product-tree.txt` (Step 2.7), when `productTree.enabled` |
64
65
  | `knowledge/<repo>/product-context.jsonl` | `product-context.mjs record`, Phase 1 Step 1.6 | `product-context.mjs recall` (Step 1.6) |
65
66
  | repo profile | `repo-profile.mjs ensure`, Phase 1 Step 1 | `state.repoProfile` |
66
67
 
@@ -84,9 +85,66 @@ Knowledge files grow over time. Maintenance rules:
84
85
  - A ledger entry earns or loses weight from the outcomes recorded against it: Phase 5 runs `learnings-ledger.mjs feedback --id <L:id> --outcome useful|dead_end|corrected` for each injected entry the run relied on or found wrong. Corrected, or a dead end at least twice and more often than useful, drops it from `brief` and `profile`; useful at least twice adds a strength that fades with age (`_memory-policy.mjs`). A new entry that repeats an existing one in other words (TF-IDF cosine 0.9 or more, same numbers, same negations) is not added
85
86
  - An entry recorded with `learnings-ledger.mjs add --supersedes <L:id>` retires the older entries it names without rewriting the file: `brief` and `profile` leave them out, `timeline` and `show` give their `superseded_by`
86
87
  - `prefs.global.memory.excludeProjects` lists repo slugs whose ledger, triage corpus and debt list are never written
88
+ - A learning that recurs across repositories can become one global learning, on request only (see "Global learnings" below)
87
89
  - `prune-logs` does not touch knowledge - only deletes logs and state
88
90
  - `purge` does not touch knowledge either. Today the only removal path is `/multi-agent:uninstall --all-data`, which drops every project's knowledge at once; there is no per-project clear yet
89
91
 
92
+ ### Global learnings
93
+
94
+ Each repository's ledger stays its own. When the same learning shows up in two
95
+ or more of them, it can be promoted to one global entry that every other
96
+ repository then sees. Nothing does this automatically: the listing runs only
97
+ when someone asks for it, and each promotion is one person's approval of one
98
+ candidate.
99
+
100
+ ```bash
101
+ node "$HOME/.claude/scripts/learnings-ledger.mjs" promote --candidates [--json]
102
+ node "$HOME/.claude/scripts/learnings-ledger.mjs" promote --accept P:<id>
103
+ node "$HOME/.claude/scripts/learnings-ledger.mjs" promote --retract G:<id> --reason "<why>"
104
+ node "$HOME/.claude/scripts/learnings-ledger.mjs" feedback --id G:<id> --outcome dead_end|corrected
105
+ ```
106
+
107
+ - **What counts as recurring**: entries of the same kind in two or more
108
+ repositories whose statements score at or above 0.5 pairwise, as the Jaccard
109
+ overlap of adjacent word pairs (`shingleSimilarity` in `_memory-policy.mjs`).
110
+ Two statements with different numbers or negations score 0, and so does one
111
+ under three words. A candidate takes at most one entry per repository, and
112
+ every pair inside it clears the threshold.
113
+ - **What may stand as evidence**: high-confidence entries only. A superseded
114
+ entry, an entry with any `dead_end` or `corrected` outcome, and every
115
+ repository in `prefs.global.memory.excludeProjects` are left out.
116
+ - **What the listing shows**: per candidate a `P:` id, its repositories, each
117
+ entry's `L:` id and score, and the lowest pairwise score. The `P:` id comes
118
+ from the members, so when a repository joins or leaves, the id changes and
119
+ the earlier approval no longer applies. A candidate an existing global entry
120
+ already covers is counted under `alreadyGlobal`, not listed again.
121
+ - **What `--accept` writes**: one row, appended to
122
+ `memory/multi-agent/_global/learnings-ledger.jsonl`, with `source: promotion`
123
+ and `promoted_from` (the candidate, its score and the source `repo` + `L:` id
124
+ pairs). Nothing rewrites that file; no repository subcommand can reach it.
125
+ - **A person confirms every write.** `--accept`, `--retract` and `feedback` on
126
+ a `G:` id show what they would write and ask y/N at a terminal; anything but
127
+ y writes nothing and exits 2. They exit 3 when `MULTI_AGENT_UNATTENDED=1`,
128
+ when `--state` names an `agent-state.json` with `autopilot: true`, or when
129
+ stdin is not a terminal. In an attended run, ask the person about each
130
+ candidate separately; one yes covers one `P:` id.
131
+ - **The guard asks first.** The y/N prompt shows a person what is about to be
132
+ written; it does not prove a person answered, because an agent can allocate
133
+ a pseudo-terminal and type y. agent-guard asks the user before an agent runs
134
+ any of the three, and refuses them in an unattended run.
135
+ - **Taking one back.** `--retract` appends a retraction row naming the `G:` id
136
+ and the reason: `brief` and `profile` drop the learning in every repository,
137
+ and its candidate is not proposed again. `feedback --id G:<id>` hides it in
138
+ one repository only.
139
+ - **Where global entries appear**: `brief` and `profile` add them marked
140
+ `(global)` with a `G:` pointer (`show --id G:<id>` prints the row). They are
141
+ left out in an excluded repository, in each source repository (its own entry,
142
+ or the entry that replaced it, already says what holds there) and in one
143
+ whose current entries already say the same thing, and in one that marked it
144
+ `dead_end` or `corrected`. Global entries hold at most a third of a brief or
145
+ profile. The office's memory
146
+ archive shows them on a shelf of their own.
147
+
90
148
  ---
91
149
 
92
150
  ## Retrieval order, and what each layer costs
@@ -616,6 +616,10 @@ Persist `state.baseline.tests` with `command`, `capturedAt`, `logPath` and exact
616
616
 
617
617
  Log: `Phase 0 Step 7.6: test baseline = {green|red|unknown} ({N} pre-existing failures)`
618
618
 
619
+ #### Step 7.65 - Product tree locate (`prefs.global.productTree.enabled`, default `false`)
620
+
621
+ Locate the task text in the product tree into `.pipeline/product-tree.txt` for Phase 1: `$HOME/.claude/multi-agent-refs/features/product-tree.md`.
622
+
619
623
  #### Step 7.7 - Evidence capability, then test depth
620
624
 
621
625
  Decide, then probe, then ask, then run. Skipped only when `visualEvidence.enabled` is `false`. Contract: `features/visual-evidence.md` sections 1a, 1b, 4.
@@ -174,6 +174,10 @@ Gated by `prefs.global.codeGraph.enabled` (default: `true`). With a rule file fo
174
174
 
175
175
  **A valid result REPLACES the opening sweep** rather than sitting beside it: Explore starts from those files and walks outward, with no broad `Glob`/`Grep` pass first - running both pays twice, and the second re-derives what the graph said. No graph (missing rule, stale, or disabled) leaves the previous behaviour untouched; a task naming a symbol or path is still grepped directly.
176
176
 
177
+ #### Step 2.7 - Product tree (`productTree.enabled`, default off)
178
+
179
+ Inject `.pipeline/product-tree.txt` into each Explore prompt as `${PRODUCT_TREE}`: `$HOME/.claude/multi-agent-refs/features/product-tree.md`.
180
+
177
181
  #### Step 3 - Codebase Exploration
178
182
 
179
183
  Launch parallel Explore agents to scan codebase:
@@ -270,6 +270,8 @@ A durable architectural fact or decision is a judgement call, so it stays here r
270
270
  # node $HOME/.claude/scripts/learnings-ledger.mjs feedback --id "<L:id>" --outcome useful --task "$TASK_ID"
271
271
  ```
272
272
 
273
+ Phase 5 never promotes a learning to the global ledger; that is `promote`, on request, one approval per candidate (`knowledge.md`).
274
+
273
275
  Print the closing report to the terminal. Two blocks, in this order - what the pipeline spent, then what it changed:
274
276
 
275
277
  ```bash