<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: VANSH ARORA</title>
    <description>The latest articles on DEV Community by VANSH ARORA (@vansharora21).</description>
    <link>https://dev.to/vansharora21</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3977293%2Fc5c372d4-6394-447c-b24e-985f05573fc4.png</url>
      <title>DEV Community: VANSH ARORA</title>
      <link>https://dev.to/vansharora21</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vansharora21"/>
    <language>en</language>
    <item>
      <title>Designing a Local Learning Ledger with No Transcripts and No Telemetry</title>
      <dc:creator>VANSH ARORA</dc:creator>
      <pubDate>Thu, 12 Nov 2026 15:29:16 +0000</pubDate>
      <link>https://dev.to/vansharora21/designing-a-local-learning-ledger-with-no-transcripts-and-no-telemetry-43k6</link>
      <guid>https://dev.to/vansharora21/designing-a-local-learning-ledger-with-no-transcripts-and-no-telemetry-43k6</guid>
      <description>&lt;p&gt;TokenCap builds task-scoped context packs for AI coding agents. Retrieval is good but not perfect, so v3.1 adds a way to tell it when a pack was right or wrong. The constraint we kept throughout: the ledger records only explicit, bounded evidence, and it records it locally.&lt;/p&gt;

&lt;h3&gt;
  
  
  Recording a judgment
&lt;/h3&gt;

&lt;p&gt;After reviewing a pack, record what happened:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tokencap analyze --learning --outcome helped \
  --task &lt;span class="s2"&gt;"invoice rounding"&lt;/span&gt; \
  --files src/billing/invoice.js,src/billing/round.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the pack left something out:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tokencap analyze --learning --outcome neutral \
  --task &lt;span class="s2"&gt;"invoice rounding"&lt;/span&gt; \
  --missing src/billing/currency.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The CLI confirms what it did and what it did not do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Recorded explicit focus-feedback (helped). Local only; no automatic behavior changed.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--outcome&lt;/code&gt; accepts &lt;code&gt;helped&lt;/code&gt;, &lt;code&gt;neutral&lt;/code&gt; or &lt;code&gt;hurt&lt;/code&gt;. Anything else is rejected.&lt;/p&gt;

&lt;h3&gt;
  
  
  What a record contains
&lt;/h3&gt;

&lt;p&gt;Each event in &lt;code&gt;.tokencap/learning/ledger.json&lt;/code&gt; has an ID, a timestamp, a kind, a source (&lt;code&gt;cli&lt;/code&gt; or &lt;code&gt;companion&lt;/code&gt;), an outcome, a task label, and two file lists: selected and missing. That is the full schema.&lt;/p&gt;

&lt;p&gt;The bounds are enforced in &lt;code&gt;src/learning/ledger.js&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Task labels are capped at 300 characters, with newlines and tabs collapsed.&lt;/li&gt;
&lt;li&gt;Each file list keeps at most 30 entries, deduplicated.&lt;/li&gt;
&lt;li&gt;Only workspace-relative paths are accepted. Absolute paths, drive letters, UNC paths, &lt;code&gt;~&lt;/code&gt; paths, URL schemes and anything containing &lt;code&gt;..&lt;/code&gt; are dropped.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Redacting the task label
&lt;/h3&gt;

&lt;p&gt;A task label is free text, so it can contain things that should not be stored. Two passes run before it is written:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Paths are scrubbed. A path inside the workspace is rewritten as workspace-relative. A path outside it becomes &lt;code&gt;[path]&lt;/code&gt;. POSIX paths are only matched under system roots such as &lt;code&gt;/Users&lt;/code&gt; or &lt;code&gt;/home&lt;/code&gt;, so an API route like &lt;code&gt;/users/:id&lt;/code&gt; stays readable.&lt;/li&gt;
&lt;li&gt;The label goes through TokenCap's central redaction engine, the same one that redacts packs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If redaction throws, the label is dropped rather than stored unredacted.&lt;/p&gt;

&lt;h3&gt;
  
  
  What it never does
&lt;/h3&gt;

&lt;p&gt;There is no transcript capture. The ledger does not accept chat history and does not infer outcomes from what an agent did. There is no telemetry; the file stays on disk and nothing reads it over the network. And there are no automatic changes. Recording feedback does not edit rules, the Constitution, or default ranking.&lt;/p&gt;

&lt;p&gt;The ledger is also not shared. Team rules in &lt;code&gt;.tokencap/team/&lt;/code&gt; are meant to be committed. The learning ledger stays ignored with the rest of &lt;code&gt;.tokencap/&lt;/code&gt;, so one developer's judgments do not end up in everyone's history.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reading it back
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tokencap analyze --learning
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This prints a count of helpful, neutral and harmful focus events, rule feedback events, and the ten most recent records with their files. Add &lt;code&gt;--json&lt;/code&gt; to get the full report, which states &lt;code&gt;local: true&lt;/code&gt; and &lt;code&gt;automaticChanges: false&lt;/code&gt; in the output itself.&lt;/p&gt;

&lt;h3&gt;
  
  
  The companion signal
&lt;/h3&gt;

&lt;p&gt;The Chrome companion can mark a file Useful or Missed for the current task. It sends that to the local loopback bridge's &lt;code&gt;/feedback&lt;/code&gt; endpoint, which writes the same kind of event with &lt;code&gt;source: "companion"&lt;/code&gt;. The bridge only accepts feedback for a project that has been indexed, named by absolute path.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where the evidence is used
&lt;/h3&gt;

&lt;p&gt;The ledger is input for two opt-in features: &lt;code&gt;tokencap ask "&amp;lt;task&amp;gt;" --adaptive&lt;/code&gt;, which can re-rank candidates using matching feedback, and &lt;code&gt;tokencap analyze --patterns&lt;/code&gt;, which reports file pairs that keep appearing together. Both are covered in the next post. Neither runs unless you ask for it.&lt;/p&gt;

&lt;p&gt;Docs: tokencap.vansharora.app&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devtools</category>
      <category>vscode</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Team Rules for AI Agents, Stored as Append-Only Files in Git</title>
      <dc:creator>VANSH ARORA</dc:creator>
      <pubDate>Wed, 11 Nov 2026 14:37:19 +0000</pubDate>
      <link>https://dev.to/vansharora21/team-rules-for-ai-agents-stored-as-append-only-files-in-git-3cjb</link>
      <guid>https://dev.to/vansharora21/team-rules-for-ai-agents-stored-as-append-only-files-in-git-3cjb</guid>
      <description>&lt;p&gt;Shared project knowledge usually needs a shared place to live. For TokenCap v3.0 we wanted that place to be the repository itself, with no server, no account and no sync service. The result is &lt;code&gt;tokencap analyze team&lt;/code&gt;, and its storage format is the interesting part.&lt;/p&gt;

