hip-agent: a harness that fits in the prompt (5 minute read)

TLDR AI Tools

Summary

hip-agent is a minimal agent harness that fits within the prompt, allowing AI models to read and adapt their own harness using simple tools like shell commands and existing protocols. It is designed to be repairable and suitable for subagent tasks.

hip-agent is a small agent harness designed for agents. The configuration is environment variables, actions are shell commands, and a subagent is a child process. The rest is handled by existing protocols and formats. The core loop is about 200 lines of Python and a module for the Codex API.
Original Article
View Cached Full Text

Cached at: 09/08/26, 11:54 PM

# hip-agent: a harness that fits in the prompt Source: [https://jonathanc.net/blog/hip-agent?amp;utm_source=tldrai&v=2](https://jonathanc.net/blog/hip-agent?amp;utm_source=tldrai&v=2) hip\-agent \(harness in prompt\) is a small agent harness designed for agents: the model reads its own harness, configuration is environment variables, and the rest is existing protocols\. ![Two marionettes. Left: a puppet hanging from a tangle of X-shaped controls held by hands cut off by the frame. Right: the same puppet standing at a mirror; the reflection shows its strings ending at one X-shaped control hanging from a hook, with nobody holding it.](https://jonathanc.net/assets/hip-agent-banner-400w.png) > *Note*: this post was written with Claude Fable 5\.1 and GPT 5\.6 sol\. Code:[github\.com/changjonathanc/hip\-agent](https://github.com/changjonathanc/hip-agent)\. ## Motivation There are many coding harnesses \(Claude Code, Codex, and many more\), but they are all designed to be used by a human\. They are not designed to be used by an agent\. If you ask an agent to use`codex exec`as a subagent, it might spend a few turns just to figure out the right CLI flags and parse the output\. And if you want a more custom loop, an agent might need even more turns to dig into the source code of Codex CLI to learn all the implementation details\. ## Harness In Prompt hip\-agent \(harness in prompt\) is a harness designed for agents\. The core loop is about 200 lines of Python, plus one module for the Codex API\. Three ideas: - **The harness fits in the prompt\.**The loop is minimal, the model is given only two tools,`sh`and`view\_image`, and the prompt tells it to read the source to learn exactly what the harness does\. - **The OS is the runtime\.**Configuration is environment variables, actions are shell commands, and a subagent is a child process\. - **The rest is handled by existing protocols and formats\.**Plugins follow[Agent Plugins](https://agent-plugins.org/), hooks use Claude Code’s hook contract, and the conversation is a Codex CLI session file, so`codex resume`opens it\. The whole configuration looks like this: ``` # ~/.zshrc P=~/hip-agent/plugins export AGENT_MODEL=gpt-5.6-sol export AGENT_PLUGINS=$P/environment:$P/cwd:$P/agentsmd ``` And a run: ``` codex login ./agent "inspect this repository and explain it" ``` Everything else comes naturally from this design: - A subagent is`agent`run from`sh`\. It inherits the environment and gets its own conversation\. The parent configures it with environment variables,`AGENT\_MODEL=\.\.\. agent "\.\.\."`\. By default the parent sees only the subagent’s final output, but its state can be read from its session file, and more advanced interactions can be implemented as plugins\. - The harness is repairable\. A sufficiently smart model that has read its harness can work around its limits, or change them\. - You can put hip\-agent in a skill and let your existing agent spawn subagents through it\. The code itself is the documentation\. ## Why not native subagents? Why a new harness when current models are already trained with subagents? 1. Models don’t always perform best in a fixed harness, and as models get better a fixed harness can become the limitation\. hip\-agent is not a fixed harness\. It is a reference implementation, deliberately small so that an agent can read, modify, and adapt it\. 2. You can train the model to use it\. Future models can follow the hip\-agent approach, building and editing their own subagent harness depending on the task\. ## Results I did a few iterations of the code on Terminal\-Bench 2 with gpt\-5\.6\-luna at effort max: improved the shell design and the prompt a bit, added the view\_image tool and command timeouts\. Otherwise the code and prompt changes were minimal and not bench\-maxxed\. The final code was then evaluated on[DeepSWE](https://github.com/datacurve-ai/deep-swe), 113 tasks, against a Codex CLI 0\.147\.0 baseline\. The results show hip\-agent performs comparably with Codex CLI\. hip\-agentCodex CLIResolved73/113 \(64\.6%\)72/113 \(63\.7%\)Model calls per task187208Agent time per task58 min52 minOne run each, no error bars\. The two runs ran concurrently on two local machines with the same CPU but otherwise different hardware\. Token usage is not compared because hip\-agent does not log it\. ## Conclusion Almost every model provider now ships its own TUI harness\. But nobody has time to try them all\. It also makes evals hard\. A benchmark run measures the model and the harness together\.[OpenAI found](https://openai.com/index/how-two-settings-tripled-our-arc-agi-3-scores/)that ARC\-AGI\-3’s harness dropped the model’s reasoning between moves\. Turning on two settings that Codex uses by default tripled the score\. On the other hand, a user\-facing harness changes every week, and not every change is an improvement: Anthropic’s[April postmortem](https://www.anthropic.com/engineering/april-23-postmortem)documented how a harness can silently degrade the result when the model is unchanged\. A user\-facing harness is therefore a poor instrument for evaluating a model\. Ideally, every model builder would ship a minimal native reference harness, like hip\-agent\. A native reference harness is like a tool parser or a chat template: it describes how the model was trained to interact with the world\. It should be separate from the model provider’s user\-facing product\. It also makes trying a new model easy: a user can ask their existing agent to run the new model as a subagent\.

Similar Articles

What Is a Harness?

Hacker News Top

The article explains the concept of AI agent harnesses by comparing them to climbing harnesses, detailing components like system prompts and tools that enable AI models to function as agents.

Harness Handbook: Making Evolving Agent Harnesses Readable,Navigable, and Editable

arXiv cs.AI

The Harness Handbook is a behavior-centric representation synthesized from agent harness codebases using static program analysis and LLM assistance, helping developers and coding agents locate code implementing specific behaviors. It introduces Behavior-Guided Progressive Disclosure (BGPD) to guide agents from high-level descriptions to relevant implementation details, improving localization accuracy and edit-plan quality.

HarnessX: A Composable, Adaptive, and Evolvable Agent Harness Foundry

Hugging Face Daily Papers

HarnessX is a foundry for composable, adaptive, and evolvable AI agent harnesses that uses compositional primitives and trace-driven evolution to improve agent performance. Across five benchmarks, it achieves an average gain of +14.5% (up to +44.0%), demonstrating that runtime interface evolution is a complementary lever to model scaling.