AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-346
  5. plan
  6. context.json
context.json(4.2 KB)· Apr 8, 2026
{
  "meta": {
    "agent": "planner",
    "task_id": "346",
    "title": "Create LLMProvider interface + PhaseResult type + ClaudeCLIProvider",
    "created_at": "2026-04-08T12:00:00Z"
  },
  "inputs": [
    {
      "name": "issue-346",
      "type": "context",
      "ref": "https://github.com/AgentSDE/agent-core/issues/346",
      "notes": "MT-2: LLMProvider abstraction — Phase 1 foundation"
    },
    {
      "name": "signal-result",
      "type": "file",
      "ref": "src/invoke/signal-result.ts",
      "notes": "Current SignalResult interface to map from"
    },
    {
      "name": "claude-invocation",
      "type": "file",
      "ref": "src/invoke/claude-invocation.service.ts",
      "notes": "Existing invoke service to wrap"
    },
    {
      "name": "signal-parser",
      "type": "file",
      "ref": "src/signal/signal-parser.ts",
      "notes": "SignalType/BlockedSubtype types"
    },
    {
      "name": "conflict-types",
      "type": "file",
      "ref": "src/conflict/conflict.types.ts",
      "notes": "ConflictMetadata type to reuse"
    },
    {
      "name": "phase-router",
      "type": "file",
      "ref": "src/phase-router/phase-router.service.ts",
      "notes": "toSignalKind() mapping logic to replicate"
    }
  ],
  "outputs": [
    {
      "name": "plan",
      "type": "spec",
      "format": "md",
      "content": "plan.md"
    }
  ],
  "files": [
    {
      "path": "src/llm/llm-provider.interface.ts",
      "action": "create",
      "reason": "LLMProvider interface, PhaseResult type, LLM_PROVIDER token"
    },
    {
      "path": "src/llm/claude/claude-cli.provider.ts",
      "action": "create",
      "reason": "ClaudeCLIProvider wrapping ClaudeInvocationService + SignalResult→PhaseResult mapping"
    },
    {
      "path": "src/llm/llm.module.ts",
      "action": "create",
      "reason": "NestJS module providing LLM_PROVIDER token"
    },
    {
      "path": "src/llm/claude/claude-cli.provider.spec.ts",
      "action": "create",
      "reason": "Unit tests for all signal mapping scenarios"
    }
  ],
  "steps": [
    {
      "id": "S1",
      "summary": "Define PhaseResult type, LLMProvider interface, and LLM_PROVIDER token in src/llm/llm-provider.interface.ts",
      "acceptance": [
        "PhaseResult has fields: status, blockedType, reason, completeType, retryAfter, prNumber, prBranch, conflictMetadata, metadata",
        "LLMProvider interface has invoke(skill, env, taskId): Promise<PhaseResult>",
        "LLM_PROVIDER is exported as Symbol('LLM_PROVIDER')"
      ],
      "depends_on": []
    },
    {
      "id": "S2",
      "summary": "Implement ClaudeCLIProvider with SignalResult-to-PhaseResult mapping and error handling",
      "acceptance": [
        "ClaudeCLIProvider.invoke() delegates to ClaudeInvocationService.invoke()",
        "Maps SignalResult.type to PhaseResult.status (complete→complete, skip→skip, blocked/partial/none→blocked)",
        "Maps SignalResult.subtype to PhaseResult.blockedType with transient default",
        "Catches invoke errors and returns blocked:transient PhaseResult",
        "No-signal case returns blocked:transient with descriptive reason"
      ],
      "depends_on": [
        "S1"
      ]
    },
    {
      "id": "S3",
      "summary": "Create LLMModule providing and exporting LLM_PROVIDER token",
      "acceptance": [
        "LLMModule imports InvokeModule",
        "Provides LLM_PROVIDER token with useClass: ClaudeCLIProvider",
        "Exports LLM_PROVIDER token"
      ],
      "depends_on": [
        "S2"
      ]
    },
    {
      "id": "S4",
      "summary": "Write unit tests covering all 7 signal mapping scenarios",
      "acceptance": [
        "Tests: complete, blocked:transient, blocked:persistent, blocked:conflict, skip, none, and invoke-throws",
        "All tests pass with npm run test",
        "tsc --noEmit passes",
        "npm run lint passes"
      ],
      "depends_on": [
        "S2"
      ]
    }
  ],
  "risks": [
    {
      "risk": "SignalResult.metadata key names are string-keyed — upstream key changes break mapping silently",
      "mitigation": "Unit tests assert metadata extraction explicitly"
    },
    {
      "risk": "partial signal type has no PhaseResult equivalent",
      "mitigation": "Map to blocked:transient — matches current PhaseRouterService.toSignalKind() behavior"
    }
  ],
  "assumptions": [
    "ConflictMetadata type from src/conflict/conflict.types.ts is stable and can be reused without modification",
    "No existing files need modification — only 4 new files created under src/llm/"
  ],
  "open_questions": []
}
Plan