&lt;h3&gt;
  
  
  The layout
&lt;/h3&gt;

&lt;p&gt;Everything lives under &lt;code&gt;.tokencap/team/&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.tokencap/team/
  team.json
  rules/rule-&amp;lt;id&amp;gt;.json
  decisions/decision-&amp;lt;id&amp;gt;.json
  approvals/approval-&amp;lt;id&amp;gt;.json
  profiles/&amp;lt;hash&amp;gt;.json
  adrs/adr-&amp;lt;hash&amp;gt;.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;team.json&lt;/code&gt; holds the team name and a schema version. Every rule, decision and approval is its own file, named by a random UUID. A record holds its text, author and creation time. Nothing else is stored.&lt;/p&gt;

&lt;h3&gt;
  
  
  The commands
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tokencap analyze team init --name &lt;span class="s2"&gt;"Platform"&lt;/span&gt;
tokencap analyze team rule --author &lt;span class="s2"&gt;"Ava"&lt;/span&gt; --text &lt;span class="s2"&gt;"Changes to auth require review."&lt;/span&gt;
tokencap analyze team approve-rule --id &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;rule-id&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; --author &lt;span class="s2"&gt;"Ben"&lt;/span&gt;
tokencap analyze team decision --author &lt;span class="s2"&gt;"Ava"&lt;/span&gt; --text &lt;span class="s2"&gt;"Use local Git records."&lt;/span&gt;
tokencap analyze team profile --author &lt;span class="s2"&gt;"Ava"&lt;/span&gt; --text &lt;span class="s2"&gt;"Owns authentication."&lt;/span&gt;
tokencap analyze team sync-adrs
tokencap analyze team status --json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each write prints the same reminder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Team intelligence: rule complete. Commit .tokencap/team/ to share it through Git.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;TokenCap never runs that commit for you. You do it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add .tokencap/team .gitignore
git commit -m &lt;span class="s2"&gt;"chore: share TokenCap team intelligence"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why one file per record
&lt;/h3&gt;

&lt;p&gt;The obvious design is a single &lt;code&gt;rules.json&lt;/code&gt; with an array in it. It works until two people add a rule on two branches. Both edit the same lines of the same file, and the merge stops for a human.&lt;/p&gt;

&lt;p&gt;With one file per record, Ava's rule and Carol's rule are different files with different names. Git merges both branches cleanly because neither branch touched a file the other changed.&lt;/p&gt;

&lt;p&gt;Approvals follow the same idea. &lt;code&gt;approve-rule&lt;/code&gt; does not edit the rule. It writes a new &lt;code&gt;approval-&amp;lt;id&amp;gt;.json&lt;/code&gt; that points at the rule's ID. &lt;code&gt;status&lt;/code&gt; reads every approval and reports each rule as &lt;code&gt;proposed&lt;/code&gt; or &lt;code&gt;accepted&lt;/code&gt;, with the list of approvers. A rule with two approvals has two approval files, and the Git log shows when each one arrived.&lt;/p&gt;

&lt;p&gt;Records are never rewritten after creation. The one exception is profiles: each contributor has one profile file, and &lt;code&gt;profile&lt;/code&gt; replaces it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting Git to see the directory
&lt;/h3&gt;

&lt;p&gt;Many repositories ignore &lt;code&gt;.tokencap/&lt;/code&gt; entirely, since most of it is generated. &lt;code&gt;analyze team init&lt;/code&gt; and &lt;code&gt;analyze team status&lt;/code&gt; add a managed block to &lt;code&gt;.gitignore&lt;/code&gt; that re-includes only &lt;code&gt;.tokencap/team/&lt;/code&gt;. In v3.0 the block re-included more than that, so &lt;code&gt;git add&lt;/code&gt; could pick up generated artifacts. v3.1 narrowed it, and running &lt;code&gt;init&lt;/code&gt; or &lt;code&gt;status&lt;/code&gt; rewrites an old block in place.&lt;/p&gt;

&lt;h3&gt;
  
  
  What it does not do
&lt;/h3&gt;

&lt;p&gt;TokenCap records evidence. It does not block a commit when a rule is unapproved, and it does not resolve a disagreement between two people. If two engineers propose contradicting rules, both files exist until the team decides what to do about them. That decision is a conversation, and then a commit.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sync-adrs&lt;/code&gt; copies your existing architecture decision records into &lt;code&gt;adrs/&lt;/code&gt;, one file per ADR, keyed by a hash of its content. Running it twice adds nothing new.&lt;/p&gt;

&lt;p&gt;The whole feature is files plus Git. Review it in a pull request like any other change.&lt;/p&gt;

&lt;p&gt;Docs and install: tokencap.vansharora.app&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devtools</category>
      <category>vscode</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Writing a TokenCap Plugin, and What the Sandbox Stops It From Doing</title>
      <dc:creator>VANSH ARORA</dc:creator>
      <pubDate>Tue, 10 Nov 2026 11:27:11 +0000</pubDate>
      <link>https://dev.to/vansharora21/writing-a-tokencap-plugin-and-what-the-sandbox-stops-it-from-doing-4i31</link>
      <guid>https://dev.to/vansharora21/writing-a-tokencap-plugin-and-what-the-sandbox-stops-it-from-doing-4i31</guid>
      <description>&lt;p&gt;TokenCap 3 added a local plugin runtime. The contract is small on purpose: two hooks, named tools, and one capability, which is reading and writing files in the plugin's own folder. This post walks through a plugin and then through each limit, with how it is enforced in &lt;code&gt;src/plugins/runtime.js&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Registering a plugin
&lt;/h3&gt;

&lt;p&gt;Plugins are opt-in per project, from that project's own &lt;code&gt;package.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"tokencapPlugins"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"./tools/tokencap-plugin.js"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each entry must be a workspace-relative path that starts with &lt;code&gt;./&lt;/code&gt; and points to a file inside the workspace. Package names and remote modules are refused.&lt;/p&gt;

&lt;h3&gt;
  
  
  A plugin file
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// tools/tokencap-plugin.js&lt;/span&gt;
&lt;span class="kd"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"build-log"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;hooks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;afterBuild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;artifacts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"last-build.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;logged&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nf"&gt;beforeRedact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;internal&lt;/span&gt;\&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;corp&lt;/span&gt;\&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"[internal-host]"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"last-build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nf"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;artifacts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"last-build.json"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The runtime validates the shape when it loads the file. The name must be 1 to 64 characters of letters, digits, &lt;code&gt;-&lt;/code&gt; or &lt;code&gt;_&lt;/code&gt;, starting with a letter or digit. A version is required. Any hook other than &lt;code&gt;afterBuild&lt;/code&gt; or &lt;code&gt;beforeRedact&lt;/code&gt; is rejected, and two plugins with the same name or the same tool name are refused.&lt;/p&gt;

