@mmerterden/multi-agent-pipeline 23.3.0 → 23.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -0
- package/README.md +27 -8
- package/README.tr.md +28 -9
- package/SECURITY.md +16 -0
- package/docs/adr/0008-installer-modularization-and-secret-leak-defense.md +1 -1
- package/docs/adr/0010-own-code-graph.md +299 -8
- package/docs/architecture.md +3 -3
- package/docs/ecosystem.md +10 -10
- package/docs/engineering.md +4 -4
- package/docs/facts.json +8 -8
- package/docs/features.md +5 -5
- package/docs/performance.md +17 -17
- package/install/_dev-only-files.mjs +9 -0
- package/install/_platform-filter.mjs +2 -55
- package/install/claude.mjs +28 -2
- package/install/codex.mjs +1 -3
- package/install/copilot.mjs +4 -8
- package/install/templates/claude-hooks.json +32 -1
- package/manifest.json +236 -167
- package/package.json +11 -3
- package/pipeline/commands/multi-agent/SKILL.md +1 -1
- package/pipeline/commands/multi-agent/design-check/SKILL.md +3 -2
- package/pipeline/commands/multi-agent/diff-explain/SKILL.md +3 -3
- package/pipeline/commands/multi-agent/graph/SKILL.md +57 -24
- package/pipeline/commands/multi-agent/pair/SKILL.md +92 -0
- package/pipeline/commands/multi-agent/prune-prompts/SKILL.md +1 -1
- package/pipeline/commands/multi-agent/search/SKILL.md +7 -1
- package/pipeline/commands/multi-agent/status/SKILL.md +4 -0
- package/pipeline/commands/multi-agent/sync/SKILL.md +3 -3
- package/pipeline/contract/CHANGELOG.md +63 -0
- package/pipeline/contract/README.md +1 -0
- package/pipeline/contract/build.mjs +13 -1
- package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
- package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
- package/pipeline/contract/fixtures/runs-awaiting-question.json +4 -1
- package/pipeline/contract/fixtures/runs-empty.json +1 -1
- package/pipeline/contract/fixtures/runs-failed.json +4 -1
- package/pipeline/contract/fixtures/runs-old-schema.json +3 -0
- package/pipeline/contract/fixtures/runs-pr-opened-redacted.json +4 -1
- package/pipeline/contract/fixtures/runs-pr-opened.json +4 -1
- package/pipeline/contract/fixtures/runs-running.json +4 -1
- package/pipeline/contract/manifest.json +41 -15
- package/pipeline/contract/types/index.d.ts +81 -3
- package/pipeline/lib/detach-self.mjs +95 -0
- package/pipeline/lib/public-mcp-servers.mjs +33 -0
- package/pipeline/lib/rotated-log.mjs +93 -0
- package/pipeline/lib/stack-detect.sh +1 -1
- package/pipeline/lib/tls-trust.mjs +29 -0
- package/pipeline/lib/usage-lifecycle.mjs +9 -11
- package/pipeline/lib/usage-names.generated.mjs +613 -0
- package/pipeline/lib/usage-run-key.mjs +235 -0
- package/pipeline/lib/usage-vocab.mjs +210 -0
- package/pipeline/multi-agent-refs/analysis/intake.md +2 -2
- package/pipeline/multi-agent-refs/analysis/render.md +1 -1
- package/pipeline/multi-agent-refs/channels/generator.md +4 -5
- package/pipeline/multi-agent-refs/cross-cli-contract.md +3 -3
- package/pipeline/multi-agent-refs/design-check/init-inventory.md +11 -1
- package/pipeline/multi-agent-refs/design-check/scope-and-ledger.md +1 -1
- package/pipeline/multi-agent-refs/features/code-graph.md +146 -11
- package/pipeline/multi-agent-refs/features/code-intelligence.md +16 -14
- package/pipeline/multi-agent-refs/features/dev-critic.md +7 -7
- package/pipeline/multi-agent-refs/features/model-fallback.md +6 -4
- package/pipeline/multi-agent-refs/features/remote-control.md +253 -0
- package/pipeline/multi-agent-refs/features/review-delta.md +1 -1
- package/pipeline/multi-agent-refs/features/review-file-set.md +3 -3
- package/pipeline/multi-agent-refs/features/review-multi-repo.md +1 -1
- package/pipeline/multi-agent-refs/features/session-brief.md +42 -0
- package/pipeline/multi-agent-refs/features/skill-conformance.md +3 -3
- package/pipeline/multi-agent-refs/features/usage-reporting.md +255 -27
- package/pipeline/multi-agent-refs/help/en.md +3 -2
- package/pipeline/multi-agent-refs/help/tr.md +3 -2
- package/pipeline/multi-agent-refs/knowledge.md +1 -1
- package/pipeline/multi-agent-refs/orchestrator/dispatcher.md +2 -2
- package/pipeline/multi-agent-refs/phases/operations.md +2 -2
- package/pipeline/multi-agent-refs/phases/phase-0-init.md +13 -12
- package/pipeline/multi-agent-refs/phases/phase-1-plan.md +4 -4
- package/pipeline/multi-agent-refs/phases/phase-3-review.md +2 -0
- package/pipeline/multi-agent-refs/phases/phase-5-report.md +1 -1
- package/pipeline/multi-agent-refs/platform-parity.md +2 -2
- package/pipeline/multi-agent-refs/wiki-capture.md +3 -17
- package/pipeline/office/index.html +1309 -236
- package/pipeline/office/toolkit.json +1 -1
- package/pipeline/rules/outside-the-pipeline.md +1 -1
- package/pipeline/schemas/activity.schema.json +23 -0
- package/pipeline/schemas/agent-state.schema.json +6 -1
- package/pipeline/schemas/code-graph-calls.schema.json +254 -0
- package/pipeline/schemas/code-graph-docs.schema.json +223 -0
- package/pipeline/schemas/code-graph-infra.schema.json +227 -0
- package/pipeline/schemas/code-graph.schema.json +2 -2
- package/pipeline/schemas/examples/design-check-config.json +27 -0
- package/pipeline/schemas/learning-curve.schema.json +67 -0
- package/pipeline/schemas/mcp-health.schema.json +96 -0
- package/pipeline/schemas/office-jobs.json +69 -2
- package/pipeline/schemas/office-jobs.schema.json +8 -1
- package/pipeline/schemas/phases.json +5 -0
- package/pipeline/schemas/phases.schema.json +8 -0
- package/pipeline/schemas/prefs.schema.json +46 -12
- package/pipeline/schemas/runs-index.schema.json +17 -0
- package/pipeline/schemas/toolkit-path-params.json +78 -8
- package/pipeline/scripts/README.md +1 -0
- package/pipeline/scripts/_code-graph.mjs +184 -103
- package/pipeline/scripts/_contract-core.mjs +1 -1
- package/pipeline/scripts/_contract-routes-office.mjs +33 -0
- package/pipeline/scripts/_diff-impact.mjs +21 -2
- package/pipeline/scripts/_graph-sidecars.mjs +372 -0
- package/pipeline/scripts/_http-post.mjs +103 -115
- package/pipeline/scripts/_safe-read.mjs +57 -0
- package/pipeline/scripts/_skill-practices.mjs +26 -0
- package/pipeline/scripts/_strip-code.mjs +380 -0
- package/pipeline/scripts/activity-snapshot.mjs +13 -1
- package/pipeline/scripts/aggregate-metrics.mjs +3 -5
- package/pipeline/scripts/build-stack-plugins.mjs +1 -47
- package/pipeline/scripts/call-graph/index.mjs +78 -0
- package/pipeline/scripts/call-graph/lang/cpp.mjs +308 -0
- package/pipeline/scripts/call-graph/lang/csharp.mjs +130 -0
- package/pipeline/scripts/call-graph/lang/go.mjs +303 -0
- package/pipeline/scripts/call-graph/lang/java.mjs +370 -0
- package/pipeline/scripts/call-graph/lang/kotlin.mjs +397 -0
- package/pipeline/scripts/call-graph/lang/python.mjs +399 -0
- package/pipeline/scripts/call-graph/lang/rust.mjs +345 -0
- package/pipeline/scripts/call-graph/lang/shared.mjs +230 -0
- package/pipeline/scripts/call-graph/lang/swift.mjs +432 -0
- package/pipeline/scripts/call-graph/lang/typescript.mjs +692 -0
- package/pipeline/scripts/call-graph/lex.mjs +396 -0
- package/pipeline/scripts/call-graph/platform.mjs +86 -0
- package/pipeline/scripts/call-graph/profiles.mjs +89 -0
- package/pipeline/scripts/call-graph/resolve.mjs +1125 -0
- package/pipeline/scripts/call-graph/scan.mjs +267 -0
- package/pipeline/scripts/code-graph-rules/android.json +7 -2
- package/pipeline/scripts/code-graph-rules/cpp.json +99 -0
- package/pipeline/scripts/code-graph-rules/csharp.json +102 -0
- package/pipeline/scripts/code-graph-rules/go.json +2 -1
- package/pipeline/scripts/code-graph-rules/ios.json +3 -1
- package/pipeline/scripts/code-graph-rules/java.json +76 -0
- package/pipeline/scripts/code-graph-rules/node.json +7 -2
- package/pipeline/scripts/code-graph-rules/python.json +6 -2
- package/pipeline/scripts/code-graph-rules/rust.json +105 -0
- package/pipeline/scripts/contract-server.mjs +3 -0
- package/pipeline/scripts/design-check-config.mjs +205 -0
- package/pipeline/scripts/feedback-send.mjs +26 -26
- package/pipeline/scripts/gate-ledger.mjs +2 -1
- package/pipeline/scripts/gen-facts.mjs +1 -2
- package/pipeline/scripts/gen-usage-names.mjs +124 -0
- package/pipeline/scripts/graph-affected.mjs +109 -20
- package/pipeline/scripts/graph-build.mjs +95 -15
- package/pipeline/scripts/graph-export.mjs +272 -0
- package/pipeline/scripts/graph-hint.mjs +15 -2
- package/pipeline/scripts/graph-query.mjs +305 -26
- package/pipeline/scripts/graph-report.mjs +187 -1
- package/pipeline/scripts/health-report.mjs +3 -4
- package/pipeline/scripts/infra/docs.mjs +317 -0
- package/pipeline/scripts/infra/extract.mjs +998 -0
- package/pipeline/scripts/infra/graph.mjs +245 -0
- package/pipeline/scripts/infra/yaml-lite.mjs +311 -0
- package/pipeline/scripts/job-launch.mjs +67 -2
- package/pipeline/scripts/learning-curve.mjs +288 -178
- package/pipeline/scripts/log-metric.sh +10 -1
- package/pipeline/scripts/mcp-health.mjs +309 -0
- package/pipeline/scripts/note-agent-event.mjs +3 -4
- package/pipeline/scripts/note-command-use.mjs +333 -0
- package/pipeline/scripts/note-command-use.sh +126 -0
- package/pipeline/scripts/note-mcp-call.sh +89 -0
- package/pipeline/scripts/note-mcp-failure.mjs +272 -1
- package/pipeline/scripts/note-session.sh +62 -3
- package/pipeline/scripts/note-skill-use.mjs +58 -2
- package/pipeline/scripts/office-build.mjs +115 -1
- package/pipeline/scripts/office-memory.mjs +14 -5
- package/pipeline/scripts/pair.mjs +333 -0
- package/pipeline/scripts/pre-push-check.sh +1 -1
- package/pipeline/scripts/remote/cbor.mjs +128 -0
- package/pipeline/scripts/remote/contract.mjs +98 -0
- package/pipeline/scripts/remote/handler.mjs +330 -0
- package/pipeline/scripts/remote/handles.mjs +57 -0
- package/pipeline/scripts/remote/lifecycle.mjs +186 -0
- package/pipeline/scripts/remote/listener.mjs +204 -0
- package/pipeline/scripts/remote/lockout.mjs +103 -0
- package/pipeline/scripts/remote/nonces.mjs +61 -0
- package/pipeline/scripts/remote/pairing.mjs +519 -0
- package/pipeline/scripts/remote/qr-encode.mjs +459 -0
- package/pipeline/scripts/remote/store.mjs +191 -0
- package/pipeline/scripts/remote/transport.mjs +211 -0
- package/pipeline/scripts/remote/verbs.json +70 -0
- package/pipeline/scripts/remote/verbs.mjs +217 -0
- package/pipeline/scripts/remote/webauthn.mjs +169 -0
- package/pipeline/scripts/remote/wire.mjs +364 -0
- package/pipeline/scripts/remote-listener.mjs +83 -0
- package/pipeline/scripts/route-learn.mjs +4 -4
- package/pipeline/scripts/run-kill.mjs +1 -1
- package/pipeline/scripts/run-write.mjs +13 -2
- package/pipeline/scripts/runs-index.mjs +30 -3
- package/pipeline/scripts/search-logs.sh +9 -0
- package/pipeline/scripts/session-brief.mjs +458 -0
- package/pipeline/scripts/session-brief.sh +130 -0
- package/pipeline/scripts/skill-usage.mjs +16 -5
- package/pipeline/scripts/test-gap-rules/cpp.json +25 -0
- package/pipeline/scripts/test-gap-rules/csharp.json +20 -0
- package/pipeline/scripts/test-gap-rules/java.json +20 -0
- package/pipeline/scripts/test-gap-rules/rust.json +14 -0
- package/pipeline/scripts/token-budget-report.mjs +3 -2
- package/pipeline/scripts/uninstall.mjs +29 -0
- package/pipeline/scripts/usage-access.mjs +16 -31
- package/pipeline/scripts/usage-health.mjs +31 -62
- package/pipeline/scripts/usage-register-beacon.mjs +11 -22
- package/pipeline/scripts/usage-register.mjs +39 -29
- package/pipeline/scripts/usage-report.mjs +579 -178
- package/pipeline/scripts/validate-code-graph.mjs +361 -111
- package/pipeline/scripts/write-state.mjs +39 -0
- package/pipeline/skills/.skill-manifest.json +21 -17
- package/pipeline/skills/.skills-index.json +13 -2
- package/pipeline/skills/shared/README.md +5 -4
- package/pipeline/skills/shared/core/multi-agent-design-check/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-diff-explain/SKILL.md +3 -3
- package/pipeline/skills/shared/core/multi-agent-graph/SKILL.md +55 -21
- package/pipeline/skills/shared/core/multi-agent-pair/SKILL.md +41 -0
- package/pipeline/skills/shared/core/multi-agent-prune-prompts/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +3 -3
- package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +2 -3
- package/pipeline/skills/shared/external/app-store-optimization/references/keyword-research-methodology.md +2 -2
- package/pipeline/skills/shared/external/app-store-optimization/references/product-page-variants.md +2 -2
- package/pipeline/skills/shared/external/app-store-review/SKILL.md +11 -4
- package/pipeline/skills/shared/external/build-settings-audit/SKILL.md +1 -1
- package/pipeline/skills/shared/external/build-time-benchmark/SKILL.md +5 -5
- package/pipeline/skills/shared/external/build-time-fixes/SKILL.md +5 -5
- package/pipeline/skills/shared/external/build-time-optimizer/SKILL.md +6 -6
- package/pipeline/skills/shared/external/free-llm-apis/references/providers.md +1 -0
- package/pipeline/skills/shared/external/ios-coding-standard/references/STANDARD.md +2 -2
- package/pipeline/skills/shared/external/ios-haptics/references/core-haptics.md +1 -1
- package/pipeline/skills/shared/external/localization-reuse-map/references/publish-and-snapshot.md +1 -1
- package/pipeline/skills/shared/external/package-build-audit/SKILL.md +3 -3
- package/pipeline/skills/shared/external/reverse-engineer-own-app/SKILL.md +2 -3
- package/pipeline/skills/shared/external/swift-compile-hotspots/SKILL.md +2 -2
- package/pipeline/skills/shared/external/weatherkit/SKILL.md +5 -6
- package/pipeline/skills/skills-index.md +3 -2
- package/docs/FIGMA_PIPELINE.md +0 -137
- package/pipeline/lib/identifier-scan.mjs +0 -156
- package/pipeline/scripts/_renamed-skills.mjs +0 -164
- package/pipeline/scripts/publish-staged.mjs +0 -324
- package/pipeline/skills/renamed.json +0 -30
- package/pipeline/skills/shared/external/ios-coding-standard/scripts/check_structure.py +0 -765
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Feature: Session Brief (plain sessions, opt-in)
|
|
2
|
+
|
|
3
|
+
**Off by default.** Turn it on with `prefs.global.sessionBrief.enabled: true`. Claude Code only: the hook is `session-brief.sh` on SessionStart (`startup|resume|clear|compact`), so the block is shown again after a compaction. The installer registers the hook; with the setting off it prints nothing, starts nothing and returns in a few milliseconds.
|
|
4
|
+
|
|
5
|
+
A pipeline run loads the learnings ledger in Phase 0. An ordinary session would start knowing none of it. The brief is an index, not the memory: every ledger line carries its pointer, and the detail is one call away (`learnings_get`, `learnings_search`, or `learnings-ledger.mjs show --id <id>`).
|
|
6
|
+
|
|
7
|
+
## What each setting injects
|
|
8
|
+
|
|
9
|
+
| Setting | Injects | Default |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| `enabled` | the ledger layer: counts by kind and up to `maxEntries` standing entries, best first, as many as fit, inside an `<untrusted-data>` block; plus one line about the code graph when one exists | false |
|
|
12
|
+
| `maxEntries`, `maxChars`, `kinds` | bound the block (0 to 10 entries, 400 to 4000 characters, which ledger kinds) | 5, 2400, all |
|
|
13
|
+
| `discipline` | a few working notes: lead with the answer; ask one question about why only when the goal is genuinely unclear; name 2-3 options and recommend one for an open choice; give each step a check; say so when a simpler route exists; give time in minutes or hours | false |
|
|
14
|
+
| `prefs.global.codeGraph.enabled false` | removes the graph line | |
|
|
15
|
+
|
|
16
|
+
The skill-routing line (the `index` skill of each enabled toolkit) rides along whenever the ledger or graph layer prints. A repository with no standing ledger entries and no code graph gets nothing at all, no routing line and no status line, and so does a repository in `memory.excludeProjects`. The user sees one status line (`systemMessage`) in the output language when something was injected.
|
|
17
|
+
|
|
18
|
+
Standing means: not superseded, not suppressed by feedback, and passing the secret scan. Ranking is confidence, then repository-wide before path-scoped, then kind (security notes and decisions first), then newest. The header counts only entries the scan did not refuse.
|
|
19
|
+
|
|
20
|
+
## What is printed and how it is made safe
|
|
21
|
+
|
|
22
|
+
Each entry line is built from the kind, statement and scope. Every field is cleaned: control, bidi and zero-width characters removed; home paths masked to `~`; ticket-key-shaped tokens (capitals, a dash, digits, so `UTF-8` too) masked; markup tags and tool-call words defused; whitespace folded; clipped by code point. The cleaned line and the unclipped fields are both secret-scanned, and a refused entry is left out.
|
|
23
|
+
|
|
24
|
+
Files are read only when they are regular files reached without a final symlink and under a size cap (ledger and feedback 4 MiB, preferences 1 MiB, graph 128 MiB). A FIFO, directory or link is skipped, so none of them can block a session. The builder exits after 10 seconds regardless.
|
|
25
|
+
|
|
26
|
+
## Silence
|
|
27
|
+
|
|
28
|
+
The hook prints nothing and builds nothing when any of these holds: `MULTI_AGENT_UNATTENDED` is set and not `0`; `MULTI_AGENT_TASK_ID` or `MULTI_AGENT_PHASE` is set; `CLAUDE_CODE_SESSION_ATTENDED` is set and not `1`; `CLAUDE_CODE_ENTRYPOINT` starts with `sdk`; `MULTI_AGENT_SESSION_BRIEF=0`; `HOME` is unset; the directory is not a repository.
|
|
29
|
+
|
|
30
|
+
What could and could not be detected: the SessionStart payload carries no field that tells a `claude -p` session apart, so non-interactive detection rests on the two host environment variables above. Their values were observed only in an interactive session (`CLAUDE_CODE_ENTRYPOINT=cli`, `CLAUDE_CODE_SESSION_ATTENDED=1`); that a `claude -p` run sets different values is expected and not verified.
|
|
31
|
+
|
|
32
|
+
## Cost
|
|
33
|
+
|
|
34
|
+
Measured by review at the defaults with a populated ledger: about 350 tokens per session, paid again after each compaction. Warm hook about 31 ms; a cold build about 3 s, in a background process, never on the session's critical path. The status line the user sees states the token estimate of what was injected (bytes divided by four).
|
|
35
|
+
|
|
36
|
+
## How the cache works
|
|
37
|
+
|
|
38
|
+
`session-brief.sh` runs builtins and one `git rev-parse`, then prints a cached file. The cache is `~/.claude/memory/multi-agent/_session-brief/<repo>-<hash>.json` (directory 0700, file 0600), named from the repository's common directory (djb2 hash, computed alike in bash and node). Its first line is `#sb1|<common dir>|<HEAD>`. The hook prints the cache only when that header equals this repository and this HEAD, the file is a regular file under 16,000 characters, and the body is one line with no control characters. Otherwise it prints nothing this session and starts a rebuild: a detached `session-brief.mjs build`, guarded by a lock directory (a lock older than five minutes is ignored).
|
|
39
|
+
|
|
40
|
+
With the header matching, the old cache is still printed while a rebuild runs after any of these files is newer than the cache: the repo's `learnings-ledger.jsonl` and `learnings-feedback.jsonl`; the cross-repo `_global/learnings-ledger.jsonl`; the repo's `code-graph.json`; the preferences file; `~/.claude/settings.json` and `settings.local.json`; the repo's `.claude/settings.json` and `settings.local.json`; `~/.claude/plugins/installed_plugins.json`.
|
|
41
|
+
|
|
42
|
+
The cache sits under the memory root, so `uninstall --all-data` removes it with the ledger it was built from.
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
## Why this exists
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Review criteria are not chosen from `detectedStack`, a string Phase 1 computes before a line of code exists: Phase 2 records which skills it actually applied, and Phase 3 resolves the criteria from the diff and that record. Without that, two things go wrong:
|
|
21
21
|
|
|
22
22
|
- The dev side and the review side could disagree about the standard without either noticing. A component built by a plugin skill was reviewed against `clean-code`.
|
|
23
23
|
- "Did it do this correctly?" had no fixed denominator, so the only available answer was "it looks fine", and a reviewer that opened nothing produced the same output as a reviewer that checked everything.
|
|
@@ -27,7 +27,7 @@ The sharper case is a document whose evidence supported few sections: the sole i
|
|
|
27
27
|
## The four rules that make it work
|
|
28
28
|
|
|
29
29
|
1. **The denominator is written before the reviewers run.** `criteria-manifest.json` lands on disk in Step 1.78. Reviewers receive the selected rule IDs and must return a verdict per ID. A reviewer cannot narrow the set after seeing the diff, and a no-findings result still has to say what it checked.
|
|
30
|
-
2. **The resolver is primary; self-report only corroborates.** Phase
|
|
30
|
+
2. **The resolver is primary; self-report only corroborates.** Phase 2 appends to `state.telemetry.skillCalls[]`, but coverage is never computed from it. An unrecorded consultation and no consultation are byte-identical in state, so a percentage derived from self-report reads green over an empty set. `ledger.source` therefore defaults to `derived`, and a declared entry the resolver could not bind to a changed file is FLAGGED rather than believed.
|
|
31
31
|
3. **Absent, empty and zero are three states.** `selfReport: absent` (no key), `empty` (key is `[]`), `declared` (has entries). Collapsing them makes the completeness claim unfalsifiable.
|
|
32
32
|
4. **The pipeline names no stack-specific skill.** Registries opt in; see below.
|
|
33
33
|
|
|
@@ -90,7 +90,7 @@ Cheap, language-agnostic, and it answers "completely" head on - an exception i
|
|
|
90
90
|
| Full-pipeline input | Dev-mode substitute |
|
|
91
91
|
|---|---|
|
|
92
92
|
| `detectedStack` (Phase 1) | language census of the diff by file extension. Describes what the diff CONTAINS, not what the repo is nominally built in, so one Objective-C bridging file in a Swift repo is classified correctly |
|
|
93
|
-
| Phase 1 analysis summary (triage scope) | the task description plus the inline task list Phase
|
|
93
|
+
| Phase 1 analysis summary (triage scope) | the task description plus the inline task list Phase 2 generated for itself |
|
|
94
94
|
| Phase 1 plan | same inline task list |
|
|
95
95
|
| `state.evidence.figma[]` (Step 1.8) | recorded as `not-applicable (no Phase 1 evidence)` |
|
|
96
96
|
| Step 2.8 visual conformance | recorded as `not-applicable (no Phase 1 evidence)` |
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
- [7. The half-configured case](#7-the-half-configured-case)
|
|
13
13
|
- [8. Where it is NOT called](#8-where-it-is-not-called)
|
|
14
14
|
- [9. Local skill usage is not reporting](#9-local-skill-usage-is-not-reporting)
|
|
15
|
-
- [10. Local MCP failures are not reporting](#10-local-mcp-failures-are-not-reporting)
|
|
15
|
+
- [10. Local MCP failures and calls are not reporting](#10-local-mcp-failures-and-calls-are-not-reporting)
|
|
16
|
+
- [11. The local logs and their previous generation](#11-the-local-logs-and-their-previous-generation)
|
|
17
|
+
- [12. Which commands are typed](#12-which-commands-are-typed)
|
|
16
18
|
<!-- /toc -->
|
|
17
19
|
|
|
18
20
|
Reporting needs three things: `usageLog.enabled` true, a token that resolves,
|
|
@@ -26,35 +28,97 @@ the three places a machine can first become real: **setup**, **update**, and
|
|
|
26
28
|
|
|
27
29
|
`usage-report.mjs` emits coarse run metadata, one record per run, upserted by
|
|
28
30
|
run id. Never prompts, never code, never diffs, never token values, never
|
|
29
|
-
absolute paths, never the repository name (a digest stands in for it).
|
|
30
|
-
|
|
31
|
+
absolute paths, never the repository name (a keyed digest stands in for it).
|
|
32
|
+
The one hook that sees a typed prompt (`note-command-use.sh`, section 12) keeps
|
|
33
|
+
only the name of a shipped `/multi-agent` command, or the constant `other`:
|
|
34
|
+
no argument, no text, no length.
|
|
35
|
+
|
|
36
|
+
**The rule behind the table.** Every field of the record is one of four things:
|
|
37
|
+
a number or a boolean; a value from a closed list shipped in the code
|
|
38
|
+
(`lib/usage-vocab.mjs` and the data files named below); a keyed digest; or an
|
|
39
|
+
explicitly opt-in field that is reduced to a summary or to a known host (`ti`, `pru`). Whatever a state file,
|
|
40
|
+
the preferences or a machine configuration hold, a value that is not on its
|
|
41
|
+
list is dropped or replaced by a constant (`other`, `private`, `unknown`);
|
|
42
|
+
nothing is sent because it merely looked harmless.
|
|
43
|
+
|
|
44
|
+
A closed list is built when the package is packed and travels inside it;
|
|
45
|
+
nothing found on the machine that runs the pipeline extends it. Command, skill
|
|
46
|
+
and tool names come from `lib/usage-names.generated.mjs`, which
|
|
47
|
+
`scripts/gen-usage-names.mjs` writes (from `prepack`) from the package's own
|
|
48
|
+
git-tracked trees (`commands/multi-agent`, `skills/shared/{core,external}` and
|
|
49
|
+
the tool list of this product's MCP server in `schemas/toolkit-path-params.json`;
|
|
50
|
+
a directory that exists only on a disk is not tracked) and which `npm test`
|
|
51
|
+
checks with `--check`; the public plugins come from the stack
|
|
52
|
+
routing table, the public MCP servers from `lib/public-mcp-servers.mjs`, the
|
|
53
|
+
credential names from `prefs.schema.json`, the models from `cost-table.json`,
|
|
54
|
+
the modes from `phases.json`. A routine saved on the machine, a local wrapper
|
|
55
|
+
command, an installed marketplace plugin or a registered server is on none of
|
|
56
|
+
them. `test/usage-body-closed.test.mjs` builds every body from a state full of
|
|
57
|
+
ticket keys, mail addresses, host names and private server, plugin, command and
|
|
58
|
+
key names (a routine with such a name exists on disk), and checks every field
|
|
59
|
+
against the same shipped lists the code uses, never a pattern. It does this for
|
|
60
|
+
the run record and for the lifecycle, registration, failure-beacon, access-check
|
|
61
|
+
and feedback bodies. The
|
|
62
|
+
registration call sends the reporting login and a label for the machine, plus the
|
|
31
63
|
signed challenge when the account was found by an SSH key (section 4).
|
|
32
64
|
|
|
33
65
|
Each record carries:
|
|
34
66
|
|
|
35
67
|
| Field | Meaning |
|
|
36
68
|
|-------|---------|
|
|
37
|
-
| `id
|
|
69
|
+
| `id` | the run key: `r` plus 16 hex characters, an HMAC-SHA256 of the run id (a ticket key in practice) under a per-install secret. The same machine and run always give the same value, so the events of one run join; the raw id never leaves the machine and stays in the local logs. The secret is 32 random bytes in `~/.claude/logs/multi-agent/usage-run-key`, created on first use (the directory 0700 when it is made, the file 0600 through an exclusive link, so two processes end with one value), never logged and never sent. A file that is not a regular file of this user's, that others can read, or that is short or damaged is replaced by a new key through a rename (a link at the name is swapped, never written through; a key others could read may have been seen, so it is never repaired in place). Replacing changes the id of runs in flight: their next event joins as a new run, once. A directory at the name cannot be replaced. A plain hash would be reversible by hashing every plausible ticket key, so there is no unkeyed form: when the secret cannot be read or created the send is skipped and `usage-last-send.json` records `skipped` with reason `run-key-unavailable`. `--dry-run` never reads, creates or repairs the file: it shows the shape of the record with a throwaway secret, so its `id` is not the id a real send carries. Upgrading from a version that sent the raw run id changes the id of every run: a run in flight at the upgrade joins as a new run, and its earlier events stay under the raw id. Creating or replacing the key happens under `usage-run-key.lock`, which holds a random token naming its holder: a holder removes the lock only while the token is still its own, and a lock older than 10 seconds is moved aside by exactly one waiter (a rename), so neither two waiters nor a slow holder can displace a live lock. |
|
|
70
|
+
| `u` | not part of a run or lifecycle record: the server names every record after the login pinned to the ingest token and ignores the body's, so none is sent. The login travels only where it is what the request is about: the registration (and its challenge), the failure beacon, and the access check (`login`) |
|
|
71
|
+
| `ap` / `lo` | booleans: the run was autopilot / local mode |
|
|
72
|
+
| `in` | where the run came from: `jira`, `github-issue` or `free-text` |
|
|
73
|
+
| `rp` | the repository, as `p` plus 16 hex characters: an HMAC-SHA256 of the project name under the install secret, with a domain label different from `id`'s, so the same name never gives the same digest as a run id. One repository on one machine always gives the same value (the panel can group a repository's runs); the name cannot be recovered by hashing candidate names without the secret. The digest changes once when a machine first sends the keyed form: runs sent before and after that point are not joined to each other |
|
|
74
|
+
| `ri` | the number of review iterations, a number |
|
|
75
|
+
| `tt` | task type, one of `component`, `bugfix`, `feature`, `refactor`, `chore` (the values `agent-state.schema.json` allows); anything else is left out |
|
|
38
76
|
| `ev` | the event that sent it: `phase`, `completed`, `halted`, `parked` |
|
|
39
77
|
| `st` | run status: `in_progress`, `completed`, `halted`, `parked`, `failed` |
|
|
40
|
-
| `ph` | current phase, from the tracker (the phase in progress, else the last one reached) |
|
|
41
|
-
| `phs` | every tracker phase
|
|
42
|
-
| `rc` / `hr` |
|
|
78
|
+
| `ph` | current phase number, from the tracker (the phase in progress, else the last one reached) |
|
|
79
|
+
| `phs` | every tracker phase as exactly four keys, `{p, st, du, tk}`: `p` a phase number (a tracker entry whose id is not a number is left out), `st` one of `pending`, `in_progress`, `completed`, `done`, `failed`, `skipped` (any other status is `null`), `du` the duration in seconds (strict ISO timestamps or a millisecond count, at most 30 days, else `null`) and `tk` tokens, both numbers |
|
|
80
|
+
| `rc` / `hr` | a closed cause code, never text from the run: `<phase>:<cause>` for a halt (the cause alone when the reason names no phase), the waiting cause for a park. The cause is one of `circuit-breaker`, `retry-cap`, `stop-guard`, `research`, `reviewer-json`, `review-blocking`, `cancelled`, `disk-full`, `rate-limit`, `timeout`, `budget`, `auth`, `network`, `permission`, `conflict`, `not-found`, `dispatch`, `lock`, `verification`, `build`, `test`, `approval`, `maturity`, `channels`, `awaiting-input`, `validation`, `run-failed`, `unknown`, chosen by matching the reason against fixed patterns in that order; a reason that matches none is `unknown`. Ticket keys, hosts, addresses, remotes, mail addresses and every other identifier a free-text reason can carry are therefore not sent, whatever their shape. The full reason stays in the local errors ledger (`errors-ledger.jsonl`, field `reason`), which is where debugging reads it |
|
|
43
81
|
| `pr` | whether a PR was opened |
|
|
44
|
-
| `pru` | the PR URL, only when `usageLog.includePrUrl` is true (it names the repository) |
|
|
45
|
-
| `ti` | a
|
|
46
|
-
| `m`, `c` | mode and command. `m` is always one of the modes `schemas/phases.json` declares, or `unknown
|
|
47
|
-
| `t`, `t0`, `du` | time of this event, run start, run duration |
|
|
48
|
-
| `tk`, `cost`, `models` | token totals, estimated cost, models used |
|
|
49
|
-
| `os`, `cli`, `lang`, `stack`, `plug`, `apps`, `creds`, `calls`, `errs`, `v` | environment and credential-health summary |
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
82
|
+
| `pru` | the PR URL, only when `usageLog.includePrUrl` is true (it names the repository), and only for `github.com`, `gitlab.com`, `bitbucket.org` and `dev.azure.com`: https, no port, reduced to host and path (credentials, query string and fragment dropped), and dropped when still over 200 characters. A pull request on any other host sends nothing; `pr` already says one exists |
|
|
83
|
+
| `ti` | only when `usageLog.includeTitle` is true (off by default): a summary of the task title, never the title. Free text cannot be scrubbed reliably, so none of it is sent. The first of the run state's title fields (`title`, the Jira summary, the issue title) is percent-decoded and normalised with NFKC (fullwidth and compatibility forms fold to plain ones) and reduced to `{w, k, l}`: `w` the number of words (at most 99), `k` whether it has the shape of a ticket key (letters then digits, with a hyphen, underscore, space or nothing between, or a `#number`), `l` the language by the shipped lists of common English and Turkish words and the Turkish letters (`en`, `tr` or `other`). That is everything the opt-in sends; no word of the title leaves the machine |
|
|
84
|
+
| `m`, `c` | mode and command. `m` is always one of the modes `schemas/phases.json` declares, or `unknown`. `c` is `/multi-agent:<name>` only when `<name>` is a command the package itself ships (the generated list built when the package is packed), otherwise the mode. A routine saved on the machine, a local wrapper or a command an older version shipped is not on the list |
|
|
85
|
+
| `t`, `t0`, `du` | time of this event, run start, run duration. `t` and `t0` are complete ISO 8601 timestamps between 2020 and 2100, written as UTC rounded down to the minute (a value of any other shape, such as `acme-4711` that a lenient parser would read as a year, is dropped: `t` then falls back to the send time, `t0` to the tracker's start). `du` is the difference of two such timestamps, at most 30 days, else `null` |
|
|
86
|
+
| `tk`, `cost`, `models` | token totals, estimated cost, models used. A model is named only when it is an id of `cost-table.json`; any other id is sent as `other` |
|
|
87
|
+
| `os`, `cli`, `lang`, `stack`, `plug`, `apps`, `creds`, `calls`, `errs`, `v` | environment and credential-health summary, each from a closed list. `os` one of `macos`, `linux`, `windows`, `other`; `cli` one of `claude`, `codex`, `copilot`; `lang` one of the two `outputLanguage` codes `en`, `tr`; `stack` only the stacks the pipeline knows (`KNOWN_STACKS`). `plug` names a plugin only when it is one of the public plugins of the stack routing table (`ai-common-toolkit`, `ai-analyst-toolkit` and one `ai-<stack>-toolkit` per known stack), else `private`; the plugins installed on the machine do not matter. `apps` names a remote only from a closed set (`github`, `gitlab`, `bitbucket`, `azure`, `azure-devops`, `gitea`) and an MCP server only by its exact registered name from the shipped public list (below), else `private`. `creds` is `{on, svc, np}`: `on` the logical credential keys that are mapped, but a key is named only when `prefs.schema.json` documents it as a `keychainMapping` key; every other mapped name is folded into `private` and counted once in `np`; `svc` holds the last check per key as `{s, at}` with `s` one of `ok`, `fail` or `expired` (the worst among the folded keys for `private`) and `at` a complete ISO timestamp or `null`. `calls` lists the skills invoked as `<plugin>:<skill>` when the plugin is public and the skill is one the package ships (the generated skill list), `<plugin>:other` when the plugin is public and the skill is not on the list, `multi-agent:<command>` for a shipped command and `multi-agent:other` otherwise; a skill of any other plugin is `private`, a repo-local one `repo-local`, one of an unlisted marketplace fallback `marketplace-fallback`. `errs` holds the same closed codes as `hr` plus `phase-<n>-failed` (numeric phase ids only) and `run-failed`. `v` is the installed version in the one release shape, `<n>.<n>.<n>` (each at most three digits) with an optional `-rc.<n>`, `-beta.<n>` or `-alpha.<n>`; anything else, a leading `v` and any other prerelease text included, is `unknown`, and the same validator applies to `vf` and to every other body that carries a version |
|
|
88
|
+
| `tools` | optional, at most 40 `{n, k}` rows for the MCP tools one run called: `n` is `<server>:<tool>`, `k` the number of calls, capped at 9999, most used first. A server is named only by its exact registered name from the shipped public list (`lib/public-mcp-servers.mjs`: this product's own `multi-agent`, `claude_ai_Figma`, `figma`, `XcodeBuildMCP`); every other server, an internal service or a ticket-named helper, is sent as `private:private` with the tool dropped and the counts summed. A tool is named only when it is on the shipped tool list of its server, which exists for this product's own server (the generated `TOOLKIT_TOOLS`); any other tool of a public server is `<server>:other`. A private server deliberately registered under a public name is therefore counted as that public server with the tool `other`, which reveals nothing. The numbers are the run's own: the run's `telemetry.mcpCalls` and the counter delta below, the larger per name. Names and counts only; never arguments or results |
|
|
89
|
+
| `services` | the apps this machine is connected to, at most 40 `{name, kind, connected}` rows: each logical key of `keychainMapping` (`kind: "token"`, `connected` while it is mapped and its last `serviceStatus` check did not fail) and each MCP server registered with Claude Code (`~/.claude.json`, user and project scope) or Copilot CLI (`~/.copilot/mcp-config.json`) (`kind: "mcp"`). The same rules as `creds` and `apps` hold here: a credential name is sent only when `prefs.schema.json` documents it, an MCP server only by its exact registered name from the shipped public list; every other name is folded into one `{name: "private", kind, connected, n}` row per kind, `n` the number of distinct names folded in. Names only: never a credential value, a server config or a path; a missing or unreadable config adds nothing |
|
|
90
|
+
| `cmds` | which `/multi-agent` commands were typed on this machine since the last accepted send, at most 80 `{n, k}` rows: `n` the name of a command the package ships (the generated `SHIPPED_COMMANDS`) or the constant `other`, `k` an integer from 1 to 9999, most used first. The rows are deltas, not totals: the server adds them to what it holds for the machine, once per `cb` (below). A count above 9999 is sent as 9999 and the remainder goes in the next batch. An empty list means none were typed. Counted from the Claude Code `UserPromptSubmit` hook only (section 12); Copilot CLI and Codex have no counter, so their commands are not in it |
|
|
91
|
+
| `cb` | present only with a non-empty `cmds`: the id of that batch of counts, 16 lowercase hex characters from `crypto.randomBytes`, made when the batch is claimed and sent again, unchanged, with the same counts, whenever that batch is sent again. It is a random nonce; nothing on the machine is hashed into it. The server adds a batch to the machine's totals once per `cb`: when it has already stored a `cb` for the machine it answers as accepted without adding the counts again, so a reply that was lost does not double them |
|
|
92
|
+
| `health` | optional machine-health summary, `{generatedAt, overall, items: [{id, status, reason}]}`: one item per `health-report.mjs` section (`services`, `toolkit`, `install`, `sessions`, `autopilot`, `office`, `disk`, `gate`, `errors`; at most 30), `status` and `overall` one of `green`, `yellow`, `red`, `reason` the id of the section's message in `lib/health-messages.mjs` (for example `errors.recurring`), taken only from that catalogue's section families, otherwise `other`. No sentence and no message parameter (a service, host or branch name, a count) is sent; the panel renders the id in its own language. Read from a cache (`~/.claude/logs/multi-agent/usage-health.json`, 30-minute TTL). On a stale cache the event tries to create `usage-health.json.lock` exclusively with a random owner token; only when it gets the lock does it start a detached refresher (`usage-health.mjs --refresh --token <owner>`, never `--probe`) and wait for it, at most 5 seconds. An event waits only when it starts the refresh: one that finds the lock held sends at once without the field. A lock older than 3 minutes is taken over; a refresher exits at once when the lock is fresh and carries another token; a successful refresh removes the lock and a failed one rewrites it, so a failing report is retried at most every 3 minutes. The field is left out when no fresh summary is ready in time or anything fails; the panel then keeps the last one it had. `MULTI_AGENT_USAGE_HEALTH=cache` uses the cache without starting a refresher, `off` never sends the field |
|
|
52
93
|
|
|
53
94
|
`st` comes from the event when one is given (`--event`), otherwise from the
|
|
54
95
|
state file: `haltReason` or `paused` is halted, `awaiting_input` or a
|
|
55
96
|
`waitingFor` step is parked, `complete` is completed, anything else is in
|
|
56
97
|
progress.
|
|
57
98
|
|
|
99
|
+
**Transport.** Every send (the run record, the lifecycle record, registration
|
|
100
|
+
and its challenge, the access check, the failure beacon and feedback) goes
|
|
101
|
+
through `scripts/_http-post.mjs`: `node:https` with an explicit
|
|
102
|
+
`rejectUnauthorized: true` on the request and on a dedicated agent, which is
|
|
103
|
+
not the global one and so uses no environment proxy. The trust store is Node's
|
|
104
|
+
bundled roots plus the file `NODE_EXTRA_CA_CERTS` names, passed as `ca`;
|
|
105
|
+
`NODE_EXTRA_CA_CERTS` is the documented way to trust a corporate TLS-inspecting
|
|
106
|
+
CA. `NODE_TLS_REJECT_UNAUTHORIZED=0`, `SSL_CERT_FILE`, `SSL_CERT_DIR`,
|
|
107
|
+
`CURL_CA_BUNDLE` and `HTTPS_PROXY` do not change what is trusted or where the
|
|
108
|
+
token goes. A transport or certificate failure is reported as it is and is
|
|
109
|
+
never retried through another client: there is no curl fallback, because
|
|
110
|
+
`node:https` is part of every supported Node (`engines` is `>=20.11.0`).
|
|
111
|
+
Redirects are never followed, and plain http is allowed for a loopback address
|
|
112
|
+
only. `test/http-post.test.mjs` runs a child process for each variable against a
|
|
113
|
+
self-signed server.
|
|
114
|
+
|
|
115
|
+
**Timestamps.** Every timestamp a body carries (`t`, `t0`, `creds.svc.*.at`,
|
|
116
|
+
`health.generatedAt`, the lifecycle `t` and the feedback `at`) is written as UTC
|
|
117
|
+
ISO text rounded down to the minute, whatever offset or seconds it came with;
|
|
118
|
+
the seconds of a start time could be joined against public activity. Durations
|
|
119
|
+
(`du`, `phs[].du`) are computed from the full-precision instants, and
|
|
120
|
+
timestamps are compared as instants, never as text.
|
|
121
|
+
|
|
58
122
|
## 2. When it is sent
|
|
59
123
|
|
|
60
124
|
| Event | Where |
|
|
@@ -72,8 +136,10 @@ since when; prefs keep the last version reported (`usageLog.reportedVersion`).
|
|
|
72
136
|
When they differ, `usage-report.mjs --lifecycle` sends one record: `ev`
|
|
73
137
|
(`update` from the reported version; without one, `install` on a machine that
|
|
74
138
|
registered after the stamp and `update` from an unknown version on one that
|
|
75
|
-
registered before it), `v`, `vf`, `hs` (the host trees at that version
|
|
76
|
-
(the stamp time), and
|
|
139
|
+
registered before it), `v`, `vf`, `hs` (the host trees at that version, from
|
|
140
|
+
`claude`, `copilot`, `codex`), `t` (the stamp time), and `os` and `cli`; it carries
|
|
141
|
+
no login, and no record is sent when the installed version is not in the release
|
|
142
|
+
shape (`vf` is `null` for a reported version that is not), and moves `reportedVersion` forward once the server accepted
|
|
77
143
|
it. The id is derived from the version and the stamp time, so a resend replaces
|
|
78
144
|
the record. The installer starts it, detached, right after it writes the stamps
|
|
79
145
|
(`MULTI_AGENT_SKIP_USAGE_REPORT=1` turns that off); it also runs after a
|
|
@@ -86,6 +152,31 @@ The panel derives a run's status from the last event it received. A run still
|
|
|
86
152
|
is waiting on a person and is never shown as abandoned. The threshold is
|
|
87
153
|
`STALE_RUN_MS` on the server side.
|
|
88
154
|
|
|
155
|
+
**Calls from a phase document never wait.** The shell lines in the phase
|
|
156
|
+
documents pass `--detach` to `usage-report.mjs` (and `usage-register.mjs`): the
|
|
157
|
+
script starts a second copy of itself with the same arguments in its own
|
|
158
|
+
session, with no stdio, and returns at once, so a slow or unreachable endpoint
|
|
159
|
+
cannot hold a run. The copy knows it is the detached one and never detaches
|
|
160
|
+
again. The copy has a hard overall limit of 120 seconds: a small watchdog
|
|
161
|
+
process outside it polls for the copy and kills its whole process group when
|
|
162
|
+
the limit passes (every read inside the copy has its own timeout, but the sum is
|
|
163
|
+
not bounded and a blocked synchronous call cannot fire a timer of its own), then
|
|
164
|
+
leaves; it leaves at once when the copy ends first. The unattended guard refuses
|
|
165
|
+
`&` and subshells in documented lines, which is why the script does the
|
|
166
|
+
detaching. The Phase 0 line adds `--register-first`:
|
|
167
|
+
the detached process runs the quiet registration to its end, in the same
|
|
168
|
+
process, and only then reads prefs and the token and sends, so the first report
|
|
169
|
+
on a machine that has never registered goes out after the registration and
|
|
170
|
+
carries the token it stored. Registration keeps its own rules: it is a no-op
|
|
171
|
+
once a token resolves, off under `usageLog.optOut`, and `deferred` in a context
|
|
172
|
+
that cannot see the accounts.
|
|
173
|
+
|
|
174
|
+
**The endpoint is held to a host list on the ingest path too.** The ingest
|
|
175
|
+
token rides in a header, so a send goes out only to the endpoint's host when it
|
|
176
|
+
is the reporting site's own host or one in `usageLog.trustedHosts` over https,
|
|
177
|
+
or loopback over http. Anything else is `skipped` with `endpoint-not-allowed`
|
|
178
|
+
and nothing is sent. A 3xx answer is never followed.
|
|
179
|
+
|
|
89
180
|
## 3. The reporting identity
|
|
90
181
|
|
|
91
182
|
The login is the GitHub login of **the account on this machine that can read the
|
|
@@ -219,6 +310,14 @@ The proof depends on how the account was found:
|
|
|
219
310
|
with `{ "u", "c", "ssh": { "challenge", "signature" } }` and no
|
|
220
311
|
Authorization header.
|
|
221
312
|
|
|
313
|
+
- **The machine label.** `c` is never the host name. It is `m` plus 10 hex
|
|
314
|
+
characters: an HMAC-SHA256 of the short host name under the install secret,
|
|
315
|
+
with a label of its own, so the panel can tell one of a person's machines from
|
|
316
|
+
another and nothing else; the name cannot be recovered without the secret.
|
|
317
|
+
Without the secret it is the constant `unknown`. The server binds a label to
|
|
318
|
+
its row (a claim or rotation with a different label is refused), so a machine
|
|
319
|
+
that registered before the digest existed registers once more as a new row
|
|
320
|
+
after the upgrade.
|
|
222
321
|
- **declared**: no proof. `{ "u", "c", "claim": true }`, no Authorization header.
|
|
223
322
|
|
|
224
323
|
For a bearer, the server resolves the token to a GitHub login and refuses a
|
|
@@ -406,7 +505,7 @@ Every send attempt past the on-switch overwrites
|
|
|
406
505
|
`not-accepted` (the server answered but did not keep the record), `rejected`
|
|
407
506
|
(with the status code), `redirected` (with the host it pointed to; a redirect is
|
|
408
507
|
never followed, because the token would ride along), `failed` (network or
|
|
409
|
-
timeout), or `skipped` (`no-token`, `no-login`, `endpoint-not-allowed`). It
|
|
508
|
+
timeout), or `skipped` (`no-token`, `no-login`, `endpoint-not-allowed`, `run-key-unavailable`). It
|
|
410
509
|
carries the run id, the event and the endpoint host, never the token. The
|
|
411
510
|
phase-tracker ping discards the emitter's output, so `/multi-agent:doctor`
|
|
412
511
|
reads this file (check `usage-report`) and turns anything but `accepted` into a
|
|
@@ -443,10 +542,20 @@ passive collection is a choice, a message somebody typed to be read is not. So a
|
|
|
443
542
|
feedback run may register (`--feedback`) on a machine that opted out - and when it
|
|
444
543
|
does, it writes the credential-store entry and **leaves `usageLog.enabled` alone**.
|
|
445
544
|
The opt-out still holds for everything it was about; the person just gets their
|
|
446
|
-
message delivered.
|
|
545
|
+
message delivered. What it sends: the typed text (by design), `kind` (`bug`,
|
|
546
|
+
`idea` or `question`), `host` (`claude`, `copilot`, `codex` or `unknown`), `at`
|
|
547
|
+
(the time it was sent) and `v` in the release shape; the same rules as every
|
|
548
|
+
other body apply to the fields that are not the typed text.
|
|
447
549
|
|
|
448
550
|
## 6c. The access check
|
|
449
551
|
|
|
552
|
+
The access check is the one request that ignores `usageLog.optOut`. It does not
|
|
553
|
+
report anything about a run: it asks the owner of the reporting site whether
|
|
554
|
+
this login may use the pipeline, and the product cannot honour a block without
|
|
555
|
+
asking. It sends the login (or null) and the version in the release shape
|
|
556
|
+
(`unknown` otherwise), nothing else, and runs even for a machine that opted out
|
|
557
|
+
of reporting. `accessBody` in `usage-access.mjs` is the exact body.
|
|
558
|
+
|
|
450
559
|
Before a run does any work, its entry point runs `usage-access.mjs`: the
|
|
451
560
|
`/multi-agent` dispatcher for every route except `status`, `log` and `help`
|
|
452
561
|
(a task input, `jira`, `issue`, `resume`, `autopilot`, `kill`, `purge` and
|
|
@@ -497,10 +606,9 @@ host, and an `invitation` only on github.com.
|
|
|
497
606
|
|
|
498
607
|
It fails open: a network error, a timeout, a non-200 answer, a body without a
|
|
499
608
|
verdict or a refusal reason it does not know all let the run start. The
|
|
500
|
-
request has one 2-second deadline
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
at most; reading the token from the credential store comes before it. A `blocked` answer is kept in
|
|
609
|
+
request has one 2-second deadline, and there is one attempt: no second client
|
|
610
|
+
is tried after a failure; reading the token from the credential store comes
|
|
611
|
+
before it. A `blocked` answer is kept in
|
|
504
612
|
`~/.claude/logs/multi-agent/access-state.json` (mode 0600: the login, the time
|
|
505
613
|
and the owner's message, no token) and honoured for 7 days, for that login
|
|
506
614
|
only, while the site cannot be reached; a later answer for the same login that
|
|
@@ -577,9 +685,9 @@ Three rules keep a candidate honest:
|
|
|
577
685
|
- A slash command the user types expands in the prompt without a Skill tool
|
|
578
686
|
call, so the hook never sees it. Everything under `~/.claude/commands` is
|
|
579
687
|
reported as not observable and is never a candidate.
|
|
580
|
-
- A rename alias (a `SKILL.md` carrying `renamed-to:`)
|
|
581
|
-
|
|
582
|
-
|
|
688
|
+
- A rename alias (a `SKILL.md` carrying `renamed-to:`) left by an earlier
|
|
689
|
+
release is not listed, and a call under the old name counts as a use of the
|
|
690
|
+
skill it points at.
|
|
583
691
|
|
|
584
692
|
The office server room shows the 30-day counts (`GET /v1/server-room` `skills`,
|
|
585
693
|
local-only, never leaves this machine).
|
|
@@ -587,7 +695,7 @@ local-only, never leaves this machine).
|
|
|
587
695
|
Codex CLI has no Skill tool call to hook, it reads skill files directly, and the
|
|
588
696
|
pipeline installs no Copilot CLI hooks, so on those hosts nothing is counted.
|
|
589
697
|
|
|
590
|
-
## 10. Local MCP failures are not reporting
|
|
698
|
+
## 10. Local MCP failures and calls are not reporting
|
|
591
699
|
|
|
592
700
|
A third record stays on this machine too: `note-mcp-failure.sh`, a Claude Code
|
|
593
701
|
PostToolUseFailure hook on `mcp__.*` that `install` registers, appends one row
|
|
@@ -618,3 +726,123 @@ more failures there; `invalid-input`, `denied` and `interrupted` are the
|
|
|
618
726
|
caller's or the user's and never count toward it. Any `disk-full` row in the
|
|
619
727
|
window also lights INFO with `/multi-agent:clean-disk` as its step, whatever the
|
|
620
728
|
count, because a full disk fails every server at once.
|
|
729
|
+
|
|
730
|
+
`note-mcp-call.sh`, registered on PostToolUse for `mcp__.*` with `async: true`
|
|
731
|
+
(the host's hook schema defines `async`: if true, the hook runs in the background
|
|
732
|
+
without blocking), counts the calls that succeeded for the usage record's
|
|
733
|
+
`tools` field. It is read by usage reporting and, on the machine only, by `mcp-health.mjs` (`GET /v1/mcp-health`, the office server room), which never sends it. It is bash only and cannot
|
|
734
|
+
parse the preferences, so it never reads the opt-out from them. It writes
|
|
735
|
+
nothing unless the marker file `<log root>/mcp-counting-on` exists, is not a
|
|
736
|
+
symlink, and is not older than the preferences file. The marker is written, and
|
|
737
|
+
its time renewed, by `syncCountingSentinel` (in `note-mcp-failure.mjs`) with a
|
|
738
|
+
real JSON parser: at every `usage-report.mjs` run and in the failure hook, and
|
|
739
|
+
only while `usageLog.enabled` is true and neither `usageLog.optOut: true` nor
|
|
740
|
+
`mcpFailures.enabled: false` is set and the preferences parse; in every other
|
|
741
|
+
case it is removed. Any later edit of the preferences makes the marker older
|
|
742
|
+
than them, so an opt-out stops the hook at once; counting resumes when the next
|
|
743
|
+
report or failure hook renews the marker. A machine that has never reported has
|
|
744
|
+
no marker, so nothing is counted before the first report, which is also when a
|
|
745
|
+
run's base is written. The hook reads only the first 8 KiB of the payload, takes
|
|
746
|
+
`session_id`, `hook_event_name` and `tool_name` from it, accepts only a
|
|
747
|
+
`PostToolUse` event, a session id of `[A-Za-z0-9_-]` (8 to 64) and a tool name of
|
|
748
|
+
`mcp__[A-Za-z0-9_-]` (up to 100), and appends one line, `<session id> <tool
|
|
749
|
+
name>`, to `<log root>/mcp-calls.log` (owner-only, never through a symlink, no
|
|
750
|
+
more than 2 MiB). It does no counting, no JSON and no locking.
|
|
751
|
+
|
|
752
|
+
Counting stops being recorded the moment it is off: when `syncCountingSentinel`
|
|
753
|
+
finds it off (opt-out, `usageLog.enabled` false, `mcpFailures.enabled: false` or
|
|
754
|
+
preferences that do not parse), it also deletes `mcp-calls.log` and any leftover
|
|
755
|
+
of a fold and empties the counter's sessions and per-run bases, so calls seen
|
|
756
|
+
while it was off are never sent after it is turned back on. The hook reads only
|
|
757
|
+
the top-level keys of the payload (a depth-aware scan of the first 8 KiB); a
|
|
758
|
+
`session_id` or `tool_name` inside `tool_input` is not read.
|
|
759
|
+
|
|
760
|
+
The counting happens when a report is built. `foldCalls` moves the lines of
|
|
761
|
+
`mcp-calls.log` into `<log root>/mcp-calls.json` (the failure log's directory,
|
|
762
|
+
`LOGS_ROOT` honoured by the hook and by the report) under the counter file's lock.
|
|
763
|
+
The whole fold runs under that lock: the log is renamed, the renamed file and
|
|
764
|
+
any leftover of an interrupted fold are read, the counts added, the files
|
|
765
|
+
deleted and the counter written, so folds that run at the same time take turns
|
|
766
|
+
and never read the same lines. The counter key is `<server as registered>:<tool, lowercase>`. The same
|
|
767
|
+
switches stop it, with a real parser, and it also stays off
|
|
768
|
+
while the preferences file exists but does not parse. The file holds `{"v": 2,
|
|
769
|
+
"sessions": {"<host session id>": {"t": ..., "calls": {"<server>:<tool>": n}}},
|
|
770
|
+
"bases": {"<run id>": {"sid": ..., "calls": {...}}}}`. A call is counted under
|
|
771
|
+
the session that made it. A run's numbers are the session total minus the
|
|
772
|
+
counts the session had when the run was first reported (its base, written once,
|
|
773
|
+
by the report); a run never carries the machine's lifetime total. At most 200
|
|
774
|
+
names per session, a count capped at 1,000,000, and only the 20 newest sessions
|
|
775
|
+
and the 20 newest bases are kept. Nothing else about a call is read or stored.
|
|
776
|
+
|
|
777
|
+
Two limits of the numbers. A run that resumes in a new host session starts a
|
|
778
|
+
new session total, so its `tools` counts only the calls made since the report
|
|
779
|
+
that follows the resume and undercount the calls of the earlier session. A line
|
|
780
|
+
appended in the instant the fold replaces the log can be lost.
|
|
781
|
+
|
|
782
|
+
## 11. The local logs and their previous generation
|
|
783
|
+
|
|
784
|
+
`metrics.jsonl`, `errors-ledger.jsonl` and `session-notes.jsonl` are written
|
|
785
|
+
owner-only and move to a single `<name>.1` generation past 1 MiB. Every writer
|
|
786
|
+
rotates under the file's `<name>.lock` and reads the size again once it holds
|
|
787
|
+
it, so two writers that saw the same full file do not move the fresh one over
|
|
788
|
+
the generation the first made: the node writers and `run-write.mjs rotate`
|
|
789
|
+
(which `log-metric.sh` uses on both of its paths) take the same lock file, and
|
|
790
|
+
`note-session.sh` takes it with the same create-exclusive protocol. The first
|
|
791
|
+
write after an older version also makes an existing 0644 file owner-only.
|
|
792
|
+
Their readers (`aggregate-metrics`, `learning-curve`, `token-budget-report`,
|
|
793
|
+
`route-learn`, the health report's errors section and the office memory shelf)
|
|
794
|
+
read `.1` and then the current file through `lib/rotated-log.mjs`, so a
|
|
795
|
+
rotation does not cost them history and rows stay in the order they were
|
|
796
|
+
written.
|
|
797
|
+
|
|
798
|
+
## 12. Which commands are typed
|
|
799
|
+
|
|
800
|
+
A run only reports its own command (`c`). Commands that are not runs (`status`,
|
|
801
|
+
`doctor`, `office-on`, `help`, `route-status`, and so on) leave no run, so the
|
|
802
|
+
panel could not tell which commands are never used. `note-command-use.sh`, a
|
|
803
|
+
Claude Code `UserPromptSubmit` hook that `install` registers with `async: true`
|
|
804
|
+
(the prompt never waits for it) and `uninstall` removes with its script, counts
|
|
805
|
+
them.
|
|
806
|
+
|
|
807
|
+
What the host sends: the payload carries the typed prompt in the top-level
|
|
808
|
+
`prompt` key beside `hook_event_name` (`UserPromptSubmit`), `session_id`,
|
|
809
|
+
`transcript_path`, `cwd` and `prompt_id`. For a slash command it is the text as
|
|
810
|
+
typed, `/multi-agent:<name> <arguments>` or `/multi-agent <name>`, with the
|
|
811
|
+
arguments in it; this was captured from a real `claude -p` run with a capture
|
|
812
|
+
hook, for both spellings.
|
|
813
|
+
|
|
814
|
+
What the hook keeps: a prompt counts only when its first token is
|
|
815
|
+
`/multi-agent:<name>`, or when it is `/multi-agent` followed by a shipped
|
|
816
|
+
command name. The name is looked up in the shipped list
|
|
817
|
+
(`lib/usage-names.generated.mjs`); a shipped name is appended to
|
|
818
|
+
`<log root>/cmd-calls.log`, and a colon-form name that is not on the list is
|
|
819
|
+
appended as `other`. A `/multi-agent <word>` whose word is not a shipped command
|
|
820
|
+
is free text for the dispatcher, not a command name, and is not counted. Nothing
|
|
821
|
+
else is read past the first two tokens or stored: no argument, no text, no
|
|
822
|
+
length, no time. It reads the first 8 KiB of the payload and scans only the
|
|
823
|
+
top-level `hook_event_name` and `prompt` keys (a `prompt` inside a nested object
|
|
824
|
+
is never read), starts no node process, appends one short line (atomic, owner-
|
|
825
|
+
only file, never through a symlink, no more than 1 MiB until it is folded),
|
|
826
|
+
prints nothing and exits 0 on every path.
|
|
827
|
+
|
|
828
|
+
When it is off: it writes nothing unless the marker `<log root>/cmd-counting-on`
|
|
829
|
+
exists, is not a symlink, and is not older than the preferences file. The marker
|
|
830
|
+
is written, and its time renewed, by `syncCommandSentinel` (in
|
|
831
|
+
`note-command-use.mjs`, called from `syncCountingSentinel`, so at every
|
|
832
|
+
`usage-report.mjs` run and in the failure hook) with a real JSON parser, only
|
|
833
|
+
while `usageLog.enabled` is true, `usageLog.optOut` is not and the preferences
|
|
834
|
+
parse; otherwise it is removed and the log and the counter are emptied, so what
|
|
835
|
+
was typed while counting was off is never sent after it is turned back on. This
|
|
836
|
+
counter has its own switches and does not depend on `mcpFailures.enabled`.
|
|
837
|
+
|
|
838
|
+
How it travels: `cmds` rides on the run record, which is the periodic send, not
|
|
839
|
+
on a request of its own. The counter `cmd-counts.json` holds `pending` counts
|
|
840
|
+
and one `inflight` batch. Everything that changes it, the fold of the log
|
|
841
|
+
included, runs under the file's lock. A send claims the pending counts as one
|
|
842
|
+
batch with an id; while that batch is out no other sender is handed it;
|
|
843
|
+
the batch is cleared when the server accepted the record, made available again
|
|
844
|
+
when it did not, and offered again by itself after 10 minutes if no sender
|
|
845
|
+
answered, with the same id and the same counts; what was typed in between waits
|
|
846
|
+
for the next batch. A dry run only looks. A sender that is killed after the
|
|
847
|
+
server accepted its record but before it acknowledged re-sends that one batch
|
|
848
|
+
once, and the server, seeing the same `cb`, does not add it a second time.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- facts: commandCount="commands" toolCount="tools, most for a RUNNING app" -->
|
|
4
4
|
```
|
|
5
|
-
Multi-Agent Pipeline -
|
|
5
|
+
Multi-Agent Pipeline - 80 commands, grouped by what you want to do
|
|
6
6
|
|
|
7
7
|
Start here:
|
|
8
8
|
|
|
@@ -92,6 +92,7 @@ Office
|
|
|
92
92
|
/multi-agent:office-on Open the office: live runs, PRs, keys, jobs
|
|
93
93
|
/multi-agent:office-status Is the office running, its URL, last actions
|
|
94
94
|
/multi-agent:office-off Stop the office server
|
|
95
|
+
/multi-agent:pair Pair a phone, or list, revoke and switch off pairings (off by default)
|
|
95
96
|
/multi-agent:serve Local contract server for a client app
|
|
96
97
|
|
|
97
98
|
Models and routing
|
|
@@ -156,7 +157,7 @@ Access and usage reporting
|
|
|
156
157
|
Plugins and tools (call them directly)
|
|
157
158
|
|
|
158
159
|
Stack plugins ai-<stack>-toolkit:<skill>; catalog: ai-<stack>-toolkit:help
|
|
159
|
-
Toolkit MCP multi-agent:
|
|
160
|
+
Toolkit MCP multi-agent: 258 tools, most for a RUNNING app:
|
|
160
161
|
ios_*, android_*, web_*, design_*, store_*, the audits.
|
|
161
162
|
Not registered means a silent no-op.
|
|
162
163
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- facts: commandCount="komut" toolCount="araç, çoğu" -->
|
|
4
4
|
```
|
|
5
|
-
Multi-Agent Pipeline -
|
|
5
|
+
Multi-Agent Pipeline - 80 komut, ne yapmak istediğine göre gruplu
|
|
6
6
|
|
|
7
7
|
Buradan başla:
|
|
8
8
|
|
|
@@ -92,6 +92,7 @@ Ofis
|
|
|
92
92
|
/multi-agent:office-on Ofisi aç: canlı koşular, PR'lar, anahtarlar, işler
|
|
93
93
|
/multi-agent:office-status Ofis çalışıyor mu, adresi, son işlemleri
|
|
94
94
|
/multi-agent:office-off Ofis sunucusunu durdur
|
|
95
|
+
/multi-agent:pair Telefon eşle; eşleşmeleri listele, kaldır, kapat (varsayılan kapalı)
|
|
95
96
|
/multi-agent:serve İstemci uygulama için yerel sözleşme sunucusu
|
|
96
97
|
|
|
97
98
|
Modeller ve yönlendirme
|
|
@@ -156,7 +157,7 @@ Erişim ve kullanım raporu
|
|
|
156
157
|
Plugin'ler ve araçlar (doğrudan çağır)
|
|
157
158
|
|
|
158
159
|
Stack plugin ai-<stack>-toolkit:<skill>; katalog: ai-<stack>-toolkit:help
|
|
159
|
-
Toolkit MCP multi-agent:
|
|
160
|
+
Toolkit MCP multi-agent: 258 araç, çoğu ÇALIŞAN uygulama için:
|
|
160
161
|
ios_*, android_*, web_*, design_*, store_*, denetimler.
|
|
161
162
|
Kayıtlı değilse sessizce hiçbir şey yapmaz.
|
|
162
163
|
|
|
@@ -230,7 +230,7 @@ Phase 3: Review (CLI-aware parallel + triage)
|
|
|
230
230
|
|
|
231
231
|
### Context-Aware Agent Prompting
|
|
232
232
|
|
|
233
|
-
When launching review agents in Phase
|
|
233
|
+
When launching review agents in Phase 3, include:
|
|
234
234
|
|
|
235
235
|
```
|
|
236
236
|
"Review this diff for {task-id}. Focus areas based on analysis:
|
|
@@ -144,8 +144,8 @@ The full action descriptions for the routing rows the dispatcher keeps short.
|
|
|
144
144
|
|
|
145
145
|
## Agent definitions
|
|
146
146
|
|
|
147
|
-
**Agent definitions** (used in Phase 1 and Phase
|
|
148
|
-
- `$HOME/.claude/agents/code-reviewer.md` - Phase 3 reviewer persona (`preferredModel: fable`; Phase
|
|
147
|
+
**Agent definitions** (used in Phase 1 and Phase 3):
|
|
148
|
+
- `$HOME/.claude/agents/code-reviewer.md` - Phase 3 reviewer persona (`preferredModel: fable`; Phase 3 overrides Reviewer 3 to `sonnet`)
|
|
149
149
|
- `$HOME/.claude/agents/explorer.md` - Phase 1 codebase scan persona (`preferredModel: sonnet` - scan work, cost-efficient)
|
|
150
150
|
- `$HOME/.claude/agents/ios-architect.md` - iOS architecture review (`preferredModel: fable`)
|
|
151
151
|
- `$HOME/.claude/agents/android-architect.md` - Android architecture review (`preferredModel: fable`)
|
|
@@ -141,7 +141,7 @@ that) is the last-resort ceiling for a PID that has been recycled.
|
|
|
141
141
|
**Halt visibility (required, autopilot included).** A halt is never silent. Whenever a phase halts on a hard error (validator failed twice, no subagent returned, dispatch error past fallback, lock irrecoverable), in addition to the `agent-log.md` line: (a) write `state.status = "paused"` and `state.haltReason = "<phase>:<cause>"`; (b) record the cause on the tracker via `phase-tracker.sh meta <phase> halt "<cause>"` and `phase-tracker.sh update <phase> failed`; (c) emit one `>&2` alert line `HALT phase <N>: <cause> - resume with /multi-agent:resume #<id>`; (d) if `prefs.global.usageLog.enabled` is true, emit the end-of-run report so a run that never reaches Phase 5 is still recorded with the phase it stopped at (`state.currentPhase` + `haltReason`) - the emitter no-ops when it is off or unconfigured:
|
|
142
142
|
|
|
143
143
|
```bash
|
|
144
|
-
node $HOME/.claude/scripts/usage-report.mjs --task-id "$TASK_ID" --event halted >/dev/null 2>&1 || true
|
|
144
|
+
node $HOME/.claude/scripts/usage-report.mjs --task-id "$TASK_ID" --event halted --detach >/dev/null 2>&1 || true
|
|
145
145
|
```
|
|
146
146
|
|
|
147
147
|
**Stopping mid-phase is held by a hook.** On Claude Code, `run-stop-guard.sh` (Stop, `install/templates/claude-hooks.json`) blocks the session driving a run from ending its turn while `status` is `in_progress`, `currentPhase` is below the mode's last phase (`schemas/phases.json`) and neither `haltReason` nor `waitingFor` is set. Its reason says to finish the current phase, record the wait, or write the halt above. Only a run bound to the session counts: `sessionId` (MULTI_AGENT_SESSION_ID) or `hostSessionId`, which `write-state.mjs` stamps on every write that sets `currentPhase`. A turn that ends on a question to the user, a session with background tasks or crons, a subagent's stop and `prefs.global.stopGuard.enabled: false` are never held. After three consecutive blocks the hook writes `haltReason: "<phase>:stop-guard: ..."` itself and lets the session stop; the next write that advances `currentPhase` clears that halt and restores `in_progress`.
|
|
@@ -164,7 +164,7 @@ A question asked through the native picker is a tool call and needs neither.
|
|
|
164
164
|
**Park visibility.** A run that stops to wait for a person (`state.status = "awaiting_input"`, or `state.waitingFor` set: a maturity decision, an open question, the channels choice) emits the same report with `--event parked` right after the state write, so the panel shows it as waiting rather than abandoned:
|
|
165
165
|
|
|
166
166
|
```bash
|
|
167
|
-
node $HOME/.claude/scripts/usage-report.mjs --task-id "$TASK_ID" --event parked >/dev/null 2>&1 || true
|
|
167
|
+
node $HOME/.claude/scripts/usage-report.mjs --task-id "$TASK_ID" --event parked --detach >/dev/null 2>&1 || true
|
|
168
168
|
```
|
|
169
169
|
|
|
170
170
|
Autopilot suppresses *confirmations*, not *halts* - the user must always be able to see why an unattended run stopped without reading the log. The endpoint upserts by run id, so this halt record and a later Phase 5 record (after resume) collapse into one.
|
|
@@ -714,20 +714,21 @@ Phase 0 owns `agent-state.json`. Do not call
|
|
|
714
714
|
|
|
715
715
|
```bash
|
|
716
716
|
node "$HOME/.claude/scripts/phase0-exit-gate.mjs" "$TASK_ID" --input "$ORIGINAL_INPUT"
|
|
717
|
-
node "$HOME/.claude/scripts/usage-
|
|
718
|
-
node "$HOME/.claude/scripts/usage-report.mjs" --task-id "$TASK_ID" --phase 0 --event phase >/dev/null 2>&1 || true
|
|
717
|
+
node "$HOME/.claude/scripts/usage-report.mjs" --task-id "$TASK_ID" --phase 0 --event phase --register-first --detach >/dev/null 2>&1 || true
|
|
719
718
|
```
|
|
720
719
|
|
|
721
|
-
The
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
720
|
+
The second line returns at once: `--detach` hands it to a detached process, so
|
|
721
|
+
reporting never delays the run, and `--register-first` makes that process run
|
|
722
|
+
`usage-register.mjs --quiet` to its end before it sends, so the first report on
|
|
723
|
+
a machine that has never registered finds its token. It reports the run as
|
|
724
|
+
started; every later phase transition, completion, halt and park upserts the
|
|
725
|
+
same key (`features/usage-reporting.md`). The registration is the backstop for a
|
|
726
|
+
machine that reached neither setup nor update - a no-op once a token resolves,
|
|
727
|
+
and permanently so under `usageLog.optOut`. In a context that cannot see the
|
|
728
|
+
machine's GitHub accounts (an unattended sandbox) it records `deferred` and
|
|
729
|
+
changes nothing; a token the server stops accepting is replaced by the emitter
|
|
730
|
+
itself on the first 401 (`features/usage-reporting.md`, "A rejected token heals
|
|
731
|
+
itself").
|
|
731
732
|
|
|
732
733
|
It asserts five things:
|
|
733
734
|
|