harness-multitool

Adapters and providers: Claude Code, Codex, Ollama and APIs

The harness runs an agent in one of two ways: its own agent loop on a model provider, or an unmodified agent program (Claude Code, Codex CLI) as a delegate. One conversation can move between them at any moment and stays the same conversation.

What it is

An adapter is what runs a session's turns (AgentBackend, IF-17). There are two kinds:

Every adapter writes the same events to the same log, so the transcript, a resume and the status line work the same way on each (ADR 0020).

How it works

The harness's own loop

Provider rowWhat it reachesHow it signs in
anthropic (the default, model claude-opus-5-5)the Anthropic APIANTHROPIC_API_KEY, or a key saved on the Provider page
kind openaiOpenAI, Azure, Groq, OpenRouter and other OpenAI-compatible APIs<PROVIDER>_API_KEY, or [session.auth.<name>]
localOllama, vLLM, LM Studio and other local OpenAI-compatible servers; Ollama's usual address http://127.0.0.1:11434/v1 is the defaultnone needed
gpt-subscriptionyour ChatGPT planOpenAI's own sign-in page

The ChatGPT plan is shipped because OpenAI documents a sign-in flow for open-source and locally hosted apps. The harness registers its own client under its own name (ADR 0019).

A Claude subscription is not offered on this loop. Anthropic's terms do not permit third-party apps to offer Claude.ai login or to collect, store or route its tokens, so Anthropic models here take a Console API key (CON-56).

Ollama and other local models are a provider of this loop: a row of kind openai with a base_url, as in the example under Provider, model and keys. The provider reads the reasoning that Ollama streams apart from the answer (crates/provider-openai/src/lib.rs).

Delegates

How the harness runs the vendors' own CLIs, unmodified, over their JSON streams, and how that stays within their terms: Delegates.

DelegateHow it runsHow it signs in
Claude Code (claude-code)the unmodified claude: claude -p with stream-json per message and --resume for the next (CON-58); always with --chrome (CON-133)only by the unmodified claude auth login, in the profile's own folder (CON-123)
Codex CLI (codex)the unmodified codex: one codex exec --json per message and resume <thread> for the next, the prompt on stdin (CON-137)only by its own codex login, in the profile's own Codex folder

The harness never reads, stores or passes on a delegate's credentials (CON-57, CON-137).

A delegate gets the harness's own tools over MCP: multitool mcp serves the journal, maps and flowcharts, the Telegram channel and the reload as mcp__harness__*, and the modes as mcp__mode__* (tools.md).

What the user set up in Claude Code and Codex reaches a delegate on every profile: MCP servers, plugins, skills, agents, commands, hooks, rules and instructions. A sign-in is never shared between profiles (CON-145).

Each delegate process runs in a systemd user scope of its own under multitool-agents.slice on Linux, so its memory is counted apart from the daemon's (CON-166).

Codex runs in Codex's own sandbox, workspace-write unless its row sets another, and read-only while plan mode is on (crates/backend-codex/src/lib.rs).

Profiles

A profile is a whole set of settings and sign-ins in its own folder, ~/.harness/profiles/<name>/: profile.toml, and its own claude/, chatgpt/ and codex/ folders (ADR 0026).

So one window can work under one Claude account, another under a second account, and a third on a ChatGPT plan, at the same time. Claude Code supports this by design: each account has its own CLAUDE_CONFIG_DIR, and a profile names that folder.

Profiles do not own conversations. Every conversation belongs to the daemon, and every profile sees the same ones (CON-126). A fresh install has default, which runs on the user's own Claude Code and Codex folders until its own are signed in (CON-120, CON-137).

One conversation in every form

A conversation is the harness's own log, which depends on no provider (INV-17). Each provider has its own form of it (conversations.md):

ProviderIts form
Claude Codea transcript file it keeps per folder; lines are appended on its chain
Codex CLIits own session files under $CODEX_HOME/sessions/ (crates/backend-codex/src/conversations.rs)
ChatGPT plan, OpenAI-compatible, Ollama, Anthropic APIthe history in each request, built from the log every time

Before each step the daemon pulls what a form gained into the log and pushes what the log gained to the form (INV-20). A conversation is linked, never copied or forked, and keeps its id (ADR 0025).

When a conversation moves to another adapter or profile, the daemon writes it in the form the target reads, and the target goes on with the whole history. When it moves back, the daemon compares a hash of the form with a hash of the log, and writes only what the form lacks, or nothing (CON-134, CON-138).

What a provider receives is always valid for it: two user messages in a row become one, a tool call with no result gets "no result in the record", and a block another model signed goes only to the model that made it (CON-73).

You can also leave the harness: claude --resume <id> opens the same conversation in Claude Code, with every turn made in the harness already in its file. While Claude Code has it open, the harness shows it but refuses to send (CON-78).

Using it

From the command line:

multitool login chatgpt|claude-code|codex     # sign the current profile in; logout signs it out
multitool profile list
multitool profile add work                    # a clean profile: defaults, no key, no sign-in
multitool --profile work                      # this run only
multitool import claude-code [id]             # list or link this folder's Claude Code conversations

In the configuration, a provider row looks like this (config.toml, see multitool setup):

[session]
provider = "local"

[session.providers.local]
kind = "openai"
base_url = "http://127.0.0.1:11434/v1"
context_window = 32000

[session.auth.local]
none = true

While the daemon writes a conversation's form for another adapter or profile, that tab shows a toast with a progress bar: what is being done, messages (or MB) done out of the total, and the share. Only that tab is held (CON-136, CON-144).

Limits and status

Specs and decisions

This page's source