&lt;h3&gt;
  
  
  The two hooks
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;afterBuild&lt;/code&gt;&lt;/strong&gt; runs after &lt;code&gt;tokencap make&lt;/code&gt;. &lt;code&gt;ctx.build&lt;/code&gt; holds &lt;code&gt;outputPath&lt;/code&gt;, &lt;code&gt;fileCount&lt;/code&gt; and &lt;code&gt;estimatedTokens&lt;/code&gt;. When any plugin hook ran, the build prints one summary line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Plugins:                     1 hook(s), 0 error(s)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;code&gt;beforeRedact&lt;/code&gt;&lt;/strong&gt; receives &lt;code&gt;ctx.content&lt;/code&gt; and &lt;code&gt;ctx.filePath&lt;/code&gt; and runs before TokenCap's own redaction. It is called synchronously, so return the new string (or &lt;code&gt;{ content }&lt;/code&gt;) directly. If a plugin throws or returns an error, its change is skipped and core redaction runs on the original content. The core engine stays authoritative.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tools
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tokencap analyze plugins list
tokencap analyze plugins run last-build --text &lt;span class="s2"&gt;"input"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;list&lt;/code&gt; prints &lt;code&gt;Plugins: 1 loaded, 0 error(s)&lt;/code&gt;. &lt;code&gt;run&lt;/code&gt; passes &lt;code&gt;--text&lt;/code&gt; to the handler as &lt;code&gt;ctx.input.text&lt;/code&gt;. Add &lt;code&gt;--json&lt;/code&gt; to either command for the full result.&lt;/p&gt;

&lt;h3&gt;
  
  
  What the sandbox enforces
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;A separate realm.&lt;/strong&gt; Each plugin gets its own V8 context with a null-prototype global, so &lt;code&gt;this.constructor&lt;/code&gt; cannot resolve to the host's &lt;code&gt;Object&lt;/code&gt;. Code generation from strings and WebAssembly code generation are both turned off. Host callbacks stay in a closure the plugin cannot reach. Payloads go in as JSON strings and come back as JSON, and the payload object a hook receives is frozen. The test suite tries six constructor paths back to the host realm, and all six come back blocked.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No &lt;code&gt;require&lt;/code&gt;, no &lt;code&gt;process&lt;/code&gt;, no network.&lt;/strong&gt; Inside a plugin, &lt;code&gt;typeof require&lt;/code&gt; and &lt;code&gt;typeof process&lt;/code&gt; are both &lt;code&gt;"undefined"&lt;/code&gt;. The only I/O is &lt;code&gt;ctx.artifacts.read&lt;/code&gt;, &lt;code&gt;write&lt;/code&gt; and &lt;code&gt;list&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One folder.&lt;/strong&gt; Every artifact path resolves under &lt;code&gt;.tokencap/plugins/&amp;lt;name&amp;gt;/&lt;/code&gt;. Empty paths, &lt;code&gt;..&lt;/code&gt; and absolute paths are rejected. Each existing path component from &lt;code&gt;.tokencap&lt;/code&gt; down is checked with &lt;code&gt;lstat&lt;/code&gt;, and a symlink or junction anywhere on that path is an error. The source names the case it is written for: a committed &lt;code&gt;.tokencap/plugins/&amp;lt;name&amp;gt;&lt;/code&gt; link pointing at &lt;code&gt;~/.ssh&lt;/code&gt;. The check runs before and after the directory is created, and the file is opened with &lt;code&gt;O_NOFOLLOW&lt;/code&gt; where the platform supports it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A clock.&lt;/strong&gt; Each hook or tool call has 1 second, and loading a plugin has 150 ms. Promise callbacks run inside the timed call, so an async hook cannot slip past the limit; a call still pending after it is reported as not completed. A plugin that overruns is disabled until its file changes or the process restarts.&lt;/p&gt;

&lt;p&gt;That last rule is a 3.1 fix. Before it, a looping hook could hang &lt;code&gt;make&lt;/code&gt; with the build lock held.&lt;/p&gt;

&lt;h3&gt;
  
  
  The limit we state up front
&lt;/h3&gt;

&lt;p&gt;The runtime's own header says it plainly: &lt;code&gt;node:vm&lt;/code&gt; is not a security boundary, and plugins are trusted code. The rules above close the known host-object escapes and stop the common accidents: a path that walks out of its folder, a committed symlink, an infinite loop. They are not designed to contain a determined attacker running code on your machine.&lt;/p&gt;

&lt;p&gt;So the usage docs end the plugin section the same way this post does: install plugins you trust.&lt;/p&gt;

&lt;p&gt;Plugin docs at tokencap.vansharora.app&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devtools</category>
      <category>vscode</category>
      <category>productivity</category>
    </item>
    <item>
      <title>TokenCap 3.0: One Build, Every Tool Reads It</title>
      <dc:creator>VANSH ARORA</dc:creator>
      <pubDate>Thu, 05 Nov 2026 14:50:56 +0000</pubDate>
      <link>https://dev.to/vansharora21/tokencap-30-one-build-every-tool-reads-it-53f1</link>
      <guid>https://dev.to/vansharora21/tokencap-30-one-build-every-tool-reads-it-53f1</guid>
      <description>&lt;p&gt;The 3.0 release was named "Platform". The change is less about new analysis and more about where the output goes. One local build produces &lt;code&gt;.tokencap/&lt;/code&gt;, and every surface reads from it: coding agents, MCP hosts, the Chrome companion, an SDK, and plugins.&lt;/p&gt;

&lt;h3&gt;
  
  
  The build
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tokencap make
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Among other things, a full build writes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.tokencap/agent/START_HERE.md&lt;/code&gt;, the entry point an agent reads first&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.tokencap/brain/knowledge.json&lt;/code&gt;, the knowledge base&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.tokencap/graph/graph-data.json&lt;/code&gt;, the dependency graph&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;allowed-context.json&lt;/code&gt; and &lt;code&gt;context-manifest.json&lt;/code&gt;, which point an agent at task-relevant files&lt;/li&gt;
&lt;li&gt;the snapshot&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything stays on disk. In v3.1, &lt;code&gt;tokencap update&lt;/code&gt;, which runs npm, is the only command that uses the network.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reader 1: coding agents
&lt;/h3&gt;

