Repository navigation
tole v0.9.0
Context compaction, global session index, command allow/deny, failover chain, child-agent handoff.
Includes the 0.8.2 hardening patch (see CHANGELOG.md [0.8.2]), which was never tagged or published on its own.
Added
- Context compaction, wired (#440, 2/2):
chat,resumeandmissioncompact between turns once a prompt reaches--compact-at(default 0.8; configcompact_at) of the model's context window. The window isTOLE_CONTEXT_WINDOW/ configcontext_window, else what the provider's/modelsreports for the session's model (context_length,context_window,max_context_length,max_model_len,max_input_tokens,top_provider.context_length) — looked up lazily, only once a prompt passes 8k tokens, at most once per process; with neither, compaction stays off and says so once. A failed summary call is reported and the session continues uncompacted.--no-compaction/ configno_compactionturns it off;tole statuslists each compaction;tole config checkshows the effective values and their sources. - Context compaction, core (#440, 1/2):
tole_core::compaction.compact()summarizes the settled turns before the kept tail with the session's provider and commits ONEcompactionentry (summary, first kept entry, compacted count, prompt size before) together with the summary call's usage row — atomic, append-only, the transcript is never rewritten.view()is what the provider sees: the transcript as is, or the latest summary (inside the untrusted-content fence used for tool results, introduced as a record rather than instructions) followed by the kept tail; the turn loop sendsview().due()compares the last call made AFTER the last compaction againstPolicy { window, at, keep_turns }, so the summary call never re-triggers it. Inactive until the CLI wiring (window resolution,--compact-at,--no-compaction, mission/chat/resume hooks,tole status) lands. - Global session index (#439): every face that starts a session (
run,chat,mission, serve/ACP/MCP) appends one line to$CODECORA_HOME/tole/sessions-index.jsonl(default~/.codecora/tole/, owner-only, append-only, a bad line is skipped): id, absolute session file, cwd, face, start time — never prompt text.tole sessions --alllists sessions from every project newest first, with their cwd and first-prompt preview read from the session file (gone files are hidden);--grep <text>filters on prompt, name or cwd.tole resume <id>for a session of another project refuses with the exact command to run there (cd <project> && tole resume <id>): resuming from here would apply this directory's workspace jail, config and trust to that session.TOLE_NO_SESSION_INDEX=1turns recording off. - Command-level allow/deny patterns (#438):
run_command:<argv pattern>in--allow/ configallowmatchesrun_commandcalls by the argv the tool executes (same splitter, no shell, so;never chains a second command): one glob per argument, a final lone*= any further arguments, the program compared literally for an allow (run_command:*allows nothing). A leading!makes any pattern a deny that wins over every allow and over--yes; a deny compares the program by file name, case-insensitively, without.exe/.cmd/.bat/.com(/bin/RM,rm.exevsrm *). Fail closed: while arun_commanddeny is configured, a command runs unattended only when an explicitrun_command:allow names it (a barerun_commandallow or--yesis not enough) and never when its program is a known wrapper (sh,bash,env,sudo,xargs, ...); everything else asks the human (refused where nobody can be asked). Denies travel with allow lists, a child agent always inherits its parent's denies, and a child's command pattern must be covered argument by argument by a parent pattern (list_covers: under a parent command deny only a parentrun_command:allow covers it; a child wildcard only by the same glob or a lone*). InAllowlistApprover::deny_only(no allows), arun_command:deny refuses everyrun_commandcall.tole_core::approval::pattern_verdictis the one evaluation both approvers use. --trust workspace(#437):read_onlypluswrite_file/edit_filethrough a path guard. The tools are jailed to the workspace root (canonicalized, so../and symlinks cannot escape), and the guard keeps files another tool may later execute prompting: any dot-component (.git/hooks,.envrc,.vscode/,.tole/,.github/), build and task files (build.rs,Cargo.toml,Makefile,package.json,pyproject.toml,SKILL.md,AGENTS.md, ...) and scripts (.sh,.ps1, ...).delete_file(Destructive) andrun_commandkeep prompting; the preset needs an explicit--workspace(or configworkspace) and refuses a home or filesystem root. Not a sandbox: ordinary source files stay writable. The guard checks the RESOLVED target the tool will write (relative to the canonical jail root, symlinks followed; Windows trailing dots/spaces normalized, 8.3 short names refused), never the raw path text. It is a pattern suffix (write_file@workspace) matched bytole_core::approval::pattern_allows, so--allowand child agents use it too. API:Tool::approval_target(defaultNone; decorators must forward it) andToolRequest::targetare new.web_searchbackends beyond the fleet contract (#436):TOLE_WEB_SEARCH_METHOD(GETdefault, orPOSTwith the JSON body{"query", "limit"}),TOLE_WEB_SEARCH_HEADERS(Name=Valuepairs,${VAR}expanded from the environment, sent only to the backend; transport headers and line breaks refused; errors never echo a value) andTOLE_WEB_SEARCH_FIELDS(wire=backend, e.g.snippet=description,results=items). A malformed value fails startup instead of dropping the tool. API:tole_core::web::WebSearchTool::from_envnow returnsResult<Option<Self>, String>;WebSearchTool::new(url)andfrom_lookupare new.- User config (#433):
$CODECORA_HOME/tole/config.toml(default~/.codecora/tole/config.toml) holds global defaults with the project config's keys and validation. Precedence is flag > env > project config > user config > default, key by key; it needs no trust record,--no-configignores it too, andtole config checkshows both files and the winning layer per key ((user config)). TOLE_SKILL(#434): preload skill files from the environment (SKILL.mdpaths, separated likePATH) — the env layer of theskillkey, so--skillstill replaces it and it replaces the config'sskilllist. Server faces refuse it like--skill, and the refusal names the variable.- Code review with cora (#422, 3/3): when
cora mcp(cora ≥ 0.19) is attached, the system prompt oftole run/tole chatnames the agent-as-reviewer flow —mcp_cora_cora_review_preparewith the diff, the model's own judgement, thenmcp_cora_cora_review_finalizewith the same diff and its findings — so "review this change" uses cora's deterministic checks and verdict without an LLM key in cora. Absent in plan mode and without the review tools. - Supported sibling versions (#422): cora ≥ 0.19.0 and uteke ≥ 0.21.1, kept in one place (
tole_cli::ecosystem).tole doctorprints anecosystem:section reporting each binary as supported, too old (with its upgrade command) or not installed; it never blocks, since both are optional. - Provider failover chain (#209):
failover::FailoverProviderretries a step on the next provider of an ordered chain when the active one is unavailable (connection failure, timeout, dropped stream, HTTP 5xx or 429); request errors (401/403/404/400, malformed responses) fail loud and never fail over. The answering provider stays active and the primary is retried after a cooldown. Each step records the route undertole_routein its usage row (durable, auditable); rows holding only tole's own keys are not counted as provider steps. Wired into every session face throughTOLE_FALLBACK_BASE_URL/TOLE_FALLBACK_API_KEY/TOLE_FALLBACK_MODEL(a reserve without its own key is refused; the primary's key is never sent to another host). A stream that breaks after part of the answer was already shown live does not fail over (no duplicated output); a reserve that fails before the cooldown ends wraps back to the primary; and after a failover only the last provider's error decides the turn loop's transient retry, so an earlier timeout no longer makes a reserve's 401 look retryable. - Child-agent handoff schema and verify gate (#383):
tole_core::handoffdefines the typed handoff document (roleexplore/implement/verify/fix, artifact references by path and rev, verification evidence), strict validation of the model-authored input (workspace-relative paths, option-safe refs, bounded fields), the close gate (an implement/fix child without passing verification isUnverified/VerifyFailed, never closed silently) and the prompt for the follow-upfixchild.agent_starttakesroleandconsumes(artifact references the child reads itself), a role child gets ahandoff_submittool, andagent_pollreports the gate and a ready-madefix_prompt(the parent decides whether to start the fix child; nothing is spawned automatically). Design and anti-goals (no DAG engine) indocs/child-agents-handoff.md. - Sibling change notices, core (#380):
sibling_watchtracks which files each child agent reads and writes in one shared append-only log (owner-only, bounded) and tells a child, once per stale path, when a sibling changed a file it had read or written; theTrackedtool decorator recordsread_file/write_file/edit_file/delete_fileon success. Interrupts gain asource: a notice is delivered at the next safe point as an attributed entry (source: notice) and never withdraws output or supersedes a final answer. Wiring intotole runchildren follows separately. - Sibling change notices (#380):
sibling_watchtracks which files each child agent reads and writes in one shared append-only log (owner-only, bounded) and tells a child, once per stale path, when a sibling changed a file it had read or written; theTrackedtool decorator recordsread_file/write_file/edit_file/delete_fileon success. Interrupts gain asource: a notice is delivered at the next safe point as an attributed entry (source: notice) and never withdraws output or supersedes a final answer. Children spawned byagent_startgetTOLE_AGENT_IDand a sharedTOLE_AGENT_TOUCH_LOG; in a child,tole runwraps its file tools and runs the watcher, so a sibling's change reaches the model at its next safe point. tole doctorcoverage ledger (#378): every run is recorded per provider + model (level reached, first blocker, fix command, timestamp) in an owner-onlydoctor-ledger.json(atomic write, a corrupt file is an error, never replaced);--summaryprintsREADY n-of-m+ the first blocker and its fix,--no-ledgerskips recording.- Soft interrupts (#377): a bounded queue on the session's
CancelTokenthat the turn loop drains at the safe point between a settled tool and the next provider call, committing each message as an attributed user-role entry (interrupt: true). Anurgentinterrupt (or any interrupt, for a final answer) withdraws an output that has not taken effect, so no tool call is left without its result, and records the drop durably. Host entry points:POST /sessions/{id}/interrupt(tole serve) and thetole_session_interruptMCP tool (409/error when no turn is running). tole doctor(#378): tiered provider diagnostics —offline(wiring),catalog(live/models, model must be served) andfull(chat, streaming and a real tool-call loop) — each blocker carries its fix command, and keys / URL credentials are never printed. Exits non-zero when the requested tier is not reached;--tier fullis the release-validation gate.- Per-user-turn token stats (#379):
tole statuslists input / output / cache-read / cache-write / reasoning tokens per turn and the status JSON (GET /sessions/{id}/status,tole_session_status) gains an additiveusage_report.turnsarray. Derived from the durable usage ledger, so old sessions read the same way and nothing is stored twice; a value no step reported isn/a/null, never 0, and no elapsed time is invented.
Fixed
- A child agent running
tole chatortole resumenow receives sibling change notices (#380) liketole rundoes: both faces run their turns on a session cancel token with the child's watcher attached (#428). tole resume,tole chat --resumeand resumed missions now use the session's own model (the durablefact/modelregister set by ACP's model picker) instead of falling back toTOLE_MODEL; only the server faces honored it before (#428). The missing-provider-config error is one clean line on every face (the server faces printed a run of spaces inside it).tole statusandtole sessionsno longer count the stop gate's own feedback message as a user turn (#418).tole doctor: concurrent runs no longer overwrite each other's ledger entry (load/record/save now happen under an exclusive lock ondoctor-ledger.json.lock); the catalog tier'sGET /modelsgets its own 20 s timeout instead of the ACP picker's 3 s convenience timeout, so a slow but healthy gateway is not reported as a blocker; and the offline tier now requires a host in the base URL (https://?xorhttps://u:p@/v1no longer pass).- Sibling change notices: a child's watcher starts at the end of the shared touch log instead of folding every earlier child's history on start-up.
- The optional
web_searchtool is registered withif letinstead of anis_some()check followed byunwrap(). tole serve --transport mcpis hardened to parity with the REST transport: the bearer token is compared in constant time and its scheme is case-insensitive; failed authentication is rate-limited per source IP (10 per minute, then429, same policy as REST); request bodies over 1 MiB are refused with413(declared or streamed, never buffered whole); a transientaccept()error is logged and no longer ends the server and every session; and the no-optimeout()around the auth check is gone. The token comparison, header matching and limiter now live in one sharedauthmodule used by both transports.
Changed
- Quiet startup (#435): the probe misses
uteke binary not found,cora binary not foundandno GitHub origin remote detectedare no longer printed on every run; setTOLE_VERBOSE=1to see them (tole doctorreports cora and uteke regardless). A configured MCP server that registers no tools is still reported. - Child-launch contract (#443):
tole_core::child_envis the one definition of the environmentagent_startgives a child (TOLE_AGENT_DEPTH,TOLE_AGENT_ID,TOLE_AGENT_TOUCH_LOG,TOLE_AGENT_ROLE,TOLE_AGENT_HANDOFF, the mailbox room and memory backend): the parent writes it withChildLaunch, and the child reads it back withdepth/sibling/role(sibling tracking, the handoff tool, the depth cap). No behaviour change. - Session registry (#441):
session_host::Sessionsowns the live session map — capacity and eviction, the admission rule (admit: replace an idle id, refuse a busy one, evict for a new id) and the per-turn busy claim (claim_turn).tole serve,tole acpand the MCP session tools use it instead of each manipulating the map; the map itself is private (tole-cli API change). No behaviour change. - Session turn runner, part 3 (#428):
turn_runner::cli_turn_tokengives every CLI face (run, resume, chat) the same cancel token plus child sibling watcher; resume and chat now run their turns with that token. - Session turn runner, part 2 (#428): the memory loop's pre-turn recall and session remember live in
turn_runnerand every face uses them. Server-face sessions now report a failed or successful remember on stderr instead of dropping the result silently. - Session turn runner, part 1 (#428): one
turn_runnermodule builds the provider for a session turn (env config, the session's model, tool specs, pinned system prompt, live-token sinks) for run, resume, chat, missions and the server faces, replacing six copies. - Tool roster (#420, 3/3): the task-list tools are registered by one
tool_roster::register_todo(hydrated from the transcript;todo_writeabsent in plan mode) instead of five copies in run, resume, chat, mission and the session host. - Tool roster (#420, 2/3): server sessions (
tole serve,tole acp, the MCP session tools) build their tools through the sametool_rosteras the CLI, replacing the third copied builder. They gainverify_package, the strict binary probe (executable files only), and sibling tracking plus the handoff tool when running as a child agent; probe misses are reported on stderr. MCP servers on server faces remain a separate follow-up. - Memory loop on uteke rooms (#422, 2/3):
--memory utekestores session summaries in the roomrepo-<dir>(uteke remember --room) and recalls withuteke room recallinstead of the namespaces uteke 0.21 deprecates; while the room is empty, recall falls back to the legacy namespace of the same name, so memory from earlier versions is still found. Child-agent mailboxes are rooms too (agent-<id>); consuming one forgets its memories, deletes the room and cleans any legacy namespace.MemoryConfig.namespaceis renamedroom(tole-core API). tole_core::transcript(#418): one read-side view of the transcript conventions the turn loop writes — which user messages open a turn (not stop-gate feedback, not interrupts), which usage rows are provider steps (not rows holding onlytole_*keys) and the token total. The turn loop,tole status,tole sessions, usage reports and mission budgets all use it, and embedders can count turns and steps without copying the rules.- Tool roster (#420, 1/3): the CLI faces (
run,resume,chat,mission) and the MCP server faces (tole mcp, MCP-over-HTTP) build their tools through onetool_rostermodule instead of two copied builders. Plan mode is applied in one place, and there is one binary probe (binary_available, executable files only) and one GitHub-origin probe. The MCP server faces now report a missinguteke/corabinary or GitHub origin on stderr like the CLI does. - Memory loop injection hygiene (#384): the recalled batch is hard-capped at 24 items / 64 KiB and deduplicated; a malformed recall payload (non-array, or a hit without content) now fails the whole batch visibly instead of silently injecting fewer items;
tole serve/MCP sessions report recall failures on stderr like the CLI does.