Manuscript Offprint
arXiv:2611.03434Optimize the Harness, Not the Model: Fitting a Minimal Agent to a Self-Hostable LLM for Investigative Analysis
Shai Nahum Gefen
Dream Security
Tel Aviv, Israel
Vered Chassida
Dream Security
Tel Aviv, Israel
Dmitry Basin
Dream Security
Tel Aviv, Israel
Guy Feigenblat
Dream Security
Tel Aviv, Israel
Abstract
Government intelligence teams need LLM agents that can analyze large, messy evidence collections, but security and cost constraints often rule out hosted frontier models and broad, hard-to-audit tool surfaces. We report CLEO: Constrained Loop for Environment Optimization, a method for fitting a minimal agent harness to a fixed, self-hostable LLM. Given an expert-validated dataset, CLEO admits only the tools, guardrails, memory policies, and loop components that improve accuracy while remaining general and auditable. On our held-out dataset, the CLEO harness reaches an 83.8% pass rate, within 1.2 points of the strongest out-of-the-box Claude Code SDK baseline, while being two orders of magnitude smaller.
CCS Concepts
• Computing methodologies → Artificial intelligence; • Security and privacy → Software and application security.
ACM Reference Format:
Shai Nahum Gefen, Vered Chassida, Dmitry Basin, and Guy Feigenblat. 2026. Optimize the Harness, Not the Model: Fitting a Minimal Agent to a Self-Hostable LLM for Investigative Analysis. In Proceedings of the 35th ACM International Conference on Information and Knowledge Management (CIKM '26), November 7–11, 2026, Rome, Italy. ACM, New York, NY, USA, 3 pages. https://doi.org/10.1145/3799682.3839256
1 Introduction
Analysts in government organizations investigate complex cases spanning thousands of heterogeneous documents—emails, reports, call records, spreadsheets, chat logs, and multilingual material with inconsistent or unknown schemas—revisiting them repeatedly to aggregate evidence, reconcile contradictions, trace entities, and build coherent explanations.
LLM agents can make such investigations tractable, but only through a harness: the tools, memory, execution policies, and control loop that let the model search corpora, inspect files, run analyses, and refine hypotheses. In high-security settings both the served model and the harness are constrained: data sensitivity and cost push organizations toward smaller self-hostable models, while security review forces tight control over exposed capabilities—every new tool and every line of harness code must be inspected, justified, and often certified before deployment.
Two lines of work bear on this. Harness design spans reason-and-act control [1], filesystem agent–computer interfaces [2], lean and generic-purpose harness implementations such as PI [7]. Harness optimization automates this design, from agent-design search [3] to autoresearch-like loops [4] and observability-driven harness evolution [10]. Evidence access is a further design choice: where the dominant pattern pre-indexes the corpus into embeddings [8], indexless access through raw-file search and scripts can match or beat strong retrievers on evolving, heterogeneous corpora [9].
We report CLEO, a method that enabled us to launch a deployed investigative agent around a fixed, self-hostable model and a deliberately minimal harness. We use CLEO for both the optimization method and the resulting production harness. CLEO's first contribution is an explicit justification gate: proposed harness changes must improve accuracy and also be generic, auditable, and worth the added capability surface. This realizes the multi-objective harness that was mentioned but not studied in [3]. Its second contribution is bottom-up harness construction: the harness starts nearly empty and grows only when evaluation shows that a new tool, guardrail, memory policy, or loop component is necessary. Minimality is therefore optimized by construction, not patched in later. The resulting agent holds up on held-out, out-of-distribution cases (Table 1), is small enough for security review, and is currently being deployed in client environments.
2 Method
Datasets. Intelligence analysts work across distinct use cases, each a self-contained investigation with its own documents and questions; the product must serve many, so we build and evaluate on three. Within a use case, files are grouped into corpora—ingestion, classification, investigation, insights, reporting, and multilingual content—that overlap in their documents but differ in which files are relevant to a given query. A representative use case holds about 8,000 files across up to seven formats, with corpora from roughly 250 MB to 6 GB, and includes misleading and contradictory evidence to stress robustness. Across the three use cases we author 300+ expert questions at four difficulty levels; 240 are held out for evaluation and the rest form the optimization pool.
2.1 Model, Data, and a Minimal Harness
The model. We work with self-hostable (on-premises), open-weights LLMs and treat the model as fixed: the method optimizes everything around it. We report results with GLM-5.1 [5].

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
CIKM '26, Rome, Italy.
© 2026 Copyright held by the owner/author(s).
ACM ISBN 979-8-4007-2539-5/2026/11
https://doi.org/10.1145/3799682.3839256
CIKM '26, November 7–11, 2026, Rome, Italy.
Shai Nahum Gefen, Vered Chassida, Dmitry Basin, and Guy Feigenblatt
Algorithm 1 Autoresearch-style harness optimization.
Require: model , initial harness (CLEO v1), graded sets , adoption margin (min. accuracy gain to keep a change), supervisor
1: ;
2: repeat
3: \quad add a tool / guardrail / loop tweak
4:
5: if and then
6: ; \quad adopt
7: else \quad revert
8: discard
9: end if
10: analyze; occasionally swap for an OOD pool
11: until no justified gain
12: return
Optimization-loop dataset. The optimization loop runs on a single use case of four corpora, approximately 3,000 files in total. Each iteration evaluates the harness on 44 Q&A pairs: a fixed core of 32-eight per corpus, drawn from all difficulty levels—plus 12 sampled fresh from the development pool every iteration. We keep the evaluation set small so each optimization iteration finishes within minutes, staying inside our time and compute budget. Periodically the pool is swapped for an out-of-distribution development case. The final 240-question benchmark in Table 1 is held out and never exposed to the supervisor loop.
A minimal harness. The initial agent is a ReAct-style model-in-a-loop [1] with a short list of terminal tools—1s, read, grep, a sandboxed non-persistent Python—and nothing else. CLEO builds on this minimal, file-system-native toolset, adding only the persistent per-case memory an analyst workflow needs.
2.2 The optimization loop
Inspired by autoresearch [4], a supervisor model (a frontier LLM - we chose Opus-4.8 [12]) drives an automatic propose-test-keep loop over harness versions (Algorithm 1). A proposed change is kept only if it improves the current evaluation objective —the pass-rate/soft-score summary produced by EVAL—by a margin on the current graded subset and survives our key contribution: a justification check that asks whether the edit is generic, auditable, and as lean as possible. This second gate is meant to guard against both benchmark overfitting and scaffold bloat. Accepted changes define the final harness: a small set of tools plus tuned guardrails, retry/refusal handling, context compaction, memory policy, and tool-call budgets. They trigger an error analysis that drives the next proposal. To prevent the loop from fitting a single case, the evaluation set is periodically swapped for an out-of-distribution pool. EVAL runs the candidate on 32 fixed and 12 randomly drawn Q&A and scores each cited answer with an LLM judge [6] against expert ground truth. We optimize bottom-up rather than pruning a large off-the-shelf harness: in a broad harness much must be removed, and deciding which capabilities are unnecessary is itself a slow security and engineering exercise. In our experiments, top-down optimization matched bottom-up on accuracy but barely shrank the harness, whereas the near-empty CLEO loop added only what it needed—e.g., read/write memory tools and a non-answer safety net with a retry loop. Conversely, a cite() helper, proposed after error analysis showed the judge penalizing answers with missing evidence, was reverted: the agent rarely used it, so the change failed the justification gate.
Table 1: Combined held-out benchmark results for four harnesses under the same model
| Harness | LOC | Pass | Soft | Lat. |
|---|---|---|---|---|
| Claude Code SDK (bare) | ~512k | 85.0% | 8.48 2.25 | 76s |
| PI #1 (bare) | ~75k | 80.8% | 8.12 2.70 | 126s |
| PI #2 (CLEO's full prompts) | ~75k | 83.8% | 8.45 2.39 | 121s |
| CLEO | ~3k | 83.8% | 8.41 2.51 | 114s |
3 Results
Evaluation setup. We evaluate four agent harnesses on our intelligence analysis benchmarks, holding fixed the model (GLM-5.1 [5]), and a single Claude Opus 4.8 LLM judge [6, 12]. The judge receives the candidate answer and expert ground truth, then returns a correct/incorrect verdict and a 0–10 soft score.
We evaluate three baselines spanning two design axes: harness size (a large off-the-shelf harness vs. a lightweight one) and prompt (generic vs. CLEO-optimized), reporting accuracy, latency, and estimated harness size for each. The large harness is the Claude Code SDK [11], a mature production-grade system we treat as a reference point for what a general-purpose harness achieves out of the box, paired with a generic task-context prompt generated by Claude itself. The lightweight harness is PI [7], a minimal execution loop with no domain-specific prompting—the natural comparison for CLEO, though still considerably larger. PI #1 receives the same prompt as Claude; PI #2 receives CLEO's full optimized prompt.
Table 1 shows that CLEO, despite its tiny harness, is competitive with the substantially larger Claude Code SDK: an 83.8% pass rate and 8.41/10 soft score, within 1.2 percentage points and 0.07 soft-score points of the best baseline. On 240 held-out questions that gap is roughly three questions, so we read this as practical parity rather than a ranking. CLEO also matches or outperforms both PI versions on pass rate with a much smaller harness surface and similar latency. Given the small accuracy gap against the large LOC gap, CLEO is the best trade-off. The bottom-up direction matters: we ran a top-down loop from PI, permitting all modifications and encouraging removals, yet it matched bottom-up on accuracy while barely shrinking the harness.
4 Conclusions
This work shows that ground-up harness optimization is a practical direction for deploying agentic systems in regulated domains: a minimal harness approaches the accuracy of the strongest out-of-the-box harness with two orders of magnitude less code and capability surface. The result holds within a defined scope: a base model already capable of multi-step tool use, one investigative domain, and accuracy scored by an LLM judge that domain experts and product managers spot-checked but that we did not validate systematically. Within those limits, careful harness design is an effective systems optimization: exposing only task-essential capabilities retains competitive performance while improving maintainability, auditability, and operational simplicity for production deployments.
¹The SDK is closed-source and distributed minified, so no exact source-line count is publicly verifiable. The ~512k figure is the one widely reported following the 2026 source-map disclosure; we could not independently verify it.
Optimize the Harness, Not the Model: Fitting a Minimal Agent to a Self-Hostable LLM for Investigative Analysis
CIKM '26, November 7–11, 2026, Rome, Italy.
Speaker Bio
Shai Nahum Gefen is Data Science Team Lead at Dream Security, an AI-native company for national cybersecurity and sovereignty, where she leads research on agentic solutions and post training, and builds LLM-based systems for national cyber defense.
Generative AI Disclosure
Generative AI was used to assist with copy-editing and formatting of this manuscript; all technical content, experiments, and analyses are the authors' own.
References
[1] S. Yao, J. Zhao, D. Yu, N. Du, I. Shafran, K. Narasimhan, and Y. Cao. ReAct: Synergizing Reasoning and Acting in Language Models. In ICLR, 2023.
[2] J. Yang, C. E. Jimenez, A. Wettig, K. Lieret, S. Yao, K. Narasimhan, and O. Press. SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering. In NeurIPS, 2024.
[3] S. Hu, C. Lu, and J. Clune. Automated Design of Agentic Systems. In ICLR, 2025.
[4] A. Karpathy. autoresearch: AI agents running experiments on single-GPU model training, automatically. GitHub repository, 2026. https://github.com/karpathy/autoresearch.
[5] GLM-5 Team, A. Zeng, X. Lv, Z. Hou, Z. Du, Q. Zheng, B. Chen, D. Yin, et al. GLM-5: From Vibe Coding to Agentic Engineering. arXiv:2602.15763, 2026.
[6] L. Zheng, W.-L. Chiang, Y. Sheng, et al. Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena. In NeurIPS Datasets and Benchmarks, 2023.
[7] M. Zechner. Pi: A Minimal Coding Agent (four tools, sub-1k-token prompt). GitHub, 2026. https://github.com/badlogic/pi-mono.
[8] P. Lewis, E. Perez, A. Piktus, et al. Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. In NeurIPS, 2020.
[9] Z. Li, H. Zhang, C. Wei, et al. Beyond Semantic Similarity: Rethinking Retrieval for Agentic Search via Direct Corpus Interaction. arXiv:2605.05242, 2026.
[10] J. Lin, S. Liu, C. Pan, L. Lin, S. Dou, X. Huang, H. Yan, Z. Han, and T. Gui. Agentic Harness Engineering: Observability-Driven Automatic Evolution of Coding-Agent Harnesses. arXiv:2604.25850, 2026.
[11] Anthropic. Claude Agent SDK (Claude Code). GitHub, 2026. https://github.com/anthropics/claude-agent-sdk-typescript.
[12] Anthropic. What's New in Claude Opus 4.8. Claude Platform documentation, 2026. https://platform.claude.com/docs/en/about-claude/models/whats-new-claude-4-8.