&lt;p&gt;Agents that read files start at &lt;code&gt;START_HERE.md&lt;/code&gt;. &lt;code&gt;make&lt;/code&gt; also creates &lt;code&gt;AGENTS.md&lt;/code&gt; when it is missing, and as of 3.1 it leaves a hand-written &lt;code&gt;AGENTS.md&lt;/code&gt; alone. The npm package ships an Agent Skill at &lt;code&gt;skills/tokencap/&lt;/code&gt; for hosts that discover skills.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reader 2: MCP hosts
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tokencap serve &lt;span class="nt"&gt;--mcp&lt;/span&gt; &lt;span class="nt"&gt;--init&lt;/span&gt;
tokencap serve &lt;span class="nt"&gt;--mcp&lt;/span&gt; &lt;span class="nt"&gt;--init&lt;/span&gt; &lt;span class="nt"&gt;--client&lt;/span&gt; vscode
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--init&lt;/code&gt; detects the host and writes its config where that host reads it: &lt;code&gt;.mcp.json&lt;/code&gt; for Claude Code, &lt;code&gt;.cursor/mcp.json&lt;/code&gt; for Cursor, &lt;code&gt;.vscode/mcp.json&lt;/code&gt; for VS Code, &lt;code&gt;.codex/config.toml&lt;/code&gt; for Codex. Claude Desktop and Windsurf use per-user files, so their entry adds &lt;code&gt;--root &amp;lt;repo&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The server answers &lt;code&gt;initialize&lt;/code&gt; at once and builds in the background. Tools such as &lt;code&gt;tokencap_overview&lt;/code&gt;, &lt;code&gt;tokencap_files&lt;/code&gt;, &lt;code&gt;tokencap_impact&lt;/code&gt; and &lt;code&gt;tokencap_review&lt;/code&gt; read the same intelligence. In 3.1, &lt;code&gt;tokencap_files&lt;/code&gt; uses the same retrieval as &lt;code&gt;tokencap ask&lt;/code&gt;, so MCP and task packs agree on file order.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reader 3: the Chrome companion
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tokencap serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This binds a loopback bridge on &lt;code&gt;127.0.0.1:4545&lt;/code&gt; with a pairing token and an origin allowlist. The companion gets a compressed, redacted, task-scoped pack. It never receives the raw &lt;code&gt;.tokencap/&lt;/code&gt; files.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reader 4: the SDK (experimental)
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;@tokencap/sdk&lt;/code&gt; is a read-only interface to the generated artifacts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;loadIntelligence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;getImpact&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;buildContext&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@tokencap/sdk&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;intelligence&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;loadIntelligence&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/workspace/my-project&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;impact&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getImpact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;intelligence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;src/payments/charge.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;buildContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;intelligence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Review the charge retry path&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;budget&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It needs &lt;code&gt;brain/knowledge.json&lt;/code&gt; and &lt;code&gt;graph/graph-data.json&lt;/code&gt; to exist, and reports &lt;code&gt;TOKENCAP_INTELLIGENCE_MISSING&lt;/code&gt; when they do not. It does not trigger a build, start a watcher, write files, or make network calls. Graph and impact answers are static evidence, and context token totals are character-based estimates.&lt;/p&gt;

&lt;p&gt;It is &lt;strong&gt;not published to npm&lt;/strong&gt;. &lt;code&gt;npm install @tokencap/sdk&lt;/code&gt; is not a supported setup path today. The source ships with TokenCap for evaluation, and it will be published only after external projects show the small API is stable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reader 5: plugins
&lt;/h3&gt;

&lt;p&gt;A project can list local plugin files in its own &lt;code&gt;package.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tokencapPlugins"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"./tools/tokencap-plugin.js"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Plugins can provide &lt;code&gt;afterBuild&lt;/code&gt; and &lt;code&gt;beforeRedact&lt;/code&gt; hooks and named tools:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tokencap analyze plugins list
tokencap analyze plugins run &amp;lt;tool-name&amp;gt; &lt;span class="nt"&gt;--text&lt;/span&gt; &lt;span class="s2"&gt;"input"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They run with no &lt;code&gt;require&lt;/code&gt;, &lt;code&gt;process&lt;/code&gt;, or network, and can only read and write inside &lt;code&gt;.tokencap/plugins/&amp;lt;name&amp;gt;/&lt;/code&gt;. The sandbox gets its own post.&lt;/p&gt;

&lt;h3&gt;
  
  
  Team intelligence
&lt;/h3&gt;

&lt;p&gt;Shared rules, decisions and approvals live in Git under &lt;code&gt;.tokencap/team/&lt;/code&gt; as append-only records. No server, no cloud account, no commits on your behalf:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tokencap analyze team init &lt;span class="nt"&gt;--name&lt;/span&gt; &lt;span class="s2"&gt;"Platform"&lt;/span&gt;
tokencap analyze team rule &lt;span class="nt"&gt;--author&lt;/span&gt; &lt;span class="s2"&gt;"Ava"&lt;/span&gt; &lt;span class="nt"&gt;--text&lt;/span&gt; &lt;span class="s2"&gt;"Changes to auth require review."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Upgrading from v2
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tokencap make &lt;span class="nt"&gt;--migrate&lt;/span&gt;
tokencap make
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--migrate&lt;/code&gt; upgrades &lt;code&gt;.tokencap/config.json&lt;/code&gt; to version 3, publishes schemas in &lt;code&gt;.tokencap/schemas/&lt;/code&gt;, and writes &lt;code&gt;.tokencap/migration.json&lt;/code&gt;. The next &lt;code&gt;make&lt;/code&gt; produces the v3 artifact manifest.&lt;/p&gt;

&lt;p&gt;The CLI is still seven commands: &lt;code&gt;make&lt;/code&gt;, &lt;code&gt;ask&lt;/code&gt;, &lt;code&gt;analyze&lt;/code&gt;, &lt;code&gt;serve&lt;/code&gt;, &lt;code&gt;update&lt;/code&gt;, &lt;code&gt;help&lt;/code&gt;, &lt;code&gt;version&lt;/code&gt;. The v2 standalone aliases are gone and print their replacement instead (&lt;code&gt;tokencap impact&lt;/code&gt; now points you to &lt;code&gt;tokencap ask impact&lt;/code&gt;). The one exception is &lt;code&gt;tokencap mcp&lt;/code&gt;, which still starts the MCP server so existing host configs keep working.&lt;/p&gt;

