AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-351
  5. plan
  6. plan.md
plan.md(2.7 KB)· Apr 8, 2026· 2 min read
  • Summary
  • Files
  • Steps
  • Verification
  • Risks

Plan: Migrate PhaseRouterService to LLMProvider#

Summary#

Replace direct ClaudeInvocationService injection in PhaseRouterService with the LLMProvider interface from #346. This removes signal parsing, metadata extraction, and skill mapping from the phase router, making it a pure orchestrator that consumes PhaseResult directly.

Files#

FileActionDescription
src/phase-router/phase-router.service.tsmodifySwap ClaudeInvocationService → @Inject(LLM_PROVIDER) LLMProvider; replace SignalResult with PhaseResult; remove toSignalKind() conversion and PR metadata extraction
src/phase-router/phase-router.module.tsmodifyImport LLMModule instead of InvokeModule
src/phase-router/phase-router.service.spec.tsmodifyReplace ClaudeInvocationService mock with LLMProvider mock returning PhaseResult

Steps#

  1. Update module imports — In phase-router.module.ts: replace InvokeModule import with LLMModule, remove InvokeModule import statement.
  2. Swap injection in service — In phase-router.service.ts constructor: replace ClaudeInvocationService with @Inject(LLM_PROVIDER) private readonly llm: LLMProvider. Remove imports for ClaudeInvocationService, SignalResult, SignalParser.
  3. Refactor executePhase() — Replace this.claude.invoke() with this.llm.invoke(). Use PhaseResult fields directly: result.signal for signal kind, result.prNumber/result.prBranch for PR metadata, result.conflictMetadata for conflict data. Remove toSignalKind() method entirely.
  4. Remove PHASE_TO_SKILL reference — Verify no local skill mapping exists in phase-router (currently in ClaudeInvocationService — confirm no duplication).
  5. Update validateCompoundScope() — Change parameter type from SignalResult to PhaseResult. Update metadata access to use PhaseResult field names instead of result.metadata?.['prNumber'].
  6. Update test file — Replace ClaudeInvocationService mock with LLM_PROVIDER token mock. Update completeResult(), blockedResult(), skipResult() helpers to return PhaseResult objects. Update all test assertions referencing SignalResult fields.

Verification#

  • npx tsc --noEmit passes with no type errors
  • npm run test — all phase-router specs pass with LLMProvider mock
  • npm run lint — zero warnings

Risks#

  • #346 not merged yet: LLMProvider, PhaseResult, LLMModule, and ClaudeCLIProvider do not exist on rc/multi-tenant yet. Implementation is blocked until #346 lands.
  • PhaseResult field contract: If PhaseResult uses different field names than assumed (e.g. signal vs type), the mapping in step 3 must adapt to the actual interface.
ContextPrd