@jaggerxtrm/specialists 3.16.0 → 3.18.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/README.md +268 -132
- package/config/mandatory-rules/json-only-final-output.md +13 -0
- package/config/mandatory-rules/research-tool-routing.md +4 -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 +1 -1
- package/config/skills/setup-specialists/SKILL.md +556 -0
- package/config/skills/specialists-creator/SKILL.md +160 -5
- package/config/skills/specialists-creator/scripts/audit-spec-uniformity.mjs +1 -1
- package/config/skills/using-specialists-auto/SKILL.md +1 -1
- package/config/skills/using-specialists-v2/SKILL.md +7 -7
- package/config/skills/using-specialists-v3/SKILL.md +223 -147
- package/config/specialists/bare.specialist.json +3 -3
- package/config/specialists/changelog-drafter.specialist.json +9 -6
- package/config/specialists/changelog-keeper.specialist.json +10 -7
- package/config/specialists/debugger.specialist.json +8 -6
- package/config/specialists/executor.specialist.json +9 -7
- package/config/specialists/explorer.specialist.json +8 -6
- package/config/specialists/memory-processor.specialist.json +7 -5
- package/config/specialists/node-coordinator.specialist.json +7 -5
- package/config/specialists/obligations-scanner.specialist.json +149 -0
- package/config/specialists/overthinker.specialist.json +7 -5
- package/config/specialists/planner.specialist.json +8 -6
- package/config/specialists/quant-methodologist.specialist.json +145 -0
- package/config/specialists/quant-researcher.specialist.json +144 -0
- package/config/specialists/researcher.specialist.json +14 -9
- package/config/specialists/reviewer.specialist.json +11 -9
- package/config/specialists/seconder.specialist.json +170 -0
- package/config/specialists/security-auditor.specialist.json +6 -4
- package/config/specialists/service-skills-sync.specialist.json +93 -0
- package/config/specialists/specialists-creator.specialist.json +9 -7
- package/config/specialists/sync-docs.specialist.json +6 -4
- package/config/specialists/test-engineer.specialist.json +134 -0
- package/config/specialists/test-runner.specialist.json +11 -9
- package/config/specialists/transcriber.specialist.json +59 -0
- package/config/specialists/xt-merge.specialist.json +7 -5
- package/dist/asset-contract.json +39 -8
- package/dist/index.js +37083 -26912
- package/dist/lib.js +9850 -6147
- 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 +2 -0
- package/dist/types/cli/log.d.ts.map +1 -0
- 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/resume.d.ts.map +1 -1
- package/dist/types/cli/run.d.ts +1 -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/steer.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 +11 -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/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/job-file-output.d.ts +2 -0
- package/dist/types/specialist/job-file-output.d.ts.map +1 -1
- package/dist/types/specialist/launch.d.ts +1 -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 +25 -0
- package/dist/types/specialist/observability-sqlite.d.ts.map +1 -1
- 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 +181 -63
- 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/supervisor.d.ts +39 -2
- package/dist/types/specialist/supervisor.d.ts.map +1 -1
- package/dist/types/specialist/timeline-events.d.ts +88 -2
- 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 +1193 -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 +17 -12
- package/config/specialists/code-sanity.specialist.json +0 -108
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Specialists System — Restructure Findings
|
|
3
|
+
scope: restructure
|
|
4
|
+
category: reference
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
updated: 2026-03-19
|
|
7
|
+
domain: []
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<!-- INDEX: auto-generated by validate_doc.py — do not edit manually -->
|
|
11
|
+
| Section | Summary |
|
|
12
|
+
|---|---|
|
|
13
|
+
| [1. The Core Problem](#1-the-core-problem) | The current execution layer has two issues: |
|
|
14
|
+
| [2. What Pi Actually Provides](#2-what-pi-actually-provides) | Source: `badlogic/pi-mono/packages/coding-agent` wiki + direct spec analysis |
|
|
15
|
+
| [3. The Polling Problem](#3-the-polling-problem) | MCP is request-response |
|
|
16
|
+
| [4. How Overstory Solves It (Reference)](#4-how-overstory-solves-it-reference) | Overstory bypasses MCP for execution: |
|
|
17
|
+
| [5. Architecture Options Evaluated](#5-architecture-options-evaluated) | **Rejected because** (from adversarial critique): |
|
|
18
|
+
| [6. Adversarial Critique — Overthinker Output](#6-adversarial-critique-overthinker-output) | > Full run: job `50bbf162`, Sonnet 4 |
|
|
19
|
+
| [7. Decision — The Chosen Path](#7-decision-the-chosen-path) | `JobRegistry` stays in memory |
|
|
20
|
+
| [8. What Does NOT Change](#8-what-does-not-change) | - The 8 MCP tool signatures — identical to consumers |
|
|
21
|
+
| [9. Open Questions (Remaining)](#9-open-questions-remaining) | - Is `RpcClient`/`AgentSession` a stable public export? → Verify against `@mariozechner/pi-coding-agent` package |
|
|
22
|
+
<!-- END INDEX -->
|
|
23
|
+
|
|
24
|
+
# Specialists System — Restructure Findings
|
|
25
|
+
|
|
26
|
+
> Status: Decision reached. See Section 7 for the chosen path.
|
|
27
|
+
> Updated: 2026-03-10
|
|
28
|
+
> Adversarial critique: overthinker specialist, job `50bbf162`, Sonnet 4.6, 169s
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 1. The Core Problem
|
|
33
|
+
|
|
34
|
+
The current execution layer has two issues:
|
|
35
|
+
|
|
36
|
+
1. **`PiAgentSession` manually reimplements what pi already provides** — raw subprocess + manual NDJSON line buffering, custom `agent_end` detection, `proc.stdin.end()` hack. Source of the split-chunk bug (2.1.5 hotfix) and fragility against any pi protocol change.
|
|
37
|
+
|
|
38
|
+
2. **MCP is request-response only** — no server-push. `poll_specialist` requires Claude to call repeatedly, generating tool call noise, burning context window, cluttering the UI.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 2. What Pi Actually Provides
|
|
43
|
+
|
|
44
|
+
Source: `badlogic/pi-mono/packages/coding-agent` wiki + direct spec analysis.
|
|
45
|
+
|
|
46
|
+
### RpcClient (subprocess wrapper)
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { RpcClient } from '@mariozechner/pi/rpc';
|
|
50
|
+
|
|
51
|
+
const pi = new RpcClient({ provider: 'anthropic', cwd: sessionDir });
|
|
52
|
+
await pi.start();
|
|
53
|
+
await pi.prompt('Do the task');
|
|
54
|
+
await pi.waitForIdle();
|
|
55
|
+
const { data } = await pi.send({ type: 'get_last_assistant_text' });
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Methods the current code reimplements manually:
|
|
59
|
+
- `onEvent(listener)` — subscribe to all pi events as they arrive
|
|
60
|
+
- `waitForIdle(timeout?)` — waits for `agent_end`, no manual polling
|
|
61
|
+
- `collectEvents(timeout?)` — gathers all events until completion
|
|
62
|
+
- `getLastAssistantText()` — clean output retrieval
|
|
63
|
+
|
|
64
|
+
### AgentSession SDK (in-process, no subprocess)
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { createAgentSession } from '@mariozechner/pi-coding-agent';
|
|
68
|
+
|
|
69
|
+
const session = await createAgentSession({ provider: 'anthropic', cwd: '.' });
|
|
70
|
+
session.subscribe((event) => { /* native TypeScript callbacks */ });
|
|
71
|
+
await session.prompt('Do the task');
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`AgentSession` is the core that all pi modes (interactive, print, RPC) attach to. **Verification required**: whether this is a stable public export or internal only — this determines whether `PiAgentSession` can be replaced cleanly or just improved.
|
|
75
|
+
|
|
76
|
+
### Session Persistence
|
|
77
|
+
|
|
78
|
+
- Sessions stored as branching JSONL in `~/.pi/agent/sessions/`
|
|
79
|
+
- `get_state` RPC → returns `sessionFile` path
|
|
80
|
+
- Resume: `pi --session <path>` CLI flag, or `switch_session` RPC command
|
|
81
|
+
- Multi-turn: call `prompt()` multiple times on same instance — full context retained
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 3. The Polling Problem
|
|
86
|
+
|
|
87
|
+
### Why it exists
|
|
88
|
+
|
|
89
|
+
MCP is request-response. No server-push mechanism. Claude calls `poll_specialist` → MCP server responds → Claude calls again. A 30-second specialist produces 30+ tool calls, each appearing in the conversation history.
|
|
90
|
+
|
|
91
|
+
### wait_ms (long-polling) — does NOT solve async
|
|
92
|
+
|
|
93
|
+
Reduces frequency but Claude still blocks during each poll. From Claude's perspective it's `use_specialist` cut into N-second chunks. Specialist runs async; Claude does not.
|
|
94
|
+
|
|
95
|
+
### MCP cannot be fixed at the protocol level
|
|
96
|
+
|
|
97
|
+
MCP notifications exist but cover meta-level events only. This is a constraint, not an implementation gap.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 4. How Overstory Solves It (Reference)
|
|
102
|
+
|
|
103
|
+
Overstory bypasses MCP for execution:
|
|
104
|
+
- `Bash(ov sling ...)` → spawns agent in tmux (returns immediately)
|
|
105
|
+
- SQLite mail for inter-agent communication
|
|
106
|
+
- `UserPromptSubmit` hook injects completion notifications
|
|
107
|
+
- Watchdog daemon for health monitoring
|
|
108
|
+
|
|
109
|
+
Key insight: hooks are a push channel MCP doesn't have. But the architecture requires tmux, a watchdog daemon, and a SQLite mail system — significant infrastructure.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 5. Architecture Options Evaluated
|
|
114
|
+
|
|
115
|
+
### Option A: Daemon + JSONL files ❌ REJECTED
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
specialists daemon → owns RpcClient instances → writes events.jsonl
|
|
119
|
+
MCP tools → thin file readers
|
|
120
|
+
specialists feed → tails JSONL
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Rejected because** (from adversarial critique):
|
|
124
|
+
- Two processes = two failure modes + one interaction failure mode
|
|
125
|
+
- File-based IPC (`queue.jsonl`) is non-atomic, misses events, reinvents a message queue badly. Unix socket is the right tool; function calls are better still.
|
|
126
|
+
- `poll_specialist` as file reader is strictly worse than memory reads (O(1) → O(n) per poll)
|
|
127
|
+
- Daemon startup question unsolved: child of MCP = dies with MCP (no gain); system service = breaks the "just add to .mcp.json" UX
|
|
128
|
+
- Event file accumulation with no GC is silent technical debt
|
|
129
|
+
- Complexity budget: 3–5x more code for problems that are partially invented
|
|
130
|
+
|
|
131
|
+
### Option B: AgentSession SDK in-process + file-backed registry ✅ CHOSEN
|
|
132
|
+
|
|
133
|
+
See Section 7.
|
|
134
|
+
|
|
135
|
+
### Option C: CLI background + hook notification (Overstory-inspired) — Deferred
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
specialists run <name> --prompt "..." > .specialists/jobs/<id>/output.jsonl &
|
|
139
|
+
# UserPromptSubmit hook reads .specialists/ready/, injects banner
|
|
140
|
+
# Claude calls poll_specialist ONCE to retrieve
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Valid for true fire-and-forget background jobs. Deferred — not a prerequisite for the core rewrite.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 6. Adversarial Critique — Overthinker Output
|
|
148
|
+
|
|
149
|
+
> Full run: job `50bbf162`, Sonnet 4.6, 169 seconds, ~12% context used.
|
|
150
|
+
|
|
151
|
+
### Key findings from Phase 2 (Devil's Advocate)
|
|
152
|
+
|
|
153
|
+
**Against the daemon:**
|
|
154
|
+
1. Two processes, two failure modes, one interaction failure mode — reconnection protocol unspecified
|
|
155
|
+
2. File-based IPC non-atomic, inotify unreliable, no delivery guarantee
|
|
156
|
+
3. Writing 15,000+ events/run to disk: thousands of syscalls vs current zero I/O
|
|
157
|
+
4. `poll_specialist` as file reader: `open + lseek + read + close + JSONL parse` vs `hashmap lookup + string.slice`
|
|
158
|
+
5. Claude Code IS the scheduler — polling is how it works for long-running operations
|
|
159
|
+
6. Pi SDK may be internal, not exported — assumption may be a mirage
|
|
160
|
+
7. No GC for job files — silent technical debt
|
|
161
|
+
|
|
162
|
+
### Phase 4 verdict (verbatim)
|
|
163
|
+
|
|
164
|
+
> **Do not build the daemon.** It solves real problems with a solution whose complexity budget far exceeds the problems' severity.
|
|
165
|
+
>
|
|
166
|
+
> **One-line verdict:** The daemon is a distributed system solution to a persistence problem. Persistence is solved by writing files. Write files from where you already are.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## 7. Decision — The Chosen Path
|
|
171
|
+
|
|
172
|
+
### File-backed in-memory registry (Priority 1 — low risk, high value)
|
|
173
|
+
|
|
174
|
+
`JobRegistry` stays in memory. Add file writes as a non-blocking side-effect:
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
On job start: open .specialists/jobs/<id>/events.jsonl for append
|
|
178
|
+
On every event: fs.appendFile(eventsPath, JSON.stringify(event) + '\n') ← async, non-blocking
|
|
179
|
+
On completion: write .specialists/jobs/<id>/result.json
|
|
180
|
+
On MCP startup: scan job files → recover done jobs → mark in-progress as crashed
|
|
181
|
+
poll_specialist: memory (fast path) → result.json fallback for post-restart reads
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**What this gives for free:**
|
|
185
|
+
- ✅ `specialists feed` CLI: formatted `tail -f .specialists/jobs/*/events.jsonl`
|
|
186
|
+
- ✅ Audit trail and debugging
|
|
187
|
+
- ✅ Completed job recovery across MCP restarts
|
|
188
|
+
- ✅ O(1) polling preserved (in-memory primary, file is secondary)
|
|
189
|
+
- ✅ Zero daemon, zero IPC, zero lifecycle complexity
|
|
190
|
+
- ✅ GC: TTL-based cleanup on MCP startup (e.g. delete job files >7 days)
|
|
191
|
+
|
|
192
|
+
### Replace PiAgentSession with RpcClient/SDK (Priority 2 — verify first)
|
|
193
|
+
|
|
194
|
+
**Before touching code:** confirm whether `RpcClient` or `AgentSession` is a stable public export from `@mariozechner/pi-coding-agent`.
|
|
195
|
+
|
|
196
|
+
- If **exported**: clean swap — same subprocess behavior, native event callbacks, `waitForIdle()` replaces manual detection, `getLastAssistantText()` replaces output accumulation. Eliminates the split-chunk class of bugs.
|
|
197
|
+
- If **internal only**: keep the subprocess, clean up the NDJSON parsing with a proper line buffer utility. Still worthwhile.
|
|
198
|
+
|
|
199
|
+
### `specialists feed` CLI (Priority 3 — falls out from Priority 1)
|
|
200
|
+
|
|
201
|
+
Once events.jsonl exists per job:
|
|
202
|
+
```bash
|
|
203
|
+
specialists feed # all active jobs, formatted event stream
|
|
204
|
+
specialists feed --job <id> # single job
|
|
205
|
+
specialists feed --follow # live tail
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Shows per job: specialist name, beadId, model, tool calls (type only), duration, status.
|
|
209
|
+
|
|
210
|
+
### Polling UX (Priority 4 — defer)
|
|
211
|
+
|
|
212
|
+
The adversarial critique is right: Claude polling IS the pattern for long-running MCP operations. The UX problem is real but not blocking. Hook notification (Option C) remains available as a follow-up once the core rewrite is stable.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 8. What Does NOT Change
|
|
217
|
+
|
|
218
|
+
- The 8 MCP tool signatures — identical to consumers
|
|
219
|
+
- `SpecialistRunner` orchestration logic
|
|
220
|
+
- `CircuitBreaker`
|
|
221
|
+
- Beads lifecycle integration
|
|
222
|
+
- The `.specialist.yaml` schema
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## 9. Open Questions (Remaining)
|
|
227
|
+
|
|
228
|
+
- Is `RpcClient`/`AgentSession` a stable public export? → Verify against `@mariozechner/pi-coding-agent` package.json `exports` field
|
|
229
|
+
- What event granularity to write to events.jsonl? All events (including thinking deltas) or only lifecycle events? Thinking deltas at 50/sec = significant I/O. Likely: lifecycle + tool events only, full text on completion.
|
|
230
|
+
- `specialists feed` output format — match `specialists status` style or a new live-updating TUI?
|
|
231
|
+
- Multi-turn (`resume_specialist` tool) — separate milestone once session file path is saved at job creation
|