&lt;p&gt;Docs and migration table at tokencap.vansharora.app&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devtools</category>
      <category>vscode</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Measuring Context Packs Against Real Commits: Recall, Tokens, and the Limits</title>
      <dc:creator>VANSH ARORA</dc:creator>
      <pubDate>Wed, 04 Nov 2026 14:46:16 +0000</pubDate>
      <link>https://dev.to/vansharora21/measuring-context-packs-against-real-commits-recall-tokens-and-the-limits-lhf</link>
      <guid>https://dev.to/vansharora21/measuring-context-packs-against-real-commits-recall-tokens-and-the-limits-lhf</guid>
      <description>&lt;p&gt;Most "fewer tokens" claims compare a small number to a big number and stop there. That rewards a tool for leaving things out. The TokenCap benchmark in &lt;code&gt;benchmarks/fair/&lt;/code&gt; scores two things for every task: the token count, and whether the files the change actually needed are in the context.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where the tasks come from
&lt;/h3&gt;

&lt;p&gt;Each task is a real commit from one of nine repositories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;fastify-example-todo (JavaScript)&lt;/li&gt;
&lt;li&gt;full-stack-fastapi-template (Python + TypeScript)&lt;/li&gt;
&lt;li&gt;hoppscotch (TypeScript + Vue)&lt;/li&gt;
&lt;li&gt;flask and httpx (Python)&lt;/li&gt;
&lt;li&gt;gin and cobra (Go)&lt;/li&gt;
&lt;li&gt;ripgrep (Rust)&lt;/li&gt;
&lt;li&gt;gson (Java)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The task text is the commit subject. The ground truth is the set of non-test source files the commit changed. The repository is evaluated at the commit's parent, so the change does not exist yet.&lt;/p&gt;

&lt;p&gt;The selection rule is recorded in &lt;code&gt;tasks.json&lt;/code&gt;. Per repository: the most recent non-merge commits that change 1 to 5 non-test source files (at most 8 files in total), are not dependency, release, docs, lint or translation commits, and have a subject of at least three words. Commits were listed by script before any measurement, and none was dropped after seeing results.&lt;/p&gt;

&lt;p&gt;50 tasks were used while changing retrieval and packing code. 50 were held out. Two more selected commits are skipped because none of their files exists at the parent.&lt;/p&gt;

&lt;h3&gt;
  
  
  The three arms
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;TokenCap task pack:&lt;/strong&gt; what &lt;code&gt;tokencap ask "&amp;lt;task&amp;gt;"&lt;/code&gt; builds from the commit subject. The companion bridge builds the same pack.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Naive, all matching files:&lt;/strong&gt; keyword grep over the repository, every matching file read in full.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Naive, 10 best-matching files:&lt;/strong&gt; the top ten files from that grep.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Results (all 100 tasks)
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Measure&lt;/th&gt;
&lt;th&gt;TokenCap task pack&lt;/th&gt;
&lt;th&gt;All matching files&lt;/th&gt;
&lt;th&gt;10 best-matching files&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Needed files present&lt;/td&gt;
&lt;td&gt;87%&lt;/td&gt;
&lt;td&gt;96%&lt;/td&gt;
&lt;td&gt;76%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Average tokens per task&lt;/td&gt;
&lt;td&gt;9,997&lt;/td&gt;
&lt;td&gt;382,258&lt;/td&gt;
&lt;td&gt;87,761&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Median saving vs. that baseline&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;td&gt;18.9×&lt;/td&gt;
&lt;td&gt;7.5×&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On average, 73% of the exact lines a commit edited are in the pack.&lt;/p&gt;

&lt;p&gt;Split by set: the held-out half scored 88% needed files, 74% edit-line coverage, and an 18.4× median saving. The tuning half scored 86%, 72%, and 20.4×. One caveat on the held-out side: the held-out tasks of the first three repositories were also run during an earlier round of work, before the other six repositories were added.&lt;/p&gt;

&lt;h3&gt;
  
  
  Running it
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node benchmarks/fair/fetch-repos.js ../bench-repos
node benchmarks/fair/run.js &lt;span class="nt"&gt;--repos&lt;/span&gt; ../bench-repos &lt;span class="nt"&gt;--set&lt;/span&gt; holdout
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CI runs the full set with &lt;code&gt;--set all --gate&lt;/code&gt;. The gate fails the job when needed-file recall, edit-line coverage, or the median saving drops below the thresholds stored in &lt;code&gt;tasks.json&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The limits
&lt;/h3&gt;

&lt;p&gt;These are published next to the table in &lt;code&gt;docs/HONEST-NUMBERS.md&lt;/code&gt;, not in a footnote.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It is not an answer-quality measurement.&lt;/strong&gt; No model is called. A pack can contain the right file and still lead to a wrong answer. The harness for that check, &lt;code&gt;benchmarks/fair/answer-eval.js&lt;/code&gt;, exists but has not been run, and there is no published model result.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grepping everything finds more.&lt;/strong&gt; 96% against 87%. The pack wins on tokens (38× fewer on average) and beats the 10-file baseline on both counts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spans can miss the edit.&lt;/strong&gt; Large files ship as selected functions and lines. Edit-line coverage is lowest on repositories with very large files: 56-58% on cobra, ripgrep, and gson.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Small repositories gain little.&lt;/strong&gt; The median saving on the small repository is 1.6×, and in 3 of its 9 tasks the pack was larger than the naive read.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Median, not mean.&lt;/strong&gt; The mean saving is 34.2×, pulled up by the large repository. The median, 18.9×, is the representative figure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Task text is terse.&lt;/strong&gt; Commit subjects are shorter than what a developer usually types.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scope.&lt;/strong&gt; This measures the task pack built by &lt;code&gt;tokencap ask&lt;/code&gt; and the companion bridge. It does not measure the &lt;code&gt;tokencap make&lt;/code&gt; capsule.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why it was worth building
&lt;/h3&gt;

&lt;p&gt;Before the v3.1 retrieval changes, the first three repositories scored 25% needed-file recall on this benchmark. Those result sets are still in &lt;code&gt;benchmarks/fair/results/&lt;/code&gt;; the 100-task results are in &lt;code&gt;benchmarks/fair/results/v2/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A benchmark that only counts tokens would have rated that 25% version as a success. This one did not, which is the whole point of having ground truth.&lt;/p&gt;

&lt;p&gt;Full table, method, and limits at tokencap.vansharora.app&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devtools</category>
      <category>vscode</category>
      <category>productivity</category>
    </item>
    <item>
      <title>We Retracted Our Own 12.2 Benchmark. Here Is What Was Wrong With It.</title>
      <dc:creator>VANSH ARORA</dc:creator>
      <pubDate>Tue, 03 Nov 2026 11:07:41 +0000</pubDate>
      <link>https://dev.to/vansharora21/we-retracted-our-own-122x-benchmark-here-is-what-was-wrong-with-it-35cm</link>
      <guid>https://dev.to/vansharora21/we-retracted-our-own-122x-benchmark-here-is-what-was-wrong-with-it-35cm</guid>
      <description>&lt;p&gt;TokenCap v1.6 shipped with a line we liked a lot: "12.2× fewer tokens, same answer." It came from &lt;code&gt;benchmarks/run.js&lt;/code&gt;. It was wrong in five separate ways, and it is now retracted in &lt;code&gt;docs/HONEST-NUMBERS.md&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This post is the list, and what replaced it.&lt;/p&gt;

