SKILL.state: Scalable Long-Horizon Agent Skills
TL;DR Highlight
Passing only a JSON state instead of chat history cut tokens and raised agent accuracy.
Who Should Read
A backend developer whose long-running agents get slower and costlier with every step.
Core Mechanics
- Pass state JSON, not chat history
- Each step's prompt has only the skill spec, the current state JSON, and the latest observation.
- Earlier observations, actions, and reasoning are not included.
- Reason, then throw the reasoning away
- Chain-of-thought is used fully within a step.
- Once the state patch is validated and applied, the reasoning trace is discarded.
- Prompt size stays flat
- History-based runtimes total O(T²) tokens; SKILL.state totals O(T).
- Prompt size does not depend on the number of steps so far.
- Truncation and compression don't match it
- At the same token budget, sliding window and LLMLingua score far lower.
- Keeping structured state is what matters.
- Robust to noise and external changes
- Irrelevant telemetry is filtered out at patch time and never reaches later prompts.
Evidence
- 16.2x fewer tokens at Warehouse T=100
- On Gemini-3-Flash, Stateful (LangGraph-style) used 1,062,387 tokens versus 65,408 for SKILL.state.
- Accuracy: Prompt (ReAct) 0.84, Stateful 0.91, SKILL.state 0.94.
- Accuracy 0.94 held at Warehouse T=200
- SKILL.state scored 0.94 with 122k tokens; Prompt (ReAct) scored 0.74 with 2.6M.
- Memory ballooned to 6.1M tokens.
- InterCode CTF pass@1 of 54.2%
- On Gemini-3-Flash, that is +7.8 points over the strongest baseline and +12.4 over Stateful.
- Total tokens fell 60.4% vs ReAct and 65.9% vs Stateful.
- Big gap at the same budget (~1,800)
- Warehouse T=100: SKILL.state 0.94, sliding window 0.18, LLMLingua 0.22, Summary-capped 0.52.
- At 50 noise events per turn (T=50), Prompt scored 0.53 and SKILL.state 0.98.
How to Apply
- Extract your agent's state into 5 fields
- Take one log today and keep only what the next step needs as JSON keys.
- Use fields like the paper's CTF schema: found results, tested hypotheses, working directory.
- Put state, not history, in the loop prompt
- Add state_patch validation and rollback retry
- Allow only the state_patch and action keys and validate against a schema.
- On failure, leave state untouched and retry.
- Write a merge function where null deletes a key.
- Force JSON output on small models
- 68% of errors were overwriting or deleting existing keys.
- State the merge behavior in the prompt and use grammar-constrained decoding if possible.
Try It
# Paste into Claude or ChatGPT (simplified version of the paper's method: one SKILL.state step)
Instructions:
{{agent role, rules, available actions}}
Skill Execution State:
{{current state JSON, start with {}}}
Latest Observation: {{latest observation}}
Provide your response with:
1. Step-by-step reasoning (will be discarded after execution)
2. A JSON block containing exactly two keys: {"state_patch": {<updates; set keys to null to delete>}, "action": "<exact command>"}
Next step: merge the returned state_patch into your state, discard the reasoning, and repeat the same prompt with the next observation.Terminology
Related Papers
Same Simulation, Different Evidence: Where Retrieved Tool Output Costs LLM Agents Accuracy
Saving long tool output to files cut GPT-5.1 accuracy by 11.3 points; naming the authoritative file restored it.
Fake News, Real Crashes: Information Injection Attacks on LLM Financial Trading Agents
Fake headlines hijacked LLM trading agents 62% of the time versus 14% for prompt injection.
Harness Engineering 101: The LLM is the brain, the harness is the body
An agent is a loop managing a JSON array; 16 chapters build one from scratch
Harness2 by Google Research – Recursive Agent Harnessing
Recursively refining the harness with fixed model weights raised benchmark scores by up to 11.8 points.
Ousted Savannah police officer gave ICE agent husband access to Flock system
A police officer shared her Flock login with her ICE-agent husband; an audit found 983 searches and she was fired
Tmux and Claude Code: Sessions, Send-Keys, and the Ceiling
Running Claude Code agents in tmux works well, but limits appear around four agents.
Original Abstract (Expand)
Large Language Models (LLMs) increasingly act as autonomous agents executing complex, long-running procedural skills. Existing agent runtimes maintain execution by continually appending observations, actions, and intermediate reasoning traces to an ever-growing conversation history, causing latency degradation and context-poisoning failures over long horizons. We present SKILL. state, a runtime architecture that replaces append-only conversational history with an explicit, mutable execution state. At each execution step, the model receives only the immutable skill specification, the current structured execution state, and the latest observation. Intermediate reasoning is discarded immediately after producing a validated state update, preventing prompt growth with execution history. Across diverse datasets, models, and execution environments, SKILL. state improves task accuracy while substantially reducing cumulative token consumption. Our results demonstrate that explicit execution state is an effective and architecture-agnostic abstraction for scalable long-horizon agent skills.