Skip to content

v7.16.0

Choose a tag to compare

@aovestdipaperino aovestdipaperino released this 22 Oct 10:31
· 776 commits to master since this release

A minor release: on first launch the new binary silently reinstalls your agent integrations, refreshing the rules text and the git-hook sections. tokensave install --agent pi --local now works, writing project-scoped .pi/mcp.json + AGENTS.md. No schema change and no forced reindex. Full detail in CHANGELOG.md.

Performance

  • Construct the MCP tool registry once during server startup and release schemas before opening the global database, preserving routing gates and schema accounting without retaining a schema cache (#735).

Added

  • The Pi integration supports --local (#747). Pi has both a user-level and a project-level configuration, so the claim that Pi has no project-scoped config was wrong: tokensave install --agent pi --local now registers the MCP server in the project's .pi/mcp.json and writes the rules block into the AGENTS.md in the project root, which Pi reads as a context file. The rules go in as a managed block, so an existing project AGENTS.md keeps its own content. A global install is unchanged (<agent-dir>/mcp.json and <agent-dir>/AGENTS.md), and tokensave uninstall --agent pi --local removes only the project files.

  • Mandatory contributor and AI agent rule for native filesystem path construction (#743), following PR #738: one component per join or push, with explicit exceptions for portable string formats and path-syntax fixtures.

  • Automatic extraction RAM safeguards complement project profiles: sample physical RAM (and visible Linux cgroup headroom) before parallel extraction and reduce concurrency using a conservative parser allowance. Applies to subprocess and in-process paths, including performance; no background polling or hard RSS guarantee.

  • Project memory_usage profiles (low, balanced, performance) limit simultaneous extraction parsers independently of CPU policy, trading throughput for lower parser memory. The default balanced caps extraction at two parsers; performance retains previous concurrency. These are not total-RAM caps.

  • Configurable language_aliases reuse enabled extractors for custom extensions such as Perl .t tests (#725). Existing project.json file/glob overrides take precedence; mapping edits invalidate unchanged indexed files. Source overrides also take precedence over artifacts, and sync diagnostics describe alias and artifact remedies. tokensave init now preserves the existing project settings instead of resetting them to their defaults, so a supplied mapping survives the first index.

  • tokensave init benchmarks the machine to choose the CPU usage profile (#731). cpu_usage defaulted to balanced on every host, so a 2-vCPU VM, a Raspberry Pi or a 512 MiB container ran the same concurrency as a workstation unless the user knew to change it. init now probes the CPUs and memory (including cgroup limits) and times a short CPU-bound workload on 1 and up to 16 threads to measure real parallel speedup. It then writes one of the existing profiles: low on small or memory-constrained hosts (at most 2 CPUs, under 3 GiB total or 1 GiB available memory, or under 2.5 effective CPUs), performance on idle hosts with many effective CPUs and ample memory, balanced otherwise or when a probe fails. No new profile or config value is added. tokensave init --cpu-usage <profile> skips the benchmark, and a cpu_usage already in the config is kept. The new tokensave tune [path] [--dry-run] [--json] measures again after init and updates the stored profile. --json always prints one document, including when the project is not initialized and the command refuses to write.

  • Add read-only quality-diff CLI and tokensave_branch_diff quality mode for baseline-aware complexity, function-size, file coupling and cyclic dependency edge comparisons between indexed branch tips, with deterministic JSON, freshness diagnostics and CI exit codes (#709).

  • Opt-in automatic language detection for unknown extensions using bounded shebang and syntax evidence, existing extractors, a bounded process-local decision cache, incremental settings invalidation and verbose sync diagnostics. Refs #727.

  • Pascal: index Delphi package sources (.dpk) and include files (.inc). Both are Pascal source, but only .pas, .pp, .dpr and .lpr were routed to the Pascal extractor, so a Delphi project reported them as "unsupported extension" and their declarations were missing from the graph. .lpr is now also reported as Pascal in language statistics, where it was already extracted but counted as Other. Existing projects pick the files up on their next tokensave sync --force.

  • Mandatory contributor and AI agent guidelines for memory bounds, CPU efficiency, resource cleanup, and resource regression review.

  • Add tokensave verify [path] [--deep] [--json], a bounded read-only integrity checker with stable diagnostics and CI exit codes. Incremental repair is deferred; --repair explicitly refuses without writes.

  • Add reusable metamorphic analysis-stability tests for Rust and Python formatting and declaration changes, comparing dead-code findings, dependency cycles, structural complexity, coupling and graph relationships across incremental and clean indexing.

  • Index static Rails routes and link them to the public controller actions they dispatch to, including resources, nested and member routes, draw files, engines and applications in subdirectories. Links refresh after controller edits and show up in search, callers and impact queries; renaming an action or controller that a route may name is refused until route strings can be edited safely.

  • Index embedded Ruby in ERB and Slim templates, including calls to helpers, with locations in the original template. Available with lang-ruby; controller-to-view and partial-render relationships are not inferred. A bare name in a template binds only to helper-shaped methods (in a helpers/ directory, a *Helper module, ApplicationController, a top-level def, or the template itself), so partial locals such as item in item.title do not become call edges to unrelated same-named methods, while helper receivers such as current_user.name still do.

  • tokensave_callers lists every line where a caller calls the target (#672). A caller that invokes the target several times was listed once, with line set to its first call, so a rename or signature change still needed a read of the method or a text search to find the others. Each result now also carries lines, every call line in ascending order ([12, 13]); line and the other fields are unchanged, and line is always among lines. The index already stored one edge per call site, so no reindex is needed. tokensave_callers_for is unchanged. Requested by @xorets.

  • Every symbol in the results of tokensave_search, tokensave_callers, tokensave_callees, tokensave_impact, tokensave_implementations and tokensave_type_hierarchy carries end_line next to line (#674). A result told where a symbol starts but not where it ends, so reading just that symbol meant fetching its body or guessing a range for tokensave_read. JSON results now carry end_line, the symbol's last line, 1-based like line; text results show the range as file:line-end_line (src/shapes.ts:14-17: total (function) in tokensave_search, -- src/shapes.ts:5-12 in tokensave_type_hierarchy). For tokensave_callers, where line is the call site, end_line closes the caller's own span that starts at def_line. Existing fields are unchanged and the span was already stored, so no reindex is needed. tokensave_implementations also stops returning bodies by default, see Changed. Requested by @xorets.

  • tokensave_callers, tokensave_callees, tokensave_impact and tokensave_type_hierarchy take a symbol name (#669). They took only node_id, so "who calls RefreshAsync" cost a tokensave_search turn first. symbol resolves as tokensave_body resolves it since #651: the literal name first, then trailing segments of a qualified name with . and :: alike (Coordinator.RefreshAsync, App::Coordinator::RefreshAsync), and a function or type outranks a same-named field or import; for tokensave_type_hierarchy a type also outranks a same-named function, such as a constructor. node_id takes precedence when both are given, and neither is an error; node_id is no longer a schema-required field. When the name matches several symbols, each of the first max_matches (default 3, max 20) is answered in its own group, headed by qualified name, kind, file, line range (line and end_line, as in #674) and node id: the JSON tools return {symbol, match_count, matches: [...]} with the tool's usual fields inside each match, and tokensave_type_hierarchy prints a ## <heading> line above each tree. Overloads share a qualified name, so they form one group, listed under overloads, with their results merged. Matches past max_matches are listed under unanswered, without results, in tokensave_search rank order, so a follow-up can name one by node_id. A new limit caps the results per match (default 50 for callers, callees and impact, max 500; tokensave_type_hierarchy is uncapped unless limit is set), and a cut is reported as in #645: count, total and truncated beside the list, or a count: N of M (truncated; ...) line under a hierarchy. Called with node_id, the output is unchanged unless limit cuts it: callers and callees then wrap their array as {count, total, truncated, callers|callees}, and impact always carries count, total and truncated beside node_count. On the CLI, a positional argument binds to symbol (a node id there still works), so tokensave tool callers RefreshAsync and tokensave tool body RefreshAsync work as written. Requested by @xorets.

  • C# property and field reads produce uses edges when the receiver's type is known (#637). h.Label, local.Label, this.Label, _field.Label, a read through an inherited property, and each step of a chain (made.Next.Label) now link the reading member to the property or field with a uses edge. Assignments (h.Id = 3) count too. The receiver is typed the same way as for calls since #642: parameters, typed locals, var locals with a known initializer, fields and properties (inherited ones included, #670), and primary-constructor parameters. A read is recorded only when the member exists on that type, never by name alone, so list.Count on an external List<T> does not link to a project property named Count. Reads show up in tokensave_impact, file dependents and dead-code checks, but not in tokensave_callers, since a read is not a call. Bare reads with an implicit this (Label inside its own class) and conditional access (h?.Label) are not recorded yet. Property accessors and expression bodies also get the typed-receiver call resolution that method bodies have. Existing C# projects pick this up on their next tokensave sync --force or as files change. Reported by @zvirgenedx.

Changed

  • The MCP server answers read-only tool calls concurrently (#685). The server handled one request at a time, so a burst of parallel searches queued behind each other and the client waited for the sum of them; a literal search alone could hold the loop for the length of its scan. A read-only tool call does not change the index, so the server now runs those side by side, up to four at a time, and writes each answer as it arrives. Everything that changes the index — an edit, a rename, a sync — still runs alone, in the order it arrived. The transport is split into a reading and a writing half so the server can read the next request while it is still answering the previous one.
  • tokensave_search with literal: true takes exact_total and timeout_ms. exact_total (default true) keeps counting past the limit, so total is the number of matches in the whole project; false stops the scan as soon as limit matches are found. timeout_ms (default 30000, 0 disables it) ends the scan when the budget runs out and answers with the matches found so far. Either way the response now carries total_exact, so a total that is only a lower bound is never passed off as the number of matches in the project; a scan that ran out of time also carries timed_out: true and a note.
  • tokensave_implementations returns locations and signatures instead of bodies by default (#674). Both forms used to inline the full source of every method, so asking which types implement an interface could cost more than reading the files. Each implementing type now comes with its file, line and end_line, plus each of its methods' signature, line and end_line; the method form returns each implementation's file, range and signature. Fetch the bodies you need with tokensave_body or tokensave_read, or pass the new bodies: true to get the bodies inline as before. tokensave_context's include_code, tokensave_body and tokensave_read are unchanged. Requested by @xorets.
  • The "Searching code" rules text no longer teaches one form per construct, and the subagent brief no longer forbids what it recommends (#667). The examples from #653 (.Name(, Name(, : IName) each covered one syntax: : IOrders misses class OrdersController : ControllerBase, IOrders, and TypeScript writes implements IOrders. The section now says that literal: true finds exact text and that, for who calls or implements a name, the agent should search the text that construct takes in the file's language, in every form the language allows. "Grep for a file type the index skips" became "grep for a regex, or for the files a literal search reports as unscanned", since files are also skipped by path. Claude's Explore-agent brief dropped "ONLY" and "Do not call Read, glob, grep", which inside the subagent blocked literal search and reading; it now carries the same search guidance. The hook-denial section and the MCP initialize instructions say the same, while the hook's per-symbol copyable calls from #654 stay. The unscanned remedy now names include[] for files skipped by path, and the compact repeat-search hint no longer points at a tokensave_files --unscanned option that does not exist. Correction to the 7.15.0 entry for #653: the reporter's A/B test measured their whole add-on, so the share of the two "Searching code" lines in the 25% fewer tool calls is unknown. Existing installs pick the text up on the next install, reinstall or upgrade resync. Reported by @xorets.
  • Path::join call sites use native path separators. A path built as dir.join("a/b") stored the literal slashes, so on Windows the resulting PathBuf mixed \ and / even though every filesystem call still succeeded. Each multi-segment path is now built with one join per segment (dir.join("a").join("b")), so the stored string matches the OS's separator. Six Vec::join("/") call sites in src/config.rs, src/db/queries/routes.rs, src/extraction/rails_routes.rs, src/extraction/mcfunction_extractor.rs, src/graph/imports.rs and src/resolution/js_specifier.rs are deliberately unchanged because they join string segments, not paths; the a/b/c/../c/tokensave fixture in src/upgrade.rs is also left intact to keep the dotdot resolution intent visible. Refs #737.

Fixed

  • A literal search scans the project in parallel, and asks the database only about the files that matched (#685). literal: true read every indexed file one at a time on the async runtime, and asked the database for a file's nodes before it knew whether that file contained the query at all. A repository-wide literal search was several times slower than git grep, and in the MCP server it held the tool loop for the whole scan. The scan now runs in chunks, in parallel, inside the project's CPU profile pool and off the async runtime, and the per-file node lookup happens only for a file that matched. The scope prefix filters the scan set up front, so a scoped search no longer reads files it will not report on. The response is unchanged: matches still come in file order, total is still the exact count over the whole project (#645), and truncated still says when the answer is capped.
  • Edit tools keep the callers of the symbols in the file they edit. After tokensave_str_replace, tokensave_insert_at, tokensave_replace_lines or another edit tool changed any line of a file, tokensave_callers returned nothing for that file's symbols: calls from other files and from the same file were both gone, and tokensave sync did not bring them back because the edit had already stored the new hash. A later tokensave_rename then saw the real call sites only as text matches and renamed only the definition. reindex_file deleted the file's nodes and their edges and never resolved references again; it now goes through sync_single_files, the path sync takes for a changed file and the one tokensave_rename moved to in #633.
  • Accept Git LF/CRLF line-ending conversion when validating quality-diff indexes, so freshly indexed Windows checkouts are not incorrectly reported as stale (#710).
  • tokensave_read accepts path for file and start/end for lines, and every tool with a file argument accepts path. Most tools name their file argument path, and tokensave_replace_lines names a line range start/end. An agent therefore sent {path, mode: "lines", start: "200", end: "460"} to tokensave_read and got two errors per call: first missing required parameter: file (got 'path' — use 'file'), then mode='lines' requires the 'lines' argument. Ten reads cost twenty failed round trips. tokensave_read now reads path when file is absent. In lines mode it reads start and end when lines is absent. Each is a number or a numeric string, and an absent end means the end of the file. A lines or start argument without a mode selects lines mode, and an explicit mode still wins. An invalid start/end pair gets the same kind of error as an invalid lines value, and the error for a missing range names both spellings. file is no longer a schema-required field of tokensave_read, since path can replace it, as #651 did for symbol. tokensave_entities, tokensave_doc, tokensave_file_dependents, tokensave_annotations, tokensave_test_map, tokensave_test_coverage and tokensave_branch_diff accept path through one shared helper, and each file description says so. lines stays the documented form. No argument is renamed, and no existing call changes.
  • tokensave_implementations and tokensave_type_hierarchy find TypeScript implementers written with type arguments (#671). The extractor only read a plain name in an implements clause, so implements IRenderer<Row> and implements IRenderer<R, V>, which tree-sitter parses as a generic type, recorded nothing, and only implements IRenderer produced an edge. An interface's extends clause was not read at all, so interface IValidatingRenderer<R, V> extends IRenderer<R, V> was invisible too. Heritage types are now recorded with their type arguments dropped, as for C# in #643, qualified names (ns.IRenderer) included, and each interface an interface extends is recorded as implements, as a C# interface's base list is. This applies to .ts, .tsx, .mts and .cts files and to TypeScript embedded in Svelte and Astro components. No schema change: an existing index picks this up for a file when it is next re-indexed, or for the whole project with tokensave sync --force. Reported by @xorets.
  • A JSON tool result that exceeds the 15,000-character cap still parses (#673). The cap cut every result at 15,000 characters and appended [... truncated at 15000 chars], so format: "json" output (tokensave_search, tokensave_read map, and any tool that returns JSON) ended in the middle of an object. An oversized JSON result is now cut down structurally instead: its largest array loses whole trailing items, or its largest string is cut at a line break, until the result fits, and the top-level object gets "truncated": true plus "omitted": N (items dropped) or "omitted_chars": N (string bytes dropped). A bare top-level array, as tokensave_search returns, keeps its shape when it fits; when it has to be cut it is wrapped as {"results": [...], "truncated": true, "omitted": N}. If nothing can be cut far enough, the result is a short JSON object with "truncated": true and an error. Text results are cut as before. tokensave tool on the CLI no longer applies the cap at all, since a script or a terminal reads its output, not a context window. Reported by @xorets.
  • A C# call through an inherited field or property resolves through the member's type, wherever it is declared (#670). The extractor types a receiver only from the members it can see in the calling class, so await Coordinator.RefreshAsync("c"), where Coordinator is a property or field declared in a base class, was recorded as a static call on a class named Coordinator. That found nothing, and the name-based fallback only bound the call when the target sat in the same file, so a shared test fixture's property typed with a class from another file gave no caller edge, and tokensave_callers and tokensave_impact stopped there. An identifier receiver the extractor cannot type is now handed to the resolver as a simple name, which it looks up as C# does: first as a field or property of the caller's type or any base type, in any file, then as a class name for a static call (Factory.Create()). A member therefore wins over a same-named class, and lower-case fields such as _coordinator are covered too. A variable declared in the method hides an inherited member of the same name even when its type cannot be told (a lambda, out, pattern, catch, foreach or query variable, or a var local with an opaque initializer), so a call on it does not bind through the member; and a verbatim identifier (@event) matches its member. A sync -f is needed to pick this up for files already indexed. Reported by @xorets.
  • Pi's rules block lands in <agent-dir>/AGENTS.md, where Pi reads it (#691). The integration wrote the block to ~/.agents/AGENTS.md, which Pi does not look at, so tokensave install --agent pi registered the MCP server but the "Prefer tokensave MCP tools" instructions were silently dropped on the floor. Per the Pi configuration docs the agent directory is $PI_CODING_AGENT_DIR or <home>/.pi/agent by default, and Pi reads user instructions from <agent-dir>/AGENTS.md (alongside AGENTS.override.md, AGENTS.MD, CLAUDE.md, CLAUDE.MD). The integration now writes the rules block there, honoring the same env-var override the MCP config already used, so the next install for an existing user loads the rules. Any orphaned ~/.agents/AGENTS.md left from a previous install is harmless dead text — the integration no longer touches it, and the user can remove it.