Repository navigation
v7.17.0
A minor release: on first launch the new binary silently reinstalls your agent integrations. The database schema moves to version 19 and is migrated automatically on first open. Full detail in CHANGELOG.md.
Fixed
-
FreeBSD watcher after directory recreation (Refs #1051). Release the old kqueue descriptors and watch eligible files in the replacement subtree so subsequent in-place edits can update the index.
-
tokensave_healthexcludes one-way links between separate cycles from the cyclic-edge count (Refs #1026). -
tokensave_readrejects unknown parameters by name and lists the accepted range syntax, so guessed names such asstart_line/end_lineno longer disappear behind a missing-range error or silently produce a full-file read (Refs #1023).
Internal
- Add an opt-in Claude Code and Codex CLI launcher that composes local TokenSave and an authenticated Auto Ontology MCP endpoint (Refs #1022).
- Evaluate NVIDIA Auto Ontology interoperability with a reproducible offline glossary-to-OKF PoC and a retrieval benchmark (Refs #1022). See the evaluation.
- Add an opt-in direct-parser ASan audit with C/C++ calibration controls, native object instrumentation checks, bounded corpus runs and Linux findings (Refs #958).
Security
- Edit tools no longer write outside the project and its git worktrees (Refs #866).
tokensave_str_replace,tokensave_multi_str_replace,tokensave_insert_at,tokensave_replace_lines,tokensave_ast_grep_rewrite,tokensave_replace_symbol,tokensave_insert_at_symbol,tokensave_delete_symbolandtokensave_renameused to honor any absolute path,..escape orproject_rootoverride, so text in an indexed file could steer an agent into editing a file anywhere the user can write. Each edit tool now resolves symlinks and.., then accepts the target only inside the project root or another worktree of the same git repository, asgit worktree listrun in the project root reports it. Paths inside.gitand tokensave's state are refused too. A file the index tracks through an in-root symlink into another tree (#34) stays editable. A refused edit fails with arefusing to editerror, and a rename that would touch a refused file is blocked as a whole. An agent editing a worktree is unaffected. Editing a file in an unrelated directory now needs the agent's own file tools. - Resolve the RustSec advisories reported by
cargo audit(Refs #960).cargo auditno longer reports any vulnerable or unsound crate inCargo.lock. Before this change it reported 20 vulnerabilities and 3 unsound crates.- libSQL is now built with only its local
corefeature. Its defaultreplication,remote,syncandtlsfeatures pulled in a network stack (hyper 0.14, h2 0.3, rustls 0.22, tonic, rustls-pemfile) that tokensave never used, because it opens databases only withBuilder::new_local.Cargo.locknow lists 73 fewer packages, andrustls0.22.4,rustls-webpki0.102.8,h20.3.27 andanyhoware gone. zip, used by the Windows self-upgrade, moves from 8 to 9 (RUSTSEC-2026-0367, -0368, -0369 and -0429). tokensave never called the affectedextractfunctions. The only code change is that zip 9 returns entry names as aResult, so an archive entry with an undecodable name now fails the upgrade with azip entry name errormessage.rustixmoves from 1.1.4 to 1.1.6, fixing RUSTSEC-2026-0486 in its safe extended-attribute APIs. The advisory was published after the original dependency update and was caught by the new workflow.- Semver-compatible updates:
rustls0.23.46,rustls-webpki0.103.16,webpki-rootsandwebpki-root-certs1.0.11,crossbeam-epoch0.9.21,faster-hex0.10.1 andtokio1.54.1. bincode1.3.3 andproc-macro-error22.0.1 are still reported as unmaintained. These are warnings and do not fail the check.
- libSQL is now built with only its local
- Refuse databases whose
-walsidecar has a different page size (Refs #940). libSQL 0.9.30 bundles SQLite 3.45.1, which predates the fix for CVE-2026-119375 (RUSTSEC-2026-0459). With a crafted database and-walfile whose page sizes differ, such as a.tokensave/directory shipped in a cloned repository, ordinary queries could return uninitialized process memory into MCP responses. Before SQLite opens a database, tokensave now compares the WAL header and every copy of page 1 in the WAL against the database header, and refuses the database as a compatibility refusal, leaving the files untouched, when they disagree. WAL files that SQLite would ignore, and WAL files that SQLite itself writes, are unaffected.cargo auditdoes not report this advisory because it is filed againstlibsqlite3-sys, which tokensave does not use. libSQL 0.10.0 bundles SQLite 3.47.0 and is also affected, so upgrading does not help.
Added
-
Optional Blaze runner for local builds and tests (Refs #984).
scripts/dev-build <cargo subcommand> [args]runs the command with Blaze on Linux and macOS when Blaze is installed and usable, and with Cargo otherwise; Windows always uses Cargo.--cargoorTOKENSAVE_BUILD_RUNNER=cargoselects Cargo explicitly. When Blaze fails a build or test, the same command runs again with Cargo, whose exit code is reported. The runner also exports the[env]settings of.cargo/config.tomlbefore it runs Blaze, so the test isolation they provide does not depend on Blaze's Cargo compatibility.scripts/blaze-bench/blaze_bench.pycompares Cargo and Blaze on clean builds, edit rebuilds and tests. CI, releases and the documentedcargocommands are unchanged, and Blaze is never required. Seedocs/BLAZE-EVALUATION.md. -
tokensave grepadds index facts to the hits of a search command (Refs #688, #682).tokensave grep COMMAND...runs agrep,rgorgit grepcommand unchanged, with its own flags, result set and exit code. Eachpath:line:hit keeps its bytes and gains a tab and a#tssuffix: the enclosing symbol and its lines ([in X, a-b]), a definition ([defines X (kind), a-b]), a resolved call ([calls X, file:a-b]), a call with several candidates ([ambiguous name, n candidates: ...]), an edge that is not a call ([uses X, file:a-b],[type_of X, file:a-b]), or[stale]for a file whose modification time or size changed after it was indexed. The facts follow the conventions of the text results oftokensave_search. The first hit on a definition gives its lines, and each later hit gives its first line.-nis added when the command has no line-number flag. Output with no such hits (-l,-c,-q,--files, context lines) is not changed, and--graph=noneruns the command as written. The command opens the index read-only, starts no sync, and needs no MCP server. With no index the search runs as written. With an index that the command cannot read, such as one that needs a migration, it also runs as written and one line on standard error gives the reason. A hit getscallsfacts and facts of other edge kinds only for a name that the search pattern contains as a whole word. Traversal (--graph=callers), symbol context and the hook mode of #682 are not part of this change. The proposal and the prototype are by @xorets. Seedocs/guide/CLI-REFERENCE.md. -
Manual AddressSanitizer evaluation for tree-sitter grammars (Refs #958). A Linux-only, pinned-nightly harness instruments Rust plus the C/C++ parsers and external scanners, runs every full-tier extraction fixture, and can index optional real corpora without writing TokenSave state into them. It records commands, logs, duration, CPU, child high-water RSS and build disk use in JSON. A manually dispatched GitHub workflow uploads fixture results but never runs on pushes, pull requests or schedules, so normal CI has no sanitizer cost. No clean sanitizer run, performance result or memory-safety guarantee is claimed until a Linux artifact is reviewed.
-
Swift calls outside function bodies are recorded (Refs #1010). Call sites were read only from function and init bodies, so a callee used only from a property initializer (
let x = Foo.make()), a computed property (var body: some View) or top-levelmain.swiftcode had no caller and looked dead totokensave_dead_code. Calls in a property declaration now belong to the property. Calls in any other top-level or type-body statement (anifinmain.swift, adeinit, asubscript) belong to the enclosing scope, the file or the type, as for Python module-level code. Reindex Swift projects to pick this up. -
tokensave_callerslabels every extracted same-named call reference instead of silently dropping sites without an edge (Refs #687). Each caller now carriesreferences, whose entries areconfirmed,other,ambiguous, orunresolved. Other-target results name the definition selected; ambiguous results say whether the requested definition is a candidate; and uncertain sites carryto_read: true. An indexed trailing-name column keeps lookup proportional to matching references rather than scanning the full table. Reference results obeylimitand report their returned and total counts when truncated. -
Import OKF bundles and search them through MCP (Refs #858).
tokensave okf import <dir>copies a bundle byte for byte into the project's state directory (okf/<name>/) and validates the copy;okf listandokf removemanage imported bundles. Bundles that are not conformant are imported best-effort, as OKF §12 asks, unless--strictis given. The code index and its schema are not changed, so no reindex is needed. The newtokensave_knowledgeMCP tool, in thememoryarea oftokensave_more, searches imported concepts by title, ID, tags, type, description and body, reads one concept with its links and backlinks, and finds the concepts that refer to a project file throughtokensave_path,graphify_source_fileor a relativeresource, reporting whether each file is indexed. The default tool list is unchanged. Bundles written by the Graphify OKF fork import withgraphify_source_filelinked to the indexed code; a fixture reconstructed from its exporter is tested, andtokensave okf exportoutput round-trips through import. Seedocs/guide/OKF.md. -
Open Knowledge Format (OKF) v0.2 validation and export (Refs #858).
tokensave okf validate <dir>checks a bundle against the three OKF conformance rules and reports each finding with a stable code, path and line: errors for conformance violations, warnings for SHOULD-level guidance on the provenance, trust, lifecycle and Attested Computation fields, and info findings for broken links and stale concepts. It exits with 1 when the bundle is not conformant (--strict: also on warnings) and prints JSON with--json.tokensave okf export --output <dir>writes the code index read-only as a bundle: oneSource Fileconcept per indexed file with its symbols and links to the files it depends on and that depend on it, plus root and per-directoryindex.md,log.mdand a provenance concept. An existing output directory is refused. The four sample bundles of the OKF specification are vendored as conformance fixtures and pass. Seedocs/guide/OKF.md. -
Record resolver precision against pinned offline language-server oracles (Refs #921). A development-only harness compares
tokensave_renamereference sites and confidence classes with rust-analyzer, TypeScript/tsserver and Pyright on content-addressed Rust, TypeScript and Python fixtures. It emits raw JSON and a Markdown summary, runs without network access after the pinned tools are installed, and adds no binary dependency or default behavior. -
Opt-in cooperation with Caveman (Refs #797). With
caveman_compatibility = truein~/.tokensave/config.toml(orTOKENSAVE_CAVEMAN_COMPATIBILITY=1) and a Caveman skill installed for Claude Code, Codex, Cursor, Copilot, Gemini, OpenCode, Pi or OMP, the MCPinitializeinstructions gain one paragraph that asks the agent to quote tokensave results exactly while Caveman shortens its prose. The setting is off by default, and then no agent file is read. Tool results, tool schemas and the default instructions are unchanged.tokensave doctor --caveman [--session-id ID]adds a read-only Caveman section to the normal checks and prints a JSON report per agent on stdout. The report separates installation from activation. Activation is reported only for a named Claude Code session of a verified Caveman release (4.0.1 or 4.1.0). tokensave never installs, configures or runs Caveman. No token savings have been measured yet; seedocs/CAVEMAN-COMPATIBILITY.md. -
tokensave initreports an installed Caveman (Refs #797). After indexing a new project,initsearches the same places asdoctor --caveman, read-only, and names the agents with a Caveman skill. Whilecaveman_compatibilityis off it shows how to opt in; it never changes the setting. With the setting on but no skill found, it says the MCP instructions stay unchanged. Hooks andserveauto-initialization do not search. -
Caveman benchmark harness (Refs #797).
scripts/caveman_bench/adds a pinned three-task suite with independent scoring and a direct, metered Anthropic benchmark agent with usage accounting, source-read auditing and private trace verification. It has been validated offline only: no paid trials have run and no savings are claimed. -
tokensave_call_chaintakes symbol names and can follow every edge kind (Refs #964).fromandtoname the ends by symbol, assymboldoes fortokensave_callers;from_idandto_idstill work and win over a name. A name that matches several symbols, or none, is not guessed: the result lists the candidates underunresolvedfor a second call by node ID. The newfollow: "any"finds the shortest connection over every stored edge kind in either direction, and each step reportsedge_direction. That search reads the edges of at most 2000 nodes and reportsbudget_exhausted: truewhen it stops there. The default (follow: "calls") is unchanged. The tool is in thenavigatearea, so the defaulttools/listis unchanged. -
Traversal tools show how each edge was resolved (Refs #962).
tokensave_callers,tokensave_calleesandtokensave_call_chainaddresolved_by(the resolver path, such asexact-matchorsimple-name-match) andresolved_exactto each item.resolved_exactisfalsewhen the resolver picked the target by name alone. When a relationship has several call sites, the strongest provenance is reported.tokensave_impactaddsheuristic_edge_count. The fields come from the storededges.resolved_bycolumn; there is no schema change and no reindex. Edges without a resolver path keep their previous output. -
Project state can live outside the repository (Refs #919).
- Set
TOKENSAVE_STATE_DIR, orstate_dirin~/.tokensave/config.toml(the variable wins; empty selects the default). Each project then keeps its state in<base>/projects/<name>-<hash>/, withbeta/beneath it for prerelease builds. <hash>comes from the root's canonical path, so linked worktrees get separate directories.init,sync,serve, branch tracking and the private cargo target dir then write nothing under the project root, and.git/info/excludeis left alone.- Existing state is never stranded: a project that already has
.tokensave/keeps using it, and state under a previously used base (recorded in~/.tokensave/state-bases.json) is still found after the setting changes. tokensave doctorreports state that is not where the setting puts it, and relocated state whose checkout was deleted.tokensave state listandtokensave state prune [--dry-run]list them and delete the orphans.- With the setting unset, every path is unchanged. The sample
scripts/post-commitno longer checks for a.tokensave/directory before runningtokensave sync.
- Set
-
tokensave_create_filecreates a file and indexes it at once (Refs #920). Takespath,contentand optionaloverwrite(default false); it is in theeditarea, so the defaulttools/listis unchanged. Stricter than the other edit tools: the file must land inside the project root (no out-of-root absolute path, no.., no symlinked directory leaving the root), never inside.gitor tokensave's state, never replaces a directory or a symlink, and refuses content overmax_file_size. The result says whether the file was indexed. -
tokensave gain --by-toolshows calls and tokens saved per tool (Refs #918). It reads the existing savings ledger, so nothing new is recorded; with--jsonit prints one{tool, calls, saved_tokens}object per tool, most-called first. Existinggainandgain --historyoutput is unchanged. The token-tracking guide now states which MCP calls write a ledger row, andgainis listed in the CLI reference. -
Opt-in filesystem watcher for
tokensave serve(#937). Settingfilesystem_watch_enabled = truein~/.tokensave/config.toml, or passingserve --watch, makes the MCP server follow file changes through the operating system's notifications (via thenotifycrate) and apply them through the existing incremental sync. It is off by default: with it off, no watcher, watch registration or watcher task is created and behavior is unchanged. The previously inertwatcher_debouncesetting now sets the watcher's quiet period (and acceptsms). Events are filtered against the scan's own scope rules (exclude globs,.gitignoreincluding ignored parent directories, hidden directories,force_include), and.git/,.tokensave/and editor temp files never trigger a sync. The event queue (1,024 events), batch size (4,096 paths) and watched directories (16,384, per-directory on Linux/BSD; one recursive watch on macOS/Windows) are bounded; an overflow, dropped events, a watcher error or a directory appearing or disappearing falls back to the bounded reconciliation scan, at most once every 10 s. The watcher starts after the startup catch-up sync, pauses on branch drift, stops before shutdown persists the database, and reports its state, counters and last error underfilesystem_watchintokensave_status. The on-demand staleness check keeps running beside it. Co-authored by @ilmanzo. -
Elixir EEx templates are indexed with the
lang-elixirfeature (#907). Code and output tags in.eexfiles contribute calls and declarations with their original locations; markup, comments, and escaped tags are ignored. -
Profiling overhead comparisons (
off/light/detailed) in the database workload harness, with per-workload production recorder snapshots, randomized fresh-process repetitions and correctness gates; optional per-engine profiler breakdowns in the existing Turso compatibility probes (#754, PR 6). Timed-out probe tasks are aborted and joined before temporary directory cleanup (#761). -
Hidden
profile --localcontrols for repository-specific profiling and independent sharing consent, with separate aggregates, reports and upload state; environment overrides and the destination gate remain in force (#764). -
Draft performance sharing controls (
profile share status|preview|enable|disable), separate default-off consent and disable-only environment override. Uploads remain unavailable pending the maintainer-approved endpoint and data policy (#754, PR 8). -
Opt-in performance profiling infrastructure (#754): a
[profiling]table inconfig.toml(mode = "off" | "light" | "detailed", slow threshold, retention, size limit, detailed-mode expiry) with aTOKENSAVE_PROFILEper-run override, a static operation registry, mergeable fixed-bucket latency histograms, sharded lock-free aggregation, spans with inclusive/exclusive time and per-invocation database attribution, and bounded hourly files under~/.tokensave/profile/. Off by default; no call sites are instrumented yet, and with profiling off nothing is measured or written. -
Profiled database execution (#754): MCP read-path queries (node, edge and search lookups, dead-code and file-dependency queries) are measured per static operation, with rows returned and errors, plus write-lock wait and write-transaction duration. Inert unless profiling is enabled.
-
Profiled MCP tool calls (#754): with profiling enabled,
tokensave serverecords eachtools/callas one invocation (end-to-end latency, attributed database time and operations, operations per call, response size, errors) per registered tool, plus project-resolution, freshness and handler phases, and flushes aggregates on exit.serve --timingsnow reads the handler measurement the profiler records. -
Profiled indexing, sync and graph traversal (#754): full-index (
index.*) and incremental-sync (sync.*) phases, whole runs bucketed by project file count (run.*), graph traversals with nodes and edges visited, and the bulk write paths (node, edge, file, unresolved-reference and FTS-document inserts, bulk-load end).tokensave initandtokensave syncstart the profiler when it is enabled. Verbose output is unchanged. -
tokensave profile status|enable|disable|report|slow-queries|export|reset(#754): ranked text and JSON reports (percentiles with sample counts, P95/P99 flagged below 100 samples, MCP database share, median DB operations per tool call), slow-operation counts, and a sanitized export that keeps only static operation and registered tool names. Seedocs/PROFILING.md. -
tokensave profile analyze(#754): bottlenecks ranked by cumulative impact and classified (DB execution latency, excessive query count, connection/transaction overhead, graph traversal, freshness/sync, parsing/extraction, result processing), each with its measured evidence; suggestions are labelled as hypotheses. MCP calls now count database operations per op, so ops run 20 or more times in one call are reported per tool as N+1 candidates. -
Opt-in performance profiling infrastructure (#754): a
[profiling]table inconfig.toml(mode = "off" | "light" | "detailed", slow threshold, retention, size limit, detailed-mode expiry) with aTOKENSAVE_PROFILEper-run override, a static operation registry, mergeable fixed-bucket latency histograms, sharded lock-free aggregation, spans with inclusive/exclusive time and per-invocation database attribution, and bounded hourly files under~/.tokensave/profile/. Off by default; with profiling off nothing is measured or written. -
Explain untracked branches:
tokensave_statusreports the effectiveauto_tracksetting and anauto_track_hintsaying why the branch was not tracked automatically (disabled, turned off byTOKENSAVE_AUTO_TRACK, failed, or a read-only view) and how to enable it;tokensave statusprints the same hint, and a failed open-time auto-track now carries its reason on the branch warning (Refs #877). -
Add
TOKENSAVE_HOOK_DEBUG=1, which makes thepost-checkouthook andbranch add --if-enabledexplain skipped actions on stderr and in a bounded.tokensave/hook-debug.log; hooks stay silent by default (Refs #877). -
initandsyncwarn when a default build-output exclude drops tracked source (Refs #949). The defaultexcludeglobs**/build/**,**/out/**andbin/**are meant for generated output, butbuild/is also a common name for a real, git-tracked source package, such as a Python data pipeline imported asbuild.extract. Those files were left out of the graph with nothing in the output to say so. Both commands now print a warning that counts the tracked, indexable files these globs alone exclude, grouped by the pruned directory, and names the glob to remove fromexclude[]to index them. It also names an explicit glob to add instead, which keeps them excluded and silences the warning. A file that any other exclude glob also matches is a deliberate opt-out and is not reported; the other defaults (node_modules,vendor,.venv, …) are not reported either, since they are rarely source or are excluded on purpose. Indexing behavior and default excludes are unchanged.
Documentation
CONTRIBUTING.md,AGENTS.mdand the pull request template now require crediting the people who proposed or substantially specified a change in an issue as co-authors of the PR that implements it, withCo-authored-by:trailers using their GitHub noreply address (Refs #950).- Correct the multi-branch guide: the
post-checkouthook tracks branches only whenauto_trackis enabled, which is off by default. Add a troubleshooting entry for untracked branches (Refs #877). - Record an MCP footprint and latency baseline in
docs/MCP-FOOTPRINT-BASELINE.md, measured with the newbenchmarks/mcp_footprint.pyprobe:initializeandtools/listbytes and token counts for the core and full toolsets, cold start, index time and size, and query latency. A unit test now fails when the defaulttools/listplus theinitializeinstructions grow beyond the recorded 24,056 bytes. The MCP tools guide now says five tools areanthropic/alwaysLoad, not three, and cites the measured sizes (Refs #917).
Changed
-
Raise the pinned build toolchain on
masterfrom Rust 1.99.0 to 1.100.0:rust-toolchain.toml, the CI and release workflow pins, and the toolchain notes inAGENTS.md,CONTRIBUTING.mdanddocs/MEMORY-SAFETY-AUDIT.md. The minimum supported Rust version (rust-version = "1.95.0") is unchanged. No build script, workflow or harness depends on Cargo's intermediatetarget/layout, which Rust 1.100.0 changes; release packaging reads only the final binaries (Refs #985). -
Raise the pinned build toolchain on
masterfrom Rust 1.98.1 to 1.99.0, matchingbeta:rust-toolchain.toml, the CI and release workflow pins, and the toolchain notes inAGENTS.mdandCONTRIBUTING.md. The minimum supported Rust version (rust-version = "1.95.0") is unchanged. Rust 1.99.0 includes the fix for rust-lang/rust#161018 (process::exitfrom a non-main thread on Unix), whichdocs/MEMORY-SAFETY-AUDIT.mdnow records as fixed on both branches (Refs #957). -
auto_trackis on by default (Refs #922). Thepost-checkouthook and open-time auto-track now register new branches and the branch a new worktree starts on without opting in, and a config without the field counts as enabled. An explicit"auto_track": falseand theTOKENSAVE_AUTO_TRACKoverride (0,false,no,off, or empty) still opt out, and upgrades never change an explicit value: projects initialized by earlier versions havefalsewritten in their config and keep the old behavior until it is set totrue. Each tracked branch holds its own copy of the index, so useauto_gcortokensave branch gcto reclaim the space of deleted branches. Tracking still does not sync the new branch. The untracked-branch hint now names the config setting that disabled tracking. -
Route every update notice (
init,sync,statusand the MCP server) through one method,cloud::available_update, which decides whether a newer release should be announced and formats the terminal and agent-facing notices. The CLI still announces every newer release, MCP only minor or major bumps; suppression windows andTOKENSAVE_UPDATE_CHECKare unchanged. No behavior change (Refs #902). -
Align
unsafeusage and hex literals with the adopted Google Rust Style Guide: document everyunsafeblock with a// SAFETY:comment, replace a hand-declaredgetppidFFI call in a test withstd::os::unix::process::parent_id(), and lowercase hex literals. No behavior change (Refs #886). -
Replace glob imports with explicit ones in the integration tests under
tests/(Refs #886). -
Replace glob imports with explicit ones in
src/main.rs,src/cpu.rsandsrc/mcp/tools/handlers/graph.rs(Refs #886). -
Replace glob imports with explicit ones in
src/agents/(Refs #886). -
Replace glob imports with explicit ones in
src/context/andsrc/tokensave/(Refs #886). -
Replace glob imports with explicit ones in
src/graph/,src/db/andsrc/resolution/(Refs #886). -
Give the language extractors'
#[allow]attributes a statedreason, and remove a staledead_codeallow in the C++ extractor (Refs #886). -
Review
#[allow]attributes outside the language extractors: remove 7 that no longer suppress anything, replace 4 with the code fix the lint asks for, and give the remaining unexplained ones areason(Refs #886). -
Resolve the pre-existing
clippy::pedanticwarnings in the MCP server: box the ~56 KiBtools/callhandler future once instead of inlining it into every caller (including the serve loop), and simplify the serve loop's control flow withlet ... elseandif let(Refs #886). -
Resolve the pre-existing
clippy::pedanticwarnings outside the MCP server (src/profile/, branch GC, config docs, one integration test) as part of the Google Rust Style Guide audit; the one intentionalOption<Option<_>>is kept with a documented#[allow]. No behavior change (Refs #886). -
Fix the
dead_codewarnings of thelitebuild: Ruby-only extractor state and helpers now compile only withlang-ruby, andfind_descendant_by_kindonly with the Julia or PowerShell extractor that uses it. No behavior change (Refs #912).
Documentation
- Adopt Google's Rust Style Guide on master with project-specific precedence, exceptions, and contributor review guidance; defer the codebase audit and cleanup to follow-up work (Refs #845).
- Evaluate optional Graphify coexistence at a pinned revision, with a disposable CLI probe, recorded resource measurements, and explicit requirements and remaining work before any adapter (Refs #791).
- Document the optional Graphify exporter workflow, limits and privacy scope in the user guide (Refs #791).
Added
-
Repositories created with
git initare indexed automatically (Refs #876). A new user-levelauto_initsetting in~/.tokensave/config.toml, on by default, lets a pathlesstokensave sync(what thepost-commitandpost-mergehooks run) andtokensave serveinitialize the top level of a git repository that has no index, so hooks installed by earlier versions pick it up without being rewritten. Repositories under the system temp dir, your home directory itself, bare repositories, subdirectories, explicitsync <path>/serve --pathtargets and trees with more candidate files thanmax_auto_sync_filesare skipped; the last prints a hint to runtokensave init.TOKENSAVE_AUTO_INIToverrides the setting for one run, andtokensave doctorreports the effective value. -
tokensave cost/monitornow accounts for GitHub Copilot CLI local~/.copilot/session-state/<id>/events.jsonlsessions. The cumulativesession.usage_checkpointrecord is read (highesttotalNanoAiuwins), and Copilot's native metering unit, nano-AIU, is imported and exposed viacost --by-agentand the monitor as whole AIU. Copilot gets a separate monitor line when Droid usage is also shown, so a long Droid coverage line does not hide its value. Copilot-only JSON includes the agent and coverage breakdown; cached Copilot rows are hidden when the local source is absent. The selected checkpoint timestamp sets Copilot's date bucket, while Droid retains its session-start bucket. AIU is reported as its own unit and never converted to USD or added to Droid credits; Copilot checkpoints carry no stable token counts, so raw tokens stay zero. Malformed JSONL lines and checkpoint records produce partial coverage.totalPremiumRequestsis intentionally out of scope for this change (a separate quota unit whose storage would need a schema column). -
tokensave costandmonitornow surface AugmentCode (auggie) subagent spend, honestly marked as partial coverage. Augment session files (~/.augment/sessions/<uuid>.json) exposesubAgentCostUsd, a real dollar amount but a subagent-only subset of true session spend; the main-agent turns are routed through Augment's Prism aliasing (model_idvalues likebutler_a) with per-nodetoken_usagepopulated on only a fraction of nodes, so a trustworthy full-session total cannot be sourced. tokensave imports the observed subagent USD per session underagent = 'augment', keeps Augment coveragePartial(neverComplete), and labels it "subagent USD (partial, main-agent usage not sourced)" rather than presenting it as a full total.subAgentCreditsUsedis present but observed always zero, so it is ignored. Parsing is local and offline. The staticAugment not importedcoverage placeholder is replaced with this real state. Verified end-to-end against a real local corpus: 45 sessions with subagent spend. -
Augment-only JSON now includes
by_agentand source coverage. When its local session directory is absent, cached Augment spend is excluded from cost totals, status, the default cost summary, and the monitor. -
Codex CLI accounting estimates API-equivalent USD from local rollout snapshots. Cached input uses the cache-read rate; native output already includes reasoning and is never counted twice. Unknown models remain explicitly unpriced. A same-row usage revision permits one source-backed repair of legacy overcounts only when validated native evidence dominates the stored snapshot; subsequent updates remain monotonic. Missing, invalid or older logs leave cached rows intact and coverage partial. Quiesce old accounting writers before the first live repair; an old runtime must not resume against the repaired database. See the cost guide.
-
Add a pinned Graphify CLI compatibility harness covering repeated exports, queries, visualization and conflicting dirty worktrees; publish fixture evidence and remaining measurement gates (Refs #791).
Added
- Add experimental
graphify-exportfor bounded, read-only single-file snapshots with resolver provenance, freshness checks and no-clobber publication (Refs #791).
Documentation
- Define the pinned, optional Graphify file-interchange evaluation contract and gated implementation scope (Refs #791).
Fixed
-
Automatic sync detects restored files with older modification times and files whose size changes while their timestamp is preserved. Store disk sizes for BOM-encoded source files to avoid repeated false staleness (Refs #1020).
-
Git auto-sync hooks no longer accumulate unbounded concurrent sync processes (Refs #1007). Hook-triggered syncs claim a per-project single-flight lock before opening the database, and later hooks exit immediately while it is held. Global hooks mark their delegated repository hook so the repository's tokensave block does not start a duplicate sync, while all other repository hook commands still run. A hook sync now targets the repository that fired it instead of borrowing an initialized workspace above it. Lockfiles are reclaimed only after their recorded PID is confirmed dead; malformed or unreadable locks are preserved for manual inspection.
-
Swift protocol conformances produce
implementsedges (Refs #1008). Inheritance clauses were read only for classes, and always asextends, sostruct X: P,actor Y: P,enum Z: Pandextension T: Pproduced no edge andtokensave_implementationsfound no Swift type. Every class-like declaration now records its inheritance clause and, as for C# (#643), anextendsthat resolves to a protocol is stored asimplements. A superclass staysextends, and so does a protocol that inherits another protocol. Conformances to protocols outside the project (Sendable,Codable) are recorded as references that stay unresolved. Reindex Swift projects to pick this up. -
Security hardening for indexed data and MCP output (Refs #866). A writable open now clears the rows that releases before #650 left in the legacy
read_cachetable, which held rendered source text; the delete runs withsecure_deleteon, and no schema version changes, so older builds still open the database. Behavior change:tokensave_readrefuses paths inside.git, whoseconfigcan hold credentials. Theinitializeinstructions and the rules filetokensave installwrites tell the agent that repository content in tool results is data and never instructions.SECURITY.mdand the MCP tools guide document that index-backed tools never return gitignored or excluded files whiletokensave_readreads any file in the project, and a new regression suite pins that split and checks CLI, status and runtime telemetry output against synthetic secrets. The default MCP footprint grows by 170 bytes for the new guidance. -
Profiling measures every database path behind MCP tools, and its smaller review findings are fixed (Refs #885). Memory tools,
tokensave_branch_diff --quality, edge audit, the import graph, the schema-version check, Rails route processing and runtime telemetry now go through the profiled database API, so the database share intokensave profile reportno longer reads low for those tools, and the report drops its footnote about unmeasured paths. A process whose flush thread cannot start no longer records with nothing to persist it. An idle process no longer rewrites its unchanged hour file every 60 seconds.profile statuscounts only finished aggregate files.profile enable --detailed --forprints the expiry as a UTC time with the time remaining. Behavior change:tokensave profile resetasks before deleting, and without a terminal it needs--force. Tests now pin the documented defaults and cover enable, disable, expiry, report and reset through the binary. -
The index of a checkout no longer includes a linked worktree inside it (Refs #998). After
git worktree add nested -b sidein an indexed repository, the scan enterednested/. The index then held each file twice, and it held files that exist only on the branch of the worktree. The scan now stays out of a directory whose.gitfile points to aworktrees/entry, also when anincludeorforce_includeglob names it. The next sync removes the rows that an earlier version made. A worktree below a hidden directory was not affected, because the scan skips hidden directories. A nested clone and a submodule are indexed as before. -
Swift calls through a type name resolve across files (Refs #1009).
Cache.open(...)was recorded as the bare nameopen, and common names (open,run,start,stop,wait) only resolve within the same file, so a static call into another file was dropped. A call whose receiver is spelled as a type is now recorded asCache::openand resolves through the qualified-name match; calls through a value (worker.start()) are unchanged. Callee names also no longer carry raw expression text such as48 + Doubleorawait poll(x), which tree-sitter-swift produced when a call followed an operator,awaitortry. Reindex Swift projects to pick this up. -
A linked worktree nested in its main checkout: the CLI warns about the borrowed index, and
tokensave initcreates the worktree index (Refs #994). Such a worktree uses the index of the main checkout until it has one of its own. Only the MCP server reported that.tokensave status,tokensave syncandtokensave toolnow print the same warning on stderr when you give no explicit path. The warning tells you to runtokensave initin the worktree, but that command answered "already initialized" and did nothing. It now creates the index at the worktree root. The detection uses file checks only and starts nogitprocess. -
An interrupted sync is recovered on the database it interrupted (Refs #993). A project in multi-branch mode has one database for each tracked branch and one
dirtysentinel. The sentinel did not name a database, so the next open recovered the database it opened. After an interrupted sync on one branch and a checkout of a different branch, the second branch got a full index it did not need, and the first branch kept its unfinished state. The sentinel now has onedb=line for each database with an unfinished write. An open recovers a database only when the sentinel names it. A sentinel from an older version applies to the database that opens next, as before. -
A sync no longer writes the working tree into the index of a different branch (Refs #992). When the checked-out branch had no index of its own, or HEAD was detached, tokensave served the index of a tracked branch.
tokensave sync, thepost-commitandpost-mergehooks, and the per-file refresh of the MCP server then wrote the working tree into that index. The index of the tracked branch held files that exist only on a different branch, andtokensave branch listshowed it as synced. tokensave now refuses these writes with an error that namestokensave branch add. Automatic syncs report the refusal and do not scan the tree. A project that tracks only its default branch keeps one index for all branches and syncs as before. Behavior change: withauto_trackset tofalseand at least one tracked branch, tokensave does not refresh an untracked branch until you track it. -
Swift functions report nesting depth (Refs #1011).
max_nestingwas 0 for every Swift function, intokensave_complexityand the stored metrics, because nesting was counted oncode_block, a node kind tree-sitter-swift does not produce. It is now counted on thestatementsnode that wraps every Swift body, with the function body as level 1, as in the other languages. Reindex Swift projects to pick this up. -
Preserve a trailing project path after
--skip-folderfortokensave initandtokensave sync; each folder is now supplied by repeating the flag, as documented (Refs #1012). -
Make profiling reports honest about cancellations, engine filters, and DB coverage (Refs #885). Dropped futures now retain their elapsed latency and increment a separate cancellation count instead of appearing as zero-latency errors. An unknown
profile report --enginevalue names the requested engine and the engines with data. The report and guide disclose the remaining raw database paths excluded from the measured DB share; the existing MCP handler boxing keeps the instrumented request future off callers' stacks. -
Run the Python comparison benchmark tests in CI and refuse Criterion clone caches marked with
.bench-ref, with guidance to use a separate cache directory (Refs #881). -
tokensave_call_chainwithfollow: "any"no longer stops at its node budget on ordinary connections (Refs #980). The search ran from the start only, so one well-connected node near the start used the whole budget of 2000 nodes. It now runs from both ends and meets in the middle. On this repository's index (28,016 nodes), 150 of 300 random function pairs stopped at the budget before and none do now, and the 95th percentile time for one search fell from 154 ms to 7 ms. The result is still a shortest path. The budget andbudget_exhaustedare unchanged. -
tokensave branch set-defaultno longer reports success when inconsistentbranch-meta.jsonmakes the rename a no-op (Refs #880). When the recorded default branch has no matching entry, the command now returns an error naming the metadata and leaves the file unchanged, instead of printing "Default branch is now ... (index kept)". -
tokensave_statusno longer reportsstale_commitsafter a sync that found no changes (Refs #936). The count started from the last content reindex (MAX(files.indexed_at)), which does not move on a quiet repo, so empty commits and commits touching only unindexed files stayed counted after every sync. It now starts from the later oflast_sync_atandlast_updated, and counts only commits strictly newer than that second, so a commit made in the same second as the sync is not reported.stale_commitscounts Git commits by committer time;stale_filesremains the signal for indexed content that needs reindexing. -
Let the Python comparison benchmark reuse
TOKENSAVE_BENCH_REPOS_DIRand standard temporary-directory selection, and report clone-storage failures with the destination and a relocation hint (Refs #767). -
Keep the recorded default branch in step with the repository: opening a project renames a default entry whose branch no longer exists (for example after
git branch -m master main) instead of serving the real default as an untracked branch or duplicating its database;origin/HEADis used only while its branch exists, andbranch adddetects the default likeinitinstead of assumingmain. Addtokensave branch set-default, aBRANCH_DEFAULT_STALEwarning intokensave verify, and adefault_branch_warningintokensave branch list,tokensave_statusandtokensave_branch_list(Refs #874). -
Hold the writer lock throughout interrupted-index recovery and refuse rebuilding a borrowed branch database from another checkout (Refs #864).
-
Restore independent MCP selected-graph regression tests for simplify scans, redundancy branch refusal, and dead-code queries after an interleaved test insertion (Refs #854).
-
Bound comparison-benchmark MCP initialization and request I/O, reap owned process groups, and defer shutdown interruptions until cleanup completes (Refs #847).
-
Return MCP invalid-parameter errors for selected graphs rejected by database compatibility checks, preserving internal errors for database failures (Refs #835).
-
Preserve database creation channel, reject beta-origin and newer-schema databases before writes or recovery, and isolate beta project/global indexes under
.tokensave/betawithout relabeling legacy databases (Refs #835).
Changed
-
tokensave_redundancyandtokensave_simplify_scanacceptgraph_rootandgraph_branch, so both run against another initialized project. On a selected graph,tokensave_redundancyrefuses with InvalidParams when the selected branch is not the one checked out in that project (a different branch, a detached HEAD, or a fallback to a parent branch's index), because it reads function bodies from the working tree; it also skips writing its fingerprint cache to the read-only selected database. -
Pi doctor distinguishes static configuration from unverified runtime state, reports possible instruction overrides and missing indexes without writes, and rejects unknown direct-tool exposure settings (Refs #833).
Added
- Add a read-only assessment of independently reviewed Pi native-read traces, preserving verification/recovery and deferring enforcement without real-model evidence (Refs #834).
Documentation
-
Require agents to verify linked PR states before closing an issue and summarize merged improvements with the actual destination branch, validation, and remaining work; synchronize this rule across master and beta (Refs #803).
-
Add a linked table of contents near the top of the README.
-
List all supported agents and their
--agentidentifiers beside the README setup command. -
Simplify README installation and agent setup, keeping advanced options in expandable sections and correcting the medium-tier Cargo command.
-
Convert the README architecture diagram to Mermaid and require Mermaid for all documentation graphs and diagrams in
AGENTS.md. -
Require upstream-master comparison and maintenance of shared agent guidance on master and beta as repository workflows change.
-
Require agents to keep the README beta announcement aligned with beta release features on master and beta.
-
Announce the beta with improved queries in the README, with beta links and a source installation command.
Added
-
Add a SQL query inventory in
docs/QUERY-REPORT.mdwith source links and dynamic construction context, and require agents to keep it synchronized with query changes (Refs #773). -
Pi reaches tokensave's tools, and gets the guardrail and the receipt Claude Code has. Pi defaults an MCP server to
exposure: "codemode", which declares none of the server's tools to the model, so an installed tokensave answered nothing and the agent fell back to grep.tokensave install --agent pinow registers the server with"exposure": "direct"(whichpi-mcp-adaptermaps todirectTools) and a one-line description, writes a Pi rules overlay naming the tools as Pi declares them (mcp__tokensave__<tool>) and forbidding research-subagent fan-out for code exploration, and installs a managed TypeScript extension in<agent-dir>/extensions(project:.pi/extensions) because Pi has no shell hooks. That extension relays Pi'sgrep/find/bashcalls to a newhook-pi-pre-tool-usesubcommand that normalizes them for the existing classifier, resets the per-turn savings counter, and prints the session receipt from a newhook-pi-stopsubcommand.tokensave doctornow fails when the exposure hides the tools or the extension is missing or stale. -
Pi sessions are part of token accounting.
tokensave cost,tokensave reportand the status cost row parsed only Claude Code transcripts and Factory Droid settings, so a Pi user saw no cost for their own work. Pi's~/.pi/agent/sessions/**/*.jsonlis now ingested incrementally (same byte-offset tracking as Claude), using the cost Pi reports per message rather than a pricing lookup, with reasoning tokens folded into output and the coverage line naming Pi when the source is present. The missed-opportunity analyzer stays Claude-only, since Pi's tool-result sizes are not recorded.
Fixed
-
tokensave_dead_codeworks withgraph_rooton a selected graph. The test-marker exclusion wrote two TEMP tables (temp.test_markers,temp.test_annotated_targets), which a selected graph opened withPRAGMA query_only = 1rejects ("attempt to write a readonly database"). Concurrent read-only calls on the shared connection could also drop or refill each other's tables.find_dead_codenow passes the test-marker ids to the dead-code query as one bound JSON array and filters in SQL withid NOT IN (SELECT target FROM edges WHERE kind = 'annotates' AND source IN (SELECT value FROM json_each(?))), with no writes. The wildcard marker scan still runs once per call, and local results are unchanged.Database::populate_test_marker_temp_table,drop_test_marker_temp_table,populate_test_annotated_targets_temp_tableanddrop_test_annotated_targets_temp_tableare removed. -
Add Pi real-session regression coverage for per-run retrieval guidance, compaction replay, and native reads after simulated retrieval failures.
-
Prefer indexed code exploration through Pi's structured per-run prompt sections, with explicit native-tool fallbacks for unavailable or stale indexes, unindexed files, documentation, configuration, and current-source verification. Existing search interception is unchanged.
-
Update the locked
derdependency from yanked 0.8.0 to compatible 0.8.3, used by the ONNX Runtime build dependency chain (Refs #805). -
Replace the deprecated atomic session-debt update with
try_update, preserving memory orderings and return behavior (Refs #804). -
Limit large-repository benchmark cleanup to an exclusively reserved scratch directory, preserve unrelated repository changes, and release scratch data during error unwinding.
-
Resolve the project that owns the current directory the same way in every command run without an explicit path:
init,tool,doctor,verify,quality-diff,branch,gitignore, the counters, a baretokensave, and the prompt-submit and stop hooks.sync,status,serve, and the MCP roots fallback already did.initin a subdirectory of an existing project now reports that project and exits 0 instead of creating a nested index. In an uninitialized git repository,initinitializes the repository root. Git repository roots isolate nested independent repositories (nested clones and submodules) from an outer repository's index, and a partial.tokensave/is no longer skipped in favor of an outer project (#749).
Internal
- Scheduled RustSec advisory check (Refs #956). The new
Security advisoriesworkflow (.github/workflows/advisories.yml) runscargo auditdaily onmasterandbeta, and on pushes and pull requests that changeCargo.lock,Cargo.tomlor the audit configuration. Vulnerabilities, unsound crates and yanked crates fail the job, unmaintained crates are reported as warnings, and the full report goes to the job summary..cargo/audit.tomlholds this policy and the list of ignored advisories, each of which needs a written rationale; the list is empty. The workflow is not part ofCI OK, so a newly published advisory does not block unrelated pull requests.