@mmerterden/multi-agent-pipeline 20.40.0 → 20.42.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 (143) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/README.md +5 -2
  3. package/README.tr.md +5 -2
  4. package/docs/adr/0019-product-tree.md +143 -0
  5. package/docs/adr/README.md +1 -0
  6. package/docs/ecosystem.md +51 -14
  7. package/docs/facts.json +7 -7
  8. package/docs/features.md +15 -4
  9. package/install/claude.mjs +45 -3
  10. package/install/templates/claude-hooks.json +23 -1
  11. package/manifest.json +146 -107
  12. package/package.json +3 -2
  13. package/pipeline/commands/multi-agent/autopilot/SKILL.md +11 -0
  14. package/pipeline/commands/multi-agent/review-analysis/SKILL.md +1 -1
  15. package/pipeline/commands/multi-agent/setup/SKILL.md +1 -1
  16. package/pipeline/contract/types/index.d.ts +53 -49
  17. package/pipeline/lib/args.mjs +131 -4
  18. package/pipeline/lib/bg-launch.mjs +5 -2
  19. package/pipeline/lib/context-budget.mjs +5 -42
  20. package/pipeline/lib/credential-store.sh +11 -1
  21. package/pipeline/lib/hook-once.mjs +134 -0
  22. package/pipeline/lib/hook-registration.mjs +5 -0
  23. package/pipeline/lib/isotonic.mjs +73 -0
  24. package/pipeline/lib/low-disk.mjs +153 -0
  25. package/pipeline/lib/mcp-schema-load.mjs +90 -0
  26. package/pipeline/lib/md2confluence-v3.py +19 -10
  27. package/pipeline/lib/model-dispatch.sh +26 -2
  28. package/pipeline/lib/normalize-text.mjs +135 -0
  29. package/pipeline/lib/outbound-gate.mjs +21 -3
  30. package/pipeline/lib/plan-todos.sh +17 -4
  31. package/pipeline/lib/redact.mjs +12 -3
  32. package/pipeline/lib/risky-settings.mjs +198 -0
  33. package/pipeline/lib/route-state.sh +1 -0
  34. package/pipeline/lib/secret-patterns.generated.mjs +6 -2
  35. package/pipeline/lib/session-usage.mjs +232 -0
  36. package/pipeline/lib/source-digest.mjs +211 -0
  37. package/pipeline/lib/tdd-evidence.mjs +250 -17
  38. package/pipeline/lib/tiered-budget.mjs +87 -0
  39. package/pipeline/lib/untrusted-fence.mjs +132 -1
  40. package/pipeline/multi-agent-refs/analysis/locked.md +1 -1
  41. package/pipeline/multi-agent-refs/analysis/review.md +23 -1
  42. package/pipeline/multi-agent-refs/features/code-graph.md +11 -1
  43. package/pipeline/multi-agent-refs/features/cost-analysis.md +37 -2
  44. package/pipeline/multi-agent-refs/features/doctor.md +82 -4
  45. package/pipeline/multi-agent-refs/features/model-fallback.md +25 -0
  46. package/pipeline/multi-agent-refs/features/plan-todos.md +4 -0
  47. package/pipeline/multi-agent-refs/features/product-tree.md +68 -0
  48. package/pipeline/multi-agent-refs/features/unattended-gates.md +5 -3
  49. package/pipeline/multi-agent-refs/features/unattended-security.md +88 -1
  50. package/pipeline/multi-agent-refs/features/usage-reporting.md +33 -0
  51. package/pipeline/multi-agent-refs/help/en.md +2 -1
  52. package/pipeline/multi-agent-refs/help/tr.md +2 -1
  53. package/pipeline/multi-agent-refs/knowledge.md +58 -0
  54. package/pipeline/multi-agent-refs/outside-the-pipeline.md +6 -0
  55. package/pipeline/multi-agent-refs/phases/phase-0-init.md +4 -0
  56. package/pipeline/multi-agent-refs/phases/phase-1-plan.md +5 -1
  57. package/pipeline/multi-agent-refs/phases/phase-2-dev.md +4 -4
  58. package/pipeline/multi-agent-refs/phases/phase-3-review.md +2 -2
  59. package/pipeline/multi-agent-refs/phases/phase-5-report.md +4 -0
  60. package/pipeline/multi-agent-refs/progress-contract.md +3 -1
  61. package/pipeline/office/index.html +13 -7
  62. package/pipeline/office/toolkit.json +1 -1
  63. package/pipeline/preferences-template.json +1 -0
  64. package/pipeline/rules/outside-the-pipeline.md +1 -1
  65. package/pipeline/schemas/doctor-report.schema.json +47 -0
  66. package/pipeline/schemas/learnings-ledger.schema.json +35 -2
  67. package/pipeline/schemas/office-archive.schema.json +225 -128
  68. package/pipeline/schemas/plan-todos.schema.json +29 -1
  69. package/pipeline/schemas/prefs.schema.json +146 -0
  70. package/pipeline/schemas/product-tree-overlay.schema.json +57 -0
  71. package/pipeline/schemas/product-tree.schema.json +136 -0
  72. package/pipeline/schemas/route-config.schema.json +51 -0
  73. package/pipeline/schemas/secret-patterns.json +17 -1
  74. package/pipeline/schemas/toolkit-path-params.json +15 -1
  75. package/pipeline/scripts/_cost-advise.mjs +357 -0
  76. package/pipeline/scripts/_cost-budget.mjs +78 -0
  77. package/pipeline/scripts/_cost.mjs +29 -0
  78. package/pipeline/scripts/_decode_text.py +107 -0
  79. package/pipeline/scripts/_eval-stats.mjs +182 -0
  80. package/pipeline/scripts/_guard-probe.mjs +406 -0
  81. package/pipeline/scripts/_guard_rules.py +336 -1
  82. package/pipeline/scripts/_learnings-promotion.mjs +229 -0
  83. package/pipeline/scripts/_locate.mjs +539 -0
  84. package/pipeline/scripts/_memory-policy.mjs +208 -33
  85. package/pipeline/scripts/_product-tree-extract.mjs +761 -0
  86. package/pipeline/scripts/_product-tree.mjs +923 -0
  87. package/pipeline/scripts/_retrieval.mjs +161 -4
  88. package/pipeline/scripts/_secret-scan.mjs +6 -1
  89. package/pipeline/scripts/_stack-routing.mjs +2 -0
  90. package/pipeline/scripts/_test-gaming.mjs +346 -0
  91. package/pipeline/scripts/_user_guard_rules.py +744 -0
  92. package/pipeline/scripts/agent-guard.py +69 -6
  93. package/pipeline/scripts/agent-guard.sh +8 -1
  94. package/pipeline/scripts/argv-secret-scan.mjs +2 -1
  95. package/pipeline/scripts/autopilot-loop.mjs +407 -0
  96. package/pipeline/scripts/autopilot-runner.mjs +38 -25
  97. package/pipeline/scripts/capture-resume.sh +9 -1
  98. package/pipeline/scripts/cost-analyze.mjs +66 -4
  99. package/pipeline/scripts/cost-budget-check.mjs +5 -13
  100. package/pipeline/scripts/disk-cleaner.mjs +1418 -0
  101. package/pipeline/scripts/doctor.mjs +324 -43
  102. package/pipeline/scripts/evidence-gate.mjs +90 -0
  103. package/pipeline/scripts/gate-ledger.mjs +76 -21
  104. package/pipeline/scripts/gc-tmp.sh +5 -0
  105. package/pipeline/scripts/graph-query.mjs +257 -17
  106. package/pipeline/scripts/guard-probe-known-holes.json +3 -0
  107. package/pipeline/scripts/learnings-ledger.mjs +680 -55
  108. package/pipeline/scripts/note-agent-event.mjs +2 -0
  109. package/pipeline/scripts/note-mcp-failure.mjs +363 -0
  110. package/pipeline/scripts/note-mcp-failure.sh +19 -0
  111. package/pipeline/scripts/note-skill-use.mjs +96 -23
  112. package/pipeline/scripts/office-archive.mjs +23 -10
  113. package/pipeline/scripts/office-memory.mjs +4 -1
  114. package/pipeline/scripts/persona-walk-anchors.mjs +443 -0
  115. package/pipeline/scripts/pre-commit-check.sh +2 -2
  116. package/pipeline/scripts/pre-push-check.sh +8 -1
  117. package/pipeline/scripts/product-tree-eval.mjs +685 -0
  118. package/pipeline/scripts/product-tree.mjs +544 -0
  119. package/pipeline/scripts/publish-staged.mjs +324 -0
  120. package/pipeline/scripts/route-learn.mjs +628 -0
  121. package/pipeline/scripts/run-scope-guard.mjs +55 -1
  122. package/pipeline/scripts/scan-agent-config.sh +1 -1
  123. package/pipeline/scripts/statusline.mjs +309 -0
  124. package/pipeline/scripts/test-integrity-gate.mjs +97 -2
  125. package/pipeline/scripts/triage-memory.mjs +12 -4
  126. package/pipeline/scripts/uninstall.mjs +1 -0
  127. package/pipeline/skills/.skill-manifest.json +15 -7
  128. package/pipeline/skills/.skills-index.json +25 -3
  129. package/pipeline/skills/shared/README.md +6 -4
  130. package/pipeline/skills/shared/core/google-play-compliance/references/examples.md +1 -1
  131. package/pipeline/skills/shared/core/multi-agent-review-analysis/SKILL.md +1 -1
  132. package/pipeline/skills/shared/external/backlog/SKILL.md +1 -1
  133. package/pipeline/skills/shared/external/disk-cleaner/SKILL.md +105 -0
  134. package/pipeline/skills/shared/external/disk-cleaner/evals/evals.json +62 -0
  135. package/pipeline/skills/shared/external/disk-cleaner/scripts/disk-cleaner.mjs +1418 -0
  136. package/pipeline/skills/shared/external/localization-reuse-map/SKILL.md +1 -1
  137. package/pipeline/skills/shared/external/spec-persona-walk/SKILL.md +118 -0
  138. package/pipeline/skills/shared/external/spec-persona-walk/evals/evals.json +50 -0
  139. package/pipeline/skills/shared/external/spec-persona-walk/scripts/persona-walk-anchors.mjs +443 -0
  140. package/pipeline/skills/shared/external/storekit/SKILL.md +1 -1
  141. package/pipeline/skills/shared/external/swiftdata/SKILL.md +1 -1
  142. package/pipeline/skills/skill-copies.json +9 -1
  143. package/pipeline/skills/skills-index.md +4 -2
