docs(adr): ADR-0029 agent runtime architecture #324
No reviewers
Labels
No labels
area:auth
area:ci
area:db
area:infra
area:native
area:pwa
area:service
epic
feature
foundation
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
james/carol!324
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "48-adr-agent-runtime"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves the load-bearing runtime decisions for epic #47 before any code lands (#48). Design only — no code, per the ticket's acceptance criteria. Linked from
docs/adr/README.md.Numbered 0029 (0028 is the export/import archive ADR).
Decisions (one per scope bullet)
LlmProviderabstraction: Anthropic native (default, best agentic tool-use) + OpenAI-compatible (OpenAI/OpenRouter/local Ollama for zero third-party). Per-user provider/model/base-URL; default model configurable (claude-sonnet-4-6out of box, opt-up toclaude-opus-4-8). Applies to the built-in agent only — MCP runs the external client's own model.apps/api/lib/agent/core (tool registry + repo-scoped execution + audit) driven by the PWA chat route andPOST /api/mcp(PAT-authed). Browser never holds the loop or keys.conversations+messages, per-user FK, normalized provider-agnostic message model (assistanttool_calls[],tool-role results bytool_call_id); JSON-as-text for both engines.CAROL_ENCRYPTION_KEY); new reversible-crypto helper (PATs are one-way hashed). Local Ollama needs none; key is write-only, never logged/returned.pending_action+ conversationawaiting_confirmation(no HTTP held across the click). PWA confirm → apply via repo layer + audit, then resume the loop; MCP returns the proposal as the tool result and the external client confirms.Consequences (new crypto surface, adapter-translation cost, one-way SSE deferring voice, resume state-machine complexity, no shared instance key) and the rejected alternatives (Anthropic-only, local-only, per-instance env key, Vercel AI SDK, WebSocket, raw provider-blob storage) are documented in the ADR.
Model IDs grounded against the current Claude model reference (Opus 4.8 / Sonnet 4.6 / Haiku 4.5).
Closes #48
🤖 Generated with Claude Code
📊 Test coverage
Patch coverage: no testable lines changed.
Overall (
app/,lib/,db/, excluding UI per ADR-0019):Soft thresholds per ADR-0019. Coverage is informational and does not block merge.