HarnessMM: Recursive Self-Improvement for Harness Token Efficiency
Organizations: Tsinghua University · Microsoft Research Asia (MSRA)
Abstract
Agent harnesses repeatedly invoke reasoning after tool feedback, even when an earlier call has already fixed the next action. We introduce HarnessMM (Harness Minus Minus), a method for improving harness token efficiency through guarded decision reuse and recursive self-improvement (RSI). RSI iteratively refines companion harness configurations from training feedback, with validation selecting the configuration for deployment. A controller at the model-tool boundary reuses resolved decisions to replace later reasoning callbacks while actor weights remain fixed. Executable Decision Graphs store exact actions, literal arguments, causal dependencies, and public guards. Guarded Decision Reuse activates these persistent decisions from observed receipts; Certified Callback Substitution executes them through the native interface and records removal of the registered slow callback. New semantic decisions, unsupported evidence, and selector abstention invoke the original actor again. The representation restricts what feedback may change, while complete-task measurements establish quality and cost. On HumanEval, HarnessMM preserves Codex success at 90.82% while reducing Tokens/task (k) from 66.72 to 47.02 (29.54% saving). For DeepSeek Harness, success rises from 71.43% to 85.71% while Tokens/task (k) fall from 96.28 to 11.62 (87.93% saving). A separate MBPP ablation measures 26.91% lower cost than single-use graphs and 19.52% lower cost than retained callbacks. These results establish guarded decision reuse as a practical way to reduce repeated reasoning in existing harnesses.
Figures & tables
| Harness | Pass (%) | Tokens/task (k) | Calls/task | Bypasses |
| HumanEval ( ) | ||||
| Codex | 90.82% | 66.72 | 5.35 | 0 |
| +HarnessMM | 90.82% | 47.02 | 5.09 | 18 |
| DeepSeek | 71.43% | 96.28 | 9.73 | 0 |
| +HarnessMM | 85.71% | 11.62 | 4.23 | 147 |
| MBPP-sanitized ( ) | ||||
Appendix figures & tables23 assets
Supplementary material from the paper’s appendix.
Appendix
| Success (%) | Tokens/task (k) | Calls/task | ||||
|---|---|---|---|---|---|---|
| Iteration | Single-use EDG | HarnessMM | Single-use EDG | HarnessMM | Single-use EDG | HarnessMM |
| 1 | 37.50 | 34.38 | 3.91 | 3.26 | 3.56 | 3.00 |
| 2 | 34.38 | 34.38 | 3.74 | 2.95 | 4.00 | 3.25 |
| 3 | 90.63 | 90.63 | 1.51 | 1.10 | 1.47 | 1.06 |
| 4 | 84.38 | 84.38 | 1.88 | 1.71 | 2.06 | 1.91 |
| 5 | 90.63 | 90.63 | 1.50 | 1.10 | 1.47 | 1.06 |
| Arm | Correct (%) | Tokens/task (k) | Bypass/task |
|---|---|---|---|
| Full HarnessMM | 93.77 | 13.17 | 1.58 |
| W/o GDR | 93.00 | 18.03 | 0.82 |
| W/o CCS | 93.39 | 16.37 | 0.00 |
| W/o EDG execution | 95.33 | 16.19 | 0.00 |
| Full versus control | correct (pp) | Cost saving (%) |
|---|---|---|
| W/o GDR | +0.78 [-3.50, +5.06] | 26.91 [4.01, 45.57] |
| W/o CCS | +0.39 [-2.72, +3.50] | 19.52 [-2.07, 38.68] |
| W/o EDG execution | -1.56 [-5.45, +2.33] | 18.62 [-9.53, 39.78] |
| Arm | Correct (%) | Tokens/task (k) | Bypass/task |
|---|---|---|---|
| Original harness | 87.55 | 67.84 | 0.00 |
| Full HarnessMM | 90.27 | 16.15 | 1.79 |
| W/o GDR (the single-use GDR control) | 91.44 | 15.87 | 0.92 |
| W/o CCS (callbacks retained) | 91.83 | 17.82 | 0.00 |
| Removal versus full | correct (pp) | Cost ratio |
|---|---|---|
| W/o GDR (the single-use GDR control) | +1.17 [-3.11, +5.45] | 0.98 [0.81, 1.22] |
| W/o CCS (callbacks retained) | +1.56 [-3.11, +6.23] | 1.10 [0.90, 1.39] |
| Run/arm | SR (%) | Tokens/task (k) | Slow/ep | Fast/ep |
|---|---|---|---|---|
| Original harness | 40.62 | 891.75 | 15.69 | 0.00 |
| CoT-only v20 | 28.12 | 1351.62 | 21.66 | 0.00 |
| CoT/Jev v20 | 34.38 | 1602.29 | 19.31 | 8.78 |
| CoT/Jev v22 | 43.75 | 753.13 | 12.62 | 1.69 |
| CoT/Jev v23 | 37.50 | 1071.85 | 15.72 | 5.28 |
| Condition | Successes /2,133 | Success (%) | Tokens/task (k) | Calls/task | Input/task (k) | Output/task (k) |
|---|---|---|---|---|---|---|
| No Skill | 902 | 42.29 | 34.05 | 35.61 | 19.71 | 14.34 |
| SkillOpt | 1,350 | 63.29 | 101.33 | 27.95 | 94.10 | 7.23 |
| AutoSaddler | 1,317 | 61.74 | 40.30 | 30.02 | 28.66 | 11.64 |
| HarnessMM skills | 1,412 | 66.20 | 31.12 | 26.43 | 21.67 | 9.46 |
| Control | Gains | Losses | Success diff. (pp) | 95% interval |
|---|---|---|---|---|
| No Skill | 603 | 93 | +23.91 | [19.15, 28.34] |
| SkillOpt | 286 | 224 | +2.91 | [0.43, 5.61] |
| AutoSaddler | 279 | 184 | +4.45 | [2.19, 6.73] |
| Condition | Correct/16,980 | EM (%) | F1 (%) | Tokens/task (k) |
|---|---|---|---|---|
| No Skill | 12,055 | 70.9953 | 79.0006 | 1.22 |
| SkillOpt | 12,986 | 76.4782 | 83.2716 | 3.27 |
| AutoSaddler | 12,643 | 74.4582 | 81.0417 | 1.61 |
| Original HarnessMM | 13,095 | 77.1201 | 83.8780 | 2.97 |
| Without recovery | 13,087 | 77.0730 | 83.9784 | 2.22 |
| With echo rejection | 13,108 | 77.1967 | 84.0475 | 2.31 |
| Condition | Correct | EM (%) | F1 (%) | Tokens/task (k) | Calls |
|---|---|---|---|---|---|
| SearchQA ( ) | |||||
| No Skill | 12,881 | 75.86 | 83.81 | 1.29 | 16,980 |
| SkillOpt | 13,156 | 77.48 | 84.41 | 3.39 | 16,980 |
| AutoSaddler | 12,639 | 74.43 | 81.55 | 1.76 | 16,980 |
| Original HarnessMM | 13,651 | 80.39 | 87.41 | 2.97 | 16,980 |
| Without recovery | 13,640 | 80.33 | 87.30 | 2.22 | 16,980 |
| Method | Correct (%) | Tokens/task (k) |
|---|---|---|
| Archived AIME 2025: ledger test set (18, tasks) Qwen3.8-27B | ||
| No Skill | 61.11% | 5.60 |
| SkillOpt | 72.22% | 5.69 |
| AutoSaddler | 72.22% | 6.81 |
| HarnessMM (ledger) | 72.22% | 6.79 |
| LiveMath: historical dynamic MCQ adapter, 160 tasks | ||
| Condition | Success (%) | Tokens/task (k) |
|---|---|---|
| Codex parent | 55.56% | 2413.56 |
| Codex + built-in compaction | 66.67% | 2057.72 |
| HarnessMM instruction module | 77.78% | 1455.83 |
| AutoSOTA-guided 32Ki compaction | 61.11% | 1068.67 |
| AutoSOTA-guided 96Ki compaction | 61.11% | 1176.39 |
| Stage | Codex seed | DeepSeek Harness seed |
|---|---|---|
| Training: original and two candidates (96 executions) | 592.97 | 862.65 |
| Benchmark judge | 0.99 | 1.05 |
| Two proposals (64 training-scenario exposures) | 3.70 | 2.06 |
| Validation selection (32 executions) | 673.91 | 821.69 |
| Benchmark judge | 1.15 | 1.35 |
| Final original harness (288 executions) | 614.78 | 748.27 |
| Method | Input | Output | Author | Total |
|---|---|---|---|---|
| No Skill | 0.22 | 4.38 | 0.00 | 4.59 |
| SkillOpt | 2.27 | 4.66 | 0.00 | 6.93 |
| AutoSaddler | 0.29 | 4.61 | 0.00 | 4.90 |
| HarnessMM | 0.54 | 4.28 | 1.08 | 5.90 |
| Method | Input | Output | Total |
|---|---|---|---|
| No Skill | 726.45 | 3.77 | 730.22 |
| SkillOpt | 767.16 | 3.46 | 770.63 |
| AutoSaddler | 768.38 | 3.84 | 772.22 |
| HarnessMM | 636.28 | 3.36 | 639.64 |
| Policy | Correct | EM/accuracy (%) | F1 (%) | Tokens/task (k) |
|---|---|---|---|---|
| SearchQA: all 3,395 TRAIN questions, Qwen3.5-9B | ||||
| No Skill | 2,404 | 70.81 | 78.65 | 1.22 |
| HarnessMM incumbent | 2,616 | 77.05 | 83.99 | 2.29 |
| Target-role guard (640) | 2,558 | 75.35 | 82.21 | 0.83 |
| Exact union 640 | 2,582 | 76.05 | 82.77 | 0.82 |
| Exact union 704 | 2,588 | 76.23 | 82.86 | 0.87 |
| Population | Policy | Success (%) | Tokens/task (k) |
|---|---|---|---|
| Validation: 32 scenarios | No Skill | 37.50% | 826.77 |
| Selected HarnessMM incumbent | 50.00% | 734.32 | |
| TRAIN: 32 scenarios | No Skill | 30.21% | 687.35 |
| Token-wire v3 | 9.38% | 942.24 | |
| TRAIN diagnostic: 8 scenarios | Original harness | 50.00% | 602.51 |
| Lazy schemas | 25.00% | 667.68 |
| Policy | Success (%) | Tokens/task (k) | Judge/task (k) |
|---|---|---|---|
| No Harness | 28.13% | 761.25 | 3.34 |
| Pi (unextended) | 20.83% | 2.50 | |
| Official SoL-Pi + original adapter | 33.33% | 2.81 | |
| HarnessMM receipt parent (historical) | 35.42% | 927.03 | 3.62 |
| HarnessMM exact references (historical) | 43.75% | 592.65 | 4.05 |
| Condition | Correct (%) | Tokens/task (k) |
|---|---|---|
| SearchQA: training set (3,395, tasks) Qwen3.5-9B | ||
| No Skill | 70.81% | 1.22 |
| Incumbent | 77.05% | 2.29 |
| risk-220 | 77.53% | 0.97 |
| AIME 2025: training set (6, tasks) Qwen3.8-27B | ||
| No Skill | 83.33% | 6.63 |
| Split | Method | EM (%) | F1 (%) | Tokens/task (k) |
|---|---|---|---|---|
| TRAIN | No Skill | 70.81 | 78.65 | 1.22 |
| TRAIN | SkillOpt | 74.40 | 80.98 | 1.61 |
| TRAIN | AutoSaddler | 71.13 | 78.76 | 1.25 |
| TRAIN | HarnessMM incumbent | 77.05 | 83.99 | 2.29 |
| TRAIN | HarnessMM risk-220 | 77.53 | 84.19 | 0.97 |
| Validation | No Skill | 69.81 | 77.51 | 1.23 |
| Seed | Condition | Success (%) | Tokens/task (k) | Calls/task |
|---|---|---|---|---|
| 9401 | HarnessMM | 66.20 | 31.12 | 26.43 |
| 9401 | w/o general guidance | 61.84 | 28.75 | 28.70 |
| 9401 | w/o task-family guidance | 49.27 | 39.04 | 33.54 |
| 9401 | w/o skills | 42.29 | 34.05 | 35.61 |
| 9401 | w/ mismatched task family | 48.48 | 43.03 | 34.11 |
| 9401 | w/ neutral text | 41.07 | 43.34 | 36.02 |
| Seed | Control | Full minus control (pp) | 95% interval | Gains | Losses |
|---|---|---|---|---|---|
| 9401 | w/o general guidance | +4.36 | [2.61, 6.21] | 232 | 139 |
| 9401 | w/o task-family guidance | +16.92 | [13.16, 20.28] | 470 | 109 |
| 9401 | w/o skills | +23.91 | [19.15, 28.30] | 603 | 93 |
| 9401 | w/ mismatched task family | +17.72 | [14.15, 21.02] | 491 | 113 |
| 9401 | w/ neutral text | +25.13 | [20.32, 29.44] | 621 | 85 |
| 9402 | w/o general guidance | +2.11 | [0.48, 3.76] | 215 | 170 |
| Configuration | Success (%) | Tokens/task (k) | Calls/task |
|---|---|---|---|
| Rules + actor | 92.82 | 1.08 | 1.04 |
| Rules only | 92.39 | 0.00 | 0.00 |
Agent Harness Optimization
Agent harness optimization improves the prompts, tools, memory, workflows, and control code that shape how AI agents act.
See all 183 papers