Docs assistant

Searches these docs locally; a configured answer service can generate responses.

Ask about this page or the wider Carina docs. Try: “How do I roll back a patch?”

llms.txt

Skip to content

Markdown

Agents overview

ReAct coding agent loop — model decides, kernel authorizes, Zig executes.

Agents

Carina drives a real ReAct coding agent. The model only decides; every side effect is authorized by the Rust capability kernel and executed by the Zig toolchain. The whole run is a tamper-evident audit trail you can replay and roll back. ReAct

Source: docs/agent.md.

Decide → authorize → execute → observe.

Hover identifiers for types (Twoslash):

session.tstwoslash
type type Profile = "safe-edit" | "read-only" | "full-workspace"Profile = "safe-edit" | "read-only" | "full-workspace";

interface CreateSessionParams {
CreateSessionParams.workspace_root: stringworkspace_root: string;
CreateSessionParams.profile?: Profile | undefinedprofile?: type Profile = "safe-edit" | "read-only" | "full-workspace"Profile;
}

interface CreateSessionResult {
CreateSessionResult.session_id: stringsession_id: string;
CreateSessionResult.workspace_id: stringworkspace_id: string;
CreateSessionResult.profile: Profileprofile: type Profile = "safe-edit" | "read-only" | "full-workspace"Profile;
}

async function 
function createSession(client: {
    request: (m: string, p: CreateSessionParams) => Promise<CreateSessionResult>;
}, root: string): Promise<CreateSessionResult>
createSession
(
client: {
    request: (m: string, p: CreateSessionParams) => Promise<CreateSessionResult>;
}
client
: { request: (m: string, p: CreateSessionParams) => Promise<CreateSessionResult>request: (m: stringm: string, p: CreateSessionParamsp: CreateSessionParams) => interface Promise<T>
Represents the completion of an asynchronous operation
Promise
<CreateSessionResult> },
root: stringroot: string, ): interface Promise<T>
Represents the completion of an asynchronous operation
Promise
<CreateSessionResult> {
return
client: {
    request: (m: string, p: CreateSessionParams) => Promise<CreateSessionResult>;
}
client
.request: (m: string, p: CreateSessionParams) => Promise<CreateSessionResult>request("session.create", {
CreateSessionParams.workspace_root: stringworkspace_root: root: stringroot, CreateSessionParams.profile?: Profile | undefinedprofile: "safe-edit", }); }

Each turn the reasoner emits one JSON action — or a batch of read-only actions ({"actions":[…]}, parallel; writes stay one per turn) — and Carina runs it and feeds back an observation:

ActionGoes throughRuns on
{"tool":"list"}FileReadZig carina-scan
{"tool":"read","path":"…"}FileReadkernel-gated read
{"tool":"search","pattern":"…"}FileReadZig carina-grep
{"tool":"run","command":["…"]}CommandExec (risk-classified)Zig carina-run
{"tool":"patch",…}PatchApplyRust transaction → Zig carina-patch-native
{"tool":"memory",…}MemoryWritegoverned long-term memory
{"tool":"ask_user",…}structured operator choice
{"tool":"code.search/symbols/…"}FileReadcode-intelligence index (+LSP)
{"tool":"mcp"} / mcp_findgoverned MCP managerexternal MCP servers
{"tool":"spawn",…}SubagentSpawnisolated subagent
{"tool":"workflow",…}PluginLoadnamed dependency DAG
{"tool":"best_of_n",…}opt-inN candidate patches, judge, apply winner
{"tool":"done","summary":"…"}ends the task

Destructive commands (rm -rf, curl … | sh) are denied before they run. Risky ones (installs) surface for approval. Secret files (.env, .ssh) are refused. Every file edit is a rollbackable patch transaction.

  • LoopGuard — breaks canonical-signature action repetition
  • MistakeTracker — breaks consecutive failure streaks
  • Compaction — folds old turns into a summary (CompactionReceipt audited); user-authored turns keep a verbatim tier
  • Steering — two-tier (urgent/normal) mailbox drained at turn boundaries

go/daemon/reasoner.go defines a pure “think” step:

BackendRole
model-routerBYOK provider adapters; prompt segments for caching; media parts when catalog allows
claude-cliExplicit compatibility backend using the local claude -p headless mode with tools disabled and an empty cwd
codex-cliExplicit compatibility backend using codex exec with ephemeral JSONL output, tool features disabled, read-only isolation, and fail-closed event parsing
scriptedFixed decisions for deterministic tests

Wiring:

  • Auto selects model-router only when an enabled provider is runnable; CLI binaries are never selected by presence
  • CARINA_REASONER_BACKEND=claude-cli or codex-cli opts into an external CLI explicitly
  • CARINA_REASONER_MODEL (e.g. openai/gpt-5) pins the selected backend’s model
  • Optional: CARINA_SUMMARIZER_MODEL, CARINA_VERIFIER_MODEL

Claude uses -p for non-interactive output. Codex uses codex exec; its -p flag selects a profile. Codex’s read-only sandbox is not a hard no-read or no-execution boundary, so Carina also rejects tool and unknown item events and keeps the backend explicit-only.

agent-loop.sh
cd your-repo
# Interactive TUI auto-starts the daemon; for headless runs you can also:
# carina daemon start
carina run "fix the failing test in parser.go"
carina audit SESSION
carina audit verify SESSION
carina patch list SESSION
carina patch rollback SESSION PATCH_ID
SurfaceRole
TUI (carina)Primary operator experience — slash commands, approvals, plan/build modes
CLIHeadless / CI: carina run, approve, audit, …
VS Code extensionOptional in-repo client under integrations/vscode — install from release assets when you need in-editor attach
Web operatorExperimental static shell under integrations/web — not a full dashboard product yet

Was this page helpful?

One vote per page is recorded during this session.