Experience-Driven Black-Box Cost Control for Coding Agents
Python agentic-aiagentic-codingai-codingai-coding-assistantanthropicartificial-intelligenceclaude-codecodexcoding-agentcoding-agentscost-optimizationcost-reductiondeveloper-toolsgithub-copilotllmopen-sourceopenaiproductivitytoken-optimization
Micro-skills
How micro-skills (see the main README) are learned, kept and injected.
Each finished session goes through three steps:
- Observe (
observe.py). Every shell command is split into segments and classified by intent (run the tests, run the interpreter, build or check, use the package tool, fetch, probe the VCS) and form (how it was spelled), and its outcome is read off the output as an environmental error class or a sign that tests ran. The words that name intents come from aVocabulary. By default the plugin reads every repository withGENERIC-- every ecosystem at once, every edited file, and the proposer's language-neutral digest and prompt; the experiments usePYTHON_GITorNODE_WEB, the paper's narrower reading. - Propose.
envfacts.pyturns recurring shapes of evidence into candidate facts, with no model call: a failing form followed by a working one (form repair), every fetch to a host refused (boundary), VCS probes that always come back empty (empty probe), a test label that loads once rewritten (arg repair), a missing environment variable that a later run sets (env value).distiller.pyadds an LLM proposer that authors facts with host-checked detectors; in the plugin,microskills=onruns both (micro-skills is off by default). - Keep or retire (
lifecycle.py). A candidate becomes active after confirmations on three sessions (for a proposed fact about the code, sessions that edited different files), retires on contradiction (for a command-spelling fact, two contradicting sessions in a row), and is injected only while the failure it prevents keeps occurring, or keeps being prevented, in at least 40% of the sessions that exercise it (over at least four).
stage.PrefixStage ties these together for a caller: render the block before a session, fold
the session in after it. The block is capped (MAX_FACTS, MAX_TOKENS), and a lint refuses any
fact that reads as completion or verification advice.
| Module | |
|---|---|
observe.py |
command segmentation, intent and form, error classes, observe_task |
envfacts.py |
EnvFactsDistiller: the five LLM-free fact families, rendering, caps |
distiller.py |
Distiller: the model-backed proposer (part of microskills=on) and its detector DSL |
lifecycle.py |
Lifecycle: formation, retirement, the firing gate |
stage.py |
PrefixStage, ComposedDistiller |