&lt;h3&gt;
  
  
  The five problems
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. "Same answer" was never measured.&lt;/strong&gt; The harness printed the phrase. It called no model and checked no answer. The words were a label, not a result.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The naive baseline counted TokenCap's own output.&lt;/strong&gt; The capsule was written to &lt;code&gt;TOKENCAP.md&lt;/code&gt; inside the repository. The naive side then read the repository, capsule included. Every naive figure carried the capsule's full size, which inflated the baseline we were claiming to beat.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. One task matched every file.&lt;/strong&gt; Keywords were matched against the absolute path. On Windows the temp path starts with &lt;code&gt;C:\Users\...&lt;/code&gt;, and &lt;code&gt;user&lt;/code&gt; was one of the keywords. So one "naive" read was simply the whole repository.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. TokenCap's side was not task-specific.&lt;/strong&gt; One capsule per repository was reused for all five tasks. The 15 data points were really three measurements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. The two headline figures used different aggregations.&lt;/strong&gt; 12.2× was the mean of per-task ratios. The 94% figure came from the ratio of the averages. Two numbers, two methods, side by side.&lt;/p&gt;

&lt;p&gt;None of these needs bad intent. Each one is a shortcut that looks fine until someone reads the harness carefully.&lt;/p&gt;

&lt;h3&gt;
  
  
  What the corrected number looked like
&lt;/h3&gt;

&lt;p&gt;With the baseline fixed, the small repository's capsule was 8,275 tokens. The naive read averaged 3,880 tokens. The capsule was about twice the size of what it was supposed to save.&lt;/p&gt;

&lt;p&gt;That is exactly the kind of result a benchmark exists to surface. The old one could not surface it.&lt;/p&gt;

&lt;h3&gt;
  
  
  What replaced it
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;benchmarks/fair/&lt;/code&gt; scores both sides against ground truth instead of against each other's size:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each task is a real commit from one of nine repositories (JavaScript, TypeScript, Vue, Python, Go, Rust, Java).&lt;/li&gt;
&lt;li&gt;The task text is the commit subject. The ground truth is the set of non-test source files the commit changed.&lt;/li&gt;
&lt;li&gt;The repository is checked out at the commit's parent, so the answer is not in the tree yet.&lt;/li&gt;
&lt;li&gt;Commits are selected mechanically by a rule recorded in &lt;code&gt;benchmarks/fair/tasks.json&lt;/code&gt;. 50 were used while changing retrieval and packing code. 50 were held out.&lt;/li&gt;
&lt;li&gt;Both sides are scored on tokens and on whether the needed files are present. A smaller pack only counts if it still holds what the task needs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Results across all 100 tasks:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Measure&lt;/th&gt;
&lt;th&gt;TokenCap task pack&lt;/th&gt;
&lt;th&gt;All matching files&lt;/th&gt;
&lt;th&gt;10 best-matching files&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Needed files present&lt;/td&gt;
&lt;td&gt;87%&lt;/td&gt;
&lt;td&gt;96%&lt;/td&gt;
&lt;td&gt;76%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Average tokens per task&lt;/td&gt;
&lt;td&gt;9,997&lt;/td&gt;
&lt;td&gt;382,258&lt;/td&gt;
&lt;td&gt;87,761&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Median saving vs. that baseline&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;td&gt;18.9×&lt;/td&gt;
&lt;td&gt;7.5×&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Note the first row. Reading every matching file finds the needed files more often than the pack does. We publish that next to the saving, not under it.&lt;/p&gt;

&lt;h3&gt;
  
  
  What changed in how we publish
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A CI job runs the benchmark and fails when needed-file recall, edit-line coverage, or the median saving drops below the thresholds in &lt;code&gt;tasks.json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The limits sit next to the numbers: no model is called, grepping everything finds more, small repositories gain little, and the median is quoted because the mean (34.2×) is pulled up by the large repository.&lt;/li&gt;
&lt;li&gt;The old script and its result file stay in &lt;code&gt;benchmarks/&lt;/code&gt;, for the record only.&lt;/li&gt;
&lt;li&gt;Before the v3.1 retrieval changes, the first three repositories scored 25% needed-file recall on this same benchmark. That earlier result set is kept in &lt;code&gt;benchmarks/fair/results/&lt;/code&gt; as well.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That 25% is the number I would point to if someone asked whether the rebuild was worth it. The old benchmark could never have shown it, because it never asked whether the right files were in the context at all.&lt;/p&gt;

&lt;p&gt;The full table and limits list are at tokencap.vansharora.app&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devtools</category>
      <category>vscode</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Announcing TokenCap: The Local-First Context Layer for AI Coding Agents</title>
      <dc:creator>VANSH ARORA</dc:creator>
      <pubDate>Thu, 22 Oct 2026 18:07:15 +0000</pubDate>
      <link>https://dev.to/vansharora21/announcing-tokencap-the-local-first-context-layer-for-ai-coding-agents-3a53</link>
      <guid>https://dev.to/vansharora21/announcing-tokencap-the-local-first-context-layer-for-ai-coding-agents-3a53</guid>
      <description>&lt;p&gt;Today, we are officially launching TokenCap: a zero-network-egress repository intelligence platform designed for developers building and pairing with AI coding agents.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is TokenCap?
&lt;/h3&gt;

&lt;p&gt;TokenCap bridges the gap between raw source code and LLM context windows. Instead of blindly dumping full files or relying on fuzzy text search, TokenCap parses your codebase into an AST symbol graph, clusters modules, and budgets context deterministically.&lt;/p&gt;

&lt;h3&gt;
  
  
  Core Verified Benchmarks and Capabilities
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;12.2x Token Reduction: Compresses typical 150k-token repository payloads down to 12.5k tokens without dropping critical call signatures.&lt;/li&gt;
&lt;li&gt;Even-Span Sampling: Proportional sampling across file heads, bodies, and exports that eliminates line-300 cutoffs.&lt;/li&gt;
&lt;li&gt;Spatial Impact Analysis: &lt;code&gt;tokencap ask impact &amp;lt;file&amp;gt;:&amp;lt;symbol&amp;gt;&lt;/code&gt; calculates caller blast radius and risk before an agent modifies code.&lt;/li&gt;
&lt;li&gt;The Four Sovereignty Laws: Zero runtime network egress, zero API keys, no compilation build steps, and under 4 dependencies.&lt;/li&gt;
&lt;li&gt;Multi-Surface Availability:

