Files
Trevin Chow dd25db036c fix(ce-sessions): move orchestration to skill, reshape historian to synthesis-only
The ce-session-historian agent deadlocked when dispatched as a subagent in
Claude Code because its first action was Skill(ce-session-inventory), and
subagents cannot invoke the Skill tool (anthropics/claude-code#38719). The
spinner hung at "Initializing…" indefinitely; after timeout the orchestrator
received a spurious "user doesn't want to proceed" rejection.

The fix removes every code path that has a subagent calling Skill:

- Move 4 extraction scripts into plugins/compound-engineering/skills/ce-sessions/scripts/
  (single home; ce-session-inventory and ce-session-extract skills deleted)
- Rewrite ce-sessions/SKILL.md as the full orchestrator: discovery, branch +
  keyword filtering, scan-window selection, top-5 deep-dive cap, mktemp
  scratch dir, per-session extraction with new --output PATH flag (extraction
  bytes write directly to scratch, never round-trip through main-context tool
  results), dispatch of synthesis-only historian
- Reshape ce-session-historian.agent.md to synthesis-only: receives file
  paths in dispatch prompt, reads via native file-read tool, returns prose
  findings. No Skill calls, no Bash discovery, no orchestration logic
- Update ce-compound Phase 1 to delegate to ce-sessions via the platform's
  skill-invocation primitive (semantic-prose form per plan-handoff.md line 57
  convention, not literal Skill(...) syntax). Specifies dispatch ordering so
  the parallel research subagents and ce-sessions still run concurrently —
  wall-clock parallelism preserved
- Add --output PATH to extract-skeleton.py and extract-errors.py: when set,
  scripts write to file and emit only a one-line JSON status to stdout.
  Stdout-mode behavior preserved when omitted (additive API change)
- Add regression test (tests/skills/ce-session-historian-no-skill-tool.test.ts)
  asserting the agent body never instructs Skill(ce-session-inventory),
  Skill(ce-session-extract), or any literal Skill(...) tool-call expression
- Register ce-session-inventory and ce-session-extract in legacy-cleanup
  lookups (STALE_SKILL_DIRS, LEGACY_ONLY_SKILL_DESCRIPTIONS, and
  EXTRA_LEGACY_ARTIFACTS_BY_PLUGIN) so existing flat-installs sweep on upgrade
- Fix broken See Also links in docs/skills/ce-sessions.md

The bug is structurally gone: no subagent in the post-refactor flow ever
invokes the Skill tool. Plan with full design rationale, alternatives
considered (including issue #794's Options 1 and 2), and implementation
units lives at docs/plans/2026-05-08-001-fix-ce-sessions-orchestration-refactor-plan.md.

All 1337 bun tests pass; bun run release:validate passes (37 skills,
49 agents). Closes #794.
2026-05-08 09:33:48 -07:00
..