Skip to content

v7.17.0

Choose a tag to compare

@atontini atontini released this 22 Nov 05:19

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_health excludes one-way links between separate cycles from the cyclic-edge count (Refs #1026).

  • tokensave_read rejects unknown parameters by name and lists the accepted range syntax, so guessed names such as start_line/end_line no 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_symbol and tokensave_rename used to honor any absolute path, .. escape or project_root override, 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, as git worktree list run in the project root reports it. Paths inside .git and 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 a refusing to edit error, 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 audit no longer reports any vulnerable or unsound crate in Cargo.lock. Before this change it reported 20 vulnerabilities and 3 unsound crates.
    • libSQL is now built with only its local core feature. Its default replication, remote, sync and tls features 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 with Builder::new_local. Cargo.lock now lists 73 fewer packages, and rustls 0.22.4, rustls-webpki 0.102.8, h2 0.3.27 and anyhow are gone.
    • zip, used by the Windows self-upgrade, moves from 8 to 9 (RUSTSEC-2026-0367, -0368, -0369 and -0429). tokensave never called the affected extract functions. The only code change is that zip 9 returns entry names as a Result, so an archive entry with an undecodable name now fails the upgrade with a zip entry name error message.
    • rustix moves 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: rustls 0.23.46, rustls-webpki 0.103.16, webpki-roots and webpki-root-certs 1.0.11, crossbeam-epoch 0.9.21, faster-hex 0.10.1 and tokio 1.54.1.
    • bincode 1.3.3 and proc-macro-error2 2.0.1 are still reported as unmaintained. These are warnings and do not fail the check.
  • Refuse databases whose -wal sidecar 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 -wal file 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 audit does not report this advisory because it is filed against libsqlite3-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. --cargo or TOKENSAVE_BUILD_RUNNER=cargo selects 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.toml before it runs Blaze, so the test isolation they provide does not depend on Blaze's Cargo compatibility. scripts/blaze-bench/blaze_bench.py compares Cargo and Blaze on clean builds, edit rebuilds and tests. CI, releases and the documented cargo commands are unchanged, and Blaze is never required. See docs/BLAZE-EVALUATION.md.

  • tokensave grep adds index facts to the hits of a search command (Refs #688, #682). tokensave grep COMMAND... runs a grep, rg or git grep command unchanged, with its own flags, result set and exit code. Each path:line: hit keeps its bytes and gains a tab and a #ts suffix: 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 of tokensave_search. The first hit on a definition gives its lines, and each later hit gives its first line. -n is 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=none runs 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 gets calls facts 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. See docs/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-level main.swift code had no caller and looked dead to tokensave_dead_code. Calls in a property declaration now belong to the property. Calls in any other top-level or type-body statement (an if in main.swift, a deinit, a subscript) belong to the enclosing scope, the file or the type, as for Python module-level code. Reindex Swift projects to pick this up.

  • tokensave_callers labels every extracted same-named call reference instead of silently dropping sites without an edge (Refs #687). Each caller now carries references, whose entries are confirmed, other, ambiguous, or unresolved. Other-target results name the definition selected; ambiguous results say whether the requested definition is a candidate; and uncertain sites carry to_read: true. An indexed trailing-name column keeps lookup proportional to matching references rather than scanning the full table. Reference results obey limit and 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 list and okf remove manage imported bundles. Bundles that are not conformant are imported best-effort, as OKF §12 asks, unless --strict is given. The code index and its schema are not changed, so no reindex is needed. The new tokensave_knowledge MCP tool, in the memory area of tokensave_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 through tokensave_path, graphify_source_file or a relative resource, reporting whether each file is indexed. The default tool list is unchanged. Bundles written by the Graphify OKF fork import with graphify_source_file linked to the indexed code; a fixture reconstructed from its exporter is tested, and tokensave okf export output round-trips through import. See docs/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: one Source File concept per indexed file with its symbols and links to the files it depends on and that depend on it, plus root and per-directory index.md, log.md and a provenance concept. An existing output directory is refused. The four sample bundles of the OKF specification are vendored as conformance fixtures and pass. See docs/guide/OKF.md.

  • Record resolver precision against pinned offline language-server oracles (Refs #921). A development-only harness compares tokensave_rename reference 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 = true in ~/.tokensave/config.toml (or TOKENSAVE_CAVEMAN_COMPATIBILITY=1) and a Caveman skill installed for Claude Code, Codex, Cursor, Copilot, Gemini, OpenCode, Pi or OMP, the MCP initialize instructions 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; see docs/CAVEMAN-COMPATIBILITY.md.

  • tokensave init reports an installed Caveman (Refs #797). After indexing a new project, init searches the same places as doctor --caveman, read-only, and names the agents with a Caveman skill. While caveman_compatibility is 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 and serve auto-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_chain takes symbol names and can follow every edge kind (Refs #964). from and to name the ends by symbol, as symbol does for tokensave_callers; from_id and to_id still work and win over a name. A name that matches several symbols, or none, is not guessed: the result lists the candidates under unresolved for a second call by node ID. The new follow: "any" finds the shortest connection over every stored edge kind in either direction, and each step reports edge_direction. That search reads the edges of at most 2000 nodes and reports budget_exhausted: true when it stops there. The default (follow: "calls") is unchanged. The tool is in the navigate area, so the default tools/list is unchanged.

  • Traversal tools show how each edge was resolved (Refs #962). tokensave_callers, tokensave_callees and tokensave_call_chain add resolved_by (the resolver path, such as exact-match or simple-name-match) and resolved_exact to each item. resolved_exact is false when the resolver picked the target by name alone. When a relationship has several call sites, the strongest provenance is reported. tokensave_impact adds heuristic_edge_count. The fields come from the stored edges.resolved_by column; 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, or state_dir in ~/.tokensave/config.toml (the variable wins; empty selects the default). Each project then keeps its state in <base>/projects/<name>-<hash>/, with beta/ 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/exclude is 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 doctor reports state that is not where the setting puts it, and relocated state whose checkout was deleted. tokensave state list and tokensave state prune [--dry-run] list them and delete the orphans.
    • With the setting unset, every path is unchanged. The sample scripts/post-commit no longer checks for a .tokensave/ directory before running tokensave sync.
  • tokensave_create_file creates a file and indexes it at once (Refs #920). Takes path, content and optional overwrite (default false); it is in the edit area, so the default tools/list is 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 .git or tokensave's state, never replaces a directory or a symlink, and refuses content over max_file_size. The result says whether the file was indexed.

  • tokensave gain --by-tool shows calls and tokens saved per tool (Refs #918). It reads the existing savings ledger, so nothing new is recorded; with --json it prints one {tool, calls, saved_tokens} object per tool, most-called first. Existing gain and gain --history output is unchanged. The token-tracking guide now states which MCP calls write a ledger row, and gain is listed in the CLI reference.

  • Opt-in filesystem watcher for tokensave serve (#937). Setting filesystem_watch_enabled = true in ~/.tokensave/config.toml, or passing serve --watch, makes the MCP server follow file changes through the operating system's notifications (via the notify crate) 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 inert watcher_debounce setting now sets the watcher's quiet period (and accepts ms). Events are filtered against the scan's own scope rules (exclude globs, .gitignore including 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 under filesystem_watch in tokensave_status. The on-demand staleness check keeps running beside it. Co-authored by @ilmanzo.

  • Elixir EEx templates are indexed with the lang-elixir feature (#907). Code and output tags in .eex files 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 --local controls 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 in config.toml (mode = "off" | "light" | "detailed", slow threshold, retention, size limit, detailed-mode expiry) with a TOKENSAVE_PROFILE per-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 serve records each tools/call as 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 --timings now 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 init and tokensave sync start 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. See docs/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 in config.toml (mode = "off" | "light" | "detailed", slow threshold, retention, size limit, detailed-mode expiry) with a TOKENSAVE_PROFILE per-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_status reports the effective auto_track setting and an auto_track_hint saying why the branch was not tracked automatically (disabled, turned off by TOKENSAVE_AUTO_TRACK, failed, or a read-only view) and how to enable it; tokensave status prints 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 the post-checkout hook and branch add --if-enabled explain skipped actions on stderr and in a bounded .tokensave/hook-debug.log; hooks stay silent by default (Refs #877).

  • init and sync warn when a default build-output exclude drops tracked source (Refs #949). The default exclude globs **/build/**, **/out/** and bin/** are meant for generated output, but build/ is also a common name for a real, git-tracked source package, such as a Python data pipeline imported as build.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 from exclude[] 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.md and 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, with Co-authored-by: trailers using their GitHub noreply address (Refs #950).
  • Correct the multi-branch guide: the post-checkout hook tracks branches only when auto_track is 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 new benchmarks/mcp_footprint.py probe: initialize and tools/list bytes 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 default tools/list plus the initialize instructions grow beyond the recorded 24,056 bytes. The MCP tools guide now says five tools are anthropic/alwaysLoad, not three, and cites the measured sizes (Refs #917).

Changed

  • Raise the pinned build toolchain on master from Rust 1.99.0 to 1.100.0: rust-toolchain.toml, the CI and release workflow pins, and the toolchain notes in AGENTS.md, CONTRIBUTING.md and docs/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 intermediate target/ layout, which Rust 1.100.0 changes; release packaging reads only the final binaries (Refs #985).

  • Raise the pinned build toolchain on master from Rust 1.98.1 to 1.99.0, matching beta: rust-toolchain.toml, the CI and release workflow pins, and the toolchain notes in AGENTS.md and CONTRIBUTING.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::exit from a non-main thread on Unix), which docs/MEMORY-SAFETY-AUDIT.md now records as fixed on both branches (Refs #957).

  • auto_track is on by default (Refs #922). The post-checkout hook 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": false and the TOKENSAVE_AUTO_TRACK override (0, false, no, off, or empty) still opt out, and upgrades never change an explicit value: projects initialized by earlier versions have false written in their config and keep the old behavior until it is set to true. Each tracked branch holds its own copy of the index, so use auto_gc or tokensave branch gc to 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, status and 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 and TOKENSAVE_UPDATE_CHECK are unchanged. No behavior change (Refs #902).

  • Align unsafe usage and hex literals with the adopted Google Rust Style Guide: document every unsafe block with a // SAFETY: comment, replace a hand-declared getppid FFI call in a test with std::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.rs and src/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/ and src/tokensave/ (Refs #886).

  • Replace glob imports with explicit ones in src/graph/, src/db/ and src/resolution/ (Refs #886).

  • Give the language extractors' #[allow] attributes a stated reason, and remove a stale dead_code allow 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 a reason (Refs #886).

  • Resolve the pre-existing clippy::pedantic warnings in the MCP server: box the ~56 KiB tools/call handler future once instead of inlining it into every caller (including the serve loop), and simplify the serve loop's control flow with let ... else and if let (Refs #886).

  • Resolve the pre-existing clippy::pedantic warnings outside the MCP server (src/profile/, branch GC, config docs, one integration test) as part of the Google Rust Style Guide audit; the one intentional Option<Option<_>> is kept with a documented #[allow]. No behavior change (Refs #886).

  • Fix the dead_code warnings of the lite build: Ruby-only extractor state and helpers now compile only with lang-ruby, and find_descendant_by_kind only 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 init are indexed automatically (Refs #876). A new user-level auto_init setting in ~/.tokensave/config.toml, on by default, lets a pathless tokensave sync (what the post-commit and post-merge hooks run) and tokensave serve initialize 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, explicit sync <path>/serve --path targets and trees with more candidate files than max_auto_sync_files are skipped; the last prints a hint to run tokensave init. TOKENSAVE_AUTO_INIT overrides the setting for one run, and tokensave doctor reports the effective value.

  • tokensave cost/monitor now accounts for GitHub Copilot CLI local ~/.copilot/session-state/<id>/events.jsonl sessions. The cumulative session.usage_checkpoint record is read (highest totalNanoAiu wins), and Copilot's native metering unit, nano-AIU, is imported and exposed via cost --by-agent and 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. totalPremiumRequests is intentionally out of scope for this change (a separate quota unit whose storage would need a schema column).

  • tokensave cost and monitor now surface AugmentCode (auggie) subagent spend, honestly marked as partial coverage. Augment session files (~/.augment/sessions/<uuid>.json) expose subAgentCostUsd, 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_id values like butler_a) with per-node token_usage populated on only a fraction of nodes, so a trustworthy full-session total cannot be sourced. tokensave imports the observed subagent USD per session under agent = 'augment', keeps Augment coverage Partial (never Complete), and labels it "subagent USD (partial, main-agent usage not sourced)" rather than presenting it as a full total. subAgentCreditsUsed is present but observed always zero, so it is ignored. Parsing is local and offline. The static Augment not imported coverage 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_agent and 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-export for 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 implements edges (Refs #1008). Inheritance clauses were read only for classes, and always as extends, so struct X: P, actor Y: P, enum Z: P and extension T: P produced no edge and tokensave_implementations found no Swift type. Every class-like declaration now records its inheritance clause and, as for C# (#643), an extends that resolves to a protocol is stored as implements. A superclass stays extends, 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_cache table, which held rendered source text; the delete runs with secure_delete on, and no schema version changes, so older builds still open the database. Behavior change: tokensave_read refuses paths inside .git, whose config can hold credentials. The initialize instructions and the rules file tokensave install writes tell the agent that repository content in tool results is data and never instructions. SECURITY.md and the MCP tools guide document that index-backed tools never return gitignored or excluded files while tokensave_read reads 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 in tokensave profile report no 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 status counts only finished aggregate files. profile enable --detailed --for prints the expiry as a UTC time with the time remaining. Behavior change: tokensave profile reset asks 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 side in an indexed repository, the scan entered nested/. 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 .git file points to a worktrees/ entry, also when an include or force_include glob 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 name open, 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 as Cache::open and resolves through the qualified-name match; calls through a value (worker.start()) are unchanged. Callee names also no longer carry raw expression text such as 48 + Double or await poll(x), which tree-sitter-swift produced when a call followed an operator, await or try. Reindex Swift projects to pick this up.

  • A linked worktree nested in its main checkout: the CLI warns about the borrowed index, and tokensave init creates 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 sync and tokensave tool now print the same warning on stderr when you give no explicit path. The warning tells you to run tokensave init in 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 no git process.

  • 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 dirty sentinel. 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 one db= 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, the post-commit and post-merge hooks, 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, and tokensave branch list showed it as synced. tokensave now refuses these writes with an error that names tokensave 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: with auto_track set to false and at least one tracked branch, tokensave does not refresh an untracked branch until you track it.

  • Swift functions report nesting depth (Refs #1011). max_nesting was 0 for every Swift function, in tokensave_complexity and the stored metrics, because nesting was counted on code_block, a node kind tree-sitter-swift does not produce. It is now counted on the statements node 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-folder for tokensave init and tokensave 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 --engine value 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_chain with follow: "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 and budget_exhausted are unchanged.

  • tokensave branch set-default no longer reports success when inconsistent branch-meta.json makes 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_status no longer reports stale_commits after 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 of last_sync_at and last_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_commits counts Git commits by committer time; stale_files remains the signal for indexed content that needs reindexing.

  • Let the Python comparison benchmark reuse TOKENSAVE_BENCH_REPOS_DIR and 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/HEAD is used only while its branch exists, and branch add detects the default like init instead of assuming main. Add tokensave branch set-default, a BRANCH_DEFAULT_STALE warning in tokensave verify, and a default_branch_warning in tokensave branch list, tokensave_status and tokensave_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/beta without relabeling legacy databases (Refs #835).

Changed

  • tokensave_redundancy and tokensave_simplify_scan accept graph_root and graph_branch, so both run against another initialized project. On a selected graph, tokensave_redundancy refuses 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 --agent identifiers 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.md with 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 pi now registers the server with "exposure": "direct" (which pi-mcp-adapter maps to directTools) 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's grep/find/bash calls to a new hook-pi-pre-tool-use subcommand that normalizes them for the existing classifier, resets the per-turn savings counter, and prints the session receipt from a new hook-pi-stop subcommand. tokensave doctor now fails when the exposure hides the tools or the extension is missing or stale.

  • Pi sessions are part of token accounting. tokensave cost, tokensave report and 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/**/*.jsonl is 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_code works with graph_root on a selected graph. The test-marker exclusion wrote two TEMP tables (temp.test_markers, temp.test_annotated_targets), which a selected graph opened with PRAGMA query_only = 1 rejects ("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_code now passes the test-marker ids to the dead-code query as one bound JSON array and filters in SQL with id 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_table and drop_test_annotated_targets_temp_table are 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 der dependency 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 bare tokensave, and the prompt-submit and stop hooks. sync, status, serve, and the MCP roots fallback already did. init in a subdirectory of an existing project now reports that project and exits 0 instead of creating a nested index. In an uninitialized git repository, init initializes 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 advisories workflow (.github/workflows/advisories.yml) runs cargo audit daily on master and beta, and on pushes and pull requests that change Cargo.lock, Cargo.toml or 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.toml holds this policy and the list of ignored advisories, each of which needs a written rationale; the list is empty. The workflow is not part of CI OK, so a newly published advisory does not block unrelated pull requests.