Decide.
Bring the goal, current state, and available tools. Router chooses a next step from that set.
pre_decisionThe decision layer for agent harnesses
Give every tool call a little more direction. Harness Router chooses the next tool, uses the result, and keeps your agent moving.
Open sourcePython 3.11+MIT licensed
The failing test points to src/parser.py.
01 / The loop
A little direction. Every iteration.A tool result changes what your agent knows. Feed that observation into the next choice, and routing becomes part of the whole workflow.
Bring the goal, current state, and available tools. Router chooses a next step from that set.
pre_decisionYour harness builds the arguments, checks its permissions, and carries out the tool call.
host harnessTurn the result into the next observation. Recompute the next tool as the task progresses.
post_tool_useYour harness keeps its planning, permissions, approvals, and execution policy.
02 / The decision stack
Reuse a known choice. Ask Jev when tools overlap. Look ahead when downstream outcomes matter.
Inside the routerA compatible state can reuse a previous decision. The hook cache includes the goal, observation, last action, and tool catalog.
Resolve a closed choice among available tools through OpenRouter. Large registries can be narrowed by category before selecting a tool.
Search a supplied, side-effect-free state graph when the first choice depends on later outcomes. Simulate the possibilities, then return the first action.
MCTS is optional and needs a simulator. A fallback hands the choice back to the planner.
03 / Integrations
One router. Five ways in.Each adapter works with the lifecycle its host exposes. Your tools and execution controls stay with the harness.
Prompt and result hooks precompute the next tool. Local validation can request a re-plan.
Native hooksSet upDiscover native and MCP tools, then connect prompt, tool-result, and validation callbacks.
Native hooksSet upRoute from the live tool registry and expose the selected tool through the active tool set.
ExtensionSet upUse invocation and result callbacks to prepare decisions, then validate before execution.
Hooks + MCPSet upConnect through the Codex hook bridge with a supplied tool catalog and current goal.
Hook bridgeSet upCall Router directly with the Python API, CLI, or MCP server.
Read the API guide04 / Get started
Python 3.11+ · OpenRouter API keyInstall the router, add your key, and connect the harness you use.
uv tool install --force --with 'mcp>=2,<3' \
'git+https://github.com/Protocol-Lattice/harness-router.git@main'export OPENROUTER_API_KEY="your-key"Make the key available to the harness process before starting a session.
curl -fsSL https://raw.githubusercontent.com/Protocol-Lattice/harness-router/main/scripts/install_hook.py \
| python3 - --provider codexThe current Codex and Claude Code installer also needs these two adapter files. Run this after installing the hook.
for hook in pre_decision stop; do
curl -fsSL "https://raw.githubusercontent.com/Protocol-Lattice/harness-router/main/.codex/hooks/${hook}.py" \
-o ".codex/hooks/${hook}.py"
doneThe startup hook discovers tools. Prompt and result callbacks then prepare the next choice for local validation.
Integration guideThe installer merges settings and backs up changed files. Add .harness-router/ to your project's .gitignore for shared session state.
Open source. Open possibilities.