&lt;ul&gt;
&lt;li&gt;CLI: &lt;code&gt;npx tokencap make&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;VS Code Extension: Auto-capture and spatial menus&lt;/li&gt;
&lt;li&gt;Local Bridge &amp;amp; Companion: Direct loopback injection into ChatGPT, Claude, and Gemini&lt;/li&gt;
&lt;li&gt;Agent Skill: Native discovery for OpenCode, Claude Code, Cursor, and Antigravity&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Quick Start
&lt;/h3&gt;

&lt;p&gt;Install globally or run directly with npx:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Generate your repository intelligence snapshot&lt;/span&gt;
npx tokencap make

&lt;span class="c"&gt;# Start the local loopback bridge for browser companions&lt;/span&gt;
npx tokencap serve &lt;span class="nt"&gt;--daemon&lt;/span&gt;

&lt;span class="c"&gt;# Query the blast radius of a function&lt;/span&gt;
npx tokencap ask impact src/auth.js:verifyToken
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explore the documentation, read the architecture specs, and install the extensions at tokencap.vansharora.app&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devtools</category>
      <category>vscode</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How We Packaged TokenCap as a Self-Discoverable Agent Skill</title>
      <dc:creator>VANSH ARORA</dc:creator>
      <pubDate>Thu, 22 Oct 2026 12:13:04 +0000</pubDate>
      <link>https://dev.to/vansharora21/how-we-packaged-tokencap-as-a-self-discoverable-agent-skill-5329</link>
      <guid>https://dev.to/vansharora21/how-we-packaged-tokencap-as-a-self-discoverable-agent-skill-5329</guid>
      <description>&lt;p&gt;When onboarding a new software engineer, you provide onboarding documentation. When onboarding an AI agent, developers often rely on ad-hoc prompts or complex custom scripts that break across different platforms.&lt;/p&gt;

&lt;p&gt;With the TokenCap Agent Skill system in &lt;code&gt;skills/tokencap/&lt;/code&gt;, any agent supporting open skill standards can discover, query, and respect repository intelligence without prior manual setup.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Skill Specification
&lt;/h3&gt;

&lt;p&gt;The skill is built around three standard files:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;SKILL.md&lt;/code&gt;: Root declaration with YAML frontmatter, trigger conditions, and high-level workflows.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;reference/commands.md&lt;/code&gt;: Exact CLI and MCP commands for snapshot generation, impact analysis, and refactoring.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;reference/workflows.md&lt;/code&gt;: Step-by-step playbooks for PR review, onboarding to unfamiliar codebases, and blast-radius audits.&lt;/li&gt;
&lt;/ol&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>ai</category>
      <category>devtools</category>
      <category>vscode</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Why AI Context Packs Must Adapt Dynamically to Target Model Economics</title>
      <dc:creator>VANSH ARORA</dc:creator>
      <pubDate>Thu, 22 Oct 2026 08:46:40 +0000</pubDate>
      <link>https://dev.to/vansharora21/why-ai-context-packs-must-adapt-dynamically-to-target-model-economics-369</link>
      <guid>https://dev.to/vansharora21/why-ai-context-packs-must-adapt-dynamically-to-target-model-economics-369</guid>
      <description>&lt;p&gt;Different LLMs have wildly different context windows and cost economics. Providing a generic 20k-token context pack is wasteful for smaller models and insufficient for massive 200k+ models.&lt;/p&gt;

&lt;p&gt;In TokenCap, we implemented model-aware budgeting in &lt;code&gt;src/bridge/generate.js&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Token Allocations Adjust
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;gpt-4o&lt;/code&gt; (Target: ~16k to 32k tokens): Balanced span sampling, key symbol definitions, priority diffs, and compressed helper functions.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;claude-3-5-sonnet&lt;/code&gt; (Target: ~32k to 64k tokens): Extended call-chain depths, full component prop interfaces, and complete ADR documentation.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;gemini-1.5-pro&lt;/code&gt; (Target: ~100k+ tokens): Deep repository breadth, full implementation bodies across related clusters, and complete test suites.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;llama-3-8b&lt;/code&gt; / Local Models (Target: ~4k to 8k tokens): Aggressive even-span folding, signatures only, zero diffs, highest Louvain cluster focus.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Selecting Profiles via CLI or Bridge
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Generate context tailored specifically for Claude 3.5 Sonnet&lt;/span&gt;
tokencap make &lt;span class="nt"&gt;--profile&lt;/span&gt; claude-3-5-sonnet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CLI Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Loaded model profile: claude-3-5-sonnet
Token budget ceiling: 64,000 tokens
Allocated:
  - Architecture and graph overview: 2,400 tokens
  - Core targeted symbols: 18,200 tokens
  - Transitive caller bodies: 14,800 tokens
  - Active ADRs and memory: 1,600 tokens
Total Generated: 37,000 tokens (58% of ceiling, 0% overflow risk)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The bridge passes these model hints automatically when queries arrive from our Chrome companion or MCP server.&lt;/p&gt;

&lt;p&gt;Read the model profiling guide at tokencap.vansharora.app&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devtools</category>
      <category>vscode</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How We Refactored a 2,400-Line CLI Monolith into 7 Core Verbs Without Breaking Changes</title>
      <dc:creator>VANSH ARORA</dc:creator>
      <pubDate>Wed, 21 Oct 2026 18:11:36 +0000</pubDate>
      <link>https://dev.to/vansharora21/how-we-refactored-a-2400-line-cli-monolith-into-7-core-verbs-without-breaking-changes-1mgf</link>
      <guid>https://dev.to/vansharora21/how-we-refactored-a-2400-line-cli-monolith-into-7-core-verbs-without-breaking-changes-1mgf</guid>
      <description>&lt;p&gt;As TokenCap expanded from a simple repository snapshot generator to a full intelligence engine with graphs, memory loops, and security scanners, our CLI sprawled out of control. We had 21 distinct commands in a single 2,455-line &lt;code&gt;bin/tokencap.js&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;To fix this, we completed a major CLI refactoring around 7 core verbs.&lt;/p&gt;

