@jaggerxtrm/specialists 3.17.0 → 3.18.1
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/README.md +268 -134
- package/config/mandatory-rules/executor-delivery.md +4 -0
- package/config/mandatory-rules/json-only-final-output.md +13 -0
- package/config/mandatory-rules/service-skills-diff-scan-mandatory.md +26 -0
- package/config/mandatory-rules/service-skills-gitnexus-triage.md +5 -0
- package/config/mandatory-rules/test-runner-execution-scope.md +4 -0
- package/config/skills/setup-specialists/SKILL.md +556 -0
- package/config/skills/specialists-creator/SKILL.md +132 -4
- package/config/skills/specialists-creator/scripts/audit-spec-uniformity.mjs +1 -1
- package/config/skills/using-specialists-v3/SKILL.md +80 -20
- package/config/specialists/bare.specialist.json +3 -3
- package/config/specialists/changelog-drafter.specialist.json +5 -4
- package/config/specialists/changelog-keeper.specialist.json +7 -6
- package/config/specialists/debugger.specialist.json +2 -2
- package/config/specialists/executor.specialist.json +2 -2
- package/config/specialists/explorer.specialist.json +4 -4
- package/config/specialists/memory-processor.specialist.json +3 -3
- package/config/specialists/node-coordinator.specialist.json +3 -3
- package/config/specialists/obligations-scanner.specialist.json +67 -17
- package/config/specialists/overthinker.specialist.json +3 -3
- package/config/specialists/planner.specialist.json +4 -4
- package/config/specialists/quant-methodologist.specialist.json +145 -0
- package/config/specialists/quant-researcher.specialist.json +144 -0
- package/config/specialists/researcher.specialist.json +5 -5
- package/config/specialists/reviewer.specialist.json +1 -1
- package/config/specialists/seconder.specialist.json +2 -2
- package/config/specialists/security-auditor.specialist.json +2 -2
- package/config/specialists/service-skills-sync.specialist.json +90 -75
- package/config/specialists/specialists-creator.specialist.json +4 -4
- package/config/specialists/sync-docs.specialist.json +4 -4
- package/config/specialists/test-engineer.specialist.json +3 -3
- package/config/specialists/test-runner.specialist.json +7 -7
- package/config/specialists/transcriber.specialist.json +3 -3
- package/config/specialists/xt-merge.specialist.json +4 -4
- package/dist/asset-contract.json +22 -3
- package/dist/index.js +28711 -18517
- package/dist/lib.js +10020 -6150
- package/dist/types/cli/console/components.d.ts +83 -0
- package/dist/types/cli/console/components.d.ts.map +1 -0
- package/dist/types/cli/console/config-source.d.ts +58 -0
- package/dist/types/cli/console/config-source.d.ts.map +1 -0
- package/dist/types/cli/console/forensic.d.ts +11 -0
- package/dist/types/cli/console/forensic.d.ts.map +1 -0
- package/dist/types/cli/console/git.d.ts +28 -0
- package/dist/types/cli/console/git.d.ts.map +1 -0
- package/dist/types/cli/console/help.d.ts +2 -0
- package/dist/types/cli/console/help.d.ts.map +1 -0
- package/dist/types/cli/console/log.d.ts +13 -0
- package/dist/types/cli/console/log.d.ts.map +1 -0
- package/dist/types/cli/console/repo-config.d.ts +26 -0
- package/dist/types/cli/console/repo-config.d.ts.map +1 -0
- package/dist/types/cli/console/repo-discovery.d.ts +12 -0
- package/dist/types/cli/console/repo-discovery.d.ts.map +1 -0
- package/dist/types/cli/console/runtime.d.ts +12 -0
- package/dist/types/cli/console/runtime.d.ts.map +1 -0
- package/dist/types/cli/console/subscribe-prototype.d.ts +18 -0
- package/dist/types/cli/console/subscribe-prototype.d.ts.map +1 -0
- package/dist/types/cli/console/theme.d.ts +91 -0
- package/dist/types/cli/console/theme.d.ts.map +1 -0
- package/dist/types/cli/console/types.d.ts +231 -0
- package/dist/types/cli/console/types.d.ts.map +1 -0
- package/dist/types/cli/console/view-model.d.ts +252 -0
- package/dist/types/cli/console/view-model.d.ts.map +1 -0
- package/dist/types/cli/console.d.ts +2 -0
- package/dist/types/cli/console.d.ts.map +1 -0
- package/dist/types/cli/db.d.ts.map +1 -1
- package/dist/types/cli/doctor.d.ts.map +1 -1
- package/dist/types/cli/edit.d.ts.map +1 -1
- package/dist/types/cli/epic.d.ts.map +1 -1
- package/dist/types/cli/feed.d.ts.map +1 -1
- package/dist/types/cli/forensic.d.ts +2 -0
- package/dist/types/cli/forensic.d.ts.map +1 -0
- package/dist/types/cli/format-helpers.d.ts +4 -2
- package/dist/types/cli/format-helpers.d.ts.map +1 -1
- package/dist/types/cli/help.d.ts.map +1 -1
- package/dist/types/cli/init.d.ts +10 -0
- package/dist/types/cli/init.d.ts.map +1 -1
- package/dist/types/cli/list.d.ts.map +1 -1
- package/dist/types/cli/log.d.ts.map +1 -1
- package/dist/types/cli/merge.d.ts.map +1 -1
- package/dist/types/cli/metrics.d.ts +2 -0
- package/dist/types/cli/metrics.d.ts.map +1 -0
- package/dist/types/cli/ps.d.ts.map +1 -1
- package/dist/types/cli/result.d.ts.map +1 -1
- package/dist/types/cli/run.d.ts +20 -0
- package/dist/types/cli/run.d.ts.map +1 -1
- package/dist/types/cli/script.d.ts +3 -0
- package/dist/types/cli/script.d.ts.map +1 -1
- package/dist/types/cli/serve.d.ts.map +1 -1
- package/dist/types/cli/setup.d.ts +19 -1
- package/dist/types/cli/setup.d.ts.map +1 -1
- package/dist/types/cli/status.d.ts.map +1 -1
- package/dist/types/cli/version-check.d.ts +1 -0
- package/dist/types/cli/version-check.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/pi/session.d.ts +12 -1
- package/dist/types/pi/session.d.ts.map +1 -1
- package/dist/types/server.d.ts +15 -0
- package/dist/types/server.d.ts.map +1 -1
- package/dist/types/specialist/benchmarks.d.ts +37 -0
- package/dist/types/specialist/benchmarks.d.ts.map +1 -0
- package/dist/types/specialist/chain-identity.d.ts +7 -1
- package/dist/types/specialist/chain-identity.d.ts.map +1 -1
- package/dist/types/specialist/control.d.ts.map +1 -1
- package/dist/types/specialist/dead-job-audit.d.ts +20 -0
- package/dist/types/specialist/dead-job-audit.d.ts.map +1 -0
- package/dist/types/specialist/forensic-events.d.ts +138 -0
- package/dist/types/specialist/forensic-events.d.ts.map +1 -0
- package/dist/types/specialist/forensic-renderer.d.ts +34 -0
- package/dist/types/specialist/forensic-renderer.d.ts.map +1 -0
- package/dist/types/specialist/git-diff-evidence.d.ts +28 -0
- package/dist/types/specialist/git-diff-evidence.d.ts.map +1 -0
- package/dist/types/specialist/global-config.d.ts +389 -0
- package/dist/types/specialist/global-config.d.ts.map +1 -0
- package/dist/types/specialist/launch.d.ts +9 -0
- package/dist/types/specialist/launch.d.ts.map +1 -1
- package/dist/types/specialist/live-aggregates.d.ts +46 -0
- package/dist/types/specialist/live-aggregates.d.ts.map +1 -0
- package/dist/types/specialist/loader.d.ts +50 -1
- package/dist/types/specialist/loader.d.ts.map +1 -1
- package/dist/types/specialist/model-chain.d.ts +7 -0
- package/dist/types/specialist/model-chain.d.ts.map +1 -0
- package/dist/types/specialist/model-probes.d.ts +28 -0
- package/dist/types/specialist/model-probes.d.ts.map +1 -0
- package/dist/types/specialist/node-contract.d.ts +18 -18
- package/dist/types/specialist/node-supervisor.d.ts.map +1 -1
- package/dist/types/specialist/observability-db.d.ts +1 -1
- package/dist/types/specialist/observability-db.d.ts.map +1 -1
- package/dist/types/specialist/observability-sqlite.d.ts +101 -0
- package/dist/types/specialist/observability-sqlite.d.ts.map +1 -1
- package/dist/types/specialist/pr-drift-refresh.d.ts +17 -0
- package/dist/types/specialist/pr-drift-refresh.d.ts.map +1 -0
- package/dist/types/specialist/preset-resolver.d.ts +56 -0
- package/dist/types/specialist/preset-resolver.d.ts.map +1 -0
- package/dist/types/specialist/prometheus-projection.d.ts +25 -0
- package/dist/types/specialist/prometheus-projection.d.ts.map +1 -0
- package/dist/types/specialist/runner.d.ts +29 -1
- package/dist/types/specialist/runner.d.ts.map +1 -1
- package/dist/types/specialist/schema.d.ts +163 -54
- package/dist/types/specialist/schema.d.ts.map +1 -1
- package/dist/types/specialist/script-runner.d.ts +5 -1
- package/dist/types/specialist/script-runner.d.ts.map +1 -1
- package/dist/types/specialist/snapshot-diff.d.ts +8 -0
- package/dist/types/specialist/snapshot-diff.d.ts.map +1 -0
- package/dist/types/specialist/source-queue.d.ts +13 -0
- package/dist/types/specialist/source-queue.d.ts.map +1 -0
- package/dist/types/specialist/status-load.d.ts.map +1 -1
- package/dist/types/specialist/supervisor.d.ts +25 -1
- package/dist/types/specialist/supervisor.d.ts.map +1 -1
- package/dist/types/specialist/timeline-events.d.ts +70 -1
- package/dist/types/specialist/timeline-events.d.ts.map +1 -1
- package/dist/types/tools/specialist/resume_specialist.tool.d.ts +4 -4
- package/dist/types/tools/specialist/specialist_status.tool.d.ts +1 -1
- package/dist/types/tools/specialist/steer_specialist.tool.d.ts +4 -4
- package/dist/types/tools/specialist/use_specialist.tool.d.ts +16 -16
- package/docs/ARCHITECTURE.md +1176 -0
- package/docs/TODO.md +9 -0
- package/docs/architecture.md +11 -0
- package/docs/archive/2026-03-13-bd-decision-context-template-plan.md +96 -0
- package/docs/archive/AGENT-HANDOFF.md +351 -0
- package/docs/archive/PARITY-ANALYSIS.md +296 -0
- package/docs/archive/SPECIALISTS_REFACTOR.md.md +30 -0
- package/docs/archive/cc-programmatic.md +216 -0
- package/docs/archive/claude-agent-sdk.md +594 -0
- package/docs/archive/decision-specialist-directory.md +41 -0
- package/docs/archive/discoveries.md +148 -0
- package/docs/archive/executor-benchmark-protocol.md +198 -0
- package/docs/archive/future-features.md +66 -0
- package/docs/archive/gzrx-completion-critique.md +183 -0
- package/docs/archive/gzrx-research-notes.md +401 -0
- package/docs/archive/gzrx-tool-catalog.md +760 -0
- package/docs/archive/iron-review-hardening-qa-chain-substrate.md +322 -0
- package/docs/archive/iron-review-hardening.html +1004 -0
- package/docs/archive/issuetracking.md +312 -0
- package/docs/archive/qa-v3.0.2.md +220 -0
- package/docs/archive/restructure.md +231 -0
- package/docs/archive/script-specialists.md +1254 -0
- package/docs/archive/spec-v3.md +792 -0
- package/docs/archive/specialist-stats.md +127 -0
- package/docs/archive/specialists-friction-audit.md +1347 -0
- package/docs/archive/specialists-runtime-critique.md +170 -0
- package/docs/archive/specialists-service-evaluation.md +713 -0
- package/docs/archive/specialists-substrate-alignment.md +255 -0
- package/docs/archive/substrate-review.md +1288 -0
- package/docs/archive/test-writer-specialist.md +254 -0
- package/docs/archive/using-specialists-v3-improvements-2026-05-09.md +600 -0
- package/docs/archive/xtrm-specialists-analysis.md +314 -0
- package/docs/authoring.md +701 -0
- package/docs/background-jobs.md +203 -0
- package/docs/bare-specialists.md +83 -0
- package/docs/benchmarks/executor-benchmark-runner.md +66 -0
- package/docs/bootstrap.md +161 -0
- package/docs/cli-reference.md +1645 -0
- package/docs/deploying-alongside.md +155 -0
- package/docs/design/README.md +36 -0
- package/docs/design/darth-feedor-migration.md +290 -0
- package/docs/design/roadmap/README.md +32 -0
- package/docs/design/roadmap/chain-templates/README.md +146 -0
- package/docs/design/roadmap/chain-templates/code-quick.formula.json +27 -0
- package/docs/design/roadmap/chain-templates/code-standard.formula.json +126 -0
- package/docs/design/roadmap/chain-templates/code-with-advisors.formula.json +128 -0
- package/docs/design/roadmap/chain-templates/code-with-tests.formula.json +76 -0
- package/docs/design/roadmap/chain-templates/debug.formula.json +128 -0
- package/docs/design/roadmap/chain-templates/doc-sync.formula.json +28 -0
- package/docs/design/roadmap/chain-templates/memory-hygiene.formula.json +27 -0
- package/docs/design/roadmap/chain-templates/planning.formula.json +27 -0
- package/docs/design/roadmap/chain-templates/premortem.formula.json +26 -0
- package/docs/design/roadmap/chain-templates/release-prep.formula.json +36 -0
- package/docs/design/roadmap/chain-templates/research-only.formula.json +28 -0
- package/docs/design/roadmap/chain-templates/restitch.formula.json +125 -0
- package/docs/design/roadmap/chain-templates/security-deep.formula.json +161 -0
- package/docs/design/roadmap/chain-templates/test-only.formula.json +52 -0
- package/docs/design/roadmap/chain-templates/triage.formula.json +35 -0
- package/docs/design/roadmap/history/handoff-from-substrate-design.md +87 -0
- package/docs/design/roadmap/history/substrate-reconciliation.md +105 -0
- package/docs/design/roadmap/specialists-roadmap.md +1261 -0
- package/docs/design/sp-console-subscribe-via-materializer.md +231 -0
- package/docs/design/sp-console-tui-mock-v2.html +293 -0
- package/docs/design/sp-console-tui-mock.html +120 -0
- package/docs/design/sp-console-tui.md +340 -0
- package/docs/design/specialist-agentops-suite.md +323 -0
- package/docs/design/substrate/channels.md +14 -0
- package/docs/design/substrate/devops-platform-engineering-prd.md +446 -0
- package/docs/design/substrate/html-design-example.md +339 -0
- package/docs/design/xtrm-tiers-architecture.svg +132 -0
- package/docs/devops/dependency-verdict-materialization.md +46 -0
- package/docs/epic-readiness.md +75 -0
- package/docs/examples/mercury-atomic-summarizer.specialist.json +26 -0
- package/docs/examples/smoke-echo-text-expected-keys.specialist.json +25 -0
- package/docs/examples/smoke-echo.specialist.json +25 -0
- package/docs/features.md +1577 -0
- package/docs/hooks.md +81 -0
- package/docs/installation.md +142 -0
- package/docs/manifest.md +184 -0
- package/docs/mcp-servers.md +73 -0
- package/docs/mcp-tools.md +71 -0
- package/docs/nodes.md +231 -0
- package/docs/observability-metrics.md +152 -0
- package/docs/operator/sp-console-v2-walkthrough.md +410 -0
- package/docs/overrides-guide.md +306 -0
- package/docs/pi-rpc-boundary.md +118 -0
- package/docs/pi-session.md +195 -0
- package/docs/release.md +22 -0
- package/docs/skills.md +132 -0
- package/docs/specialists/handoff-schema.md +181 -0
- package/docs/specialists-catalog.md +99 -0
- package/docs/specialists-service-install.md +226 -0
- package/docs/specialists-service.md +363 -0
- package/docs/surface-ownership.md +138 -0
- package/docs/upgrade-notes/kan-90-global-user-config.md +114 -0
- package/docs/upgrade-notes/kan-91-expanded-overrides.md +261 -0
- package/docs/workflow.md +114 -0
- package/docs/worktree.md +71 -0
- package/docs/worktrees.md +309 -0
- package/package.json +7 -4
package/docs/nodes.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Nodes: CLI-native coordinator, runtime architecture, and operator flow
|
|
2
|
+
|
|
3
|
+
## Doc contract
|
|
4
|
+
|
|
5
|
+
- **Source of truth:**
|
|
6
|
+
- `src/specialist/node-contract.ts`
|
|
7
|
+
- `src/specialist/node-supervisor.ts`
|
|
8
|
+
- `src/specialist/job-control.ts`
|
|
9
|
+
- `src/cli/node.ts`
|
|
10
|
+
- `src/specialist/observability-sqlite.ts`
|
|
11
|
+
- **Drift rule:** update this doc in the same change whenever node contract, lifecycle, or `sp node` CLI behavior changes.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 1) Architecture
|
|
16
|
+
|
|
17
|
+
Node execution is split into three roles:
|
|
18
|
+
|
|
19
|
+
- **Coordinator specialist (LOW permission):** CLI-native orchestrator.
|
|
20
|
+
- **NodeSupervisor:** effect executor and lifecycle authority.
|
|
21
|
+
- **Members:** worker specialists managed by NodeSupervisor.
|
|
22
|
+
|
|
23
|
+
Coordinator decides *what to do next* and does so by calling `sp node` commands. NodeSupervisor executes, persists state, and enforces lifecycle semantics.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 2) Coordinator behavior (CLI-native)
|
|
28
|
+
|
|
29
|
+
The coordinator no longer emits a JSON orchestration schema as its control output.
|
|
30
|
+
|
|
31
|
+
Instead it:
|
|
32
|
+
1. Calls `sp node ... --json` commands,
|
|
33
|
+
2. Reads structured responses,
|
|
34
|
+
3. Issues follow-up commands,
|
|
35
|
+
4. Uses `wait-phase` as the phase barrier,
|
|
36
|
+
5. Calls `complete` when node goals are satisfied.
|
|
37
|
+
|
|
38
|
+
### Required command set
|
|
39
|
+
|
|
40
|
+
- `sp node spawn-member --node $NODE_ID --member-key <key> --specialist <name> [--bead <id>] [--phase <id>] [--json]`
|
|
41
|
+
- `sp node create-bead --node $NODE_ID --title '...' [--type task] [--priority 2] [--depends-on <id>] [--json]`
|
|
42
|
+
- `sp node complete --node $NODE_ID --strategy <pr|manual> [--json]`
|
|
43
|
+
- `sp node wait-phase --node $NODE_ID --phase <id> --members <k1,k2,...> [--json]`
|
|
44
|
+
- `sp ps` (or `sp ps --node <id>` when available) for node snapshot/status
|
|
45
|
+
- `sp feed --node <id> [--json]` for node event stream
|
|
46
|
+
- `sp steer <coordinator-job-id> "..."` for coordinator steering
|
|
47
|
+
- `sp attach <coordinator-job-id>` for coordinator attach
|
|
48
|
+
- `sp result <node-ref>:<member-key>` for member result retrieval
|
|
49
|
+
|
|
50
|
+
Node refs accept any unique prefix (e.g. `research`, `research-5eaf`, or full ID).
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 3) CLI command reference
|
|
55
|
+
|
|
56
|
+
| Command | Purpose | Typical usage |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| `sp ps` | Read node snapshot and job health | Before and after every orchestration step |
|
|
59
|
+
| `sp node spawn-member` | Start a member for a phase/task | Launch explore/impl/review workers |
|
|
60
|
+
| `sp node wait-phase` | Enforce phase barrier for declared members | Block transition until phase members finish |
|
|
61
|
+
| `sp node create-bead` | Create tracked follow-up work | Persist discovered blockers/tasks |
|
|
62
|
+
| `sp node complete` | Finalize node run with strategy | End run via `pr` or `manual` completion |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 4) Wait-phase semantics
|
|
67
|
+
|
|
68
|
+
`sp node wait-phase` is the canonical phase barrier.
|
|
69
|
+
|
|
70
|
+
- Coordinator must provide the phase id and explicit member key set.
|
|
71
|
+
- Progression to the next phase is blocked until wait-phase reports completion.
|
|
72
|
+
- This applies equally to review/fix/re-review loops.
|
|
73
|
+
|
|
74
|
+
Recommended pattern:
|
|
75
|
+
1. spawn all members for phase N,
|
|
76
|
+
2. call `wait-phase` for phase N,
|
|
77
|
+
3. read `sp ps --node <id> --json`,
|
|
78
|
+
4. decide next phase (or completion).
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 5) Error handling model
|
|
83
|
+
|
|
84
|
+
Coordinator handles command errors by reading error JSON and adapting.
|
|
85
|
+
|
|
86
|
+
Recovery loop:
|
|
87
|
+
1. run command with `--json`,
|
|
88
|
+
2. inspect error payload,
|
|
89
|
+
3. correct arguments or sequencing,
|
|
90
|
+
4. retry boundedly,
|
|
91
|
+
5. if unrecoverable, track via `create-bead` and choose explicit completion strategy.
|
|
92
|
+
|
|
93
|
+
Examples:
|
|
94
|
+
- unknown member in `wait-phase` -> refresh via `status`, retry with valid members.
|
|
95
|
+
- invalid spawn args -> correct `member-key` / `phase` / `specialist`, retry.
|
|
96
|
+
- completion rejected by state -> satisfy unmet prerequisites, then retry `complete`.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 6) Lifecycle and state machine
|
|
101
|
+
|
|
102
|
+
Node states:
|
|
103
|
+
- `created`
|
|
104
|
+
- `starting`
|
|
105
|
+
- `running`
|
|
106
|
+
- `waiting`
|
|
107
|
+
- `degraded`
|
|
108
|
+
- `awaiting_merge`
|
|
109
|
+
- `fixing_after_review`
|
|
110
|
+
- `failed`
|
|
111
|
+
- `error`
|
|
112
|
+
- `done`
|
|
113
|
+
- `stopped`
|
|
114
|
+
|
|
115
|
+
`awaiting_merge` is terminal for the node runtime loop under PR-based completion.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 7) Completion behavior
|
|
120
|
+
|
|
121
|
+
`sp node complete --strategy <pr|manual>` decides publication semantics:
|
|
122
|
+
|
|
123
|
+
- `pr`: run ends in `awaiting_merge` when completion intent succeeds.
|
|
124
|
+
- `manual`: run ends in `done` when completion checks pass.
|
|
125
|
+
|
|
126
|
+
Coordinator should call `complete` only after phase barriers and status checks indicate readiness.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 7.5) `completion_strategy` in node configs
|
|
131
|
+
|
|
132
|
+
The `completion_strategy` field in `.node.json` configs controls how NodeSupervisor handles coordinator completion:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"completion_strategy": "manual" // or "pr" (default)
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Values
|
|
141
|
+
|
|
142
|
+
| Strategy | Behavior | Use case |
|
|
143
|
+
|---|---|---|
|
|
144
|
+
| `pr` (default) | When coordinator job reaches `done` with valid output, node auto-closes to `done` state. | Implementation nodes — auto-publish work via PR |
|
|
145
|
+
| `manual` | When coordinator job reaches `done` with valid output, node transitions to `waiting`. Operator must close via `sp node stop`. | Research/interactive nodes — operator reviews findings before closure |
|
|
146
|
+
|
|
147
|
+
### Key behavior
|
|
148
|
+
|
|
149
|
+
When the coordinator completes synthesis and its job status becomes `done`:
|
|
150
|
+
|
|
151
|
+
1. NodeSupervisor checks `completion_strategy` from node config.
|
|
152
|
+
2. If `manual`: node enters `waiting` state (coordinator_done_manual_completion transition).
|
|
153
|
+
3. If `pr`: node enters `done` state directly (coordinator_done transition).
|
|
154
|
+
|
|
155
|
+
This allows research nodes to persist in `waiting` after coordinator synthesis, giving the operator time to review findings, steer for more work, or close explicitly.
|
|
156
|
+
|
|
157
|
+
### Example configs
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
// config/nodes/research.node.json (interactive research)
|
|
161
|
+
{
|
|
162
|
+
"completion_strategy": "manual",
|
|
163
|
+
"members": [...]
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Implementation nodes (auto-publish via PR)
|
|
167
|
+
{
|
|
168
|
+
"completion_strategy": "pr",
|
|
169
|
+
"members": [...]
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## 8) Member bootstrap behavior
|
|
176
|
+
|
|
177
|
+
Members start in idle-wait bootstrap mode:
|
|
178
|
+
- acknowledge readiness,
|
|
179
|
+
- wait for coordinator steering,
|
|
180
|
+
- avoid eager autonomous execution before routing.
|
|
181
|
+
|
|
182
|
+
This is intentional and remains part of runtime safety behavior.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 9) Observability and inspection
|
|
187
|
+
|
|
188
|
+
Persisted SQLite surfaces:
|
|
189
|
+
- `node_runs`
|
|
190
|
+
- `node_members`
|
|
191
|
+
- `node_events`
|
|
192
|
+
- `node_memory`
|
|
193
|
+
|
|
194
|
+
Useful CLI inspection commands:
|
|
195
|
+
- `sp ps` (or `sp ps --node <id>` when available)
|
|
196
|
+
- `sp feed --node <id> [--json]`
|
|
197
|
+
- `sp steer <coordinator-job-id> "..."`
|
|
198
|
+
- `sp attach <coordinator-job-id>`
|
|
199
|
+
- `sp result <node-ref>:<member-key>`
|
|
200
|
+
- `sp node members <id> [--json]`
|
|
201
|
+
- `sp node memory <id> [--json]`
|
|
202
|
+
|
|
203
|
+
Canonical dispatch event remains `action_written`.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## 10) Current `sp node` surface
|
|
208
|
+
|
|
209
|
+
- `sp node run <config-or-name> [--inline JSON] [--bead <id>] [--context-depth <n>] [--json]`
|
|
210
|
+
- `sp node list [--json]`
|
|
211
|
+
- `sp node members <node-id> [--json]`
|
|
212
|
+
- `sp node memory <node-id> [--json]`
|
|
213
|
+
- `sp node stop <node-id> [--json]`
|
|
214
|
+
- `sp node promote <node-id> <finding-id> --to-bead <bead-id> [--json]`
|
|
215
|
+
|
|
216
|
+
Related top-level commands for node operations:
|
|
217
|
+
- `sp ps` / `sp ps --node <id>`
|
|
218
|
+
- `sp feed --node <id> [--json]`
|
|
219
|
+
- `sp steer <coordinator-job-id> <message>`
|
|
220
|
+
- `sp attach <coordinator-job-id>`
|
|
221
|
+
- `sp result <node-ref>:<member-key>`
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## 11) Practical coordinator heuristics
|
|
226
|
+
|
|
227
|
+
- Re-check `sp ps --node <id> --json` before every phase transition.
|
|
228
|
+
- Use `wait-phase` as mandatory barrier, not advisory.
|
|
229
|
+
- Parallelize only disjoint mutating scopes.
|
|
230
|
+
- Keep retries bounded and explicit.
|
|
231
|
+
- Prefer explicit follow-up beads over silent failure when blocked.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: RPC Observability Metrics Contract
|
|
3
|
+
scope: observability-metrics
|
|
4
|
+
category: reference
|
|
5
|
+
version: 2.0.0
|
|
6
|
+
updated: 2026-04-08
|
|
7
|
+
synced_at: e7de0be7
|
|
8
|
+
source_of_truth_for: "src/specialist/timeline-events.ts, src/pi/session.ts, src/cli/ps.ts, src/cli/result.ts"
|
|
9
|
+
domain: ["observability", "metrics", "timeline"]
|
|
10
|
+
summary: "Defines additive metrics from Pi RPC surfaced via specialists status/feed/timeline. v2.0 adds extension_error, model_change events; enriched compaction/retry fields; token_usage CLI display."
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# RPC Observability Metrics Contract
|
|
14
|
+
|
|
15
|
+
> **Bridge-era note (2026-06-02):** this file documents the current RPC/timeline metrics emitted by specialists. New Prometheus-facing metric design lives in `docs/telemetry/prometheus-projection-contract.md`, and forensic event shape lives in `docs/telemetry/forensic-event-contract.md`. Keep this file for source mapping/backward compatibility until the projection exporter lands.
|
|
16
|
+
|
|
17
|
+
## Cross-repo telemetry contract
|
|
18
|
+
|
|
19
|
+
This file is the specialists-owned metrics contract. It defines what the runtime
|
|
20
|
+
emits for jobs, turns, token usage, tool calls, retries, compactions, model
|
|
21
|
+
changes, extension errors, and related agent lifecycle events.
|
|
22
|
+
|
|
23
|
+
The platform path is deliberately split:
|
|
24
|
+
|
|
25
|
+
- `~/projects/mercury/infra/MONITORING.md` and `docs/AGENT_MONITORING.md` own scraping, storage, alerting, dashboard infrastructure, and future Terraform/IaC wiring.
|
|
26
|
+
- `~/dev/gitboard/docs/xtrm-observability-prd.md` owns how these metrics become operator-console panels, links, and agent-authored dashboards.
|
|
27
|
+
- `~/second-mind/1-projects/xtrm/research/agentops-telemetry-for-specialists.md` is the current research note for expanding this contract into AgentOps metrics.
|
|
28
|
+
|
|
29
|
+
Do not rely on host/container metrics alone for specialist health. Required
|
|
30
|
+
specialist-level signals include queue age, job state, tool-call error rate, MCP
|
|
31
|
+
latency/error rate, model-change history, token/cost totals, retry/compaction
|
|
32
|
+
frequency, worktree cleanup state, and durable result availability.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
This document defines additive, backward-compatible metrics captured from Pi RPC and surfaced through specialists status/feed/timeline. For KPI analysis recipes, see `.xtrm/skills/default/using-kpi/SKILL.md`.
|
|
36
|
+
|
|
37
|
+
## Metric Source Map
|
|
38
|
+
|
|
39
|
+
| Metric | RPC source | Capture file | Persisted to |
|
|
40
|
+
|---|---|---|---|
|
|
41
|
+
| `token_usage.*` | `assistantMessageEvent.done`, `turn_end`, `agent_end` usage-like payloads | `src/pi/session.ts` (`findTokenUsage`) | `status.json.metrics`, `events.jsonl` (`token_usage`), `run_complete.metrics` |
|
|
42
|
+
| `finish_reason` | `stopReason` / `finishReason` from `assistantMessageEvent.done`, `turn_end`, `agent_end` | `src/pi/session.ts` (`findFinishReason`) | `status.json.metrics`, `events.jsonl` (`finish_reason`), `run_complete.metrics` |
|
|
43
|
+
| `turns` | `turn_start` count | `src/pi/session.ts` | `status.json.metrics`, `run_complete.metrics` |
|
|
44
|
+
| `tool_calls` | `tool_execution_start` count | `src/pi/session.ts` (+ supervisor reconciliation) | `status.json.metrics`, `run_complete.metrics` |
|
|
45
|
+
| `auto_compactions` | `auto_compaction_end` count | `src/pi/session.ts` | `status.json.metrics`, `events.jsonl` (`compaction`), `run_complete.metrics` |
|
|
46
|
+
| `auto_retries` | `auto_retry_end` count | `src/pi/session.ts` | `status.json.metrics`, `events.jsonl` (`retry`), `run_complete.metrics` |
|
|
47
|
+
| `extension_error` | Extension error callbacks | `src/pi/session.ts` | `events.jsonl` (`extension_error`) |
|
|
48
|
+
| `model_change` | Model change callbacks (`set_model`, `cycle_model`) | `src/pi/session.ts` | `events.jsonl` (`model_change`) |
|
|
49
|
+
|
|
50
|
+
## Timeline Additions (Additive)
|
|
51
|
+
|
|
52
|
+
### Event Types
|
|
53
|
+
|
|
54
|
+
**Core metrics:**
|
|
55
|
+
- `token_usage` — token consumption snapshot (input, output, cache, total, cost)
|
|
56
|
+
- `finish_reason` — why the model stopped (stop, length, toolUse, etc.)
|
|
57
|
+
- `turn_summary` — per-turn metadata with context health
|
|
58
|
+
- `compaction` — context compaction lifecycle
|
|
59
|
+
- `retry` — automatic retry lifecycle
|
|
60
|
+
|
|
61
|
+
**New in v2.0:**
|
|
62
|
+
- `extension_error` — extension failure events
|
|
63
|
+
- `model_change` — model switch events (`set_model`, `cycle_model`)
|
|
64
|
+
|
|
65
|
+
### Enriched Event Fields
|
|
66
|
+
|
|
67
|
+
**Compaction events** (`auto_compaction_start`, `auto_compaction_end`):
|
|
68
|
+
- `tokens_before` — context size before compaction
|
|
69
|
+
- `summary` — what was compacted
|
|
70
|
+
- `first_kept_entry_id` — first entry retained after compaction
|
|
71
|
+
|
|
72
|
+
**Retry events** (`auto_retry_start`, `auto_retry_end`):
|
|
73
|
+
- `attempt` — current attempt number
|
|
74
|
+
- `max_attempts` — configured retry limit
|
|
75
|
+
- `delay_ms` — backoff delay before retry
|
|
76
|
+
- `error_message` — transient error that triggered retry
|
|
77
|
+
|
|
78
|
+
Existing jobs without these events remain valid.
|
|
79
|
+
|
|
80
|
+
## Surface Coverage
|
|
81
|
+
|
|
82
|
+
### JSON APIs
|
|
83
|
+
|
|
84
|
+
- `specialists feed --json`: includes `metrics` envelope from status + additive events.
|
|
85
|
+
- `feed_specialist` tool: includes `metrics` from status.
|
|
86
|
+
- `specialists status --json`: includes per-job `metrics`.
|
|
87
|
+
- `specialist_status` tool: includes per-job `metrics`.
|
|
88
|
+
|
|
89
|
+
### Human-Readable CLI (v2.0)
|
|
90
|
+
|
|
91
|
+
**`sp ps` (list view):**
|
|
92
|
+
- Total tokens displayed alongside elapsed time: `15s · 2500 tok`
|
|
93
|
+
|
|
94
|
+
**`sp ps <id>` (inspect view):**
|
|
95
|
+
- Dedicated `tokens` line with breakdown: `input=500 · output=2000 · total=2500`
|
|
96
|
+
- Dedicated `cost_usd` line: `cost_usd=$0.0125`
|
|
97
|
+
|
|
98
|
+
**`sp result` (human mode):**
|
|
99
|
+
- Metrics footer appended to output:
|
|
100
|
+
```
|
|
101
|
+
--- metrics: input=500 · output=2000 · total=2500 · cost_usd=$0.0125 ---
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Backward Compatibility
|
|
105
|
+
|
|
106
|
+
All new fields are optional:
|
|
107
|
+
- `status.json.metrics` may be absent for old runs.
|
|
108
|
+
- `run_complete.metrics` may be absent for old runs.
|
|
109
|
+
- `extension_error` and `model_change` events only present in jobs after 2026-04-08.
|
|
110
|
+
- Enriched `compaction` and `retry` fields only present when those features are triggered.
|
|
111
|
+
- Consumers must treat missing metrics as unknown, not zero.
|
|
112
|
+
|
|
113
|
+
## Open Review Workflow
|
|
114
|
+
|
|
115
|
+
For every new protocol-derived metric:
|
|
116
|
+
1. Open RFC issue with sample RPC payloads and backward-compat notes.
|
|
117
|
+
2. Update this matrix with source path and confidence/caveats.
|
|
118
|
+
3. Add fixture-driven contract tests from recorded RPC traces.
|
|
119
|
+
4. Require two approvals (maintainer + external reviewer) before stable surfacing.
|
|
120
|
+
5. Keep added fields optional for at least one minor release window.
|
|
121
|
+
|
|
122
|
+
## Implementation Notes (v2.0)
|
|
123
|
+
|
|
124
|
+
### Timeline Event Schema
|
|
125
|
+
|
|
126
|
+
See `src/specialist/timeline-events.ts` for canonical event type definitions:
|
|
127
|
+
- `TimelineEventExtensionError` — extension error events
|
|
128
|
+
- `TimelineEventModelChange` — model change events
|
|
129
|
+
- `TimelineEventCompaction` — enriched with `tokens_before`, `summary`, `first_kept_entry_id`
|
|
130
|
+
- `TimelineEventRetry` — enriched with `attempt`, `max_attempts`, `delay_ms`, `error_message`
|
|
131
|
+
|
|
132
|
+
### Token Usage Display
|
|
133
|
+
|
|
134
|
+
Token usage formatting uses shared helpers from `src/cli/format-helpers.js`:
|
|
135
|
+
- `formatTokenUsageSummary()` — produces `input=X · output=Y · total=Z`
|
|
136
|
+
- `formatCostUsd()` — produces `$0.0125` format
|
|
137
|
+
|
|
138
|
+
Used by:
|
|
139
|
+
- `src/cli/ps.ts` — list and inspect views
|
|
140
|
+
- `src/cli/result.ts` — human-mode result display
|
|
141
|
+
|
|
142
|
+
### Infrastructure Fixes
|
|
143
|
+
|
|
144
|
+
**initSchema race condition (2026-04-08):**
|
|
145
|
+
- Fixed DROP/RENAME race in `src/specialist/observability-sqlite.ts`
|
|
146
|
+
- Gates specialist_jobs rebuild to only run when legacy columns are missing
|
|
147
|
+
- Prevents "no such table: specialist_jobs" errors during concurrent init/read
|
|
148
|
+
|
|
149
|
+
**Loader precedence (2026-04-08):**
|
|
150
|
+
- Fixed in `src/specialist/loader.ts`
|
|
151
|
+
- `config/specialists/` now takes precedence over `.specialists/default/`
|
|
152
|
+
- Ensures `sp edit` changes are not overridden by stale default copies
|