Skip to content

<objective> Extend the doctor with control-channel and agentos items carrying fix texts, and add the package.json bin field pointing at the compiled CLI.

Purpose: Deliver CLI-03 through the existing runChecks runner plus the P6-D7 install entry, reusing the 06-01 socket surface. Output: Extended checks module, bin field, and the doctor test file. </objective>

<execution_context> @~/.claude/gsd-core/workflows/execute-plan.md @~/.claude/gsd-core/templates/summary.md </execution_context>

<context> @.planning/PROJECT.md @.planning/ROADMAP.md @.planning/phases/06-cli-daemon-and-host-packaging/06-CONTEXT.md @.planning/phases/06-cli-daemon-and-host-packaging/06-01-PLAN.md </context>

<tasks>

<task type="tdd"> <name>Task 1: control-channel and agentos doctor items with fix texts (P6-D6, P6-D14)</name> <files>src/doctor/checks.ts, test/doctor/control-channel.test.ts</files> <read_first> - src/doctor/checks.ts lines 36-65 (CheckId, CheckStatus, CheckResult with fix null-only-on-pass, DoctorOptions seams) - src/doctor/checks.ts lines 90-124 (REGISTERED order and the shared-probe runChecks pattern) - src/doctor/checks.ts lines 314-473 (Phase 3 item shape: status, detail naming a code or rule, fix constants) - src/doctor/checks.ts lines 522-542 (defaultConnectSocket dial-and-close precedent) - src/session/paths.ts lines 30-34 (controlSocketPath) - src/runtime/agentos.ts lines 22-31 (AgentOsDriver alive surface and backoff constants) </read_first> <behavior> - Test (CLI-03): the full report lists all eight items in order with the two new ids appended deliberately - Test (CLI-03): control-channel passes when the run directory is 0700 and the socket accepts; fails with a fix when the mode is wrong; warns with a fix when the socket is absent (daemon down) - Test (CLI-03): agentos warns with the fix when no live session exists; an injected agentosAlive probe drives pass and fail, each fail carrying its fix - Test (CLI-03): every non-pass result across both items carries a non-null fix - Test titles cite CLI-03 </behavior> <action>Write the failing tests first per behavior, then extend src/doctor/checks.ts per P6-D6 and P6-D14: add control-channel and agentos to CheckId, append the two items to REGISTERED after anda-bridge without reshaping existing items, implement the control-channel item (stat the run directory for 0700, dial controlSocketPath with the injected connectSocket bounded by SOCKET_TIMEOUT_MS; absent socket warns since a stopped daemon is normal), add an optional agentosAlive probe to DoctorOptions defaulting to warn with fix "Run realm up, then rerun doctor.", and define FIX constants naming the corrective action for each failing shape. Fix is null only on pass. Test titles cite CLI-03.</action> <acceptance_criteria> - Eight items report in order; both new items carry fix text on every non-pass - All probes stay injected; no process runs and no socket opens in tests </acceptance_criteria> <verify> <automated>npx tsc -p tsconfig.json && node --test dist/test/doctor/control-channel.test.js</automated> </verify> <done>Doctor covers all eight CLI-03 prerequisites with fix texts.</done> </task>

<task type="auto"> <name>Task 2: package.json bin field at the compiled CLI (P6-D7)</name> <files>package.json</files> <read_first> - package.json (scripts, engines, omp.extensions; the bin entry joins them) - src/cli/main.ts (from plan 06-04; the entry the compiled bin path names) </read_first> <action>Add the bin field to package.json per P6-D7 pointing at the compiled CLI under dist/src/cli/ (matching the 06-04 entry module and the existing omp.extensions dist convention), with no new dependency and no other field changed. Verify the named path is the file plan 06-04 creates and that npm test still enumerates the suite.</action> <acceptance_criteria> - bin names the compiled 06-04 CLI entry; dependencies and scripts are otherwise unchanged </acceptance_criteria> <verify> <automated>npx tsc -p tsconfig.json && node --test dist/test/doctor/control-channel.test.js</automated> </verify> <done>bin field installed; CLI entry resolvable from the compiled output.</done> </task>

</tasks>

<threat_model>

Trust Boundaries ​

BoundaryDescription
run directory stat -> control-channel itemDirectory mode crosses here; a wrong mode fails closed with its fix
agentos probe -> agentos itemLiveness crosses here; no live session warns instead of claiming pass

STRIDE Threat Register ​

Threat IDCategoryComponentSeverityDispositionMitigation Plan
T-06-12T (Tampering)src/doctor/checks.tsmediummitigateThe control-channel item stats the directory and dials the socket, so a tampered or foreign socket reports fail instead of pass (P6-D6)
T-06-13I (Information Disclosure)src/doctor/checks.tslowmitigateDetails name codes, modes, and rules only; no socket bytes, env values, or policy values reach results (privacy rule carry)
</threat_model>

<verification> npx tsc -p tsconfig.json && node --test dist/test/doctor/control-channel.test.js; node -e "console.log(require('./package.json').bin)"; grep test/doctor/control-channel.test.ts for CLI-03 in test titles. </verification>

<success_criteria> Eight-item doctor report with fix texts complete; bin points at the compiled CLI; no existing item reshaped. </success_criteria>

Artifacts this phase produces (contribution of this plan) ​

  • src/doctor/checks.ts (extended): control-channel and agentos items plus FIX constants (P6-D6, P6-D14).
  • package.json (extended): bin field at the compiled CLI (P6-D7).
  • test/doctor/control-channel.test.ts (new): CLI-03 item, order, and fix-text cases.

<output> Create .planning/phases/06-cli-daemon-and-host-packaging/06-05-SUMMARY.md when done </output>

AGPL-3.0-only. Copyright (C) 2026 Spectrum Web Co/swcstudiospace.