Docs/Multi-mind ask & MCP▾

Multi-mind ask & MCP

constant ask and constant mcp make Constant agent-native: an active coding agent can consult one or multiple independent runtimes on its exact, unedited conversation (including failing tool outputs) without taking over your terminal or losing context to a summary.

Parallel multi-mind ask & harness:model matrix

Pass comma-separated targets (--to claude:sonnet,claude:opus,codex:o3,antigravity) or repeat --to to fan out concurrently from a single frozen Dry Master snapshot:

constant ask \
  --to claude:sonnet,claude:opus,codex:o3,antigravity \
  --session "$CLAUDE_CODE_SESSION_ID" \
  --with-tools \
  --render triage \
  --isolate worktree \
  --verify-cmd "cargo test" \
  --question "Audit this root cause and propose a minimal patch." \
  --json

What happens under the hood, in-process:

  1. Constant reads the source session once and seals one immutable Dry Master chapter (chNN) under ~/.constant/snapshots/.
  2. Native forks (codex, claude, opencode) are materialized sequentially so registries and SQLite never race; Antigravity (agy), ACP agents, and external plugins receive the projected Dry Master directly (optionally sliced with --until-turn K or compressed with anti-compaction --render triage).
  3. All targets execute in parallel via std::thread::scope against a shared deadline (--timeout SECS, default 300), each pinned to its explicit --model when <harness>:<model> is specified.
  4. When --verify-cmd is set, Constant runs the verification command inside each target's workspace/ephemeral worktree before teardown and captures its pass/fail status, exit code, and output tails alongside files_touched and unified patch_diff.
  5. Constant computes a deterministic zero-LLM divergence summary comparing answers, shared vs. unique file references per target, worktree diffs, and objective verify_passed_by / verify_failed_by outcomes.

Workspace isolation (--isolate)

ModeBehavior
auto (default)Uses worktree when querying multiple targets inside a git repo; none for single target.
worktreeCreates one RAII-guarded detached git worktree per target, mirrors uncommitted tracked changes as a temporary detached baseline commit, captures net edits (including new files), and deletes every worktree unconditionally on drop.
readonlyPasses verified read-only flags (codex exec -s read-only, claude --permission-mode plan, plugin readonly: true; ACP cancels permission prompts automatically).
noneRuns directly in the conversation's working directory.

Multi-target JSON envelope

Single-target constant ask --json keeps its flat response shape (ok, to, answer, session, resume, receipt, snapshot). Multi-target runs emit:

{
  "ok": true,
  "all_ok": true,
  "multi": true,
  "handle": "cobalt-37",
  "trail": "ch03",
  "isolation": "worktree",
  "targets": ["codex", "claude", "opencode"],
  "results": [
    {
      "ok": true,
      "to": "codex",
      "adapter_kind": "builtin",
      "answer": "...",
      "files_touched": ["src/auth.rs", "src/session.rs"],
      "patch_diff": "...",
      "elapsed_ms": 4120
    }
  ],
  "divergence": {
    "targets_succeeded": 3,
    "targets_failed": 0,
    "answers_identical": false,
    "shared_references": ["src/auth.rs"],
    "unique_references_by_target": {
      "codex": ["src/session.rs"],
      "claude": ["src/retry.rs"]
    },
    "patches_differ": true,
    "summary": "3/3 answered · divergent answers · 1 shared file ref(s) · worktree patches differ"
  }
}

Native stdio MCP server (constant mcp)

Constant ships a zero-dependency JSON-RPC 2.0 stdio MCP server directly inside the binary. All 7 tools run in-process with diagnostics strictly on stderr.

Connect your host

# Claude Code
claude mcp add constant -- constant mcp
 
# Codex
codex mcp add constant -- constant mcp
 
# Print exact snippets for OpenCode, Cursor, Windsurf, Cline, Goose
constant integration mcp-config
constant integration mcp-config --json

Generic .mcp.json / .cursor/mcp.json:

{
  "mcpServers": {
    "constant": {
      "command": "constant",
      "args": ["mcp"]
    }
  }
}

Tools exposed

ToolDescription
constant_askConsult 1 or N runtimes in parallel (targets[] or to, session or from, question, with_tools, isolate, timeout_secs).
constant_recordSeal an idempotent Dry Master snapshot (session or from, force).
constant_searchDeterministic zero-LLM lexical search across turns and (tools: true) redacted tool calls/outputs.
constant_recallRead verbatim turns and paired redacted tool traffic by handle, chapter, and range.
constant_carryMaterialize a native resumable projection in codex, claude, opencode, or a write_native plugin.
constant_sessionsDiscover local sessions on disk linked to Constant handles.
constant_runtimesList built-ins, configured ACP agents, and discovered constant-adapter-* plugins.

Next: Universal runtimes (ACP & plugins).