Documentation

Docs / Reference

ADR 0003 — Model backends: provider mode and agent-driven mode

Status: Proposed Date: 2026-10-05

Context

Graphvein's understanding and judgement layers (Tiers 3 and 4) need an LLM. Users fall into two groups:

The original architecture included a "CLI driver" in which Graphvein would spawn agent CLIs headlessly (for example claude -p, codex exec) and use them as model backends. This means a third-party tool programmatically driving a user's subscription. Vendor terms for consumer subscriptions may restrict that, and they have changed over time. Graphvein should not depend on a usage pattern that may be disallowed or may break.

CodeWiki demonstrated a different pattern: the user runs their own coding agent, and a skill teaches the agent to call the tool's CLI commands to fetch evidence, write pages, and validate them. The tool never touches the subscription.

Options considered

  1. API providers only. Simple and unambiguous, but excludes subscription users.
  2. Headless CLI driver. Uses subscriptions, but Graphvein drives the agent, with terms-of-service risk, credential handling, and fragile parsing of CLI output.
  3. Provider mode plus agent-driven mode. API providers for direct calls; for subscriptions, the user's own agent session drives Graphvein through skills.

Decision

Option 3. The headless CLI driver is removed from the architecture.

Provider mode

Graphvein calls models directly through a provider interface:

Provider mode is required for unattended and batch runs (for example regenerating stale pages after re-indexing, or CI use). All calls go through internal/egress and are allowed only in llm egress mode.

Agent-driven mode

The user runs Codex, Claude Code or OpenCode as they normally would. Graphvein ships skill/instruction packages for each agent that teach it a fixed workflow using Graphvein's CLI:

Rules:

Relationship to MCP

The MCP server (Tier 5) is for agents doing other work that need context from Graphvein. Agent-driven mode is for agents doing Graphvein's generation work. Both can use the same underlying query code; they are separate entry points.

Consequences

Known gaps

Report a problem with this pageSource: docs/adr/0003-model-backends.md