The harness
How an agent runs.
Hive does not wrap another agent tool. Every job runs on its own harness: one model, a small set of typed tools, a linear history and limits you set. The harness is part of the hive binary, so a machine that runs agents needs no other agent tool.
The tool loop
A run starts from a system prompt, the repository's own instructions and the job's brief. The model answers with tool calls. Each call runs in the job's throwaway clone, and its result goes back to the model as that call's observation. The run ends when the model answers with no call: that message is its final report.
system prompt (+ the clone's AGENTS.md) + the job's brief
─► the model answers with one or more tool calls
─► every call runs in the clone, in order
─► each result goes back as that call's observation
─► ... until the model answers with no call: that message is the final reportOne reply may carry several calls. The ones that only look (read, grep, glob, fetch) run at the same time; the ones that change something run one after another, in the order the model gave. Every step is stored as it happens, so the console shows a run command by command while it is still going.
The tools
A run that may change code is offered seven typed tools; a read-only run gets them without edit and write. The file tools take paths inside the clone only. bash starts in the clone and runs as your user. All of them pass the same deny rules and the same output cap.
| Tool | What it does |
|---|---|
bash | one shell command, a fresh process each time; it can also start a server or a watcher in the background |
read | one file, every line numbered |
grep | a regular expression over the clone, a folder or a file |
glob | the files whose path matches a pattern |
edit | exact search and replace in one file |
write | a whole new file |
plan | the task's checklist: to do, doing, done |
Beside them: process for the run's background processes, memory for what should be kept for later runs, skill, subagent and the tools of the project's MCP servers, each of which a setting can take away. fetch is offered once you name the hosts it may read. web_search is offered in a session and not in a job, unless you set harness.web_search to on.
Limits
Three budgets bound every run, and all three are settings.
harness.max_steps: the model calls one run may make. 60 by default.minutes_per_job: the wall clock. The harness stops a minute before the runner would end the run, so it can still report.harness.max_cost: the cost the provider reports for one run.0means no cap.
One command may run for harness.step_timeout seconds (300 by default) before it is ended. Output longer than harness.output_limit characters (20,000) is cut in the middle. When the conversation fills half of the model's context window (harness.compact_at, 50 percent), the harness has the model summarise the older part and carries on with the summary. A run that hits a limit still reports what it did.
Deny rules
Before a shell command of a job runs, the harness matches its text against four patterns. A match is refused without being run, and the model is told why:
- a command that starts with
git push; - a command that starts with
git remote add,set-urlorremove; - a command that starts with
gh; - a command that names
~/.ssh/,.netrc,~/.copilot,~/.config/ghor Hive's ownprivate/folder.
Other spellings pass: git -C . push, gh by its full path, $HOME/.ssh/.... The rules catch a mistake; they are not a barrier. A job runs as your user, with no container and no operating-system sandbox around it, so treat a repository you point Hive at like code you would run yourself.
Hive hands a run no git login of its own. The rule is that agents commit in their clones and do not push; the runner delivers the branch after the run has ended. You add rules of your own in the tool(filter) form:
hive settings set harness.deny_tools 'bash(rm *), read(.env*), write(*.lock)'Deny beats allow, and allow beats the default. A denied call is refused before anything runs, and a tool denied whole is not offered to the model at all. Jobs that only look, such as answers and ballots, run read-only: edit and write are not offered, and a command that would change the clone is refused.
Hooks
.hive/hooks.json in the repository and ~/.hive/hooks.json name commands the harness runs at six moments of a run: run_start, user_prompt, pre_tool, post_tool, pre_compact and run_end.
{"hooks": [
{"event": "pre_tool", "tools": ["bash"], "command": "hive-guard --stdin", "timeout": 10},
{"event": "post_tool", "tools": ["edit", "write"], "command": "npm run lint:changed"},
{"event": "run_end", "command": "./scripts/after-run.sh"}
]}A pre_tool hook that exits with 2 blocks the call, and the model sees the hook's words as the reason. What a post_tool hook prints is added to the observation, so a linter that runs after every edit speaks to the model in the same turn.
MCP servers
A run connects the project's enabled MCP servers when it starts and offers their tools to the model by name, as mcp__<server>__<tool>. Past 32 tools the run offers a search over them instead, so a large server does not fill the context. A server that does not answer within 45 seconds is skipped, and the run goes on without it. Connecting the outside world says how to register one.
Skills
A skill is a folder with a SKILL.md. The harness finds skills in .hive/skills, .claude/skills, .github/skills and .agents/skills in the repository, then in ~/.hive/skills. The model sees each name with its one-line description, cut at 240 characters, and loads a skill only when the task calls for it, so a project with forty skills costs the context forty short lines, not forty documents.
Helpers and sub-sessions
A run may hand a self-contained sub-task to a helper through the subagent tool: a second agent loop on the same model and in the same clone, with a history of its own. Helpers go one level deep, and their calls count against the parent's budgets.
A session in the console has a second shape of delegation. A sub-session is a session of its own, with its own page and budget, that you can open and steer while the parent carries on. It reports back to the parent when it has something to say.
What a run reads first
A run reads your own ~/.hive/AGENTS.md, then the clone's AGENTS.md, CLAUDE.md, GEMINI.md and .github/copilot-instructions.md, and the rule files under .hive/rules, .claude/rules and .github/instructions. A rule that is scoped to a path arrives the first time the model touches a file it covers.
What a run learns the hard way it can keep with the memory tool: a plain Markdown file per project under ~/.hive/memory/, which the next run in that project reads.
Providers
GitHub Copilot is the default provider and logs in with GitHub's device flow. These take an API key: openai, anthropic, gemini, and the OpenAI-compatible vendors openrouter, groq, mistral, deepseek, xai, together, fireworks, cerebras, github-models and azure-openai. The local servers ollama, lmstudio and vllm need no key, and custom points at any other OpenAI-compatible server.
hive harness login # GitHub's device flow, for the default provider
hive settings set provider openai # or anthropic, gemini, ollama, custom, ...
hive harness login --provider openai --with-token # reads the key on stdin
hive harness models # the models of the provider you chose; --provider NAME lists another's
hive harness status # the provider, the login, the models and limits in forceThree settings choose the models: worker_model for the runs that change code, light_model for the light runs (the lead, answers, ballots) and measure_model for the loop's measurements. To send a provider through a proxy, a gateway or a local server, set provider.<name>.base_url.
Talk to it yourself
hive harness chat is the same agent as a conversation in your terminal, with the same instruction files, skills, hooks and MCP servers as a job, and your own deny rules. Two things differ: web search is offered, and a command a job would refuse, such as git push or a gh call, is shown to you and runs if you say yes. Each line you type is a turn. A call that would change something is shown first, and you answer yes, no or always.
hive harness chat -C ~/src/my-appStep by step
This page says how it works. The guides say what to click and what to type:
- Choose models and set budgets. Connect a model provider, give each kind of run its own model, and set how much one run and one day may use.
- Give agents skills and tools. Add a skill that tells agents how your team does a job, and an MCP server that gives them new tools. See which projects get each and switch one off.
- Work with an agent in a session. Talk to one agent in the console while it works on a branch of its own, and bring the coding agent you already use to the project's board.
The full reference
- The harness: every tool, budget, flag and provider, with the reasons behind the defaults.
- The board: the commands agents use, MCP servers, shared skills, hooks and events.
- Sessions in the console: conversations with an agent, and their sub-sessions.