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
docs updated
Aarondf8886ba97fc
diff --git a/README.md b/README.mdindex eb6a552..a0c6e2e 100644--- a/README.md+++ b/README.md@@ -38,11 +38,9 @@</picture></p>-TokenEconomizer is a plugin that makes **Claude Code**, **Codex**, the **GitHub Copilot CLI**-and **Pi** cheaper to run in the repositories you work in often. It does not change the agent;-it learns from your sessions. Its unit is the *session*: one conversation with your agent, from-start to exit, however many tasks you do in it. After each session in a repository ends, the-plugin reads its log, and it changes what the next sessions there start with. It has three+TokenEconomizer makes coding agents cheaper to run in the repositories you work in often,+without changing the agent itself. It learns from the sessions an agent has already run in a+repository, and uses that experience to cut waste in the sessions that follow. It has threemechanisms:- **Micro-skills: remember how the repository works.** Sessions keep rediscovering the same@@ -51,22 +49,26 @@ mechanisms:variable a command needs, where generated files live. Micro-skills learns such facts, in anylanguage, from two sources: failures that repeat across sessions, and a model that reviews therecent sessions every *k* sessions (*k* = 3) and proposes facts. A fact is stated at the start- of each session once later sessions confirm it, and dropped when one contradicts it.-- **Tool pruning: stop loading tools that go unused.** Every loaded tool is sent with every- request. A tool that goes unused over *p* prompts spread across at least *m* sessions, or over- *s* sessions of any length (*p* = 10, *m* = 2, *s* = 5), is left out of the next sessions+ of each session once three sessions have confirmed it, and dropped when later sessions+ contradict it.+- **Tool pruning: stop loading tools that go unused.** Every loaded tool's definition is sent with+ every request. A tool that goes unused over *p* prompts spread across at least *m* sessions, or+ over *s* sessions of any length (*p* = 10, *m* = 2, *s* = 5), is left out of the next sessionsthrough the agent's own settings. One command brings it back.- **Failure-loop intervention (the loop guard): step in when a turn is stuck.** When a turn (theagent's work on one prompt) keeps hitting the same failures, a judge model checks whether it is- stuck. If the judge is at least *c* sure (*c* = 0.7), the agent gets a short redirect, at most- *r* times per turn (*r* = 1). If the turn is still stuck after that, the plugin tells you how to- stop it; it never stops a turn itself.+ stuck. If the judge is at least *c* sure (*c* = 0.7), the agent gets a redirect (a short note,+ added to its context, to try another approach), at most *r* times per turn (*r* = 1). If the+ turn is still stuck after that, TokenEconomizer tells you how to stop it; it never stops a turn+ itself.-Each italic letter is a setting, shown with its default ([Settings](#settings)), and each+TokenEconomizer is a plugin for **Claude Code**, **Codex**, the **GitHub Copilot CLI** and **Pi**.+Each italic letter above is a setting, shown with its default ([Settings](#settings)), and eachmechanism can be turned on or off. The plugin announces each action in one line, and if any part-of it fails, your session carries on as if it were not installed. Its only model calls (the fact-proposer and the judge) run through your own agent, on the same plan or login, and their cost is-included in its reports. What it learns stays on your machine, in `~/.tokeneconomizer`.+of it fails, your session carries on as if it were not installed. Its model calls (the fact+proposer, and the judge with the redirect it writes) run through your own agent, on the same plan+or login, and their cost is included in its reports. What it learns stays on your machine, in+`~/.tokeneconomizer`.## Results@@ -98,7 +100,7 @@ follow. Four principles guide the mechanisms:computed with cache pricing, and it includes the plugin's own model calls.- **Protect task success.** Facts form only from repeated evidence, tools are removed only aftergoing unused, and the loop guard leaves alone a turn that is still making progress.-- **Keep every action reversible.** A fact that a later session contradicts is dropped, removed+- **Keep every action reversible.** A fact that later sessions contradict is dropped, removedtools can be given back, and the loop guard only redirects and tells you: stopping a turn isyour call.@@ -135,8 +137,8 @@ codex plugin add tokeneconomizer@tokeneconomizer```Start `codex`, choose **Trust and continue** for the folder, then at **Hooks need review**-choose **Trust all and continue**; the hooks run from the next session on. Check with-`$tokeneconomizer:status`.+choose **Trust all and continue**. The hooks take effect from your next Codex session, so quit+(`/exit`), start `codex` again, and check with `$tokeneconomizer:status`.**Copilot CLI**@@ -210,7 +212,7 @@ commands. They have the same names on every agent; only the way you type them di| `toolprune` | the tools it left out, and the evidence (not on Pi) || `toolprune restore` | give them back; they will not be removed again || `config` | every setting in effect |-| `config set microskills=on` | turn a mechanism on (or `=off`) here; add `--global` for every repository |+| `config set microskills=on` | turn a mechanism on (or `=off`) in this repository; add `--global` for every repository |Inside an agent, a command costs one model turn; from a terminal it is free. The other commands(`repos`, `doctor`, `config unset`, ...) and each agent's permission prompts are listed under@@ -218,11 +220,12 @@ Inside an agent, a command costs one model turn; from a terminal it is free. The## Settings-Tool pruning and the loop guard are on by default; with these defaults, the plugin's only model-call is the judge, asked only about a turn that shows signs of looping. Micro-skills is off by-default, because its proposer adds model calls and how much it saves depends on the repository-and the work you do there. Each mechanism takes `on` or `off`, and the italic letters above are-these settings:+Tool pruning and the loop guard are on by default; with these defaults, the plugin calls a model+only when a turn shows signs of looping: the judge, and the redirect it writes if it finds the+turn stuck. Micro-skills is off by default, because its proposer adds model calls and how much it+saves depends on the repository and the work you do there. Each mechanism has its own switch+(`microskills`, `toolprune`, `loopguard`) that takes `on` or `off`, and the italic letters above+are these settings:| | Setting | Default | What it sets ||---|---|---|---|@@ -231,7 +234,7 @@ these settings:| *m* | `toolprune_min_sessions` | 2 | sessions those prompts must span || *s* | `toolprune_sessions` | 5 | or this many sessions, of any length || *q* | `toolprune_quiet_minutes` | 60 | minutes your sessions here must be idle before a deny list is written |-| *e* | `loopguard.envelope_min_samples` | 5 | turns here that ended with passing checks before the loop guard acts |+| *e* | `loopguard.envelope_min_samples` | 5 | turns here that ended well (no failing check after the last edit) before the loop guard acts || *c* | `loopguard.judge_confidence` | 0.7 | how sure the judge must be that a turn is stuck || *r* | `loopguard_nudges` | 1 | redirects per turn before the guard only tells you || *b* | `loopguard.backstop_mult` | 2.5 | how many times its usual length a churning turn may run before it is redirected without the judge |@@ -248,9 +251,9 @@ Change them with `config set`, shown here in Claude Code's form (other agents tyTool pruning counts prompts so that long sessions weigh more, and requires *m* sessions so that asingle session never decides alone. It writes the deny list only once your sessions in the-repository have been idle for *q* minutes: a conversation resumed after its tools change must-write its whole history to the prompt cache again instead of reading it, and after an idle hour-that cache has expired anyway.+repository have been idle for *q* minutes (or, at the latest, a day after the list formed): a+conversation resumed after its tools change must write its whole history to the prompt cache again+instead of reading it, and after an idle hour that cache has expired anyway.Besides `on` and `off`, two modes are useful: `toolprune=propose` only proposes the deny list, andnothing changes until you run `toolprune apply`; `microskills=envfacts` learns facts only from@@ -258,48 +261,51 @@ repeated failures, with no model calls.To change a single session, set an environment variable when you start the agent:`TE_DISABLE=1 claude` turns the whole plugin off, and `TE_LOOPGUARD=off codex` turns off one-mechanism (likewise `TE_MICROSKILLS` and `TE_TOOLPRUNE`). Every setting, its default and its-environment variable are listed under [Settings](plugin/README.md#settings).+mechanism (likewise `TE_MICROSKILLS` and `TE_TOOLPRUNE`). Every setting and its default are+listed under [Settings](plugin/README.md#settings); each one's environment variable is `TE_` plus+its name in capitals.## What it does on each agent-Micro-skills and the loop guard work the same way on every agent. Tool pruning acts through each-agent's own settings, so what it can leave out differs:+Micro-skills and the loop guard work the same way on every agent. Each agent learns on its own:+facts, tool evidence and the loop guard's sense of a usual turn are kept per agent and+repository, while settings are shared. Tool pruning acts through each agent's own settings, so+what it can leave out differs:| Agent | Tool pruning leaves out | Written to ||---|---|---|| Claude Code | single tools | `.claude/settings.local.json` || Codex | capability packages | `.codex/config.toml` || Copilot CLI | whole MCP servers | `.github/copilot/settings.local.json` |-| Pi | nothing: Pi loads four tools | — |+| Pi | nothing (Pi loads only four tools) | — |-Tool pruning adds only its own entries and never touches deny rules you wrote; a settings file-it creates is kept out of git (`.git/info/exclude`). On Claude Code, the session-start line that-says what it left out shows only in the detailed transcript (**Ctrl+O**), so check with+Tool pruning adds only its own entries and never touches deny rules you wrote; a settings file it+creates is kept out of git (`.git/info/exclude`). On Claude Code, the session-start line that says+what it left out shows only in the detailed transcript (**Ctrl+O**), so check with`/tokeneconomizer:toolprune`. `toolprune restore` removes the plugin's entries and nothing else,and tools you give back are not removed again. If the plugin cannot edit a file safely (a-`.codex/config.toml` your repository commits, a settings file that is not valid JSON, a path-through a symlink), the list stays a proposal and the session start says why; `toolprune apply`-tries again. **[`docs/PLUGIN.md`](docs/PLUGIN.md)** records how each agent's hooks and settings-were verified to behave, and **[`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md)** how the package-fits together.+`.codex/config.toml` your repository commits, a settings file that is not valid JSON, a symlink+that leads out of the repository), the list stays a proposal and the session start says why;+`toolprune apply` tries again. **[`docs/PLUGIN.md`](docs/PLUGIN.md)** records how each agent's+hooks and settings were verified to behave, and **[`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md)**+how the package fits together.### When a turn gets stuckThe loop guard first learns how long a turn in this repository usually runs: it waits until *e*-turns here have ended with passing checks. After that, a turn that shows signs of looping (the-same failures repeating, or errors piling up) goes to the judge. One case is redirected without-the judge: a turn that runs past *b* times the usual length while churning the same edits through-the same failures. If a turn is still stuck after its redirects, you see one line that ends with-how to stop it:+turns here have ended well, on their own and with no failing check after the last edit. After+that, a turn that shows signs of looping (the same failures repeating, or errors piling up) goes+to the judge. One case is redirected without the judge: a turn that runs past *b* times the usual+length while churning the same edits through the same failures. If a turn is still stuck after its+redirects, you see one line that ends with how to stop it:-> TokenEconomizer: this turn still looks stuck after a redirect (envelope, 12 tool calls). Press-> Esc to interrupt it.+> TokenEconomizer: this turn still looks stuck after a redirect ([email protected], 46 tool+> calls). Press Esc to interrupt it.Where that line appears, and how to stop the turn, in the terminal UI and in a headless run(`claude -p`, `codex exec`, `copilot -p`, `pi -p`):-| Agent | Interactive: shown | Stop with | Headless: shown | Stop with |+| Agent | Interactive: where it shows | How to stop | Headless: where it shows | How to stop ||---|---|---|---|---|| Claude Code | in Claude's reply | Esc | in the final reply | Ctrl+C || Codex | in the conversation | Esc, then `/stop` | not shown | Ctrl+C |diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex 4341626..53b70bd 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -8,9 +8,9 @@ standard-library-only package `tokeneconomizer`:`call_cwds`, `tool_usage`, `parse_catalog`), with one module per agent's format. A new agentneeds a reader here and nothing else.- `tokeneconomizer.ledger` and `tokeneconomizer.pricing` are the one definition of cost.- Mechanisms record their per-task overhead; the plugin's session ledger and the experiments'- aggregation read it back through the same modules, so recorded and reported cost cannot- drift.+ Mechanisms record their per-task overhead (in the plugin, a session counts as one task); the+ plugin's session ledger and the experiments' aggregation read it back through the same modules,+ so recorded and reported cost cannot drift.- `tokeneconomizer.domain.DomainAdapter` is the interface to the task domain: reading a session,the tools pruning protects or excludes, a trajectory's loop signals, the task text for theoptional judge, and the micro-skill vocabulary. A new domain is a new adapter, with no changediff --git a/docs/PLUGIN.md b/docs/PLUGIN.mdindex c90df62..dafea54 100644--- a/docs/PLUGIN.md+++ b/docs/PLUGIN.md@@ -13,7 +13,7 @@ the hooks run) and `plugin/` (the packaging for each agent). To install and use| Hook | What the plugin does | Mechanism it drives ||---|---|---|-| `SessionStart` | Injects the repository's micro-skills (a cached render) as `additionalContext`, at a new start, and on a Copilot resume the text that session started with (§3); announces changed facts, tools the deny list newly left out, or a proposal still waiting, each in one `systemMessage` line; folds any earlier session whose end was never seen | microskills |+| `SessionStart` | Injects the repository's micro-skills (a cached render) as `additionalContext`, at a new start, and on a Copilot resume the text that session started with (§3); announces changed facts, tools the deny list newly left out, or, under `toolprune=propose` (or when `auto` could not write the file), a proposal still waiting, each in one `systemMessage` line; folds any earlier session whose end was never seen | microskills || `UserPromptSubmit` | Opens a prompt-turn for the loop guard | loopguard || `PostToolUse` | Folds the call into the turn's guard; delivers a redirect as `additionalContext`, then, if the turn is still stuck, a one-line notice to the person (on Claude Code, also as context asking the model to repeat it); never stops the turn | loopguard || `PostToolUseFailure` | The same, for a call that failed (Claude Code and Copilot report a failed call only here); the answer names this event, as Claude Code requires | loopguard |@@ -32,14 +32,14 @@ re-tuned. Three things it adds:`apply_patch <<'PATCH'`. The loopstate counts only edit tools, and agents that edit through Bash then looked as if they hadedited nothing.-* **The nudge always comes before the stop.** The benchmark ladder checks a hard backstop (a- multiple of the learned envelope: 2.5 × at the default level, 1.8 × at `aggressive`) before- anything else. With the large envelopes of the benchmark streams, the backstop lay well past- the stuck rule's own floor (20 calls at the default level, 14 at `aggressive`), and the nudge- came first. An interactive repository learns a small envelope. Its backstop then falls inside- that floor, so the first call that counts as stuck has also tripped the backstop, and the turn- would be stopped (or, in nudge mode, merely flagged) without ever being redirected. Now an- unspent nudge goes first, and the stop needs a second stuck segment after it.+* **The redirect always comes before the still-stuck notice.** The benchmark ladder checks a+ hard backstop (a multiple of the learned envelope: 2.5 × at the default level, 1.8 × at+ `aggressive`) before anything else. With the large envelopes of the benchmark streams, the+ backstop lay well past the stuck rule's own floor (20 calls at the default level, 14 at+ `aggressive`), and the redirect came first. An interactive repository learns a small envelope.+ Its backstop then falls inside that floor, so the first call that counts as stuck has also+ tripped the backstop, and the turn would get the notice without ever being redirected. Now an+ unspent redirect goes first, and the notice needs a second stuck segment after it.* The **stuck judge and nudge writer run in a detached `te judge` job**, not inthe hook. The hook starts the job and returns; a later PostToolUse picks up the verdict, withthe redirect already written. Each job's spend is charged to the ledger when it is spent.@@ -55,14 +55,14 @@ Every hook fails open: any error becomes an empty output (no change) and a trace| Learning signal | the official grader's `resolved` | the envelope learns from turns that **ended green**: the agent stopped on its own, was not stopped by the guard, and no verification after its last edit failed | There is no grader. Micro-skills and evidence pruning never needed one || Injection channel | a prefix on the task prompt | `SessionStart` `additionalContext` | Verified to reach the model (§3) || Tool removal | `--disallowed-tools` / Codex config at launch | a **deny list**, applied by default once the evidence forms it and the repository's sessions have been idle longer than a prompt cache lives (§3), and announced at the next session start (`toolprune=propose` waits for approval instead), written to the repository's own settings file — tools in `.claude/settings.local.json`, Codex capability packages in `.codex/config.toml`, Copilot MCP servers in `.github/copilot/settings.local.json` — effective from the **next** session | The plugin launches nothing. A session keeps the tools it started with, but a conversation resumed after a change sends the new ones, re-writing its cached prefix, hence the idle wait. Each agent's file can express a different unit (§3) |-| Pruning candidates | `toolprune.tools.INAPPLICABLE_TOOLS` — orchestration, Q&A, plan mode, web — "inapplicable by construction" for a sealed headless task | nothing is inapplicable by construction; only **evidence** (never used, and unused over N prompts across two or more sessions, or over N sessions) proposes a tool, and a person's tools — AskUserQuestion, plan mode, sub-agents, the web — are protected | A person asks questions, plans and browses in a real session. A deny rule the plugin wrote for a tool that has since become protected is given back at the next fold |+| Pruning candidates | `toolprune.tools.INAPPLICABLE_TOOLS` — orchestration, Q&A, plan mode, web — "inapplicable by construction" for a sealed headless task | nothing is inapplicable by construction; only **evidence** (never used, and unused over `toolprune_evidence` prompts (10) across at least `toolprune_min_sessions` sessions (2), or over `toolprune_sessions` sessions (5)) proposes a tool, and a person's tools — AskUserQuestion, plan mode, sub-agents, the web — are protected | A person asks questions, plans and browses in a real session. A deny rule the plugin wrote for a tool that has since become protected is given back at the next fold || Network | every arm, baseline included, carries an answer-key guard — a `PreToolUse` hook and an `/etc/hosts` block refuse the benchmarks' upstream sources — and drops the web tools | **no guard**: no `PreToolUse` hook (on Pi, no `tool_call` handler), no blocked command or host; the web tools stay | A benchmark's answer is a fetch away. A real session has no answer key, and the web is part of the work |-| Who decides a turn is stuck | in the guard's arms, the trace judge, woken by the rule gate or by a turn past the envelope (the agents ran under a turn cap); without a judge, the strict rule | **always the judge** when the guard is on, woken only by a sign of trouble (a repeated failure, or dense errors) after `min_turns` calls, and never before the repository has an envelope; a `productive` or unsure verdict spares the turn. The hard backstop (far past the envelope AND the strict stall rule) still acts without it. While the agent's model calls are paused, the judge gives no verdict and only the backstop acts | The rule alone redirected turns that had found their cause and were working around it (§5); interactive turns outrun a small envelope all the time, so the envelope alone wakes nothing |-| Nudge | kill the agent, resume it with a continuation prompt | a mid-turn reminder attached to the tool result | Different intervention, so its effect is not inherited from the experiments |+| Who decides a turn is stuck | in the guard's arms, the trace judge, woken by the rule gate or by a turn past the envelope (the agents ran under a turn cap); without a judge, the strict rule | **always the judge** when the guard is on, woken only by a sign of trouble (a repeated failure, or dense errors) after `min_turns` calls, and never before the repository has an envelope; a `productive` or ambiguous verdict spares the turn (at the `aggressive` preset an ambiguous one past the envelope gets the redirect). The hard backstop (far past the envelope AND the strict stall rule) still acts without it. While the agent's model calls are paused, the judge gives no verdict and only the backstop acts | The rule alone redirected turns that had found their cause and were working around it (§5); interactive turns outrun a small envelope all the time, so the envelope alone wakes nothing |+| Redirect | kill the agent, resume it with a continuation prompt | a mid-turn reminder attached to the tool result | Different intervention, so its effect is not inherited from the experiments || Still stuck after the redirect | terminal abort, in autonomous runs | a one-line **notice** to the person, ending with how to stop the turn on that agent and in that mode (§3); the plugin never stops a turn, and `loopguard: stop` is read as `nudge` | Not every agent's hooks can stop a turn (Codex and Copilot ignore `continue: false`), and the person decides: the benchmark guard's own design note says "interactive callers should map it to a hand-off" || Micro-skills' reading | a domain vocabulary per benchmark (Python/git, Node/web); the proposer's digest counts edited Python files, lists test invocations and flags Python import errors, and its prompt leads with the test command | **generic**, whatever the repository: every ecosystem's interpreters, package tools and test runners at once, builds and checks (`make`, `tsc`, `npm run build`, `cargo check`, ...) as their own intent, every edited file, and a language-neutral digest (failing commands with a normalized error line, paths relative to the repository) and prompt, with tests one topic among several. `vocabulary=python-git` or `node-web` selects an experiment's | A person's repository may be in any language, or several; the experiments keep the paper's reading (its prompt is pinned by a test) |-| Micro-skills | on in the arms that measured it: the proposer every 5 tasks (on Codex, every 10, over the free layer) | **off by default**; `on` runs the free layer under the proposer, every 3 sessions (after the 2nd, 5th, 8th, ...), since a real session usually carries more work than one benchmark task | The proposer calls a model on the person's plan, and what it injects is derived from command output a repository controls: turning it on is the person's call. In the experiments the free layer alone formed almost nothing once the harness set each environment up properly, so `on` keeps the proposer |-| Optimizer model | the agent's own model, so overhead could not look cheaper than its arm | the cheapest capable model on the user's own agent CLI (`paid_model`, default `haiku`): the proposer when micro-skills is on, the loop guard's judge and redirect writer whenever the guard is on | Every call is still charged to the session ledger |+| Micro-skills | on in the arms that measured it: the proposer every 5 tasks (on Codex, every 10, over the free layer) | **off by default**; `on` runs the free layer under the proposer, every `microskills_propose_every` sessions (3 by default: after the 2nd, 5th, 8th, ...), since a real session usually carries more work than one benchmark task | The proposer calls a model on the person's plan, and what it injects is derived from command output a repository controls: turning it on is the person's call. In the experiments the free layer alone formed almost nothing once the harness set each environment up properly, so `on` keeps the proposer |+| Optimizer model | the agent's own model, so overhead could not look cheaper than its arm | the cheapest capable model on the user's own agent CLI (`paid_model`; when empty, `haiku` on Claude Code, the agent's default model on Codex and Pi, and on Copilot a concrete `COPILOT_MODEL` or a BYOK provider's Haiku): the proposer when micro-skills is on, the loop guard's judge and redirect writer whenever the guard is on | Every call is still charged to the session ledger |## 3. Verified agent behaviour@@ -83,7 +83,7 @@ and date it was verified on; §5 says what has not been exercised.list `--disallowed-tools` produces, whether the rule comes from `--settings` or from aproject's `.claude/settings.local.json`. A plugin's own `settings.json` cannot carry deny rules(only `agent` and `subagentStatusLine` take effect), which is why the deny-list writer edits the- project-local file, with approval.+ project-local file (by itself under `toolprune=auto`, on `toolprune apply` under `propose`).* An interactive transcript does not record the tool list a session loaded. Without a recordedcatalog, evidence pruning sees only the tools Claude Code defers (one listing line each) andthose a session used; `te toolprune refresh-catalog` records the always-loaded set, with no model@@ -191,7 +191,7 @@ feature flags):`toolDefinitionsTokens`; the probe reports it before and after the deny list.* **Usage under BYOK** keeps the grand-total form: with an Anthropic provider, `inputTokens`includes the `cacheWriteTokens`, which the ledger splits out.-* **Paid side calls under BYOK.** With `COPILOT_MODEL=auto` (the subscription's router) in the+* **The plugin's own model calls under BYOK.** With `COPILOT_MODEL=auto` (the subscription's router) in theenvironment, `copilot -p` without a model answered nothing. The side call now names a model:`paid_model`, else a concrete `COPILOT_MODEL`, else `claude-haiku-4-5` on an Anthropicprovider. It answered, and was priced from its own session log. The local capture behind@@ -208,7 +208,7 @@ itself, with no model and no quota:* Copilot loads a Claude-format plugin, and prefers `.github/plugin/plugin.json` to`.claude-plugin/plugin.json`: with both present, only the hook file the first one namesran. That is how the plugin gives Copilot its own `hooks/copilot-hooks.json` (`--host- copilot`, plus `PostToolUseFailure`) while Claude Code keeps `hooks/hooks.json`.+ copilot`) while Claude Code keeps `hooks/hooks.json`.`copilot plugin marketplace add <checkout>` and `copilot plugin install` load the pluginlive from the checkout ("nothing was copied"), and the installed copy's hooks all fired.* PascalCase events receive Claude-shaped snake_case payloads: `session_id`, `cwd`,@@ -244,7 +244,7 @@ itself, with no model and no quota:* A side effect to know when scripting Copilot's TUI: under an editor's terminal (`TERM_PROGRAM`set), its first run offers to add a shift+enter binding and writes that editor's`keybindings.json` if accepted.-* Untooling. Copilot has no persistent per-tool filter: `--excluded-tools` is a launch flag,+* Tool pruning. Copilot has no persistent per-tool filter: `--excluded-tools` is a launch flag,and `permissions.deny` refuses a call but leaves the schema in the request. What does work,from the repository's `.github/copilot/settings.local.json`, is `disabledMcpServers`: listingthe built-in `github-mcp-server` removes all of that server's tools from the request.@@ -273,8 +273,9 @@ isolated `PI_CODING_AGENT_DIR`):* Pi's bash result carries a real exit code (`structuredContent.exit_code`), which theended-green proxy uses; its session file is a tree, and only the active branch is read.* Not exercised live: a nudge (`sendMessage` with `deliverAs: "steer"`) and a stop- (`ctx.abort()`) — the dispatcher's side is covered by the offline tests, Pi's by its API.- Untooling does not apply: Pi declares four tools by default.+ (`ctx.abort()`, since removed: the plugin no longer stops a turn) — the dispatcher's side is+ covered by the offline tests, Pi's by its API. Tool pruning does not apply: Pi declares four+ tools by default.**Pi 1.2.0 — verified live, 2026-10-14** (Haiku 4.5 through Pi's built-in OpenRouter provider,set as the default provider and model in an isolated `PI_CODING_AGENT_DIR`, as a Pi user's own@@ -286,7 +287,7 @@ settings would be):file, and `errors.log` stayed empty.* `/te status` answered as a `notify` over RPC (the terminal UI's notice), and on stderr inprint mode, leaving stdout to the reply.-* A paid side call — `pi --print --mode json` with no tools, extensions, skills, prompt+* One of the plugin's own model calls — `pi --print --mode json` with no tools, extensions, skills, prompttemplates, context files, MCP servers or saved session, and no `--model` — ran on the defaultmodel and returned its text and usage; the plugin's own extension did not load inside it. Pi0.99.2 rejects `--no-mcp`, so the call retries without it.@@ -308,7 +309,7 @@ this plugin's guide step by step (Claude Code 2.1.300, Codex 0.153.1, Copilot CLwith `loopguard=stop` a headless turn ended at the next stuck verdict (nudged at call 17,stopped at 35) — the first live check of both on Pi. On Codex and Copilot the second fire isa notice. (Since 2026-10-21 the second fire is a notice on every agent; see below.)-* Paid side calls ran through each agent's own CLI (Copilot's only off BYOK, above) and were+* The plugin's own model calls ran through each agent's own CLI (Copilot's only off BYOK, above) and werecharged to the ledger, without recursing into the plugin.* Pi's real git install (a local git daemon standing in for GitHub): cloned, `npm install`ed,listed, loaded; `pi update --extensions` fast-forwarded it; `pi remove` removed it.@@ -422,7 +423,7 @@ OpenRouter (cache breakpoints, which move every turn, left out of the comparisonfact was retired on disk kept the original system message, and a new session took thecurrent facts.-**Counting prompts, 2026-10-24** (the `experimental` branch). Can the mechanisms learn from the+**Counting prompts, 2026-10-24** (on the `experimental` branch, since merged into `main`). Can the mechanisms learn from theprompts of a session rather than from whole sessions, so a long first session counts for more?* Tool pruning: yes, with a floor. Replaying this machine's recorded Claude Code sessions@@ -431,8 +432,8 @@ prompts of a session rather than from whole sessions, so a long first session co| Rule | Projects with a list | Wrong prunes | Tools left out of the next session, summed ||---|---|---|---|- | 5 sessions (`main`) | 7 | 1 | 340 |- | 10 prompts over 2+ sessions, or 5 sessions (now) | 8 | 1 | 512 |+ | 5 sessions (the earlier rule) | 7 | 1 | 340 |+ | 10 prompts over 2+ sessions, or 5 sessions (the current default) | 8 | 1 | 512 || 10 prompts (`toolprune_min_sessions=1`) | 8 | 7 | 628 |Ten prompts in one session pruned tools the next session needed (`ListAgents`,@@ -499,7 +500,7 @@ nothing.All state is local, under `$TOKENECONOMIZER_HOME` (default `~/.tokeneconomizer`), one directoryper repository and host: the mechanisms' own state, `ledger.jsonl` (one priced record per-session), `events.jsonl` (every injection, nudge, stop), and per-session guard state.+session), `events.jsonl` (every injection, redirect and still-stuck notice), and per-session guard state.Uninstalling the plugin leaves this directory; delete it to forget. `te repos` lists what itholds.@@ -531,12 +532,14 @@ Which repository a session belongs to (`plugin/paths.py`, `plugin/repos.py`):sessions are folded again from their logs where those still exist; a session folded under twokeys counts once, at its later fold. Nothing is deleted: a merged directory moves to`merged/`, displaced learned state to `premerge-*`. `te repos merge KEY [INTO]` joins two by- hand, for state whose checkouts are gone. Like the agents'-own session logs it is derived from, it is private to you: the plugin creates it `0700` and its-files `0600`, and tightens a looser one it finds.+ hand, for state whose checkouts are gone.++The state directory, like the agents' own session logs it is derived from, is private to you:+the plugin creates it `0700` and its files `0600`, and tightens a looser one it finds.Nothing leaves the machine but the model calls of the loop guard (its judge and nudge writer, on-by default with the guard) and of micro-skills (its proposer, when it is on). Those calls send+by default with the guard), of micro-skills (its proposer, when it is on), and, only when you run+it, of `toolprune measure` on Claude Code. Those calls send**digests** — command templates, edited file basenames, error lines with paths and numbersmasked, never file contents — through your own agent CLI (`claude -p` / `codex exec` /`copilot -p` / `pi -p`), billed where your session is. The proposer keeps the digests of the last eight@@ -552,8 +555,8 @@ parse rather than write over it.A learned fact is text injected into your agent's context, derived from your sessions' commandoutput — which a repository controls. The free layer only fills fixed templates with observedcommand forms and hosts, and lints out completion advice; the proposer's facts are-open-vocabulary. On a repository you do not trust, use `microskills=envfacts`, or read what it-learned with `te microskills`.+open-vocabulary. On a repository you do not trust, leave micro-skills off (the default) or use+`microskills=envfacts`, and read what it learned with `te microskills`.## 5. Known limitations@@ -579,8 +582,9 @@ learned with `te microskills`.* The free fact layer has no family for "this tool is absent here, with no workingalternative" (a missing `ruff`, `mypy` or `pre-commit`, say).* Test runs launched from a script are not recognised as verification.- * `refresh-catalog` is manual; until it runs in a repository, evidence pruning sees only- deferred tools. Running it at a repository's first session would close that gap.+ * `refresh-catalog` is manual, once per machine and agent; until it runs, evidence pruning+ sees only the tools sessions used (plus, on Claude Code, the deferred ones). Running it at+ an agent's first session on a machine would close that gap.* Windows (the launcher is POSIX `sh`), Python 3.9, and compressed Codex rollouts (`.zst`).* Transcript formats are internal to each agent and change between versions; the readers arepinned by tests against the shapes observed on the versions above.diff --git a/docs/assets/framework_overview.png b/docs/assets/framework_overview.pngindex e27f128..a3facea 100644Binary files a/docs/assets/framework_overview.png and b/docs/assets/framework_overview.png differdiff --git a/docs/assets/framework_overview.py b/docs/assets/framework_overview.pyindex 8cd39b3..2cb21e1 100644--- a/docs/assets/framework_overview.py+++ b/docs/assets/framework_overview.py@@ -7,8 +7,8 @@ Left column what the plugin keeps for a repository, the three mechanisms thatnext session, and the fold that updates them when a session ends.Right column the agent, unchanged, drawn as the three surfaces the plugin reaches. Eachmechanism is shown by what it adds to or removes from its surface: facts added- to the session's context, tools struck out of the loaded set, and calls struck- out of a turn the guard stopped.+ to the session's context, tools struck out of the loaded set, and a redirect,+ then a notice to the person, in a turn that keeps failing.The layout is the paper figure's. Every row sits on one pitch, so a card, its arrow and itssurface share one horizontal axis; the gaps inside a row are solved for, so the three surfaces@@ -173,10 +173,10 @@ MECHANISMS = ["that recur across finished sessions")),(2, "Tool pruning", TOOLS, TOOLS_LIGHT,("tools left unused session after session",- "go on a deny list once you approve it")),+ "are left out of the next sessions")),(3, "Failure-loop intervention", SPIRAL, SPIRAL_LIGHT,("learns how long turns here usually run;",- "one redirect, then a stop or a notice")),+ "one redirect, then a notice to you")),]@@ -325,14 +325,14 @@ def draw_tools_row(fig, ax):ax.plot([x + 0.28, x + w - 0.28], [y + BAR_H / 2] * 2,color=DROPPED_TC, lw=0.6, zorder=6)x += w + TOOL_GAP- annotate(ax, 2, dropped[0][0], dropped[-1][1], "denied, once you approve", DROPPED_TC)+ annotate(ax, 2, dropped[0][0], dropped[-1][1], "left out, and announced", DROPPED_TC)# One prompt-turn, read left to right, in the order the guard acts: the same failure comes# back, and only then is one redirect attached to a tool result; when it comes back again-# the turn is stopped (headless; interactive use gets a notice instead), so the calls after-# it are struck out exactly like a pruned tool. An ellipsis stands for the repetitions a-# schematic cannot show, so the two groups are not read as exactly two calls each.+# the person gets a notice saying how to stop the turn. The plugin never stops it, so the+# calls after the notice run as before. An ellipsis stands for the repetitions a schematic+# cannot show, so the two groups are not read as exactly two calls each.TURNBOXES = [(ELLIPSIS, "earlier", 1.40, None),("edit", "repeat", 2.55, "loop"),@@ -342,14 +342,14 @@ TURNBOXES = [("edit", "repeat", 2.55, "again"),("test", "repeat", 2.55, "again"),(ELLIPSIS, "more", 1.40, "again"),- ("STOP", "abort", 3.30, None),- ("edit", "dropped", 2.50, "dropped"),- ("test", "dropped", 2.50, "dropped"),+ ("NOTICE", "abort", 3.70, None),+ ("edit", "repeat", 2.55, "after"),+ ("test", "repeat", 2.55, "after"),]ROLLOUT_NOTES = [("loop", "repeated failures", SPIRAL),("again", "still repeating", SPIRAL),- ("dropped", "never run", DROPPED_TC),+ ("after", "until you stop it", SPIRAL),]BOX_STYLES = { # fill, edge, text, family, weightdiff --git a/docs/assets/framework_overview.svg b/docs/assets/framework_overview.svgindex 326f18a..55ec025 100644--- a/docs/assets/framework_overview.svg+++ b/docs/assets/framework_overview.svg@@ -258,108 +258,108 @@ z" clip-path="url(#p37831d8287)" style="fill: #edeff1; stroke: #bac4ca; stroke-width: 0.7; stroke-linejoin: miter"/></g><g id="patch_20">- <path d="M 155.664 140.76-L 170.28 140.76-Q 172.152 140.76 172.152 138.888-L 172.152 131.832-Q 172.152 129.96 170.28 129.96-L 155.664 129.96-Q 153.792 129.96 153.792 131.832-L 153.792 138.888-Q 153.792 140.76 155.664 140.76+ <path d="M 155.304 140.76+L 169.92 140.76+Q 171.792 140.76 171.792 138.888+L 171.792 131.832+Q 171.792 129.96 169.92 129.96+L 155.304 129.96+Q 153.432 129.96 153.432 131.832+L 153.432 138.888+Q 153.432 140.76 155.304 140.76z" clip-path="url(#p37831d8287)" style="fill: #f4dcda; stroke: #bf4f4b; stroke-width: 0.7; stroke-linejoin: miter"/></g><g id="patch_21">- <path d="M 179.496 140.76-L 194.112 140.76-Q 195.984 140.76 195.984 138.888-L 195.984 131.832-Q 195.984 129.96 194.112 129.96-L 179.496 129.96-Q 177.624 129.96 177.624 131.832-L 177.624 138.888-Q 177.624 140.76 179.496 140.76+ <path d="M 178.776 140.76+L 193.392 140.76+Q 195.264 140.76 195.264 138.888+L 195.264 131.832+Q 195.264 129.96 193.392 129.96+L 178.776 129.96+Q 176.904 129.96 176.904 131.832+L 176.904 138.888+Q 176.904 140.76 178.776 140.76z" clip-path="url(#p37831d8287)" style="fill: #f4dcda; stroke: #bf4f4b; stroke-width: 0.7; stroke-linejoin: miter"/></g><g id="patch_22">- <path d="M 218.88 140.76-L 241.776 140.76-Q 243.648 140.76 243.648 138.888-L 243.648 131.832-Q 243.648 129.96 241.776 129.96-L 218.88 129.96-Q 217.008 129.96 217.008 131.832-L 217.008 138.888-Q 217.008 140.76 218.88 140.76+ <path d="M 217.44 140.76+L 240.336 140.76+Q 242.208 140.76 242.208 138.888+L 242.208 131.832+Q 242.208 129.96 240.336 129.96+L 217.44 129.96+Q 215.568 129.96 215.568 131.832+L 215.568 138.888+Q 215.568 140.76 217.44 140.76z" clip-path="url(#p37831d8287)" style="fill: #bf4f4b; stroke: #bf4f4b; stroke-width: 0.7; stroke-linejoin: miter"/></g><g id="patch_23">- <path d="M 250.992 140.76-L 265.608 140.76-Q 267.48 140.76 267.48 138.888-L 267.48 131.832-Q 267.48 129.96 265.608 129.96-L 250.992 129.96-Q 249.12 129.96 249.12 131.832-L 249.12 138.888-Q 249.12 140.76 250.992 140.76+ <path d="M 249.192 140.76+L 263.808 140.76+Q 265.68 140.76 265.68 138.888+L 265.68 131.832+Q 265.68 129.96 263.808 129.96+L 249.192 129.96+Q 247.32 129.96 247.32 131.832+L 247.32 138.888+Q 247.32 140.76 249.192 140.76z" clip-path="url(#p37831d8287)" style="fill: #f4dcda; stroke: #bf4f4b; stroke-width: 0.7; stroke-linejoin: miter"/></g><g id="patch_24">- <path d="M 274.824 140.76-L 289.44 140.76-Q 291.312 140.76 291.312 138.888-L 291.312 131.832-Q 291.312 129.96 289.44 129.96-L 274.824 129.96-Q 272.952 129.96 272.952 131.832-L 272.952 138.888-Q 272.952 140.76 274.824 140.76+ <path d="M 272.664 140.76+L 287.28 140.76+Q 289.152 140.76 289.152 138.888+L 289.152 131.832+Q 289.152 129.96 287.28 129.96+L 272.664 129.96+Q 270.792 129.96 270.792 131.832+L 270.792 138.888+Q 270.792 140.76 272.664 140.76z" clip-path="url(#p37831d8287)" style="fill: #f4dcda; stroke: #bf4f4b; stroke-width: 0.7; stroke-linejoin: miter"/></g><g id="patch_25">- <path d="M 314.208 140.76+ <path d="M 311.328 140.76L 334.224 140.76Q 336.096 140.76 336.096 138.888L 336.096 131.832Q 336.096 129.96 334.224 129.96-L 314.208 129.96-Q 312.336 129.96 312.336 131.832-L 312.336 138.888-Q 312.336 140.76 314.208 140.76+L 311.328 129.96+Q 309.456 129.96 309.456 131.832+L 309.456 138.888+Q 309.456 140.76 311.328 140.76z" clip-path="url(#p37831d8287)" style="fill: #ffffff; stroke: #bf4f4b; stroke-width: 1.1; stroke-linejoin: miter"/></g><g id="patch_26">- <path d="M 343.44 140.76+ <path d="M 343.08 140.76L 357.696 140.76Q 359.568 140.76 359.568 138.888L 359.568 131.832Q 359.568 129.96 357.696 129.96-L 343.44 129.96-Q 341.568 129.96 341.568 131.832-L 341.568 138.888-Q 341.568 140.76 343.44 140.76+L 343.08 129.96+Q 341.208 129.96 341.208 131.832+L 341.208 138.888+Q 341.208 140.76 343.08 140.76z-" clip-path="url(#p37831d8287)" style="fill: #edeff1; stroke: #bac4ca; stroke-width: 0.7; stroke-linejoin: miter"/>+" clip-path="url(#p37831d8287)" style="fill: #f4dcda; stroke: #bf4f4b; stroke-width: 0.7; stroke-linejoin: miter"/></g><g id="patch_27">- <path d="M 366.912 140.76+ <path d="M 366.552 140.76L 381.168 140.76Q 383.04 140.76 383.04 138.888L 383.04 131.832Q 383.04 129.96 381.168 129.96-L 366.912 129.96-Q 365.04 129.96 365.04 131.832-L 365.04 138.888-Q 365.04 140.76 366.912 140.76+L 366.552 129.96+Q 364.68 129.96 364.68 131.832+L 364.68 138.888+Q 364.68 140.76 366.552 140.76z-" clip-path="url(#p37831d8287)" style="fill: #edeff1; stroke: #bac4ca; stroke-width: 0.7; stroke-linejoin: miter"/>+" clip-path="url(#p37831d8287)" style="fill: #f4dcda; stroke: #bf4f4b; stroke-width: 0.7; stroke-linejoin: miter"/></g><g id="text_1"><!-- PLUGIN -->@@ -1410,91 +1410,58 @@ z<use xlink:href="#DejaVuSans-6f" transform="translate(1781.949219 0)"/><use xlink:href="#DejaVuSans-6e" transform="translate(1843.130859 0)"/></g>- <!-- go on a deny list once you approve it -->+ <!-- are left out of the next sessions --><g style="fill: #63727d" transform="translate(12.24 102.235803) scale(0.046 -0.046)"><defs>- <path id="DejaVuSans-67" d="M 2906 1791-Q 2906 2416 2648 2759-Q 2391 3103 1925 3103-Q 1463 3103 1205 2759-Q 947 2416 947 1791-Q 947 1169 1205 825-Q 1463 481 1925 481-Q 2391 481 2648 825-Q 2906 1169 2906 1791-z-M 3481 434-Q 3481 -459 3084 -895-Q 2688 -1331 1869 -1331-Q 1566 -1331 1297 -1286-Q 1028 -1241 775 -1147-L 775 -588-Q 1028 -725 1275 -790-Q 1522 -856 1778 -856-Q 2344 -856 2625 -561-Q 2906 -266 2906 331-L 2906 616-Q 2728 306 2450 153-Q 2172 0 1784 0-Q 1141 0 747 490-Q 353 981 353 1791-Q 353 2603 747 3093-Q 1141 3584 1784 3584-Q 2172 3584 2450 3431-Q 2728 3278 2906 2969-L 2906 3500-L 3481 3500-L 3481 434-z-" transform="scale(0.015625)"/>- <path id="DejaVuSans-76" d="M 191 3500-L 800 3500-L 1894 563-L 2988 3500-L 3597 3500-L 2284 0-L 1503 0-L 191 3500+ <path id="DejaVuSans-78" d="M 3513 3500+L 2247 1797+L 3578 0+L 2900 0+L 1881 1375+L 863 0+L 184 0+L 1544 1831+L 300 3500+L 978 3500+L 1906 2253+L 2834 3500+L 3513 3500z" transform="scale(0.015625)"/></defs>- <use xlink:href="#DejaVuSans-67"/>- <use xlink:href="#DejaVuSans-6f" transform="translate(63.476562 0)"/>- <use xlink:href="#DejaVuSans-20" transform="translate(124.658203 0)"/>- <use xlink:href="#DejaVuSans-6f" transform="translate(156.445312 0)"/>- <use xlink:href="#DejaVuSans-6e" transform="translate(217.626953 0)"/>- <use xlink:href="#DejaVuSans-20" transform="translate(281.005859 0)"/>- <use xlink:href="#DejaVuSans-61" transform="translate(312.792969 0)"/>- <use xlink:href="#DejaVuSans-20" transform="translate(374.072266 0)"/>- <use xlink:href="#DejaVuSans-64" transform="translate(405.859375 0)"/>- <use xlink:href="#DejaVuSans-65" transform="translate(469.335938 0)"/>- <use xlink:href="#DejaVuSans-6e" transform="translate(530.859375 0)"/>- <use xlink:href="#DejaVuSans-79" transform="translate(594.238281 0)"/>- <use xlink:href="#DejaVuSans-20" transform="translate(653.417969 0)"/>- <use xlink:href="#DejaVuSans-6c" transform="translate(685.205078 0)"/>- <use xlink:href="#DejaVuSans-69" transform="translate(712.988281 0)"/>- <use xlink:href="#DejaVuSans-73" transform="translate(740.771484 0)"/>- <use xlink:href="#DejaVuSans-74" transform="translate(792.871094 0)"/>- <use xlink:href="#DejaVuSans-20" transform="translate(832.080078 0)"/>- <use xlink:href="#DejaVuSans-6f" transform="translate(863.867188 0)"/>- <use xlink:href="#DejaVuSans-6e" transform="translate(925.048828 0)"/>- <use xlink:href="#DejaVuSans-63" transform="translate(988.427734 0)"/>- <use xlink:href="#DejaVuSans-65" transform="translate(1043.408203 0)"/>- <use xlink:href="#DejaVuSans-20" transform="translate(1104.931641 0)"/>- <use xlink:href="#DejaVuSans-79" transform="translate(1136.71875 0)"/>- <use xlink:href="#DejaVuSans-6f" transform="translate(1195.898438 0)"/>- <use xlink:href="#DejaVuSans-75" transform="translate(1257.080078 0)"/>- <use xlink:href="#DejaVuSans-20" transform="translate(1320.458984 0)"/>- <use xlink:href="#DejaVuSans-61" transform="translate(1352.246094 0)"/>- <use xlink:href="#DejaVuSans-70" transform="translate(1413.525391 0)"/>- <use xlink:href="#DejaVuSans-70" transform="translate(1477.001953 0)"/>- <use xlink:href="#DejaVuSans-72" transform="translate(1540.478516 0)"/>- <use xlink:href="#DejaVuSans-6f" transform="translate(1579.341797 0)"/>- <use xlink:href="#DejaVuSans-76" transform="translate(1640.523438 0)"/>- <use xlink:href="#DejaVuSans-65" transform="translate(1699.703125 0)"/>- <use xlink:href="#DejaVuSans-20" transform="translate(1761.226562 0)"/>- <use xlink:href="#DejaVuSans-69" transform="translate(1793.013672 0)"/>- <use xlink:href="#DejaVuSans-74" transform="translate(1820.796875 0)"/>+ <use xlink:href="#DejaVuSans-61"/>+ <use xlink:href="#DejaVuSans-72" transform="translate(61.279297 0)"/>+ <use xlink:href="#DejaVuSans-65" transform="translate(100.142578 0)"/>+ <use xlink:href="#DejaVuSans-20" transform="translate(161.666016 0)"/>+ <use xlink:href="#DejaVuSans-6c" transform="translate(193.453125 0)"/>+ <use xlink:href="#DejaVuSans-65" transform="translate(221.236328 0)"/>+ <use xlink:href="#DejaVuSans-66" transform="translate(282.759766 0)"/>+ <use xlink:href="#DejaVuSans-74" transform="translate(316.214844 0)"/>+ <use xlink:href="#DejaVuSans-20" transform="translate(355.423828 0)"/>+ <use xlink:href="#DejaVuSans-6f" transform="translate(387.210938 0)"/>+ <use xlink:href="#DejaVuSans-75" transform="translate(448.392578 0)"/>+ <use xlink:href="#DejaVuSans-74" transform="translate(511.771484 0)"/>+ <use xlink:href="#DejaVuSans-20" transform="translate(550.980469 0)"/>+ <use xlink:href="#DejaVuSans-6f" transform="translate(582.767578 0)"/>+ <use xlink:href="#DejaVuSans-66" transform="translate(643.949219 0)"/>+ <use xlink:href="#DejaVuSans-20" transform="translate(679.154297 0)"/>+ <use xlink:href="#DejaVuSans-74" transform="translate(710.941406 0)"/>+ <use xlink:href="#DejaVuSans-68" transform="translate(750.150391 0)"/>+ <use xlink:href="#DejaVuSans-65" transform="translate(813.529297 0)"/>+ <use xlink:href="#DejaVuSans-20" transform="translate(875.052734 0)"/>+ <use xlink:href="#DejaVuSans-6e" transform="translate(906.839844 0)"/>+ <use xlink:href="#DejaVuSans-65" transform="translate(970.21875 0)"/>+ <use xlink:href="#DejaVuSans-78" transform="translate(1029.992188 0)"/>+ <use xlink:href="#DejaVuSans-74" transform="translate(1089.171875 0)"/>+ <use xlink:href="#DejaVuSans-20" transform="translate(1128.380859 0)"/>+ <use xlink:href="#DejaVuSans-73" transform="translate(1160.167969 0)"/>+ <use xlink:href="#DejaVuSans-65" transform="translate(1212.267578 0)"/>+ <use xlink:href="#DejaVuSans-73" transform="translate(1273.791016 0)"/>+ <use xlink:href="#DejaVuSans-73" transform="translate(1325.890625 0)"/>+ <use xlink:href="#DejaVuSans-69" transform="translate(1377.990234 0)"/>+ <use xlink:href="#DejaVuSans-6f" transform="translate(1405.773438 0)"/>+ <use xlink:href="#DejaVuSans-6e" transform="translate(1466.955078 0)"/>+ <use xlink:href="#DejaVuSans-73" transform="translate(1530.333984 0)"/></g></g><g id="text_7">@@ -1635,6 +1602,40 @@ z<!-- learns how long turns here usually run; --><g style="fill: #63727d" transform="translate(12.24 139.575281) scale(0.046 -0.046)"><defs>+ <path id="DejaVuSans-67" d="M 2906 1791+Q 2906 2416 2648 2759+Q 2391 3103 1925 3103+Q 1463 3103 1205 2759+Q 947 2416 947 1791+Q 947 1169 1205 825+Q 1463 481 1925 481+Q 2391 481 2648 825+Q 2906 1169 2906 1791+z+M 3481 434+Q 3481 -459 3084 -895+Q 2688 -1331 1869 -1331+Q 1566 -1331 1297 -1286+Q 1028 -1241 775 -1147+L 775 -588+Q 1028 -725 1275 -790+Q 1522 -856 1778 -856+Q 2344 -856 2625 -561+Q 2906 -266 2906 331+L 2906 616+Q 2728 306 2450 153+Q 2172 0 1784 0+Q 1141 0 747 490+Q 353 981 353 1791+Q 353 2603 747 3093+Q 1141 3584 1784 3584+Q 2172 3584 2450 3431+Q 2728 3278 2906 2969+L 2906 3500+L 3481 3500+L 3481 434+z+" transform="scale(0.015625)"/><path id="DejaVuSans-3b" d="M 750 3309L 1409 3309L 1409 2516@@ -1691,7 +1692,7 @@ z<use xlink:href="#DejaVuSans-6e" transform="translate(1860.412109 0)"/><use xlink:href="#DejaVuSans-3b" transform="translate(1923.791016 0)"/></g>- <!-- one redirect, then a stop or a notice -->+ <!-- one redirect, then a notice to you --><g style="fill: #63727d" transform="translate(12.24 145.075803) scale(0.046 -0.046)"><use xlink:href="#DejaVuSans-6f"/><use xlink:href="#DejaVuSans-6e" transform="translate(61.181641 0)"/>@@ -1714,22 +1715,19 @@ z<use xlink:href="#DejaVuSans-20" transform="translate(895.158203 0)"/><use xlink:href="#DejaVuSans-61" transform="translate(926.945312 0)"/><use xlink:href="#DejaVuSans-20" transform="translate(988.224609 0)"/>- <use xlink:href="#DejaVuSans-73" transform="translate(1020.011719 0)"/>- <use xlink:href="#DejaVuSans-74" transform="translate(1072.111328 0)"/>- <use xlink:href="#DejaVuSans-6f" transform="translate(1111.320312 0)"/>- <use xlink:href="#DejaVuSans-70" transform="translate(1172.501953 0)"/>- <use xlink:href="#DejaVuSans-20" transform="translate(1235.978516 0)"/>- <use xlink:href="#DejaVuSans-6f" transform="translate(1267.765625 0)"/>- <use xlink:href="#DejaVuSans-72" transform="translate(1328.947266 0)"/>- <use xlink:href="#DejaVuSans-20" transform="translate(1370.060547 0)"/>- <use xlink:href="#DejaVuSans-61" transform="translate(1401.847656 0)"/>- <use xlink:href="#DejaVuSans-20" transform="translate(1463.126953 0)"/>- <use xlink:href="#DejaVuSans-6e" transform="translate(1494.914062 0)"/>- <use xlink:href="#DejaVuSans-6f" transform="translate(1558.292969 0)"/>- <use xlink:href="#DejaVuSans-74" transform="translate(1619.474609 0)"/>- <use xlink:href="#DejaVuSans-69" transform="translate(1658.683594 0)"/>- <use xlink:href="#DejaVuSans-63" transform="translate(1686.466797 0)"/>- <use xlink:href="#DejaVuSans-65" transform="translate(1741.447266 0)"/>+ <use xlink:href="#DejaVuSans-6e" transform="translate(1020.011719 0)"/>+ <use xlink:href="#DejaVuSans-6f" transform="translate(1083.390625 0)"/>+ <use xlink:href="#DejaVuSans-74" transform="translate(1144.572266 0)"/>+ <use xlink:href="#DejaVuSans-69" transform="translate(1183.78125 0)"/>+ <use xlink:href="#DejaVuSans-63" transform="translate(1211.564453 0)"/>+ <use xlink:href="#DejaVuSans-65" transform="translate(1266.544922 0)"/>+ <use xlink:href="#DejaVuSans-20" transform="translate(1328.068359 0)"/>+ <use xlink:href="#DejaVuSans-74" transform="translate(1359.855469 0)"/>+ <use xlink:href="#DejaVuSans-6f" transform="translate(1399.064453 0)"/>+ <use xlink:href="#DejaVuSans-20" transform="translate(1460.246094 0)"/>+ <use xlink:href="#DejaVuSans-79" transform="translate(1492.033203 0)"/>+ <use xlink:href="#DejaVuSans-6f" transform="translate(1551.212891 0)"/>+ <use xlink:href="#DejaVuSans-75" transform="translate(1612.394531 0)"/></g></g><g id="text_9">@@ -2121,23 +2119,6 @@ z<g id="text_14"><!-- session context --><g style="fill: #20303c" transform="translate(193.86 38.26525) scale(0.056 -0.056)">- <defs>- <path id="DejaVuSans-78" d="M 3513 3500-L 2247 1797-L 3578 0-L 2900 0-L 1881 1375-L 863 0-L 184 0-L 1544 1831-L 300 3500-L 978 3500-L 1906 2253-L 2834 3500-L 3513 3500-z-" transform="scale(0.015625)"/>- </defs><use xlink:href="#DejaVuSans-73"/><use xlink:href="#DejaVuSans-65" transform="translate(52.099609 0)"/><use xlink:href="#DejaVuSans-73" transform="translate(113.623047 0)"/>@@ -3099,7 +3080,7 @@ z</g><g id="text_33"><!-- edit -->- <g style="fill: #bf4f4b" transform="translate(158.035344 136.502234) scale(0.041 -0.041)">+ <g style="fill: #bf4f4b" transform="translate(157.675344 136.502234) scale(0.041 -0.041)"><use xlink:href="#DejaVuSansMono-65"/><use xlink:href="#DejaVuSansMono-64" transform="translate(60.205078 0)"/><use xlink:href="#DejaVuSansMono-69" transform="translate(120.410156 0)"/>@@ -3108,7 +3089,7 @@ z</g><g id="text_34"><!-- test -->- <g style="fill: #bf4f4b" transform="translate(181.867344 136.502234) scale(0.041 -0.041)">+ <g style="fill: #bf4f4b" transform="translate(181.147344 136.502234) scale(0.041 -0.041)"><use xlink:href="#DejaVuSansMono-74"/><use xlink:href="#DejaVuSansMono-65" transform="translate(60.205078 0)"/><use xlink:href="#DejaVuSansMono-73" transform="translate(120.410156 0)"/>@@ -3117,13 +3098,13 @@ z</g><g id="text_35"><!-- … -->- <g style="fill: #bf4f4b" transform="translate(203.396 137.070812) scale(0.062 -0.062)">+ <g style="fill: #bf4f4b" transform="translate(202.316 137.070812) scale(0.062 -0.062)"><use xlink:href="#DejaVuSans-2026"/></g></g><g id="text_36"><!-- REDIRECT -->- <g style="fill: #ffffff" transform="translate(218.450258 136.546531) scale(0.043 -0.043)">+ <g style="fill: #ffffff" transform="translate(217.010258 136.546531) scale(0.043 -0.043)"><use xlink:href="#DejaVuSans-Bold-52"/><use xlink:href="#DejaVuSans-Bold-45" transform="translate(77.001953 0)"/><use xlink:href="#DejaVuSans-Bold-44" transform="translate(145.3125 0)"/>@@ -3136,7 +3117,7 @@ z</g><g id="text_37"><!-- edit -->- <g style="fill: #bf4f4b" transform="translate(253.363344 136.502234) scale(0.041 -0.041)">+ <g style="fill: #bf4f4b" transform="translate(251.563344 136.502234) scale(0.041 -0.041)"><use xlink:href="#DejaVuSansMono-65"/><use xlink:href="#DejaVuSansMono-64" transform="translate(60.205078 0)"/><use xlink:href="#DejaVuSansMono-69" transform="translate(120.410156 0)"/>@@ -3145,7 +3126,7 @@ z</g><g id="text_38"><!-- test -->- <g style="fill: #bf4f4b" transform="translate(277.195344 136.502234) scale(0.041 -0.041)">+ <g style="fill: #bf4f4b" transform="translate(275.035344 136.502234) scale(0.041 -0.041)"><use xlink:href="#DejaVuSansMono-74"/><use xlink:href="#DejaVuSansMono-65" transform="translate(60.205078 0)"/><use xlink:href="#DejaVuSansMono-73" transform="translate(120.410156 0)"/>@@ -3154,22 +3135,24 @@ z</g><g id="text_39"><!-- … -->- <g style="fill: #bf4f4b" transform="translate(298.724 137.070812) scale(0.062 -0.062)">+ <g style="fill: #bf4f4b" transform="translate(296.204 137.070812) scale(0.062 -0.062)"><use xlink:href="#DejaVuSans-2026"/></g></g><g id="text_40">- <!-- STOP -->- <g style="fill: #bf4f4b" transform="translate(317.797242 136.546531) scale(0.043 -0.043)">- <use xlink:href="#DejaVuSans-Bold-53"/>- <use xlink:href="#DejaVuSans-Bold-54" transform="translate(72.021484 0)"/>- <use xlink:href="#DejaVuSans-Bold-4f" transform="translate(140.234375 0)"/>- <use xlink:href="#DejaVuSans-Bold-50" transform="translate(225.244141 0)"/>+ <!-- NOTICE -->+ <g style="fill: #bf4f4b" transform="translate(313.835695 136.546531) scale(0.043 -0.043)">+ <use xlink:href="#DejaVuSans-Bold-4e"/>+ <use xlink:href="#DejaVuSans-Bold-4f" transform="translate(83.691406 0)"/>+ <use xlink:href="#DejaVuSans-Bold-54" transform="translate(168.701172 0)"/>+ <use xlink:href="#DejaVuSans-Bold-49" transform="translate(236.914062 0)"/>+ <use xlink:href="#DejaVuSans-Bold-43" transform="translate(274.121094 0)"/>+ <use xlink:href="#DejaVuSans-Bold-45" transform="translate(347.509766 0)"/></g></g><g id="text_41"><!-- edit -->- <g style="fill: #98a4ac" transform="translate(345.631344 136.502234) scale(0.041 -0.041)">+ <g style="fill: #bf4f4b" transform="translate(345.451344 136.502234) scale(0.041 -0.041)"><use xlink:href="#DejaVuSansMono-65"/><use xlink:href="#DejaVuSansMono-64" transform="translate(60.205078 0)"/><use xlink:href="#DejaVuSansMono-69" transform="translate(120.410156 0)"/>@@ -3178,7 +3161,7 @@ z</g><g id="text_42"><!-- test -->- <g style="fill: #98a4ac" transform="translate(369.103344 136.502234) scale(0.041 -0.041)">+ <g style="fill: #bf4f4b" transform="translate(368.923344 136.502234) scale(0.041 -0.041)"><use xlink:href="#DejaVuSansMono-74"/><use xlink:href="#DejaVuSansMono-65" transform="translate(60.205078 0)"/><use xlink:href="#DejaVuSansMono-73" transform="translate(120.410156 0)"/>@@ -3495,8 +3478,8 @@ L 383.04 97.848" clip-path="url(#p37831d8287)" style="fill: none; stroke: #98a4ac; stroke-width: 0.7; stroke-linecap: square"/></g><g id="text_47">- <!-- denied, once you approve -->- <g style="fill: #98a4ac" transform="translate(293.013031 106.807312) scale(0.044 -0.044)">+ <!-- left out, and announced -->+ <g style="fill: #98a4ac" transform="translate(295.368406 106.807312) scale(0.044 -0.044)"><defs><path id="DejaVuSans-Bold-2c" d="M 653 1209L 1778 1209@@ -3508,30 +3491,29 @@ L 653 1209z" transform="scale(0.015625)"/></defs>- <use xlink:href="#DejaVuSans-Bold-64"/>- <use xlink:href="#DejaVuSans-Bold-65" transform="translate(71.582031 0)"/>- <use xlink:href="#DejaVuSans-Bold-6e" transform="translate(139.404297 0)"/>- <use xlink:href="#DejaVuSans-Bold-69" transform="translate(210.595703 0)"/>- <use xlink:href="#DejaVuSans-Bold-65" transform="translate(244.873047 0)"/>- <use xlink:href="#DejaVuSans-Bold-64" transform="translate(312.695312 0)"/>- <use xlink:href="#DejaVuSans-Bold-2c" transform="translate(384.277344 0)"/>- <use xlink:href="#DejaVuSans-Bold-20" transform="translate(422.265625 0)"/>- <use xlink:href="#DejaVuSans-Bold-6f" transform="translate(457.080078 0)"/>- <use xlink:href="#DejaVuSans-Bold-6e" transform="translate(525.78125 0)"/>- <use xlink:href="#DejaVuSans-Bold-63" transform="translate(596.972656 0)"/>- <use xlink:href="#DejaVuSans-Bold-65" transform="translate(656.25 0)"/>- <use xlink:href="#DejaVuSans-Bold-20" transform="translate(724.072266 0)"/>- <use xlink:href="#DejaVuSans-Bold-79" transform="translate(758.886719 0)"/>- <use xlink:href="#DejaVuSans-Bold-6f" transform="translate(824.072266 0)"/>- <use xlink:href="#DejaVuSans-Bold-75" transform="translate(892.773438 0)"/>- <use xlink:href="#DejaVuSans-Bold-20" transform="translate(963.964844 0)"/>- <use xlink:href="#DejaVuSans-Bold-61" transform="translate(998.779297 0)"/>- <use xlink:href="#DejaVuSans-Bold-70" transform="translate(1066.259766 0)"/>- <use xlink:href="#DejaVuSans-Bold-70" transform="translate(1137.841797 0)"/>- <use xlink:href="#DejaVuSans-Bold-72" transform="translate(1209.423828 0)"/>- <use xlink:href="#DejaVuSans-Bold-6f" transform="translate(1258.740234 0)"/>- <use xlink:href="#DejaVuSans-Bold-76" transform="translate(1327.441406 0)"/>- <use xlink:href="#DejaVuSans-Bold-65" transform="translate(1392.626953 0)"/>+ <use xlink:href="#DejaVuSans-Bold-6c"/>+ <use xlink:href="#DejaVuSans-Bold-65" transform="translate(34.277344 0)"/>+ <use xlink:href="#DejaVuSans-Bold-66" transform="translate(102.099609 0)"/>+ <use xlink:href="#DejaVuSans-Bold-74" transform="translate(145.605469 0)"/>+ <use xlink:href="#DejaVuSans-Bold-20" transform="translate(193.408203 0)"/>+ <use xlink:href="#DejaVuSans-Bold-6f" transform="translate(228.222656 0)"/>+ <use xlink:href="#DejaVuSans-Bold-75" transform="translate(296.923828 0)"/>+ <use xlink:href="#DejaVuSans-Bold-74" transform="translate(368.115234 0)"/>+ <use xlink:href="#DejaVuSans-Bold-2c" transform="translate(415.917969 0)"/>+ <use xlink:href="#DejaVuSans-Bold-20" transform="translate(453.90625 0)"/>+ <use xlink:href="#DejaVuSans-Bold-61" transform="translate(488.720703 0)"/>+ <use xlink:href="#DejaVuSans-Bold-6e" transform="translate(556.201172 0)"/>+ <use xlink:href="#DejaVuSans-Bold-64" transform="translate(627.392578 0)"/>+ <use xlink:href="#DejaVuSans-Bold-20" transform="translate(698.974609 0)"/>+ <use xlink:href="#DejaVuSans-Bold-61" transform="translate(733.789062 0)"/>+ <use xlink:href="#DejaVuSans-Bold-6e" transform="translate(801.269531 0)"/>+ <use xlink:href="#DejaVuSans-Bold-6e" transform="translate(872.460938 0)"/>+ <use xlink:href="#DejaVuSans-Bold-6f" transform="translate(943.652344 0)"/>+ <use xlink:href="#DejaVuSans-Bold-75" transform="translate(1012.353516 0)"/>+ <use xlink:href="#DejaVuSans-Bold-6e" transform="translate(1083.544922 0)"/>+ <use xlink:href="#DejaVuSans-Bold-63" transform="translate(1154.736328 0)"/>+ <use xlink:href="#DejaVuSans-Bold-65" transform="translate(1214.013672 0)"/>+ <use xlink:href="#DejaVuSans-Bold-64" transform="translate(1281.835938 0)"/></g></g><g id="text_48">@@ -3556,33 +3538,23 @@ z</g></g><g id="line2d_12">- <path d="M 343.584 135.36-L 357.552 135.36-" clip-path="url(#p37831d8287)" style="fill: none; stroke: #98a4ac; stroke-width: 0.6; stroke-linecap: square"/>- </g>- <g id="line2d_13">- <path d="M 367.056 135.36-L 381.024 135.36-" clip-path="url(#p37831d8287)" style="fill: none; stroke: #98a4ac; stroke-width: 0.6; stroke-linecap: square"/>- </g>- <g id="line2d_14">- <path d="M 153.792 143.28-L 211.536 143.28+ <path d="M 153.432 143.28+L 210.456 143.28" clip-path="url(#p37831d8287)" style="fill: none; stroke: #bf4f4b; stroke-width: 0.7; stroke-linecap: square"/></g>- <g id="line2d_15">- <path d="M 153.792 143.28-L 153.792 140.688+ <g id="line2d_13">+ <path d="M 153.432 143.28+L 153.432 140.688" clip-path="url(#p37831d8287)" style="fill: none; stroke: #bf4f4b; stroke-width: 0.7; stroke-linecap: square"/></g>- <g id="line2d_16">- <path d="M 211.536 143.28-L 211.536 140.688+ <g id="line2d_14">+ <path d="M 210.456 143.28+L 210.456 140.688" clip-path="url(#p37831d8287)" style="fill: none; stroke: #bf4f4b; stroke-width: 0.7; stroke-linecap: square"/></g><g id="text_49"><!-- repeated failures -->- <g style="fill: #bf4f4b" transform="translate(161.248375 149.647312) scale(0.044 -0.044)">+ <g style="fill: #bf4f4b" transform="translate(160.528375 149.647312) scale(0.044 -0.044)"><use xlink:href="#DejaVuSans-Bold-72"/><use xlink:href="#DejaVuSans-Bold-65" transform="translate(49.316406 0)"/><use xlink:href="#DejaVuSans-Bold-70" transform="translate(117.138672 0)"/>@@ -3602,24 +3574,24 @@ L 211.536 140.688<use xlink:href="#DejaVuSans-Bold-73" transform="translate(913.916016 0)"/></g></g>- <g id="line2d_17">- <path d="M 249.12 143.28-L 306.864 143.28+ <g id="line2d_15">+ <path d="M 247.32 143.28+L 304.344 143.28" clip-path="url(#p37831d8287)" style="fill: none; stroke: #bf4f4b; stroke-width: 0.7; stroke-linecap: square"/></g>- <g id="line2d_18">- <path d="M 249.12 143.28-L 249.12 140.688+ <g id="line2d_16">+ <path d="M 247.32 143.28+L 247.32 140.688" clip-path="url(#p37831d8287)" style="fill: none; stroke: #bf4f4b; stroke-width: 0.7; stroke-linecap: square"/></g>- <g id="line2d_19">- <path d="M 306.864 143.28-L 306.864 140.688+ <g id="line2d_17">+ <path d="M 304.344 143.28+L 304.344 140.688" clip-path="url(#p37831d8287)" style="fill: none; stroke: #bf4f4b; stroke-width: 0.7; stroke-linecap: square"/></g><g id="text_50"><!-- still repeating -->- <g style="fill: #bf4f4b" transform="translate(260.527437 149.647312) scale(0.044 -0.044)">+ <g style="fill: #bf4f4b" transform="translate(258.367437 149.647312) scale(0.044 -0.044)"><use xlink:href="#DejaVuSans-Bold-73"/><use xlink:href="#DejaVuSans-Bold-74" transform="translate(59.521484 0)"/><use xlink:href="#DejaVuSans-Bold-69" transform="translate(107.324219 0)"/>@@ -3637,36 +3609,44 @@ L 306.864 140.688<use xlink:href="#DejaVuSans-Bold-67" transform="translate(722.265625 0)"/></g></g>- <g id="line2d_20">- <path d="M 341.568 143.28+ <g id="line2d_18">+ <path d="M 341.208 143.28L 383.04 143.28-" clip-path="url(#p37831d8287)" style="fill: none; stroke: #98a4ac; stroke-width: 0.7; stroke-linecap: square"/>+" clip-path="url(#p37831d8287)" style="fill: none; stroke: #bf4f4b; stroke-width: 0.7; stroke-linecap: square"/></g>- <g id="line2d_21">- <path d="M 341.568 143.28-L 341.568 140.688-" clip-path="url(#p37831d8287)" style="fill: none; stroke: #98a4ac; stroke-width: 0.7; stroke-linecap: square"/>+ <g id="line2d_19">+ <path d="M 341.208 143.28+L 341.208 140.688+" clip-path="url(#p37831d8287)" style="fill: none; stroke: #bf4f4b; stroke-width: 0.7; stroke-linecap: square"/></g>- <g id="line2d_22">+ <g id="line2d_20"><path d="M 383.04 143.28L 383.04 140.688-" clip-path="url(#p37831d8287)" style="fill: none; stroke: #98a4ac; stroke-width: 0.7; stroke-linecap: square"/>+" clip-path="url(#p37831d8287)" style="fill: none; stroke: #bf4f4b; stroke-width: 0.7; stroke-linecap: square"/></g><g id="text_51">- <!-- never run -->- <g style="fill: #98a4ac" transform="translate(350.251437 149.647312) scale(0.044 -0.044)">- <use xlink:href="#DejaVuSans-Bold-6e"/>- <use xlink:href="#DejaVuSans-Bold-65" transform="translate(71.191406 0)"/>- <use xlink:href="#DejaVuSans-Bold-76" transform="translate(139.013672 0)"/>- <use xlink:href="#DejaVuSans-Bold-65" transform="translate(204.199219 0)"/>- <use xlink:href="#DejaVuSans-Bold-72" transform="translate(272.021484 0)"/>- <use xlink:href="#DejaVuSans-Bold-20" transform="translate(321.337891 0)"/>- <use xlink:href="#DejaVuSans-Bold-72" transform="translate(356.152344 0)"/>- <use xlink:href="#DejaVuSans-Bold-75" transform="translate(405.46875 0)"/>- <use xlink:href="#DejaVuSans-Bold-6e" transform="translate(476.660156 0)"/>- </g>- </g>- <g id="line2d_23">+ <!-- until you stop it -->+ <g style="fill: #bf4f4b" transform="translate(342.369719 149.647312) scale(0.044 -0.044)">+ <use xlink:href="#DejaVuSans-Bold-75"/>+ <use xlink:href="#DejaVuSans-Bold-6e" transform="translate(71.191406 0)"/>+ <use xlink:href="#DejaVuSans-Bold-74" transform="translate(142.382812 0)"/>+ <use xlink:href="#DejaVuSans-Bold-69" transform="translate(190.185547 0)"/>+ <use xlink:href="#DejaVuSans-Bold-6c" transform="translate(224.462891 0)"/>+ <use xlink:href="#DejaVuSans-Bold-20" transform="translate(258.740234 0)"/>+ <use xlink:href="#DejaVuSans-Bold-79" transform="translate(293.554688 0)"/>+ <use xlink:href="#DejaVuSans-Bold-6f" transform="translate(358.740234 0)"/>+ <use xlink:href="#DejaVuSans-Bold-75" transform="translate(427.441406 0)"/>+ <use xlink:href="#DejaVuSans-Bold-20" transform="translate(498.632812 0)"/>+ <use xlink:href="#DejaVuSans-Bold-73" transform="translate(533.447266 0)"/>+ <use xlink:href="#DejaVuSans-Bold-74" transform="translate(592.96875 0)"/>+ <use xlink:href="#DejaVuSans-Bold-6f" transform="translate(640.771484 0)"/>+ <use xlink:href="#DejaVuSans-Bold-70" transform="translate(709.472656 0)"/>+ <use xlink:href="#DejaVuSans-Bold-20" transform="translate(781.054688 0)"/>+ <use xlink:href="#DejaVuSans-Bold-69" transform="translate(815.869141 0)"/>+ <use xlink:href="#DejaVuSans-Bold-74" transform="translate(850.146484 0)"/>+ </g>+ </g>+ <g id="line2d_21"><path d="M 360 155.52L 360 182.52" clip-path="url(#p37831d8287)" style="fill: none; stroke: #63727d; stroke-width: 0.85; stroke-linecap: square"/>diff --git a/plugin/README.md b/plugin/README.mdindex 6658e37..fa1519f 100644--- a/plugin/README.md+++ b/plugin/README.md@@ -16,7 +16,6 @@ behaviour of each agent are in [`docs/PLUGIN.md`](../docs/PLUGIN.md).- [ ] Your agent installed and signed in, any way it supports (a subscription or an API key), at asupported version ([Supported versions](../README.md#supported-versions))- [ ] Python 3.10 or newer on `PATH` (or set `TE_PYTHON=/path/to/python3.10+`)-- [ ] Access to this repository on GitHub- [ ] Copilot CLI only: the repository's folder trusted by Copilot (it asks the first time youstart it there: choose **Yes, and remember this folder for future sessions**); Copilot ignores afolder's `.github/copilot` settings otherwise@@ -30,8 +29,9 @@ git clone https://github.com/microsoft/TokenEconomizer.gitKeep the clone where it is: the installed plugin runs from it.-> **Where commands go.** Lines starting with `/` (`/plugin …`, `/tokeneconomizer:…`, `/te …`)-> are typed into **the agent's prompt**, not your shell. Shell commands are in `bash` blocks.+> **Where commands go.** Lines starting with `/` or `$` (`/plugin …`, `/tokeneconomizer:…`,+> `$tokeneconomizer:…`, `/te …`) are typed into **the agent's prompt**, not your shell. Shell+> commands are in `bash` blocks.## Claude Code@@ -286,48 +286,53 @@ from); `pi config` turns it off without removing it. Optional: `rm -rf ~/.tokene## What to expect-The plugin works session by session. A session is one conversation with the agent, from start to-exit, however many tasks you do in it; resuming it continues the same session. The plugin learns-from a session once it ends, and acts at the start of the next one; only the loop guard acts-during a turn.+The plugin works session by session: what it learns from a repository's earlier sessions is+applied to the ones that follow. Facts and the deny list take effect when a session starts; the+loop guard acts during a turn. Each agent learns on its own (what Claude Code learned in a+repository is not used by Codex there), while settings are shared by every agent.- **Facts** (once you turn micro-skills on; it is off by default). Two sources propose them, in- any language or toolchain. The first needs no model call: the same environment failure in a- few sessions (a tool, interpreter, build or test command that fails as typed and works spelled- another way). The second runs every `microskills_propose_every` sessions (3 by default): a- model reads digests of the recent sessions (the commands run, including build, test and lint- commands, the files edited, and each failing command with its error line, with paths relative- to the repository) and writes facts about the repository, each with patterns that test it- against later sessions. A fact is injected at every session start once later sessions confirm- it (three confirming sessions among at least four where it applied), and retired when one- contradicts it. How much this helps depends on the repository's state and the tasks you run in- it. A session start that adds facts says so once, in one line. A resumed session keeps the- facts it started with, word for word, so its cached prompt still matches. `microskills` shows- the facts injected and those still forming.+ any language or toolchain. The first needs no model call: the same environment failure in a few+ sessions (a tool, interpreter, build or test command that fails as typed and works spelled+ another way). The second runs every `microskills_propose_every` sessions (3 by default): a model+ reads digests of the recent sessions (the commands run, including build, test and lint commands,+ the files edited, and each failing command with its error line, with paths relative to the+ repository) and writes facts about the repository, each with patterns that test it against later+ sessions. A fact becomes active once three sessions confirm it (for a proposed fact about the+ code, sessions that edited different files), and is injected at every session start while the+ failure it prevents keeps showing up, or keeps being avoided, in at least 40% of the sessions+ where it applies (over at least four). It is retired when a session contradicts it (for a+ command-spelling fact, two in a row). How much this helps depends on the repository's state and+ the tasks you run in it. A session start that adds facts says so once, in one line. A resumed+ session keeps the facts it started with, word for word, so its cached prompt still matches.+ `microskills` shows the facts injected and those still forming.- **Deny list.** A tool, package or server that is loaded but never used here is left out withoutasking you, once it has gone unused over `toolprune_evidence` prompts (10 by default) across atleast `toolprune_min_sessions` sessions (2), or over `toolprune_sessions` sessions of any length- (5); a few higher-risk tools need three times as long. A session that ran no prompt does not- count. The list is written once the repository's sessions have been idle for- `toolprune_quiet_minutes` (60 by default), so that no conversation you resume loses its prompt- cache, and it applies from the next session, whose start says so once. `toolprune` shows a list- still waiting. `toolprune restore` gives back what the plugin removed, and only that; what you- give back is never removed again (`toolprune apply NAME` removes one again). With- `toolprune=propose`, the list is only proposed, the session start says so, and nothing changes- until you run `toolprune apply`. A settings file the plugin creates is added to- `.git/info/exclude`. Each checkout keeps its own settings file: a repository's clones share- what was learned, and each gets the list when one of its own sessions ends.+ (5); Claude Code's `NotebookEdit` and Codex's `image_media` package need three times as long. A+ session that ran no prompt does not count. The list is written once the repository's sessions+ have been idle for `toolprune_quiet_minutes` (60 by default), so that no conversation you resume+ loses its prompt cache (a list that has waited a day is written anyway), and it applies from the+ next session, whose start says so once. `toolprune` shows a list still waiting.+ `toolprune restore` gives back what the plugin removed, and only that; what you give back is+ never removed again (`toolprune apply NAME` removes one again). With `toolprune=propose`, the+ list is only proposed, the session start says so, and nothing changes until you run+ `toolprune apply`. `toolprune=off` stops new lists but leaves an applied one in place;+ `toolprune restore` gives the tools back. A settings file the plugin creates is added to+ `.git/info/exclude`. Each checkout keeps its own settings file: a repository's clones share what+ was learned, and each gets the list when one of its own sessions ends.- **Loop guard.** Quiet on normal turns, and idle until `loopguard.envelope_min_samples` turns in- a repository (5 by default) have ended with passing checks. After that, a turn that keeps- hitting the same failures, or piles up errors, after `loopguard.min_turns` tool calls is put to- a judge model. Only a "stuck" verdict with confidence `loopguard.judge_confidence` (0.7) or more- attaches a redirect (written by that model) to a tool result, at most `loopguard_nudges` (1)- per turn; if the turn is still stuck after that, a one-line notice tells you how to stop it. A- long turn with no sign of looping is never judged. A turn past `loopguard.backstop_mult` (2.5)- times the repository's usual length that also keeps churning edits through the same failures- is redirected even if the judge disagrees. The plugin never stops a turn itself. Where the- notice appears, and how to stop the turn, on each agent and in each mode:- [When a turn gets stuck](../README.md#when-a-turn-gets-stuck).+ a repository (5 by default) have ended well: on their own, with no failing check after the last+ edit. After that, a turn that keeps hitting the same failures, or piles up errors, after+ `loopguard.min_turns` tool calls is put to a judge model. Only a "stuck" verdict with confidence+ `loopguard.judge_confidence` (0.7) or more attaches a redirect (written by that model) to a tool+ result (at the `aggressive` preset, an ambiguous verdict past the envelope also does), at most+ `loopguard_nudges` (1) per turn; if the turn is still stuck after that, a one-line notice tells+ you how to stop it. A long turn with no sign of looping is never judged. A turn past+ `loopguard.backstop_mult` (2.5) times the repository's usual length that also keeps churning+ edits through the same failures is redirected even if the judge disagrees. The plugin never+ stops a turn itself. Where the notice appears, and how to stop the turn, on each agent and in+ each mode: [When a turn gets stuck](../README.md#when-a-turn-gets-stuck).- **Cost.** `status` shows each session's tokens, priced after it ends, and the plugin's ownoverhead: the loop guard's judge, and micro-skills' proposer when it is on.@@ -344,7 +349,7 @@ during a turn.| `toolprune measure` | the request with and without the proposal || `config` | the settings: what is on, and every value in effect || `config set KEY=VALUE … [--global]` | change settings for this repository (or every one); see [Settings](#settings) |-| `config unset KEY … [--global]` | put a setting back to its default |+| `config unset KEY … [--global]` | remove the setting at this level, so the global value (or the default) applies || `repomap` / `repomap refresh` | the cached repository map / make it now (see [Repository map](#repository-map)) || `repos` | every repository it keeps state for: how it was identified, its sessions per agent, the checkouts seen || `repos migrate` | file state an earlier version recorded under the repository it belongs to (runs by itself, once, after an upgrade) |@@ -360,6 +365,9 @@ How to run them:| Copilot CLI | `/tokeneconomizer:<command>` (interactive mode) | `~/.tokeneconomizer/bin/te --host copilot <command>` || Pi | `/te <command>` | `~/.tokeneconomizer/bin/te --host pi <command>` |+`doctor` and `repomap` run from a terminal (or as `/te …` on Pi); there is no slash command or+Codex skill for them.+Inside an agent, each command is one model turn; from a terminal it costs nothing. Codex asksbefore a command that changes something (`config set`, `toolprune restore`, ...), since itwrites outside Codex's sandbox: choose **Yes, proceed**. The Copilot CLI runs these commands in@@ -396,8 +404,8 @@ and are shared by every agent working in it. The examples use Claude Code's form| Mechanism | Key | `on` means | Other values ||---|---|---|---|| Micro-skills (off by default) | `microskills` | `envfacts+distiller`: facts found without model calls, plus a model proposing facts every `microskills_propose_every` sessions | `off`; `envfacts`: only the facts found without model calls; `distiller`: only the proposer |-| Tool pruning | `toolprune` | `auto`: applied without asking once your sessions have been idle for `toolprune_quiet_minutes`, from the next session, which announces it | `off`; `propose`: only proposed, applied when you run `toolprune apply` |-| Loop guard | `loopguard` | `nudge`: a judge model decides whether a looping turn is stuck; if so, one mid-turn redirect, then a notice to you if the turn is still stuck | `off` (no judge either); `stop` is read as `nudge`, with a warning |+| Tool pruning | `toolprune` | `auto`: applied without asking once your sessions have been idle for `toolprune_quiet_minutes` (or a day after it formed), from the next session, which announces it | `off`; `propose`: only proposed, applied when you run `toolprune apply` |+| Loop guard | `loopguard` | `nudge`: a judge model decides whether a looping turn is stuck; if so, up to `loopguard_nudges` mid-turn redirects, then a notice to you if the turn is still stuck | `off` (no judge either); `stop` is read as `nudge`, with a warning |**Tune a mechanism:**@@ -410,22 +418,22 @@ and are shared by every agent working in it. The examples use Claude Code's form| Key | Default | What it sets ||---|---|---|-| `microskills_max_facts` | `4` | the most facts injected at session start |-| `microskills_max_tokens` | `150` | the size of the injected block, in tokens (about 4 characters each) |-| `microskills_propose_every` | `3` | sessions between runs of the fact proposer (the first runs after the second session) |-| `toolprune_evidence` | `10` | prompts a never-used tool must go unused, over at least `toolprune_min_sessions` sessions, before it is left out (three times as many for a few higher-risk tools; the web is never proposed) |+| `microskills_max_facts` | `4` | the most facts from repeated failures injected at session start (the proposer's facts are not capped) |+| `microskills_max_tokens` | `150` | the size of those facts' block, in tokens (about 4 characters each) |+| `microskills_propose_every` | `3` | sessions between runs of the fact proposer (the first run comes one session early: after the second, by default) |+| `toolprune_evidence` | `10` | prompts a never-used tool must go unused, over at least `toolprune_min_sessions` sessions, before it is left out (three times as many for `NotebookEdit` and Codex's `image_media`; the web is never proposed) || `toolprune_min_sessions` | `2` | sessions those prompts must span; `1` lets a single session's prompts decide || `toolprune_sessions` | `5` | or this many sessions, however few prompts they ran |-| `toolprune_quiet_minutes` | `60` | how long the repository's sessions must have been idle before `auto` writes a deny list, so that no conversation resumed while its prompt cache is warm loses it; `0` writes at once |+| `toolprune_quiet_minutes` | `60` | how long the repository's sessions must have been idle before `auto` writes a deny list, so that no conversation resumed while its prompt cache is warm loses it (a list is written at the latest a day after it formed); `0` writes at once || `loopguard_aggr` | `default` | the guard's threshold preset: `conservative`, `default` or `aggressive` |-| `loopguard_nudges` | `1` | redirects per prompt-turn before the guard only notifies you |+| `loopguard_nudges` | `1` | redirects per turn before the guard only tells you || `loopguard.<name>` | from the preset | one guard threshold, set by hand (below) |-The guard calls a turn stuck when it keeps editing the same files and hitting the same-failures, well past how long this repository's turns that end with passing tests usually take-(the *envelope*). Until a repository has a few such turns, the preset's thresholds apply; after-that, some are learned from the repository's own turns. A value you set with `loopguard.<name>`-wins over both. Defaults at each preset:+The guard looks for a turn that keeps editing the same files and hitting the same failures. It+also learns how long this repository's turns usually run when they end well (on their own, with+no failing check after the last edit): the *envelope*. Until `envelope_min_samples` such turns+exist the guard does nothing; after that, some thresholds are learned from those turns, on top+of the preset. A value you set with `loopguard.<name>` wins over both. Defaults at each preset:| `loopguard.<name>` | `conservative` | `default` | `aggressive` | What it sets ||---|---|---|---|---|@@ -434,9 +442,9 @@ wins over both. Defaults at each preset:| `distinct_edit_files` | 3 | 3 | 3 | files edited that count as scattered || `error_outputs` | 8 | 6 | 4 | failing tool results that count as sustained errors || `stagnation` | 0.30 | 0.20 | 0.12 | share of failures that repeat an earlier one |-| `envelope_pct` | 90 | 90 | 90 | percentile of the repository's passing turns the envelope starts from |+| `envelope_pct` | 90 | 90 | 90 | percentile of the repository's well-ended turns the envelope starts from || `envelope_margin` | 1.5 | 1.25 | 1.0 | multiplier on that percentile |-| `envelope_min_samples` | 7 | 5 | 3 | passing turns needed before the envelope is used |+| `envelope_min_samples` | 7 | 5 | 3 | well-ended turns needed before the guard acts || `backstop_mult` | 3.5 | 2.5 | 1.8 | past this multiple of the envelope, a turn the rule calls stuck is redirected even if the judge disagrees, then flagged to you || `judge_confidence` | 0.85 | 0.7 | 0.55 | how sure the judge must be that a turn is stuck || `gate_min_turns` | 24 | 18 | 12 | tool calls before the judge is asked (never fewer than `min_turns`) |@@ -455,14 +463,14 @@ wins over both. Defaults at each preset:| Key | Default | Values ||---|---|---|-| `paid_model` | `""` | model for the plugin's own calls; empty: `haiku` on Claude Code, the agent's own default model on Codex and Pi, `COPILOT_MODEL` on Copilot (unless it is `auto`) |+| `paid_model` | `""` | model for the plugin's own calls; empty: `haiku` on Claude Code, the agent's own default model on Codex and Pi, on Copilot `COPILOT_PROVIDER_MODEL_ID` or `COPILOT_MODEL` (unless it is `auto`), else a BYOK provider's Haiku, else Copilot's own default || `shadow` | `false` | decide and log everything, act on nothing || `mode` | `auto` | `interactive` or `headless` to override what the plugin detects |**Where settings live, and when they apply.** For one session, an environment variable wins:-`TE_MICROSKILLS`, `TE_TOOLPRUNE`, `TE_LOOPGUARD`, `TE_LOOPGUARD_NUDGES`,-`TE_MICROSKILLS_MAX_FACTS`, and so on, and `TE_LOOPGUARD_THRESHOLDS='{"min_turns": 30}'` for the-guard's thresholds; `TE_DISABLE=1` turns the whole plugin off. Otherwise the repository's+`TE_` plus the setting's name in capitals (`TE_MICROSKILLS`, `TE_TOOLPRUNE_EVIDENCE`,+`TE_LOOPGUARD_NUDGES`, ...), and `TE_LOOPGUARD_THRESHOLDS='{"min_turns": 30}'` for the guard's+thresholds; `TE_DISABLE=1` turns the whole plugin off. Otherwise the repository'ssettings win over the global ones, and those over the defaults; `unset` goes back one level. Achange applies from the agent's next hook call: the guard at the next tool call, facts and thedeny list at the next session start. A new fact-size cap shows once the next session has ended.@@ -482,7 +490,7 @@ agent knows where things are before it starts reading files. Turn it on per repo```bashpip install aider-chat # or: pipx install aider-chat / uv tool install aider-chat-~/.tokeneconomizer/bin/te config set repomap=on # add --host for Codex, Copilot or Pi+~/.tokeneconomizer/bin/te config set repomap=on # settings are shared by every agent```- **What goes in.** At most `repomap_tokens` tokens (default 2048), once per session. On Claude@@ -541,7 +549,7 @@ and only when you run it.|---|---|| a command prints an import error, or the hooks seem to do nothing | run `~/.tokeneconomizer/bin/te doctor` (or `plugin/scripts/te doctor` in the clone) and read its errors.log lines || errors.log says the package "was not found for the plugin" | the clone the plugin was installed from moved or is gone: add it again, or use the [self-contained install](#codex) |-| `python 3.x (needs >= 3.10)` | install Python 3.10+ or set `TE_PYTHON` to one |+| `TokenEconomizer needs Python >= 3.10 (this is 3.x)` | install Python 3.10+ or set `TE_PYTHON` to one || the deny list leaves nothing out after many sessions | run `toolprune refresh-catalog` (Claude Code, Copilot) || a Codex deny list was applied but nothing changed | trust the project in Codex; `~/.tokeneconomizer/bin/te --host codex doctor` says whether it is trusted || errors.log has `sidecall copilot: no reply`, and a session start says the plugin's model calls are paused | they cannot use a Copilot BYOK provider ([Copilot CLI](#copilot-cli)): micro-skills keeps its facts that need no model call (`microskills=envfacts` stops trying the proposer), and the loop guard redirects only at its backstop. Once Copilot is signed in, `config set microskills=on` (or `loopguard=on`) tries again |diff --git a/plugin/codex-skills/config/SKILL.md b/plugin/codex-skills/config/SKILL.mdindex 0ef39c5..83bfb6a 100644--- a/plugin/codex-skills/config/SKILL.md+++ b/plugin/codex-skills/config/SKILL.md@@ -16,7 +16,6 @@ Use `show` as ARGS unless the user asked to change a setting; then `set KEY=VALUChanging a setting (`set`, `unset`) writes TokenEconomizer's own state under `~/.tokeneconomizer`, outside the workspace, which the sandbox keeps read-only: run that command with `sandbox_permissions` set to `"require_escalated"` and a one-line `justification`, so that Codex asks the user to approve it. `show` reads only and needs no approval.-The command reads and writes only TokenEconomizer's own state (under `~/.tokeneconomizer`)-and, for `toolprune apply` or `restore`, the project's `.codex/config.toml`; it makes no model-call. If it reports that the launcher does not exist, the plugin has not run in a session yet:+The command reads and writes only TokenEconomizer's own state (under `~/.tokeneconomizer`); it+makes no model call. If it reports that the launcher does not exist, the plugin has not run in a session yet:ask the user to start a new Codex session in this repository first.diff --git a/plugin/codex-skills/microskills/SKILL.md b/plugin/codex-skills/microskills/SKILL.mdindex ce31ea9..a8c383a 100644--- a/plugin/codex-skills/microskills/SKILL.md+++ b/plugin/codex-skills/microskills/SKILL.md@@ -14,7 +14,6 @@ Run this command in the repository's root directory:Show the output verbatim in a code block, with no commentary.-The command reads and writes only TokenEconomizer's own state (under `~/.tokeneconomizer`)-and, for `toolprune apply` or `restore`, the project's `.codex/config.toml`; it makes no model-call. If it reports that the launcher does not exist, the plugin has not run in a session yet:+The command reads and writes only TokenEconomizer's own state (under `~/.tokeneconomizer`); it+makes no model call. If it reports that the launcher does not exist, the plugin has not run in a session yet:ask the user to start a new Codex session in this repository first.diff --git a/plugin/codex-skills/status/SKILL.md b/plugin/codex-skills/status/SKILL.mdindex 977aa7a..6fa2db3 100644--- a/plugin/codex-skills/status/SKILL.md+++ b/plugin/codex-skills/status/SKILL.md@@ -14,7 +14,6 @@ Run this command in the repository's root directory:Show the output verbatim in a code block. Add nothing unless it contains a warning; then explain the warning in one sentence.-The command reads and writes only TokenEconomizer's own state (under `~/.tokeneconomizer`)-and, for `toolprune apply` or `restore`, the project's `.codex/config.toml`; it makes no model-call. If it reports that the launcher does not exist, the plugin has not run in a session yet:+The command reads and writes only TokenEconomizer's own state (under `~/.tokeneconomizer`); it+makes no model call. If it reports that the launcher does not exist, the plugin has not run in a session yet:ask the user to start a new Codex session in this repository first.diff --git a/plugin/codex-skills/toolprune/SKILL.md b/plugin/codex-skills/toolprune/SKILL.mdindex 9abe8eb..19084b5 100644--- a/plugin/codex-skills/toolprune/SKILL.md+++ b/plugin/codex-skills/toolprune/SKILL.md@@ -12,7 +12,7 @@ Run this command in the repository's root directory:"${TOKENECONOMIZER_HOME:-$HOME/.tokeneconomizer}/bin/te" --host codex --cwd "$(pwd)" toolprune ARGS```-Use `show` as ARGS unless the user asked to `apply`, `restore` or `measure` (optionally naming capabilities). Never run `apply` or `restore` unless the user asked for it. Show the output verbatim in a code block; if it is a proposal, end with one line saying how to apply it and that it takes effect from the next session.+Use `show` as ARGS unless the user asked to `apply`, `restore` or `measure` (optionally naming capabilities). Never run `apply` or `restore` unless the user asked for it. Show the output verbatim in a code block. If it shows a proposal waiting for `toolprune apply` (under `toolprune=propose`, or one the plugin could not write), end with one line saying how to apply it and that it takes effect from the next session; if it shows a pending list, say that it is written by itself once this repository's sessions have been idle, or now with `apply`.`apply` and `restore` edit the project's `.codex/config.toml` and record the change in TokenEconomizer's own state under `~/.tokeneconomizer`, outside the workspace, which the sandbox keeps read-only: run that command with `sandbox_permissions` set to `"require_escalated"` and a one-line `justification`, so that Codex asks the user to approve it. `show` and `measure` need no approval.diff --git a/plugin/slash-commands/toolprune.md b/plugin/slash-commands/toolprune.mdindex deba614..c757e9b 100644--- a/plugin/slash-commands/toolprune.md+++ b/plugin/slash-commands/toolprune.md@@ -9,4 +9,4 @@ Run this exact command with the Bash tool, then show me its output verbatim in ate="${CLAUDE_PLUGIN_ROOT}/scripts/te"; [ -x "$te" ] || te="${TOKENECONOMIZER_HOME:-$HOME/.tokeneconomizer}/bin/te"; "$te" --cwd "$(pwd)" toolprune $ARGUMENTS```-It applies or restores the deny list only when I typed `apply` or `restore` in those arguments; never add them yourself. If the output is a proposal, end with one line telling me how to apply it (`/tokeneconomizer:toolprune apply`) and that it takes effect from the next session.+It applies or restores the deny list only when I typed `apply` or `restore` in those arguments; never add them yourself. If it shows a proposal waiting for `toolprune apply` (under `toolprune=propose`, or one the plugin could not write), end with one line telling me how to apply it (`/tokeneconomizer:toolprune apply`) and that it takes effect from the next session. If it shows a pending list, say that it is written by itself once this repository's sessions have been idle, or now with `/tokeneconomizer:toolprune apply`.diff --git a/plugin/slash-commands/untool.md b/plugin/slash-commands/untool.mdindex 289ef14..a5fc7b9 100644--- a/plugin/slash-commands/untool.md+++ b/plugin/slash-commands/untool.md@@ -9,4 +9,4 @@ Run this exact command with the Bash tool, then show me its output verbatim in ate="${CLAUDE_PLUGIN_ROOT}/scripts/te"; [ -x "$te" ] || te="${TOKENECONOMIZER_HOME:-$HOME/.tokeneconomizer}/bin/te"; "$te" --cwd "$(pwd)" toolprune $ARGUMENTS```-It applies or restores the deny list only when I typed `apply` or `restore` in those arguments; never add them yourself. If the output is a proposal, end with one line telling me how to apply it (`/tokeneconomizer:toolprune apply`) and that it takes effect from the next session.+It applies or restores the deny list only when I typed `apply` or `restore` in those arguments; never add them yourself. If it shows a proposal waiting for `toolprune apply` (under `toolprune=propose`, or one the plugin could not write), end with one line telling me how to apply it (`/tokeneconomizer:toolprune apply`) and that it takes effect from the next session. If it shows a pending list, say that it is written by itself once this repository's sessions have been idle, or now with `/tokeneconomizer:toolprune apply`.diff --git a/tokeneconomizer/loopguard/README.md b/tokeneconomizer/loopguard/README.mdindex d7f175e..c746b00 100644--- a/tokeneconomizer/loopguard/README.md+++ b/tokeneconomizer/loopguard/README.md@@ -8,13 +8,16 @@ Per tool call, `turn.TurnGuard`:1. folds the call into a `state.SpiralState` -- edits per file, files edited, error outputs,verification runs, and how often a failure repeats one seen before (edits made through theshell count too, `shell_edits.py`);-2. checks a hard backstop: stuck *and* far past this repository's envelope;-3. asks `rules.assess_abort`: a free gate decides whether the turn is worth a look; then either- the optional paid judge (`judge.py`) or the strict heuristic `is_stuck` with the envelope- decides;+2. checks a hard backstop: stuck *and* far past this repository's envelope (an unspent+ redirect is still given first);+3. asks `rules.assess_abort`: a free gate decides whether the turn is worth a look; then the+ judge (`judge.py`) decides -- in the plugin always, once the repository has an envelope;+ without a judge (some experiment arms), the strict heuristic `is_stuck` with the envelope+ does;4. answers the first stuck verdict with a redirect (`rules.nudge_text`, or a judge-written one)- and starts a fresh segment, so the agent gets a fair window to recover; a later one with a- stop.+ and starts a fresh segment, so the agent gets a fair window to recover; a later one with an+ `abort` verdict, which the plugin delivers as a notice to the person (it never stops a+ turn).The **envelope** (`envelope.py`) is a percentile of how long this repository's turns run whenthey end well -- the agent stopped on its own and no check after its last edit failed. Only such@@ -29,4 +32,4 @@ from a preset (`SPIRAL_LEVELS`), learn on top of it, and can be pinned by hand| `envelope.py` | `EnvelopeTracker` and its per-repository storage || `state.py` | `SpiralState`, `completed_calls` (one streamed line to finished calls) || `shell_edits.py` | files a shell command writes (`sed -i`, redirects, inline Python, ...) |-| `judge.py` | the optional paid stuck judge and redirect writer |+| `judge.py` | the stuck judge and redirect writer (model calls) |diff --git a/tokeneconomizer/microskills/README.md b/tokeneconomizer/microskills/README.mdindex 5effd05..7c3d213 100644--- a/tokeneconomizer/microskills/README.md+++ b/tokeneconomizer/microskills/README.md@@ -8,19 +8,20 @@ Each finished session goes through three steps:*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 anenvironmental error class or a sign that tests ran. The words that name intents come from a- `Vocabulary`. The plugin reads every repository with `GENERIC` -- every ecosystem at once,- every edited file, and the proposer's language-neutral digest and prompt; the experiments+ `Vocabulary`. By default the plugin reads every repository with `GENERIC` -- every ecosystem at+ once, every edited file, and the proposer's language-neutral digest and prompt; the experimentsuse `PYTHON_GIT` or `NODE_WEB`, the paper's narrower reading.2. **Propose.** `envfacts.py` turns recurring shapes of evidence into candidate facts, with nomodel call: a failing form followed by a working one (*form repair*), every fetch to a hostrefused (*boundary*), VCS probes that always come back empty (*empty probe*), a test labelthat loads once rewritten (*arg repair*), a missing environment variable that a later runsets (*env value*). `distiller.py` adds an LLM proposer that authors facts with host-checked- detectors; in the plugin, `microskills=on` runs both.+ detectors; in the plugin, `microskills=on` runs both (micro-skills is off by default).3. **Keep or retire** (`lifecycle.py`). A candidate becomes active after confirmations onthree sessions (for a proposed fact about the code, sessions that edited different files),- retires on contradiction, and is injected only while- the failure it prevents keeps occurring (or keeps being prevented).+ 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, foldthe session in after it. The block is capped (`MAX_FACTS`, `MAX_TOKENS`), and a lint refuses any@@ -30,6 +31,6 @@ fact that reads as completion or verification advice.|---|---|| `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 optional paid proposer and its detector DSL |+| `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` |diff --git a/tokeneconomizer/plugin/README.md b/tokeneconomizer/plugin/README.mdindex 10b4ace..1adc4f3 100644--- a/tokeneconomizer/plugin/README.md+++ b/tokeneconomizer/plugin/README.md@@ -13,10 +13,11 @@ What happens at each hook, and how each agent was verified to behave, is in| `controller.py` | what happens at each hook || `hosts.py` | per-agent hook payloads and outputs (Claude Code, Codex, Copilot CLI, Pi) || `fold.py` | a finished session through `PrefixStage` and `ToolingStage` |-| `denylist.py` | writing an approved proposal into each agent's settings, and taking it back |+| `denylist.py` | writing the deny list into each agent's settings (by itself under `auto`, on `toolprune apply` under `propose`), and taking it back || `toolcheck.py` | asking the agent CLIs what a session loads, and what a deny list removed || `config.py` | settings, their sources, and the earlier names they are still read under || `context.py`, `paths.py`, `store.py` | where state lives, which repository a session is in, locked atomic JSON |+| `repos.py` | which repository's state a session belongs to over time: session pins, `te repos`, `repos migrate` and `merge` || `adapter.py` | the `DomainAdapter` for a real repository || `accounting.py` | the session ledger || `sidecall.py`, `judge.py` | the plugin's model calls (the loop guard's judge, micro-skills' proposer) through the agent's own CLI, off the hook's critical path |diff --git a/tokeneconomizer/plugin/controller.py b/tokeneconomizer/plugin/controller.pyindex 4fa0f92..bedeb9a 100644--- a/tokeneconomizer/plugin/controller.py+++ b/tokeneconomizer/plugin/controller.py@@ -67,6 +67,8 @@ class LiveController:return f"/tokeneconomizer:{name}"if self.host.name == "pi":return f"/te {name}" # registered by the Pi extension+ if self.host.name == "codex":+ return f"$tokeneconomizer:{name}" # the plugin's Codex skillsreturn f"te --host {self.host.name} {name}"def _log(self, kind, **fields):diff --git a/tokeneconomizer/toolprune/README.md b/tokeneconomizer/toolprune/README.mdindex c6bc1e5..cb695a1 100644--- a/tokeneconomizer/toolprune/README.md+++ b/tokeneconomizer/toolprune/README.md@@ -3,21 +3,27 @@How tool pruning (see the [main README](../../README.md)) decides what to drop, per agent.- **Evidence pruning** (Claude Code, Copilot CLI; `stage.ToolingStage`). After each session, a- loaded tool's unused streak grows or resets. A tool is proposed once its streak reaches- `evidence` sessions; a protected work-surface tool (`tools.PROTECTED_TOOLS`) or one ever seen- in use is never proposed. An optional per-task judge (`tools.judge_tools_for_task`) can also- drop tools the task text makes irrelevant, its cost charged to the ledger.+ loaded tool's unused streak grows or resets. In the experiments a tool is proposed once its+ streak reaches `evidence` sessions. The plugin asks for more (`plugin/fold.py`): unused over+ `toolprune_evidence` prompts across at least `toolprune_min_sessions` sessions, or over+ `toolprune_sessions` sessions, and three times as long for `NotebookEdit`. A protected+ work-surface tool (`tools.PROTECTED_TOOLS`) or one ever seen in use is never proposed. In the+ experiments only, a per-task judge (`tools.judge_tools_for_task`) can also drop tools the+ task text makes irrelevant, its cost charged to the ledger; the plugin has no task text and+ never calls a model to prune.- **Capability pruning** (Codex; `codex.CodexUntoolProfile`). Codex's unit is a capabilitypackage (collaboration, goals, image/media, ...) switched off in its config. A package isdemoted only after enough loaded-but-unused sessions, at most two per session, and a single- use protects it for good.+ use protects it for good. The plugin proposes a demoted package only once it also meets the+ prompt-and-session evidence above (three times as long for image/media).-This package decides *what* to drop. Writing the decision into an agent's own settings file, only-after the person approves it and only from the next session, is the plugin's job-(`tokeneconomizer/plugin/denylist.py`).+This package decides *what* to drop. Writing the decision into an agent's own settings file is+the plugin's job (`tokeneconomizer/plugin/denylist.py`): by itself under `toolprune=auto` (the+default), once the repository's sessions have been idle `toolprune_quiet_minutes`, or on+`toolprune apply` under `propose`; either way it takes effect from the next session.| Module | ||---|---|| `stage.py` | `ToolingStage`: evidence across sessions, the proposal, the Codex mask || `codex.py` | `CodexUntoolProfile`: Codex's evidence-gated capability controller |-| `tools.py` | the protected and inapplicable tool sets; the optional per-task tool judge |+| `tools.py` | the protected and inapplicable tool sets; the experiments' per-task tool judge |