@@ -3,6 +3,7 @@
3
3
  <!-- toc -->
4
4
  - [What turns it on](#what-turns-it-on)
5
5
  - [The guard](#the-guard)
6
+ - [User guard rules](#user-guard-rules)
6
7
  - [Phase 4: a PR request instead of a push](#phase-4-a-pr-request-instead-of-a-push)
7
8
  - [The runner's launch](#the-runners-launch)
8
9
  - [The publish step](#the-publish-step)
@@ -649,6 +650,91 @@ An autonomous research pass is narrower still: the runner launches it with
649
650
  other `research_*` tools and `WebSearch`) denied, because tracker text is
650
651
  untrusted and often confidential.
651
652
 
653
+ ## User guard rules
654
+
655
+ `prefs.global.guardRules` lets the user add rules to the guard, attended and
656
+ unattended (`scripts/_user_guard_rules.py`, schema in `prefs.schema.json`):
657
+
658
+ ```json
659
+ { "id": "no-prod-db", "tool": "Bash", "match": "psql\\s+.*prod",
660
+ "action": "block", "reason": "production database" }
661
+ ```
662
+
663
+ - **What is matched.** `match` is a Python regex searched in the command for
664
+ `Bash`, in the target path for `Edit` (which also covers `NotebookEdit`),
665
+ `Write` and `Read` (as given, made absolute, and real-pathed), and in the tool
666
+ input as compact sorted JSON for a toolkit glob such as
667
+ `mcp__multi-agent-toolkit__web_*`. Each `agent_run_steps` step is judged as a
668
+ call of its own tool. Text is also matched after the confusables fold the
669
+ attribution rule uses. An `Edit` rule also matches `MultiEdit` on a host that
670
+ still has that tool, but the default hooks register the guard on
671
+ `Edit|Write|NotebookEdit` only, so such a host needs a `MultiEdit` entry too.
672
+ - **Rules only add.** The built-in verdict is reached first: a built-in block
673
+ or deny is final, a rule `block` outranks a built-in ask, and no rule turns a
674
+ refusal or an ask into an allow. `warn` lets the call through with a note
675
+ (`systemMessage` and `additionalContext`); `ask` raises the same confirmation
676
+ as the built-in asks, one confirmation covering both; `block` refuses. A
677
+ `warn` or `ask` message that meets a built-in ask is added to that prompt's
678
+ reason.
679
+ - **Confirming without a prompt.** In `bypassPermissions` and `dontAsk` no
680
+ prompt can be raised, so an ask is refused with the command that records the
681
+ user's yes: `confirm-command.mjs --command '<key>'`, valid ten minutes for one
682
+ use. For `Bash` the key is the exact command. For any other tool it is the
683
+ tool name, the target path when there is one, and `sha256:` of the tool input
684
+ as sorted compact JSON, which the refusal prints in full; the yes covers that
685
+ exact call, and a call with any other input is asked again.
686
+ - **Unattended, ask is block.** Nobody is there to answer the prompt.
687
+ - **Bounded regex.** A pattern is at most 512 characters. A pattern with a
688
+ back-reference, or one that does not compile, is invalid. Every other
689
+ pattern runs under a 1-second wall-clock budget: `re` has no timeout, but it
690
+ checks for pending signals while it backtracks, so a timer ends a runaway
691
+ match in place, and a `block` or `ask` rule that runs out of time fails
692
+ closed (below). Doctor's `guard-rules` check names a valid rule with a slow
693
+ shape: a variable quantifier (`?`, `*`, `+`, `{m,n}`) inside a group
694
+ repeated more than 16 times whose repetitions can split the same text more
695
+ than one way (`(a+)+`, `(\w+\s?)*`, `(?:a?){28}`), or three or more adjacent
696
+ open-ended quantifiers whose characters overlap (`a*a*a*b`, `\w+\d+\w+`).
697
+ A bounded repeat with a small maximum (`(\d{1,3}\.){3}`) and a group whose
698
+ quantified items cannot match each other's characters
699
+ (`git\s+push(\s+\S+)*\s+--force`, `(\s+-\w+)*\s+prod`) are not slow shapes.
700
+ The shape check cannot catch every slow pattern (`(a|aa)+$` passes it); the
701
+ budget covers those too. Rules run `block`
702
+ first, then `ask`, then `warn`, and each gets an even share of the budget
703
+ still left, so a slow rule cannot use up the time of the rules after it;
704
+ a timeout message names the share the rule had. This costs no process start
705
+ per call, which a child interpreter would. The guard's own 5-second deadline
706
+ shares the timer and is re-armed with what is left, so it still fires on
707
+ time. Text past 65,536 characters is matched on its head and tail (32,768
708
+ characters each); when that finds nothing, the input counts as past the cap.
709
+ - **When a rule cannot be applied.** An invalid rule is ignored and doctor's
710
+ `guard-rules` check reports it (health shows doctor's warnings); a repeated
711
+ id keeps the first rule, and the warning names both positions. An invalid
712
+ `block` rule whose tool is readable refuses every call of that tool
713
+ unattended: the rule exists to stop something, and an unwatched run that
714
+ silently drops it is the failure it was written against. A rule gives no
715
+ answer when it runs out of its share of the time, when the budget is spent
716
+ before its turn (reported as not checked), or when the input is past the
717
+ cap.
718
+ Then unattended an `ask` or `block` rule refuses; attended an `ask` or
719
+ `block` rule asks, so input the agent controls cannot switch a refusing rule
720
+ off, and a `warn` rule leaves a note.
721
+ - **A file that cannot be read.** A preferences file that does not parse, or a
722
+ `guardRules` that is not a list, applies no rule. Unattended it refuses every
723
+ call a rule could govern (`Bash`, the file tools and toolkit tools) when the
724
+ file names `guardRules`, or cannot be read at all: the rules it holds cannot
725
+ be read, and nobody is watching. A broken file that never names
726
+ `guardRules` holds no rules, so nothing is refused for it. Attended each such
727
+ call proceeds with a note that the guard rules could not be read. Doctor's
728
+ `guard-rules` check warns, and `prefs-valid` blocks on a file that does not
729
+ parse.
730
+ - **No echo.** A message names the rule id and its reason, never the matched
731
+ text or the pattern; doctor prints neither.
732
+ - **Where it runs.** Only where `agent-guard.sh` is registered: `Bash`, file
733
+ edits, `WebFetch` and toolkit tools under the default hooks. A `Read` rule
734
+ needs a `PreToolUse` `Read` entry for the guard; doctor names the gap. Even
735
+ then a `Read` rule does not stop `cat`, `head` or any other shell read of the
736
+ same file: that needs a matching `Bash` rule.
737
+
652
738
  ## Phase 4: a PR request instead of a push
653
739
 
654
740
  Under the variable Phase 4 commits as usual (the commit hook still needs a
@@ -1120,7 +1206,8 @@ so the guard's own verdict is what the harness sees. The work is bounded: no
1120
1206
  network, one prefs read, and read-only git calls memoized per invocation, each
1121
1207
  capped at 3 seconds; a command above 50 segments is refused unparsed rather than
1122
1208
  walked. Measured over a 40-command corpus the guard's median is about 0.13 s and
1123
- its p99 about 0.17 s.
1209
+ its p99 about 0.17 s. User guard rules add no process: their matching runs
1210
+ in the guard's own interpreter under a 1-second timer.
1124
1211
 
1125
1212
  ## The phone routes
1126
1213
 
@@ -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,35 @@ 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`, `disk-full`, `timeout`, `rate-limit`, `auth`, `connection`, `invalid-input`, `not-found`, `server-error`, `interrupted`, `other`, chosen in this order: the host's interrupt flag (`interrupted`), then a refusal by the user or the permission layer (`denied`), then a JSON-RPC error code in the error text (`-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 `disk-full` (`ENOSPC`, no space left on device) first and the other server-side classes before `invalid-input` |
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. Any `disk-full` row in the
407
+ window also lights INFO with the disk-cleaner skill as its step, whatever the
408
+ count, because a full disk fails every server at once.
@@ -144,7 +144,7 @@ Plugins & tools (called directly, no wrappers):
144
144
 
145
145
  Stack plugins ai-<stack>-toolkit:<skill>, e.g. ai-ios-toolkit:create-component
146
146
  Catalog: ai-<stack>-toolkit:help Enable per repo: /multi-agent:stack (common + analyst always on)
147
- Toolkit MCP multi-agent-toolkit - 228 tools, most for a RUNNING app, no pipeline run needed:
147
+ Toolkit MCP multi-agent-toolkit - 230 tools, most for a RUNNING app, no pipeline run needed:
148
148
  ios_* / android_* (launch, tap, screenshot, ui tree, logs, crashes,
149
149
  locale, dark mode), web_*, design_* (Design Check above), and the
150
150
  audits (ios_app_store_audit, ios_testflight_validate, android_apk_audit,
@@ -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
 
@@ -143,7 +143,7 @@ Plugin'ler ve tool'lar (doğrudan çağrılır, sarmalayıcı yok):
143
143
 
144
144
  Stack plugin ai-<stack>-toolkit:<skill>, örn. ai-ios-toolkit:create-component
145
145
  Katalog: ai-<stack>-toolkit:help Repo bazında aç: /multi-agent:stack (common + analyst hep açık)
146
- Toolkit MCP multi-agent-toolkit - 228 araç, çoğu ÇALIŞAN uygulama için, pipeline koşusu
146
+ Toolkit MCP multi-agent-toolkit - 230 araç, çoğu ÇALIŞAN uygulama için, pipeline koşusu
147
147
  gerektirmez: ios_* / android_* (başlat, tap, screenshot, ui ağacı, log,
148
148
  crash, locale, koyu mod), web_*, design_* (yukarıdaki Design Check), ve
149
149
  denetimler (ios_app_store_audit, ios_testflight_validate,
@@ -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
@@ -6,6 +6,7 @@
6
6
  - [Read here, write through a command](#read-here-write-through-a-command)
7
7
  - [Which stack skills apply](#which-stack-skills-apply)
8
8
  - [multi-agent-toolkit MCP](#multi-agent-toolkit-mcp)
9
+ - [Status line](#status-line)
9
10
  <!-- /toc -->
10
11
 
11
12
  > Loaded on demand by `rules/outside-the-pipeline.md`, which carries only the
@@ -112,6 +113,7 @@ another stack's toolkit in its place.
112
113
  | `learnings_search` / `learnings_timeline` / `learnings_get` | what past runs learned about a repo, across every repo not excluded from memory |
113
114
  | `graph_*` (`graph_stats`, `graph_hubs`, `graph_cluster`, `graph_query`, ...) | reading a built code graph without a shell |
114
115
  | `research_community` / `media_transcript` | what developers already reported about a problem, or the subtitles of a linked YouTube talk (`media-remote` cap, `yt-dlp`) |
116
+ | `media_video_plan` / `media_video_render` | a short video is wanted from screenshots, clips or a script: plan the scenes and timing first, then render the planned video |
115
117
  | `social_read` | the user asked for posts from X, Reddit, LinkedIn, Instagram or Facebook; reads through their own signed-in Chrome, off unless the `social` cap is set, confirmed per channel, never unattended |
116
118
  | `pass_*` (`pass_inspect`, `pass_validate`, `pass_certificates`, `pass_build`) | an Apple Wallet pass will not open, or a test pass is needed |
117
119
  | `store_*` (`store_status`, `store_asc_*`, `store_play_*`, `store_search` / `store_call`) | a question about App Store Connect or Google Play data: builds and build numbers, reviews, subscriptions, tracks, vitals. Keys come from the Keychain via the store reference file `/multi-agent:setup` writes; `store_status` says which store resolves. Writes return a preview until `confirm: true` and are refused unattended |
@@ -125,3 +127,7 @@ config, and a `@scope:registry=` line there outranks `--registry`. That is how t
125
127
  server came to report `CONNECTION_CLOSED` while working perfectly when run directly:
126
128
  npm fetched from the wrong registry and the process never started. The registration
127
129
  carries `--@<scope>:registry=<url>`; `smoke-npm-scope-pinning.sh` keeps it that way.
130
+
131
+ ## Status line
132
+
133
+ Asked for a status bar that shows the run, offer `node "$HOME/.claude/scripts/statusline.mjs" install`. It adds a Claude Code `statusLine` with the phase, the cost against an enabled `costBudget`, the gates and whether the run waits for an answer, from local files only. It never replaces a `statusLine` already set; `statusline.mjs uninstall` removes only its own.
@@ -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:
@@ -209,7 +213,7 @@ Phase 1 and Phase 2 pre-flights BLOCK on `analysis/<feature-slug>-<platform>.md`
209
213
 
210
214
  A fresh document is also skipped when one already exists for this feature and platform AND its front-matter `evidence_digest` still matches (Locked 26 cache); record `docStatus = "reused"`.
211
215
 
212
- **How it runs.** Load `$HOME/.claude/multi-agent-refs/analysis/` on demand, in order: `locked.md` (the 31 binding decisions) then `evidence.md`, `synthesis.md`, `render.md`. Intake is NOT re-asked; platform, repos and account come from Phase 0 state. Autopilot auto-approves the Phase 2a convention preview and writes the local file, because it may not ask.
216
+ **How it runs.** Load `$HOME/.claude/multi-agent-refs/analysis/` on demand, in order: `locked.md` (the 37 binding decisions) then `evidence.md`, `synthesis.md`, `render.md`. Intake is NOT re-asked; platform, repos and account come from Phase 0 state. Autopilot auto-approves the Phase 2a convention preview and writes the local file, because it may not ask.
213
217
 
214
218
  **Where it lands.** `<worktree>/analysis/<feature-slug>-<platform>.md`, one file per platform in `state.analysisSpec.platforms[]`. Persist the paths to `state.analysis.docPath[]` and set `docStatus` to `produced` | `reused` | `not-applicable`. Also persist `state.run.lastAnalysisDigest` (this document's `evidence_digest`) and `state.run.analysisBaseCommit` (`git rev-parse HEAD`). Phase 2's freshness check reads both; unwritten, it has nothing to compare and passes silently. Whether the file is committed with the work is `prefs.global.analysisPhase.commitDoc` (default `true`), read at Phase 4.
215
219
 
@@ -166,7 +166,7 @@ For each task (respecting dependency order), on start and on end: `bash $HOME/.c
166
166
  - **ios, fallback (raw)**: same lock pair around `xcodebuild build -scheme "{scheme}" -destination "generic/platform=iOS" -derivedDataPath "{worktreePath}/.DerivedData" 2>&1 | tail -5`.
167
167
  - **android**: lock pair around `./gradlew assembleDebug 2>&1 | tail -5` (the Gradle daemon and `build/` outputs contend across parallel worktrees exactly as DerivedData does - the lock applies).
168
168
  - **backend / web**: `python -m compileall .` / run the command `node $HOME/.claude/scripts/package-manager.mjs run --dir "{worktreePath}" --script build` prints, `2>&1 | tail -5` (exit 3: no build script); no lock.
169
- 5. If build fails → fix → rebuild (max 3 attempts, track `retryCount` in state).
169
+ 5. If build fails → fix → rebuild (max 3 attempts, track `retryCount` in state). A failure that says `ENOSPC` or no space left is not a code defect, and retrying will not fix it: save the output and run `node $HOME/.claude/lib/low-disk.mjs --scan <log>`, print its line, and stop retrying. Attended, ask once whether to run the disk-cleaner skill; unattended, record the line and halt. Never delete anything from here.
170
170
  6. **Intermediate commit** (after each completed task in the plan):
171
171
  ```bash
172
172
  git -C "{worktreePath}" add -A
@@ -372,11 +372,11 @@ bash $HOME/.claude/scripts/pre-commit-check.sh
372
372
  **Default-FAIL evidence gate (required before recording any pass):** a green exit code is not enough - the captured log must actually show success. Before marking build/test passed, run the evidence gate against the tee'd log; it fails CLOSED when the log is missing, empty, or shows failure markers:
373
373
 
374
374
  ```bash
375
- node $HOME/.claude/scripts/evidence-gate.mjs --claim build --status passed --evidence "$WORKTREE/.build.log" || BUILD_PASS=false
376
- node $HOME/.claude/scripts/evidence-gate.mjs --claim test --status passed --evidence "$WORKTREE/.test.log" || TEST_PASS=false
375
+ node $HOME/.claude/scripts/evidence-gate.mjs --claim build --status passed --evidence "$WORKTREE/.build.log" --repo "$WORKTREE" || BUILD_PASS=false
376
+ node $HOME/.claude/scripts/evidence-gate.mjs --claim test --status passed --evidence "$WORKTREE/.test.log" --repo "$WORKTREE" --command "<test-command>" || TEST_PASS=false
377
377
  ```
378
378
 
379
- This prevents a false "it built" claim with no log behind it. On exit 1, treat the gate as failed (do NOT proceed to AI review) and surface the gate's `reason`.
379
+ This prevents a false "it built" claim with no log behind it. `--repo` fails a log older than the last edit, `--command` a narrowed run (`-only-testing`, `-k`, `-t`, one file). On exit 1, treat the gate as failed (do NOT proceed to AI review) and surface the gate's `reason`.
380
380
 
381
381
  **Why the pipe (opt-in via `prefs.global.contextOffload.enabled`).** `tee` decides where the log is written, not how much of it the model reads. The filter parks the full text at `.multi-agent/refs/<node_id>.md` and prints a stub plus the tail, where a failing build's error already is; read that file before re-running a failed build. The evidence gate still reads the whole `.build.log`, so what counts as a verified pass is unchanged. Pref off = pass-through.
382
382
 
@@ -123,11 +123,11 @@ $HOME/.claude/scripts/log-metric.sh "$TASK_ID" 3 review.diff_risk \
123
123
 
124
124
  #### Step 1.76 - Test-integrity gate (produces BLOCKING findings)
125
125
 
126
- Turns Step 1.75's `test_lines_removed` hint into blocking findings triage must adjudicate, and greps the diff for test gaming: an environment branch, a swallowed error, an inflated timeout, a disabled test, a lint suppression or a loosened lint config. A lint suppression that states its reason on the line is important, not blocking. `TI_COUNT=-1` (non-zero exit, missing file, or `gaming.scanned: false`) means the change was not checked for test gaming, never "no findings": `review-decision-gate.mjs` reads that file as unreadable (exit 3), which parks the run; where that gate does not run, add one blocking `test_integrity` finding with `signal: "gate_error"`. `--out` drops the previous iteration's file first, so a failed run leaves none.
126
+ Turns Step 1.75's `test_lines_removed` hint into blocking findings triage must adjudicate, and greps the diff for test gaming: an environment branch, a swallowed error, an inflated timeout, a disabled test, a lint suppression or a loosened lint config; `--state` adds RED tests changed later. A lint suppression that states its reason on the line is important, not blocking. `TI_COUNT=-1` (non-zero exit, missing file, or `gaming.scanned: false`) means the change was not checked for test gaming, never "no findings": `review-decision-gate.mjs` reads that file as unreadable (exit 3), which parks the run; where that gate does not run, add one blocking `test_integrity` finding with `signal: "gate_error"`. `--out` drops the previous iteration's file first, so a failed run leaves none.
127
127
 
128
128
  ```bash
129
129
  TI_FILE="$WORKTREE/.pipeline/test-integrity.json"
130
- printf '%s' "$RISK_FULL" | node $HOME/.claude/scripts/test-integrity-gate.mjs --diff-base "$BASE_BRANCH" --repo "$WORKTREE" --out "$TI_FILE" 2>/dev/null; TI_RC=$?
130
+ printf '%s' "$RISK_FULL" | node $HOME/.claude/scripts/test-integrity-gate.mjs --diff-base "$BASE_BRANCH" --repo "$WORKTREE" --state "$STATE_FILE" --out "$TI_FILE" 2>/dev/null; TI_RC=$?
131
131
  TI_COUNT=$(jq -r 'if .gaming.scanned == false then -1 else (.count // 0) end' "$TI_FILE" 2>/dev/null || echo -1)
132
132
  [ "$TI_RC" -ne 0 ] && TI_COUNT=-1
133
133
  [ "$TI_COUNT" -gt 0 ] && $HOME/.claude/scripts/log-metric.sh "$TASK_ID" 3 review.test_integrity findings="$TI_COUNT"
@@ -233,6 +233,8 @@ WS_ERR=$(printf '{"status":"complete","currentPhase":5,"finishedAt":"%s"}' "$TS"
233
233
 
234
234
  **Per-run outcome metrics (evidence corpus):** also emit `run-metrics.mjs --state <agent-state.json>` and append/persist its JSON. It records review iterations, first-pass-clean, reviewer signal-to-noise, consensus verdict and build outcome.
235
235
 
236
+ **Routing outcomes:** with `modelRouting.learned.enabled`, run `route-learn.mjs ingest --state "$STATE_FILE"` (outcome rows only, `features/model-fallback.md`).
237
+
236
238
  **Cost Breakdown emission (required):** as part of agent-log compose, append the per-task cost block produced by `render-agent-log-cost.sh`:
237
239
 
238
240
  ```bash
@@ -270,6 +272,8 @@ A durable architectural fact or decision is a judgement call, so it stays here r
270
272
  # node $HOME/.claude/scripts/learnings-ledger.mjs feedback --id "<L:id>" --outcome useful --task "$TASK_ID"
271
273
  ```
272
274
 
275
+ Phase 5 never promotes a learning to the global ledger; that is `promote`, on request, one approval per candidate (`knowledge.md`).
276
+
273
277
  Print the closing report to the terminal. Two blocks, in this order - what the pipeline spent, then what it changed:
274
278
 
275
279
  ```bash
@@ -158,7 +158,9 @@ Act on the exit code:
158
158
  - `10` (WARN) - surface the printed `WARN: ...` line to the user (and into `agent-log.md`). Continue.
159
159
  - `11` (EXCEEDED) - surface the `EXCEEDED: ...` line. If `costBudget.onExceed = "halt"`, pause the run and require `multi-agent:resume` (autopilot included) so the user explicitly accepts the overage; if `"warn"`, continue.
160
160
 
161
- The check is a silent no-op (exit 0) when the budget is disabled or no tracker data exists yet, so unconditional invocation is safe. It prices accumulated tokens conservatively (default `opus` rate) so the ceiling trips early. Enforced by `smoke-cost-budget.sh`.
161
+ The check is a silent no-op (exit 0) when the budget is disabled or no tracker data exists yet, so unconditional invocation is safe. It prices accumulated tokens conservatively (default `fable` rate, the most expensive tier) so the ceiling trips early. Enforced by `smoke-cost-budget.sh`.
162
+
163
+ Between phases the same ladder is read at every subagent spawn: `run-scope-guard.sh` on `Agent|Task` prices the bound run's tracker with `_cost-budget.mjs` and, while the run is over `maxUsd`, asks the user before the subagent starts (`onExceed: "halt"` refuses it). From `warnPct` up to the ceiling the model gets a note and the spawn goes ahead. Off with the budget, outside a run, and for a finished run.
162
164
 
163
165
  ---
164
166