Configuration

Config file

Location: ~/.config/agent-doc/config.toml

default_agent = "claude"

[agents.claude]
command = "claude"
args = ["-p", "--output-format", "json"]
result_path = ".result"
session_path = ".session_id"

[agents.codex]
command = "codex"
args = ["--prompt"]
result_path = ".output"
session_path = ".id"

[agents.opencode]
command = "opencode"
args = ["run"]

Fields

FieldDescription
default_agentAgent backend used when not specified elsewhere
[agents.NAME]Agent backend configuration
commandExecutable name or path
argsArguments passed before the prompt
result_pathJSON path to extract the response text
session_pathJSON path to extract the session ID

Resolution order

The agent backend is resolved in this order:

  1. --agent CLI flag
  2. agent: field in document frontmatter
  3. default_agent in config
  4. Fallback: "claude"

Per-document overrides

Set agent and model in the document's YAML frontmatter:

---
session: null
agent: opencode
opencode_model: zai/glm-5
---

These override the config file for that specific document.

Environment Variables

Runtime Tuning

VariableDefaultDescription
AGENT_DOC_LOGStructured log filter (e.g. debug, agent_doc::preflight=debug)
AGENT_DOC_RUN_AGENT_TIMEOUT_SECS1800Max agent run time before timeout (30 min)
AGENT_DOC_RUN_HEARTBEAT_SECS30Run heartbeat interval
AGENT_DOC_QUEUE_MAX_ITERATIONS_HARD_CAP50Hard cap on auto-loop queue iterations
AGENT_DOC_TSIFT_BINOverride tsift binary path
AGENT_DOC_TSIFT_GRAPH_TIMEOUT_SECSTsift graph query timeout

Harness Detection

These are read by detect_harness() to identify the active agent harness:

VariableHarness
CLAUDE_CODE_SESSION / CLAUDE_CODE / CLAUDECODEClaude Code
CODEX_SESSION / CODEX_THREAD_ID / CODEX_CLI / CODEXCodex
OPENCODE_CLIENT / OPENCODEOpenCode

Harness Arg Overrides

VariableDescription
AGENT_DOC_CLAUDE_ARGSClaude CLI args (lowest precedence, below frontmatter + config)

Vision

VariableDescription
AGENT_DOC_VISION_PROVIDERVision provider override (e.g. openai)
AGENT_DOC_VISION_API_KEYVision API key
AGENT_DOC_VISION_MODELVision model override
AGENT_DOC_VISION_ENDPOINTVision endpoint override

Testing / Debug

VariableDescription
AGENT_DOC_NO_AUTOSTARTPrevent auto-start of new agent panes
AGENT_DOC_ROUTE_BINOverride agent-doc binary for route dispatch
AGENT_DOC_DEBUG_FILTERDebug filter for supervisor start
AGENT_DOC_DEBUG_STDINDebug stdin for supervisor start
AGENT_DOC_ALLOW_REPLACE_PENDINGAllow replacing pending items
AGENT_DOC_HARNESS_PROMPTOverride harness prompt detection

Probe Markers

Set by child processes to confirm capability proofs:

VariableDescription
AGENT_DOC_NETWORK_PROBE_OKCodex child network probe success
AGENT_DOC_WRITABLE_ROOT_PROBE_OKCodex child writable root probe
AGENT_DOC_OPENCODE_SSH_PROBE_OKOpenCode child SSH probe

Project Config

Location: .agent-doc/config.toml (relative to project root).

FieldDescription
tmux_sessionTmux session name bound to this project
agent_doc_auto_compactLine threshold for automatic compaction opt-in
documents.includeProject-relative globs for session document opt-in
documents.auto_session_for_all_mdLegacy escape hatch (default false)

SSH Config

[ssh.profiles.production]
targets = ["host1", "host2"]

[ssh.docs."ops/deploy.md"]
profile = "production"

Component Config

Inline component attributes override defaults:

<!-- agent:exchange patch=append max_lines=50 -->