&lt;h3&gt;
  
  
  The 7 Core Verbs Hierarchy
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;make&lt;/code&gt; (&lt;code&gt;src/cli/make.js&lt;/code&gt;): Snapshot generation, watch mode, custom budgeting profiles.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ask&lt;/code&gt; (&lt;code&gt;src/cli/ask.js&lt;/code&gt;): Spatial queries (&lt;code&gt;ask impact&lt;/code&gt;, &lt;code&gt;ask dead-code&lt;/code&gt;, &lt;code&gt;ask adr&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;analyze&lt;/code&gt; (&lt;code&gt;src/cli/analyze.js&lt;/code&gt;): Repo audits (&lt;code&gt;analyze health&lt;/code&gt;, &lt;code&gt;analyze debt&lt;/code&gt;, &lt;code&gt;analyze security&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;serve&lt;/code&gt; (&lt;code&gt;src/cli/serve.js&lt;/code&gt;): Background daemons (&lt;code&gt;serve --daemon&lt;/code&gt;, &lt;code&gt;serve --mcp&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;update&lt;/code&gt; (&lt;code&gt;src/cli/update.js&lt;/code&gt;): In-place upgrades.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;help&lt;/code&gt; &amp;amp; &lt;code&gt;version&lt;/code&gt;: System introspection.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Silent Alias Strategy
&lt;/h3&gt;

&lt;p&gt;To guarantee that existing scripts and CI workflows did not break:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// bin/tokencap.js excerpt&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ALIASES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;graph&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ask&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;impact&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;capsule&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;make&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;security&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;analyze&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;security&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;health&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;analyze&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;health&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;mcp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;serve&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;--mcp&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;normalizedArgs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;resolveAliases&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The dispatcher shrank from 2,455 lines down to 234 lines of clean routing logic, with handlers decoupled into modular, testable files in &lt;code&gt;src/cli/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Inspect the CLI architecture at tokencap.vansharora.app&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devtools</category>
      <category>vscode</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How TokenCap Eliminates Context Query Latency with Background Pre-Warming</title>
      <dc:creator>VANSH ARORA</dc:creator>
      <pubDate>Wed, 21 Oct 2026 12:09:36 +0000</pubDate>
      <link>https://dev.to/vansharora21/how-tokencap-eliminates-context-query-latency-with-background-pre-warming-omg</link>
      <guid>https://dev.to/vansharora21/how-tokencap-eliminates-context-query-latency-with-background-pre-warming-omg</guid>
      <description>&lt;p&gt;When integrating browser companions or IDE extensions with a local intelligence bridge, latency matters. If generating prompt context takes 4 or 5 seconds, developers stop using the integration.&lt;/p&gt;

&lt;p&gt;To deliver sub-second responses, TokenCap implements background cache pre-warming in &lt;code&gt;src/bridge/warmCache.js&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Pre-Warming Operates
&lt;/h3&gt;

&lt;p&gt;When you run &lt;code&gt;tokencap serve&lt;/code&gt;, the HTTP server begins listening immediately. While the pairing handshake occurs, an asynchronous worker kicks off:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Graph Pre-Compilation: Traverses all files and loads AST symbol tables into memory.&lt;/li&gt;
&lt;li&gt;Memory and ADR Indexing: Loads active session records and architecture decisions into RAM.&lt;/li&gt;
&lt;li&gt;Git Diff Snapshotting: Caches uncommitted working tree diffs and affected symbols.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/bridge/warmCache.js logic&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;preWarmBridgeContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;repoRoot&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;setImmediate&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Builds query-independent artifacts concurrently&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;graph&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getOrBuildGraph&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;repoRoot&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;memory&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;loadActiveMemory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;repoRoot&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;diff&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;computeWorkingDiff&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;repoRoot&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;bridgeCache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;repoRoot&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;graph&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;diff&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Response Time Comparison
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Cold Generation (No Pre-Warm): 1,840ms&lt;/li&gt;
&lt;li&gt;With Pre-Warmed Cache: 180ms (10x faster first-click response)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When the Chrome Companion requests task-scoped context via &lt;code&gt;POST /generate&lt;/code&gt;, TokenCap slices the pre-warmed graph and formats the prompt payload almost instantaneously.&lt;/p&gt;

&lt;p&gt;Documentation available at tokencap.vansharora.app&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devtools</category>
      <category>vscode</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How We Built an Atomic, Sharded Incremental Cache with 57ms Rebuild Times</title>
      <dc:creator>VANSH ARORA</dc:creator>
      <pubDate>Tue, 20 Oct 2026 18:04:41 +0000</pubDate>
      <link>https://dev.to/vansharora21/how-we-built-an-atomic-sharded-incremental-cache-with-57ms-rebuild-times-5fb</link>
      <guid>https://dev.to/vansharora21/how-we-built-an-atomic-sharded-incremental-cache-with-57ms-rebuild-times-5fb</guid>
      <description>&lt;p&gt;When building a local-first repository intelligence engine, speed is everything. A cold build on a 100k-file benchmark can take 45 to 55 seconds. But during active coding, developers expect instantaneous updates when saving a file.&lt;/p&gt;

&lt;p&gt;In TokenCap, we implemented an atomic sharded incremental cache in &lt;code&gt;src/incremental/cacheManager.js&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cache Architecture and Integrity Guarantees
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Atomic Sharding: Instead of a monolithic cache file, intelligence graphs are sharded into modular JSON blocks keyed by file path hashes.&lt;/li&gt;
&lt;li&gt;Content-Based Checksums: Cache validity is verified via SHA-256 checksums rather than volatile filesystem mtimes.&lt;/li&gt;
&lt;li&gt;Version Guard: Any version mismatch between the running TokenCap binary and stored cache forces an automatic, safe cold rebuild instead of mis-reading stale schemas.&lt;/li&gt;
&lt;li&gt;Scoped Invalidation: When &lt;code&gt;src/auth.js&lt;/code&gt; changes, TokenCap only re-parses &lt;code&gt;auth.js&lt;/code&gt; and updates direct incoming and outgoing graph edges.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Benchmark Numbers
&lt;/h3&gt;

&lt;p&gt;On our benchmark repository of 1,200 files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cold Build (Zero Cache): 1.14s&lt;/li&gt;
&lt;li&gt;Warm Full Rebuild: 290ms&lt;/li&gt;
&lt;li&gt;Scoped Incremental Build (1 File Edit): 57ms
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Watch mode with sub-60ms incremental rebuilds&lt;/span&gt;
tokencap make &lt;span class="nt"&gt;--watch&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Watching for changes (rebuild after 300ms idle)...
✓ Change detected in src/auth/jwt.js
✓ Invalidation scope: 1 file, 4 affected callers
✓ Rebuilt incremental snapshot in 57ms (.tokencap/snapshot.md)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because rebuilds take under 60ms, the VS Code extension auto-captures on save without interrupting typing cadence.&lt;/p&gt;

&lt;p&gt;Explore the caching implementation at tokencap.vansharora.app&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devtools</category>
      <category>vscode</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
