Repository navigation
v7.16.0
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 --localnow registers the MCP server in the project's.pi/mcp.jsonand writes the rules block into theAGENTS.mdin the project root, which Pi reads as a context file. The rules go in as a managed block, so an existing projectAGENTS.mdkeeps its own content. A global install is unchanged (<agent-dir>/mcp.jsonand<agent-dir>/AGENTS.md), andtokensave uninstall --agent pi --localremoves only the project files. -
Mandatory contributor and AI agent rule for native filesystem path construction (#743), following PR #738: one component per
joinorpush, 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_usageprofiles (low,balanced,performance) limit simultaneous extraction parsers independently of CPU policy, trading throughput for lower parser memory. The defaultbalancedcaps extraction at two parsers;performanceretains previous concurrency. These are not total-RAM caps. -
Configurable
language_aliasesreuse enabled extractors for custom extensions such as Perl.ttests (#725). Existingproject.jsonfile/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 initnow preserves the existing project settings instead of resetting them to their defaults, so a supplied mapping survives the first index. -
tokensave initbenchmarks the machine to choose the CPU usage profile (#731).cpu_usagedefaulted tobalancedon 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.initnow 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:lowon small or memory-constrained hosts (at most 2 CPUs, under 3 GiB total or 1 GiB available memory, or under 2.5 effective CPUs),performanceon idle hosts with many effective CPUs and ample memory,balancedotherwise or when a probe fails. No new profile or config value is added.tokensave init --cpu-usage <profile>skips the benchmark, and acpu_usagealready in the config is kept. The newtokensave tune [path] [--dry-run] [--json]measures again afterinitand updates the stored profile.--jsonalways prints one document, including when the project is not initialized and the command refuses to write. -
Add read-only
quality-diffCLI andtokensave_branch_diffquality 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,.dprand.lprwere routed to the Pascal extractor, so a Delphi project reported them as "unsupported extension" and their declarations were missing from the graph..lpris 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 nexttokensave 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;--repairexplicitly 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,
drawfiles, 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 ahelpers/directory, a*Helpermodule,ApplicationController, a top-leveldef, or the template itself), so partial locals such asiteminitem.titledo not become call edges to unrelated same-named methods, while helper receivers such ascurrent_user.namestill do. -
tokensave_callerslists every line where a caller calls the target (#672). A caller that invokes the target several times was listed once, withlineset 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 carrieslines, every call line in ascending order ([12, 13]);lineand the other fields are unchanged, andlineis always amonglines. The index already stored one edge per call site, so no reindex is needed.tokensave_callers_foris unchanged. Requested by @xorets. -
Every symbol in the results of
tokensave_search,tokensave_callers,tokensave_callees,tokensave_impact,tokensave_implementationsandtokensave_type_hierarchycarriesend_linenext toline(#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 fortokensave_read. JSON results now carryend_line, the symbol's last line, 1-based likeline; text results show the range asfile:line-end_line(src/shapes.ts:14-17: total (function)intokensave_search,-- src/shapes.ts:5-12intokensave_type_hierarchy). Fortokensave_callers, wherelineis the call site,end_linecloses the caller's own span that starts atdef_line. Existing fields are unchanged and the span was already stored, so no reindex is needed.tokensave_implementationsalso stops returning bodies by default, see Changed. Requested by @xorets. -
tokensave_callers,tokensave_callees,tokensave_impactandtokensave_type_hierarchytake asymbolname (#669). They took onlynode_id, so "who callsRefreshAsync" cost atokensave_searchturn first.symbolresolves astokensave_bodyresolves 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; fortokensave_type_hierarchya type also outranks a same-named function, such as a constructor.node_idtakes precedence when both are given, and neither is an error;node_idis no longer a schema-required field. When the name matches several symbols, each of the firstmax_matches(default 3, max 20) is answered in its own group, headed by qualified name, kind, file, line range (lineandend_line, as in #674) and node id: the JSON tools return{symbol, match_count, matches: [...]}with the tool's usual fields inside each match, andtokensave_type_hierarchyprints a## <heading>line above each tree. Overloads share a qualified name, so they form one group, listed underoverloads, with their results merged. Matches pastmax_matchesare listed underunanswered, without results, intokensave_searchrank order, so a follow-up can name one bynode_id. A newlimitcaps the results per match (default 50 for callers, callees and impact, max 500;tokensave_type_hierarchyis uncapped unlesslimitis set), and a cut is reported as in #645:count,totalandtruncatedbeside the list, or acount: N of M (truncated; ...)line under a hierarchy. Called withnode_id, the output is unchanged unlesslimitcuts it: callers and callees then wrap their array as{count, total, truncated, callers|callees}, and impact always carriescount,totalandtruncatedbesidenode_count. On the CLI, a positional argument binds tosymbol(a node id there still works), sotokensave tool callers RefreshAsyncandtokensave tool body RefreshAsyncwork as written. Requested by @xorets. -
C# property and field reads produce
usesedges 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 ausesedge. Assignments (h.Id = 3) count too. The receiver is typed the same way as for calls since #642: parameters, typed locals,varlocals 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, solist.Counton an externalList<T>does not link to a project property namedCount. Reads show up intokensave_impact, file dependents and dead-code checks, but not intokensave_callers, since a read is not a call. Bare reads with an implicitthis(Labelinside 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 nexttokensave sync --forceor 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_searchwithliteral: truetakesexact_totalandtimeout_ms.exact_total(defaulttrue) keeps counting past the limit, sototalis the number of matches in the whole project;falsestops the scan as soon aslimitmatches are found.timeout_ms(default30000,0disables it) ends the scan when the budget runs out and answers with the matches found so far. Either way the response now carriestotal_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 carriestimed_out: trueand a note.tokensave_implementationsreturns 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,lineandend_line, plus each of its methods' signature,lineandend_line; themethodform returns each implementation's file, range and signature. Fetch the bodies you need withtokensave_bodyortokensave_read, or pass the newbodies: trueto get the bodies inline as before.tokensave_context'sinclude_code,tokensave_bodyandtokensave_readare 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:: IOrdersmissesclass OrdersController : ControllerBase, IOrders, and TypeScript writesimplements IOrders. The section now says thatliteral: truefinds 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 asunscanned", 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 MCPinitializeinstructions say the same, while the hook's per-symbol copyable calls from #654 stay. Theunscannedremedy now namesinclude[]for files skipped by path, and the compact repeat-search hint no longer points at atokensave_files --unscannedoption 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 nextinstall,reinstallor upgrade resync. Reported by @xorets. Path::joincall sites use native path separators. A path built asdir.join("a/b")stored the literal slashes, so on Windows the resultingPathBufmixed\and/even though every filesystem call still succeeded. Each multi-segment path is now built with onejoinper segment (dir.join("a").join("b")), so the stored string matches the OS's separator. SixVec::join("/")call sites insrc/config.rs,src/db/queries/routes.rs,src/extraction/rails_routes.rs,src/extraction/mcfunction_extractor.rs,src/graph/imports.rsandsrc/resolution/js_specifier.rsare deliberately unchanged because they join string segments, not paths; thea/b/c/../c/tokensavefixture insrc/upgrade.rsis 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: trueread 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 thangit 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,totalis still the exact count over the whole project (#645), andtruncatedstill 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_linesor another edit tool changed any line of a file,tokensave_callersreturned nothing for that file's symbols: calls from other files and from the same file were both gone, andtokensave syncdid not bring them back because the edit had already stored the new hash. A latertokensave_renamethen saw the real call sites only as text matches and renamed only the definition.reindex_filedeleted the file's nodes and their edges and never resolved references again; it now goes throughsync_single_files, the pathsynctakes for a changed file and the onetokensave_renamemoved 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_readacceptspathforfileandstart/endforlines, and every tool with afileargument acceptspath. Most tools name their file argumentpath, andtokensave_replace_linesnames a line rangestart/end. An agent therefore sent{path, mode: "lines", start: "200", end: "460"}totokensave_readand got two errors per call: firstmissing required parameter: file (got 'path' — use 'file'), thenmode='lines' requires the 'lines' argument. Ten reads cost twenty failed round trips.tokensave_readnow readspathwhenfileis absent. Inlinesmode it readsstartandendwhenlinesis absent. Each is a number or a numeric string, and an absentendmeans the end of the file. Alinesorstartargument without amodeselectslinesmode, and an explicitmodestill wins. An invalidstart/endpair gets the same kind of error as an invalidlinesvalue, and the error for a missing range names both spellings.fileis no longer a schema-required field oftokensave_read, sincepathcan replace it, as #651 did forsymbol.tokensave_entities,tokensave_doc,tokensave_file_dependents,tokensave_annotations,tokensave_test_map,tokensave_test_coverageandtokensave_branch_diffacceptpaththrough one shared helper, and eachfiledescription says so.linesstays the documented form. No argument is renamed, and no existing call changes.tokensave_implementationsandtokensave_type_hierarchyfind TypeScript implementers written with type arguments (#671). The extractor only read a plain name in animplementsclause, soimplements IRenderer<Row>andimplements IRenderer<R, V>, which tree-sitter parses as a generic type, recorded nothing, and onlyimplements IRendererproduced an edge. An interface'sextendsclause was not read at all, sointerface 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 asimplements, as a C# interface's base list is. This applies to.ts,.tsx,.mtsand.ctsfiles 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 withtokensave 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], soformat: "json"output (tokensave_search,tokensave_readmap, 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": trueplus"omitted": N(items dropped) or"omitted_chars": N(string bytes dropped). A bare top-level array, astokensave_searchreturns, 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": trueand an error. Text results are cut as before.tokensave toolon 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"), whereCoordinatoris a property or field declared in a base class, was recorded as a static call on a class namedCoordinator. 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, andtokensave_callersandtokensave_impactstopped 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_coordinatorare 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,foreachor query variable, or avarlocal with an opaque initializer), so a call on it does not bind through the member; and a verbatim identifier (@event) matches its member. Async -fis 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, sotokensave install --agent piregistered 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_DIRor<home>/.pi/agentby default, and Pi reads user instructions from<agent-dir>/AGENTS.md(alongsideAGENTS.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 nextinstallfor an existing user loads the rules. Any orphaned~/.agents/AGENTS.mdleft from a previous install is harmless dead text — the integration no longer touches it, and the user can remove it.