AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-351
  5. plan
  6. context.json
context.json(3.6 KB)· Apr 8, 2026
{
  "meta": {
    "agent": "planner",
    "task_id": "351",
    "title": "Migrate PhaseRouterService from ClaudeInvocationService to LLMProvider",
    "created_at": "2026-04-08T12:00:00Z"
  },
  "inputs": [
    {
      "name": "issue-351",
      "type": "context",
      "ref": "https://github.com/AgentSDE/agent-core/issues/351",
      "notes": "MT-7: consumer migration from ClaudeInvocationService to LLMProvider"
    },
    {
      "name": "phase-router.service.ts",
      "type": "file",
      "ref": "src/phase-router/phase-router.service.ts",
      "notes": "731 lines; injects ClaudeInvocationService, has toSignalKind(), validateCompoundScope(), buildEnv()"
    },
    {
      "name": "phase-router.module.ts",
      "type": "file",
      "ref": "src/phase-router/phase-router.module.ts",
      "notes": "Imports InvokeModule"
    },
    {
      "name": "phase-router.service.spec.ts",
      "type": "file",
      "ref": "src/phase-router/phase-router.service.spec.ts",
      "notes": "Mocks ClaudeInvocationService, uses SignalResult helpers"
    }
  ],
  "outputs": [
    {
      "name": "plan",
      "type": "plan",
      "format": "md",
      "content": "plan.md"
    }
  ],
  "files": [
    {
      "path": "src/phase-router/phase-router.service.ts",
      "action": "modify",
      "reason": "Swap ClaudeInvocationService → LLMProvider; remove toSignalKind(), update executePhase() to use PhaseResult"
    },
    {
      "path": "src/phase-router/phase-router.module.ts",
      "action": "modify",
      "reason": "Import LLMModule instead of InvokeModule"
    },
    {
      "path": "src/phase-router/phase-router.service.spec.ts",
      "action": "modify",
      "reason": "Replace ClaudeInvocationService mock with LLM_PROVIDER mock returning PhaseResult"
    }
  ],
  "steps": [
    {
      "id": "S1",
      "summary": "Update module imports and service injection to use LLMProvider",
      "acceptance": [
        "phase-router.module.ts imports LLMModule, not InvokeModule",
        "phase-router.service.ts constructor injects LLMProvider via LLM_PROVIDER token",
        "No import of ClaudeInvocationService or InvokeModule in phase-router files"
      ],
      "depends_on": []
    },
    {
      "id": "S2",
      "summary": "Refactor executePhase() and remove signal conversion logic",
      "acceptance": [
        "executePhase() calls this.llm.invoke() instead of this.claude.invoke()",
        "PhaseResult fields used directly — no toSignalKind() conversion",
        "PR metadata extracted from PhaseResult.prNumber/prBranch instead of result.metadata",
        "validateCompoundScope() accepts PhaseResult parameter",
        "toSignalKind() method removed entirely"
      ],
      "depends_on": [
        "S1"
      ]
    },
    {
      "id": "S3",
      "summary": "Update unit tests to mock LLMProvider with PhaseResult",
      "acceptance": [
        "Test module provides LLM_PROVIDER token mock instead of ClaudeInvocationService",
        "completeResult(), blockedResult(), skipResult() helpers return PhaseResult",
        "All existing test cases pass with updated mocks",
        "tsc --noEmit passes",
        "npm run lint passes"
      ],
      "depends_on": [
        "S2"
      ]
    }
  ],
  "risks": [
    {
      "risk": "Blocked by #346 — LLMProvider/PhaseResult/LLMModule do not exist yet on rc/multi-tenant",
      "mitigation": "Implementation deferred until #346 is merged; plan is ready for immediate execution after"
    },
    {
      "risk": "PhaseResult field names may differ from assumptions",
      "mitigation": "Step 2 must read the actual PhaseResult interface from #346 before coding"
    }
  ],
  "assumptions": [
    "LLMProvider.invoke() returns a PhaseResult with signal kind, reason, prNumber, prBranch, and conflictMetadata fields",
    "LLMModule exports LLM_PROVIDER injection token",
    "PhaseResult signal field maps directly to SignalKind without conversion"
  ],
  "open_questions": []
}
Plan