<?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: Krish Verma</title>
    <description>The latest articles on DEV Community by Krish Verma (@krish_verma_77e28d3fd63ca).</description>
    <link>https://dev.to/krish_verma_77e28d3fd63ca</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%2F3710608%2F08842ad2-8dfd-4b6a-ae46-060bdd4a055d.png</url>
      <title>DEV Community: Krish Verma</title>
      <link>https://dev.to/krish_verma_77e28d3fd63ca</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/krish_verma_77e28d3fd63ca"/>
    <language>en</language>
    <item>
      <title>How I built a skill scaffolder for my desktop AI companion: 3 questions, 20 tests, and a registry two installers can't corrupt</title>
      <dc:creator>Krish Verma</dc:creator>
      <pubDate>Thu, 26 Nov 2026 10:27:34 +0000</pubDate>
      <link>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-a-skill-scaffolder-for-my-desktop-ai-companion-3-questions-20-tests-and-a-registry-40m9</link>
      <guid>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-a-skill-scaffolder-for-my-desktop-ai-companion-3-questions-20-tests-and-a-registry-40m9</guid>
      <description>&lt;h1&gt;
  
  
  How I built a skill scaffolder for my desktop AI companion: 3 questions, 20 tests, and a registry two installers can't corrupt
&lt;/h1&gt;

&lt;p&gt;Ankita AI is the desktop AI assistant I build, by Krish Verma — a little companion that lives on your desktop and gets things done while you're away. Its skills are folders with a &lt;code&gt;SKILL.md&lt;/code&gt; inside, and writing one by hand means remembering the folder layout, the frontmatter rules, the permission manifest, and the offline fixture — get any of it wrong and the skill installs but never loads, which is worse than no skill at all. So I built &lt;code&gt;ankita new skill&lt;/code&gt;: it asks three questions and writes a skill that loads on the first try.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three questions, one folder
&lt;/h2&gt;

&lt;p&gt;The command is &lt;code&gt;node chat.mjs new skill&lt;/code&gt;, and it asks for a name, a permission list, and one example input — or one line for scripts: &lt;code&gt;node chat.mjs new skill explain-log --permissions files --example "Explain this log"&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Every answer is validated before anything is written. The name has to match the skill-name regex — lowercase letters, digits and hyphens. Permissions must come from the four known kinds in &lt;code&gt;src/skills/layout.mjs&lt;/code&gt;: &lt;code&gt;files&lt;/code&gt;, &lt;code&gt;network&lt;/code&gt;, &lt;code&gt;shell&lt;/code&gt;, &lt;code&gt;browser&lt;/code&gt;. The example has to be 1–200 characters, because it becomes the skill's description and the parser caps descriptions. An invalid name, an unknown permission, or an empty example fails before a single folder is created.&lt;/p&gt;

&lt;p&gt;A successful scaffold writes five things into &lt;code&gt;skills/&amp;lt;name&amp;gt;/&lt;/code&gt;: the &lt;code&gt;SKILL.md&lt;/code&gt; itself, a &lt;code&gt;plugin.json&lt;/code&gt; manifest carrying the permission declaration, a short documentation file, and a &lt;code&gt;fixtures/&lt;/code&gt; directory holding a &lt;code&gt;skill.json&lt;/code&gt; input and the expected rendered output. If anything fails halfway through, the scaffolder rolls back the folder it exclusively created, so a failed install never leaves a half-written skill behind.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fixture is the contract
&lt;/h2&gt;

&lt;p&gt;The fixture is the part I care about most. Every scaffolded skill ships with an offline golden fixture: the expected file is the exact output of &lt;code&gt;renderSkill()&lt;/code&gt; on the skill that was just written. A skill can be checked without a model call and without a network call — the loader renders the skill, compares it against the fixture, and a mismatch fails loudly instead of loading something subtly different from what the author wrote.&lt;/p&gt;

&lt;p&gt;This runs before login and makes no model or network call at all. The permission declarations describe intent; they do not enforce a runtime sandbox and they do not replace tool approvals. I say that in the scaffolded documentation file itself, because a manifest that looks like a sandbox and isn't one is a trap.&lt;/p&gt;

&lt;h2&gt;
  
  
  The registry bug: two installers, one lost root
&lt;/h2&gt;

&lt;p&gt;Registration was the hard half. A skill installed to a custom directory — &lt;code&gt;--directory&lt;/code&gt; — has to be discoverable by the chat, by &lt;code&gt;/skills&lt;/code&gt;, by the skill tool, and by the desktop app, including after a restart. The first version did the obvious thing: a single &lt;code&gt;skill-roots.json&lt;/code&gt; registry file that each installer read, appended to, and rewrote.&lt;/p&gt;

&lt;p&gt;A review of PR #54 caught the failure. The CLI reported success for a custom root while the default catalogue returned no new skills — the install and the discovery disagreed. Worse, a deterministic two-process filesystem repro showed the classic lost update: two installers reading the same registry at the same time ended up with only root &lt;code&gt;one&lt;/code&gt; present instead of &lt;code&gt;one&lt;/code&gt; and &lt;code&gt;two&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The fix, in &lt;code&gt;src/skills/roots.mjs&lt;/code&gt;, stops sharing a single file. Registrations are now append-only records in a sibling &lt;code&gt;skill-roots.json.d&lt;/code&gt; directory: each install writes one UUID-named JSON record with the canonical root path and a timestamp, using an atomic write. Readers merge the legacy &lt;code&gt;skill-roots.json&lt;/code&gt; file — still readable, never rewritten — with every completed &lt;code&gt;.json&lt;/code&gt; record, sorted by registration time. Temporary writes are excluded from discovery, malformed records are diagnosed without hiding the bundled skills, and sequential registrations are idempotent because the reader dedupes by path.&lt;/p&gt;

&lt;p&gt;The numbers: the focused scaffold and loader suite passed 20/20, including the two-process repro and the blocked-records-directory case; the root-registration suite passed 10/10 and the contribution checks 11/11. The published 2.6.0 Windows executable was audited for real: two CLI installations registered an external folder, the packaged app listed both skills alongside all six bundled ones — &lt;code&gt;catalogSize=8&lt;/code&gt; — delivered all eight instruction bodies into nine captured model requests, and found the same catalogue after a full restart.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest limits
&lt;/h2&gt;

&lt;p&gt;Three gaps stay open. First, the permission declarations are advisory — a skill that declares &lt;code&gt;files&lt;/code&gt; gets no sandbox from that declaration; the approval gate is still the enforcement boundary. Second, &lt;code&gt;find_tools(query="skills")&lt;/code&gt; advertises the skill reader but does not enumerate installed skill names and descriptions, so automatic skill selection in hosted ChatGPT is not established. Third, the failure-injection coverage is incomplete: the storage-failure repro uses a file occupying the records directory, but permission-denied and device-failure paths have not been separately injected.&lt;/p&gt;

&lt;h2&gt;
  
  
  The question
&lt;/h2&gt;

&lt;p&gt;Tell me I'm wrong: is a directory of UUID-named JSON records the right shape for a registry, or a lock file with extra steps? A single file with an exclusive-create lock would be simpler to inspect — but the two-process repro is exactly what killed the single-file version, and a lock only works if every writer honours it. Is the append-only directory the honest answer to concurrent installers, or just the version of the bug I haven't found yet?&lt;/p&gt;

&lt;p&gt;Ankita is open source (MIT) at &lt;a href="https://github.com/akyourowngames/A.N.K.I.T.A" rel="noopener noreferrer"&gt;github.com/akyourowngames/A.N.K.I.T.A&lt;/a&gt;, and the scaffolder lives in &lt;code&gt;src/skills/scaffold.mjs&lt;/code&gt; and &lt;code&gt;src/skills/roots.mjs&lt;/code&gt;. The project site is &lt;a href="https://ankita-sable.vercel.app" rel="noopener noreferrer"&gt;ankita-sable.vercel.app&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;— Krish Verma, creator of Ankita AI&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>ai</category>
      <category>showdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How I built one-time browser pairing for my desktop AI companion: 73 tests, 0 repeated prompts, and a click that can never replay</title>
      <dc:creator>Krish Verma</dc:creator>
      <pubDate>Wed, 25 Nov 2026 10:29:03 +0000</pubDate>
      <link>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-one-time-browser-pairing-for-my-desktop-ai-companion-73-tests-0-repeated-prompts-and-6a0</link>
      <guid>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-one-time-browser-pairing-for-my-desktop-ai-companion-73-tests-0-repeated-prompts-and-6a0</guid>
      <description>&lt;h1&gt;
  
  
  How I built one-time browser pairing for my desktop AI companion: 73 tests, 0 repeated prompts, and a click that can never replay
&lt;/h1&gt;

&lt;p&gt;Ankita AI is the desktop AI assistant I build — a little companion, a lot more possible — by Krish Verma. It can already drive a browser, but until recently every session started the same way: connect, answer the prompt, work, close everything, repeat tomorrow. The browser tools worked. The pairing did not survive anything. The fix: pair once, let Ankita use my signed-in browser without asking again — and make sure a click can never fire twice because a connection dropped.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem: the prompt was the feature
&lt;/h2&gt;

&lt;p&gt;The old path built a Chrome DevTools command with &lt;code&gt;--autoConnect&lt;/code&gt; and told the user Chrome asks each time. That is honest, but it is a tax on every session — and a remote-debugging port needs a non-default data directory from Chrome 136 onwards, so it cannot deliver "use my existing signed-in profile" at all. The extension route can: the debugger API gives an extension a DevTools transport without a debugging port, and the scripting API covers ordinary DOM work. So the design question was not "which transport?" but "what survives a restart?" The answer: the pairing identity and credential persist on both sides, while transport sessions and request IDs stay separate from that identity. A restarted process authenticates with a fresh session using the existing grant. Desktop close, browser close, worker suspension, transport loss — disconnections, not revocations. They must never delete the pairing or open another prompt.&lt;/p&gt;

&lt;h2&gt;
  
  
  The grant, the session, and the alarm
&lt;/h2&gt;

&lt;p&gt;The whole wire policy lives in one file, &lt;code&gt;desktop/browser-helper/control-protocol.mjs&lt;/code&gt;. The pairing lives under &lt;code&gt;CONTROL_SESSION_KEY = 'pairedDesktop'&lt;/code&gt; in extension-private storage, so it survives worker and browser restarts. The reconnect loop, &lt;code&gt;BrowserConnection&lt;/code&gt; in &lt;code&gt;desktop/browser-helper/connection.mjs&lt;/code&gt;, says the quiet part out loud in its own comment: "Reconnects transport sessions, never browser commands."&lt;/p&gt;

&lt;p&gt;The numbers that shape the loop:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;1,500 ms&lt;/strong&gt; initial retry, doubling to a &lt;strong&gt;30,000 ms&lt;/strong&gt; cap while the desktop is closed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;0.5 minutes&lt;/strong&gt; (Chrome's minimum alarm interval) to wake a suspended worker&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;20,000 ms&lt;/strong&gt; long poll, under the extension fetch/worker idle deadline&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;30,000 ms&lt;/strong&gt; bound on any page command, and a command is never retried once delivered&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;32&lt;/strong&gt; pending commands maximum — a bounded mailbox, not a replay queue&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;3 MB&lt;/strong&gt; maximum result, including a base64 screenshot&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Explicit Disconnect pauses automatic reconnect until the user chooses Connect again — no new pairing needed. Explicit Unpair/Revoke removes the saved grant and requires a new pairing. The two actions are labelled distinctly. And if access is removed, the transport outage never deletes the pairing: the status becomes &lt;code&gt;browser_access_removed&lt;/code&gt; with the shared recovery line "Browser access removed. Pair with Ankita again."&lt;/p&gt;

&lt;h2&gt;
  
  
  DOM first, debugger only when the job needs it
&lt;/h2&gt;

&lt;p&gt;Ordinary operations — open, navigate, snapshot, read, act, fill a form, screenshot — go through packaged extension code. The debugger is reserved for trusted input events, the page accessibility tree, background screenshots, and JavaScript dialogs. A synthetic DOM click is not a trusted input event, and I do not pretend otherwise.&lt;/p&gt;

&lt;p&gt;That split exists because of one rule: &lt;strong&gt;do not retry a mutating action through a second path after an uncertain result.&lt;/strong&gt; If a click was dispatched and the outcome is unknown, the code observes first — it never fires the click again through the debugger "just in case". A lost receipt must not cause the action to be dispatched twice, so the result POST is never retried. When the page changes, stale element references are invalidated and the model gets a plain instruction: "The page changed. Take a fresh snapshot before interacting." And when the connection drops mid-action: "Browser connection interrupted. A dispatched action may have completed; its outcome is uncertain. Inspect the page before continuing."&lt;/p&gt;

&lt;p&gt;Chrome's own notices stay visible. Cancelling the debugger warning detaches the session, and I treat that as a revocation — not a reason to immediately reattach.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the verification actually proved
&lt;/h2&gt;

&lt;p&gt;The focused serial integration run passed &lt;strong&gt;73 tests, 73 passed, 0 failed&lt;/strong&gt;, covering pairing persistence, cancelled command admission, site/ref/job guards, and both app entry points under the shipped CSP. A real extension trace against a dedicated Chromium profile reported &lt;code&gt;EXTENSION_LIVE_OK&lt;/code&gt;: one pairing, a DOM post and an Enter post exactly once each, a screenshot, restarts, pause/resume, and revoke recovery. The form received exactly two intended submissions in total, with no replay after restarts. The last shared-copy refactor rechecked &lt;strong&gt;16/16&lt;/strong&gt; broker/reconnect/actual-extension cases.&lt;/p&gt;

&lt;p&gt;Honest limits: the extension is loaded unpacked — no store distribution yet. Packaged desktop IPC, macOS/Linux/Edge acceptance, and the full test suite were not run for this change. The real-browser tests used a dedicated fixture profile, not my signed-in profile. Commands already sent before Stop cannot be undone, and uncertain receipts are not replayed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tell me I'm wrong
&lt;/h2&gt;

&lt;p&gt;DOM-first with debugger escalation means two execution paths to maintain, and the debugger path carries Chrome's warning banner. Would a single debugger-only path be simpler and more honest — one code path, one capability model, banner and all? Or is the split worth it, since most of what a companion does in a browser is ordinary reading, clicking, and typing? And on the strict side: treating Chrome's Cancel as a revocation is the safe call, but is it too strict when the user just fat-fingered the banner?&lt;/p&gt;

&lt;p&gt;The code is in the &lt;a href="https://github.com/akyourowngames/A.N.K.I.T.A" rel="noopener noreferrer"&gt;Ankita repo&lt;/a&gt; — &lt;code&gt;desktop/browser-helper/control-protocol.mjs&lt;/code&gt; and &lt;code&gt;connection.mjs&lt;/code&gt; are the two files to read first — and the project site is &lt;a href="https://ankita-sable.vercel.app" rel="noopener noreferrer"&gt;ankita-sable.vercel.app&lt;/a&gt;. If you have shipped an extension that survives restarts without nagging its user, where does your line sit?&lt;/p&gt;

&lt;p&gt;— Krish Verma, creator of Ankita AI&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>ai</category>
      <category>showdev</category>
      <category>security</category>
    </item>
    <item>
      <title>How I built memory that forgets on purpose: 90 days to stale, 365 to gone, and a pin that never expires</title>
      <dc:creator>Krish Verma</dc:creator>
      <pubDate>Tue, 24 Nov 2026 10:28:46 +0000</pubDate>
      <link>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-memory-that-forgets-on-purpose-90-days-to-stale-365-to-gone-and-a-pin-that-never-12gk</link>
      <guid>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-memory-that-forgets-on-purpose-90-days-to-stale-365-to-gone-and-a-pin-that-never-12gk</guid>
      <description>&lt;h1&gt;
  
  
  How I built memory that forgets on purpose: 90 days to stale, 365 to gone, and a pin that never expires
&lt;/h1&gt;

&lt;p&gt;Ankita AI is a desktop AI assistant by Krish Verma, and it remembers things about you — your preferences, your projects, the decisions you made last month. The problem with a companion that remembers everything is that it remembers everything &lt;em&gt;forever&lt;/em&gt;. A fact you stated once, a year ago, in a context that no longer exists, still arrives in the model's context with the same authority as something you said yesterday. The assistant doesn't know it's stale. It just asserts it.&lt;/p&gt;

&lt;p&gt;So I gave Ankita's memory an expiry date — two of them, actually — and a rule that nothing is ever deleted.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two windows, not a delete button
&lt;/h2&gt;

&lt;p&gt;The design lives in two config values in &lt;code&gt;src/core/config.mjs&lt;/code&gt;:&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="n"&gt;memoryStaleDays&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3650&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;posInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;pick&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"MEMORY_STALE_DAYS"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;90&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;memoryForgetDays&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3650&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;posInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;pick&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"MEMORY_FORGET_DAYS"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;365&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;A fact untouched for 90 days is &lt;strong&gt;stale&lt;/strong&gt;: it sinks to the bottom of recall results and is filtered out of default recall entirely. A fact untouched for 365 days is past the &lt;strong&gt;forget window&lt;/strong&gt;: it drops out of normal results altogether. Both windows are configurable with env vars, both are capped at 3,650 days (ten years), and both can be turned off by setting them to 0.&lt;/p&gt;

&lt;p&gt;The important part: neither window deletes anything. A stale fact is still on disk, still in the store, and one explicit flag — &lt;code&gt;includeStale&lt;/code&gt; on the &lt;code&gt;recall&lt;/code&gt; tool — brings it back. The comment above the filter says it plainly: "Old, rarely recalled facts sink but are never deleted; only an explicit ask returns them."&lt;/p&gt;

&lt;h2&gt;
  
  
  What counts as "touched"
&lt;/h2&gt;

&lt;p&gt;Staleness is decided by &lt;code&gt;isStale()&lt;/code&gt; in &lt;code&gt;src/memory/memory-similarity.mjs&lt;/code&gt;:&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;isStale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fact&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;staleDays&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&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="o"&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="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;fact&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;fact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;always&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Pins are deliberate and permanent.&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;days&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;staleDays&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;days&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;at&lt;/span&gt; &lt;span class="o"&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;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lastRecalledAt&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;fact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;updatedAt&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;fact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;createdAt&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;at&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="kc"&gt;false&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;now&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;at&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;days&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;86400000&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;Three decisions are doing the work here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pins never go stale.&lt;/strong&gt; A fact marked &lt;code&gt;always&lt;/code&gt; is deliberate and permanent — the user chose to pin it, so silence doesn't erode it. Everything else ages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The clock is last recall, not last edit.&lt;/strong&gt; The timestamp is &lt;code&gt;lastRecalledAt&lt;/code&gt;, falling back to &lt;code&gt;updatedAt&lt;/code&gt;, then &lt;code&gt;createdAt&lt;/code&gt;. A fact you keep using stays fresh because you keep using it — recall &lt;em&gt;is&lt;/em&gt; the ageing signal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The threshold is a hard line, not a decay.&lt;/strong&gt; Past 90 days, the fact is stale. There is no "a bit stale" — the flag is binary, one comparison against &lt;code&gt;days * 86400000&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Recall refreshes the clock — but only for what you actually saw
&lt;/h2&gt;

&lt;p&gt;Every fact in the store carries &lt;code&gt;lastRecalledAt&lt;/code&gt; and a &lt;code&gt;recallCount&lt;/code&gt;, and recall updates both through &lt;code&gt;touchRecalled()&lt;/code&gt; in &lt;code&gt;src/memory/profile.mjs&lt;/code&gt;. Two details matter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One batched write.&lt;/strong&gt; A recall can touch many facts, but the store writes once, not once per fact. The ageing signal is bookkeeping; it shouldn't cost a write per row.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Only rows the caller actually received get touched.&lt;/strong&gt; The model can't keep a fact alive by searching for something else. And if the calling context is read-only — a read-only subagent, for instance — the touch is skipped entirely. The comment in &lt;code&gt;tools/personal/recall.mjs&lt;/code&gt; is explicit: "recall is advertised readOnly, and a read-only subagent must stay read-only: the ageing signal is bookkeeping, never worth violating that contract."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The ageing signal also surfaces to the model. Each recall row carries its &lt;code&gt;confidence&lt;/code&gt;, its &lt;code&gt;conflictsWith&lt;/code&gt; list, and its &lt;code&gt;stale&lt;/code&gt; flag, and stale rows sort last in every ranking — semantic or lexical. The system prompt even counts them: the personal-memory block in &lt;code&gt;src/core/agent.mjs&lt;/code&gt; reads "Personal memory store: N saved fact(s), M stale" so the model knows the store has entries it shouldn't trust blindly. And the automatic context builder, &lt;code&gt;personalMemoryContext()&lt;/code&gt;, searches project notes and decisions too, not just personal facts, inside a 1,600-character budget — so a stale personal preference doesn't crowd out a fresh project decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Confidence doesn't age. That's the part I'm least sure about.
&lt;/h2&gt;

&lt;p&gt;Every fact also carries a &lt;code&gt;confidence&lt;/code&gt; from 0 to 1. The default is 1, with a comment that says why: "A direct user statement is treated as certain." Confidence is clamped on write, returned on every recall row, and otherwise left alone.&lt;/p&gt;

&lt;p&gt;That means confidence never decays. A fact you stated once, confidently, a year ago keeps confidence 1 right up to the day it goes stale — and then the binary flag takes over. The number says "certain" while the flag says "don't use this." I chose the binary flag over a decay curve because a decaying number would silently downgrade the user's own words without telling them, and a number that drifts is harder to argue with than a flag you can see. But I'm not convinced the split is right: the confidence is the model's evidence about &lt;em&gt;how sure the fact is&lt;/em&gt;, and age is evidence about &lt;em&gt;whether it's still true&lt;/em&gt;. Right now the two never meet.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The two windows run on different clocks.&lt;/strong&gt; Staleness keys on last recall (&lt;code&gt;lastRecalledAt&lt;/code&gt;), but the 365-day forget window keys on last edit — &lt;code&gt;withinForgetWindow()&lt;/code&gt; in &lt;code&gt;recall.mjs&lt;/code&gt; compares &lt;code&gt;row.at&lt;/code&gt;, which is &lt;code&gt;updatedAt&lt;/code&gt;. A fact you recall every week but never edit still drops out of normal results a year after its last edit. That may be the right behaviour — a year without an edit is a year without the user reaffirming it — but the two windows disagreeing about what "touched" means is an inconsistency I haven't resolved, and I can see the argument that the forget window should use the same clock as the stale window.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stale is binary.&lt;/strong&gt; There is no gradient between fresh and stale, no "probably outdated" — a fact is either in play or it isn't. A gradient would be more honest about how memory actually fades, but it would also be a number the model could quietly round down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recall is the only thing that refreshes the clock.&lt;/strong&gt; If the model never recalls a fact, it ages even if the user still holds it. The store can't know what the user still believes; it only knows what the assistant has surfaced.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ankita is open source at &lt;a href="https://github.com/akyourowngames/A.N.K.I.T.A" rel="noopener noreferrer"&gt;https://github.com/akyourowngames/A.N.K.I.T.A&lt;/a&gt;, and the site is &lt;a href="https://ankita-sable.vercel.app" rel="noopener noreferrer"&gt;https://ankita-sable.vercel.app&lt;/a&gt;. The memory code is in &lt;code&gt;src/memory/&lt;/code&gt; and &lt;code&gt;tools/personal/recall.mjs&lt;/code&gt; if you want to check the two windows against the code.&lt;/p&gt;

&lt;p&gt;Tell me I'm wrong: is 90 days of silence the right line for "forgotten", or should a fact the user stated once — confidence 1, their own words — never go stale on its own? And should confidence decay with age, or is a binary flag the honest shape — a fact is either in play or it isn't?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;— Krish Verma, creator of Ankita AI&lt;/em&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>ai</category>
      <category>showdev</category>
      <category>privacy</category>
    </item>
    <item>
      <title>How I built a voice stream that stops instead of repeating itself: 2,000-char chunks, 1 read-ahead sentence, 0 replays</title>
      <dc:creator>Krish Verma</dc:creator>
      <pubDate>Mon, 23 Nov 2026 10:28:34 +0000</pubDate>
      <link>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-a-voice-stream-that-stops-instead-of-repeating-itself-2000-char-chunks-1-read-ahead-867</link>
      <guid>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-a-voice-stream-that-stops-instead-of-repeating-itself-2000-char-chunks-1-read-ahead-867</guid>
      <description>&lt;h1&gt;
  
  
  How I built a voice stream that stops instead of repeating itself: 2,000-char chunks, 1 read-ahead sentence, 0 replays
&lt;/h1&gt;

&lt;p&gt;Ankita AI is a desktop AI assistant by Krish Verma, and it speaks its progress reports out loud. That sounds simple until the network drops mid-sentence. The obvious fix — just play the sentence again — is worse than the failure: the listener hears the same sentence twice and has no way to tell which copy is real. So the stream is built to die loudly instead of repeating itself. This is how that boundary works, and the one place it is still silent.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rule: only a capability failure may fall back
&lt;/h2&gt;

&lt;p&gt;The streaming path starts in &lt;code&gt;prepareVoiceStreamClip&lt;/code&gt; (&lt;code&gt;src/channels/voice-stream-clip.mjs&lt;/code&gt;). It asks the provider for exactly one chunk first, then pipes the iterator straight into the player's stdin. The fallback to a buffered clip is deliberately narrow: it fires only when the error carries the code &lt;code&gt;VOICE_STREAM_UNSUPPORTED&lt;/code&gt;, which the Sarvam path sets for HTTP 404, 405, 415, 422 and 501 — capability or model failures that happen before any audio exists. Auth and rate-limit failures are not in that set, and neither is a stream that dies after audio started.&lt;/p&gt;

&lt;p&gt;A mid-stream death throws. The iterator is closed, the controller aborts, and the sentence is never re-spoken. Only a clip that finishes cleanly gets cached (&lt;code&gt;cached = Buffer.concat(chunks)&lt;/code&gt; runs after the loop completes), so a half-played sentence can never come back as a replay later. The delivery object the player reports — &lt;code&gt;{mode, fallback, firstChunkMs}&lt;/code&gt; — carries the mode so the panel can show whether what you heard was streamed, buffered, or cached, instead of guessing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The queue: one sentence ahead, no second chances
&lt;/h2&gt;

&lt;p&gt;Playback is owned by &lt;code&gt;VoiceSpeechQueue&lt;/code&gt; (&lt;code&gt;src/automation/voice-speech-queue.mjs&lt;/code&gt;). Sentences are cut with &lt;code&gt;chunkSentences&lt;/code&gt; — 190 characters for the Groq path, up to 2,000 characters per Sarvam chunk — and the queue pre-fetches at most one following sentence while the current one plays, hiding its TTS latency under live audio. The pending backlog is capped at 24 clips.&lt;/p&gt;

&lt;p&gt;When a part fails, the queue's &lt;code&gt;pump()&lt;/code&gt; catches it and calls &lt;code&gt;onError&lt;/code&gt; — but only for non-abort errors. The entry is marked &lt;code&gt;unavailable&lt;/code&gt;, resolves as not played, and the queue moves on. There is no retry for a failed part: the &lt;code&gt;retry&lt;/code&gt; flag exists for reports interrupted by the user, not for synthesis that died. That is the whole point. A retry would need to know how much of the sentence already played, and the queue does not track that — so it refuses to guess.&lt;/p&gt;

&lt;p&gt;The measured cost of the design is small: first audio arrived in 491 ms on the 10 November re-verification, with the first chunk consumed 32 ms later. The numbers were single samples, not a benchmark, but they are the reason streaming was worth building at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the listener actually gets today
&lt;/h2&gt;

&lt;p&gt;Here is the honest limit, and it is the reason this article exists. When a stream dies mid-sentence, the error travels up through &lt;code&gt;onError&lt;/code&gt; into &lt;code&gt;fail(session, error)&lt;/code&gt; in &lt;code&gt;desktop/electron/voice.mjs&lt;/code&gt; — the failure is visible in the panel, but nothing is spoken. The listener hears half a sentence, then silence. Silence after half a sentence is easy to mistake for a pause, so they keep waiting for the rest.&lt;/p&gt;

&lt;p&gt;That gap came out of a thread on Ahmad Dogar's TTS-voices article, where he put it plainly: he'd rather the player say something short when the stream dies. He is right, and I am going with the spoken note. There is already a precedent in the same code — a stop word gets a spoken &lt;code&gt;Stopped.&lt;/code&gt; (&lt;code&gt;STOPPED_LINE&lt;/code&gt; in &lt;code&gt;desktop/electron/voice.mjs&lt;/code&gt;) — so a cut-off note would be a short fixed phrase through the same path, not a re-speak of the sentence. Re-speaking would reopen the double-play the whole design exists to prevent.&lt;/p&gt;

&lt;h2&gt;
  
  
  The open question
&lt;/h2&gt;

&lt;p&gt;The part still undecided is what the note should say. A fixed phrase — "That update got cut off" — is honest about what happened and costs nothing to generate. Naming the sentence that died would be more useful, but it means speaking text the listener already half-heard, through the same queue that just failed. Tell me I'm wrong: is a fixed short phrase enough when the listener already heard the first half, or should the note name what was lost?&lt;/p&gt;

&lt;p&gt;Ankita is open source at &lt;a href="https://github.com/akyourowngames/A.N.K.I.T.A" rel="noopener noreferrer"&gt;https://github.com/akyourowngames/A.N.K.I.T.A&lt;/a&gt;, and the site is &lt;a href="https://ankita-sable.vercel.app" rel="noopener noreferrer"&gt;https://ankita-sable.vercel.app&lt;/a&gt;. If you run spoken output anywhere — a voice assistant, a screen reader, a notification reader — how do you signal a cut-off stream without replaying it?&lt;/p&gt;

&lt;p&gt;— Krish Verma, creator of Ankita AI&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>ai</category>
      <category>showdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How I built spoken controls for my desktop AI companion: 7 phrases mean stop, and none of them cancels your task</title>
      <dc:creator>Krish Verma</dc:creator>
      <pubDate>Sun, 22 Nov 2026 10:27:31 +0000</pubDate>
      <link>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-spoken-controls-for-my-desktop-ai-companion-7-phrases-mean-stop-and-none-of-them-4c27</link>
      <guid>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-spoken-controls-for-my-desktop-ai-companion-7-phrases-mean-stop-and-none-of-them-4c27</guid>
      <description>&lt;p&gt;Say "stop" to a voice assistant and it should stop talking. It should not cancel the job it was telling you about, approve the thing waiting for approval, or decide you meant the shop down the road. Ankita AI, the open-source desktop AI assistant by Krish Verma, now has spoken controls that run without a single planner call — and the whole design is one rule: a control word only counts when it is the whole utterance.&lt;/p&gt;

&lt;p&gt;Ankita lives at &lt;a href="https://ankita-sable.vercel.app" rel="noopener noreferrer"&gt;ankita-sable.vercel.app&lt;/a&gt;, and the code is open source at &lt;a href="https://github.com/akyourowngames/A.N.K.I.T.A" rel="noopener noreferrer"&gt;github.com/akyourowngames/A.N.K.I.T.A&lt;/a&gt;. This is the story of the smallest feature that could still ruin your day if it misfires.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem: "stop" is a word, not a command
&lt;/h2&gt;

&lt;p&gt;Voice controls sit in the worst possible place: between a microphone and a to-do list. The assistant is reading a progress report aloud, and you say "stop". Three things could go wrong, and two of them are silent. The speech stops but the task keeps running with nobody watching it. Or the word "stop" inside a longer sentence — "stop by the store on the way home" — gets treated as an interruption and the report dies mid-sentence. Or "pause Spotify" gets swallowed as a control command instead of reaching the planner that actually knows what Spotify is.&lt;/p&gt;

&lt;p&gt;The usual fix is a substring match with a confidence threshold. I did not want a threshold. A threshold is a guess with a number on it, and a wrong guess here either kills work or ignores the user. So the controls are exact phrases, matched against the whole utterance, in a table. Nothing fuzzy, nothing scored.&lt;/p&gt;

&lt;h2&gt;
  
  
  The mechanism: a table of exact phrases
&lt;/h2&gt;

&lt;p&gt;Everything lives in &lt;code&gt;desktop/shared/voice.mjs&lt;/code&gt;, in three phrase sets. The matching is deliberately boring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;LOCAL_CONTROL_PHRASES&lt;/code&gt; — 18 phrases across five actions: resume ("continue", "continue speaking", "continue the report", "resume speaking", "resume the report"), repeat ("repeat that", "repeat the report", "say that again"), skip ("skip the report", "skip this report", "skip that report"), stop speaking ("stop speaking", "stop talking", "be quiet"), and pause ("pause listening", "pause the microphone", "mute the microphone", "mute your microphone").&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;VOICE_STOP_PHRASES&lt;/code&gt; — 7 whole-utterance stop phrases: "stop", "stop it", "stop that", "cancel", "cancel that", "never mind", "nevermind". The comment above the set says it plainly: a command that merely contains one of these words ("stop by the store") is not a stop, so matching is exact, not a search.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;VOICE_END_PHRASES&lt;/code&gt; — 9 phrases that end the voice session: "exit", "quit", "end", "end voice", "exit voice", "leave", "leave voice", "goodbye", "bye".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;voiceCommand()&lt;/code&gt; checks the end phrases first, then the stop phrases, then the local-control table. The wake word is a single lowercase token, &lt;code&gt;ankita&lt;/code&gt; — the only phrase that wakes standby listening. The phrase maps are exact vocabulary, not substring patterns, by design.&lt;/p&gt;

&lt;p&gt;Mixed requests never reach the table at all. "Pause Spotify" stays a normal planner request, because it names a target the controls do not own. A bare "continue" with nothing to continue also stays with the planner instead of guessing. The controls only fire when the utterance is one of theirs, in full.&lt;/p&gt;

&lt;h2&gt;
  
  
  The safety line: speech controls never touch tasks
&lt;/h2&gt;

&lt;p&gt;The sharpest line in the code is a comment on &lt;code&gt;VOICE_SPEECH_ACTIONS&lt;/code&gt;: "Separate speech control from task cancellation." Stopping speech is not stopping work, and the code treats them as different verbs in different layers.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;desktop/electron/voice-actions.mjs&lt;/code&gt; validates the action payload's shape and bounds, and the audio owner checks the session, the interruption turn, and that the report actually exists before anything happens. Speech controls never cancel a task and never approve pending work — that is stated as a rule in the implementation, not as a hope. A temporary microphone pause keeps the unfinished report around for the Resume microphone button, and suspended speech stays selectable ahead of other queued reports, so pausing mid-report does not lose your place.&lt;/p&gt;

&lt;p&gt;The panel got the same treatment: separate Stop speaking, Continue, Repeat, and Skip report controls, a truthful speaker-fallback and headphone-interruption message instead of a generic error, and an explicit hint when the microphone is paused. If the mic is paused, it cannot hear "resume" — and the UI says so rather than pretending otherwise.&lt;/p&gt;

&lt;h2&gt;
  
  
  What "local" actually means
&lt;/h2&gt;

&lt;p&gt;"Local" here means zero planner calls. Status reads the real voice jobs and results without asking the model anything; pause, stop, continue, repeat, and skip all run before delegation. A control that needs a model round trip is not a control, it is a request with a fast path.&lt;/p&gt;

&lt;p&gt;But I want to be honest about the word. Spoken controls still wait for the transcription service, and any new spoken status still needs speech synthesis. "Local" describes the decision, not the audio path. The finding doc records that plainly, and its confidence score for the whole change is 92 out of 100 — docked for exactly the things that were not tested: no physical microphone or headset trials, no packaged-desktop check, no full-repository suite run.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verification: 124 tests, 0 work cancellations
&lt;/h2&gt;

&lt;p&gt;The numbers that made me trust it: 124 out of 124 focused regression tests pass across the voice command, state, engine, UI, report-control, and speech-queue suites. 3 out of 3 renderer and service round trips pass, using real React components, injected microphone and speech synthesis, disk task receipts, and the actual speech queue — and the controls add zero planner calls. One spoken stop-and-continue integration test records exactly one original planner request while stop, continue, skip, and repeat operate on its real report, with zero work cancellations. Typecheck exits 0, and the whitespace gate passes.&lt;/p&gt;

&lt;p&gt;The regression story is the part I like most. Before the implementation, the focused checks were 1 pass and 3 fails: the local matcher did not exist, and a status question made a second planner request. After it, 4 out of 4. A queue-focus regression first failed because a queued report hid the Continue button; it passed once suspended reports were prioritised. The tests caught real behaviour, not just typos.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;p&gt;Speakers cannot hear interruptions during playback, so "stop" while audio is playing is a race the user loses. A paused microphone cannot hear "resume" — the button is the only way back. The vocabulary is English only; anything unmatched, or in another language, falls through to the normal planner. And the 124 tests are focused regressions, not a full-suite run on a packaged desktop.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tell me I'm wrong
&lt;/h2&gt;

&lt;p&gt;Exact-phrase matching is the laziest safe design I could ship: it understands "stop speaking" and nothing else. A substring matcher would understand "could you stop talking please" — and would also kill a report when you say "stop by the store on the way home". I chose the table because a missed control is a shrug and a wrong control is lost work. But maybe I have the asymmetry backwards: is a voice assistant that only understands seven ways to say "stop" actually controllable, or is it just a polite way of not listening?&lt;/p&gt;

&lt;p&gt;— Krish Verma, creator of Ankita AI&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>ai</category>
      <category>showdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How I built slash commands for my desktop AI companion: 15 actions, 4 guided stages, and a draft that survives the menu</title>
      <dc:creator>Krish Verma</dc:creator>
      <pubDate>Sat, 21 Nov 2026 10:26:55 +0000</pubDate>
      <link>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-slash-commands-for-my-desktop-ai-companion-15-actions-4-guided-stages-and-a-draft-3oei</link>
      <guid>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-slash-commands-for-my-desktop-ai-companion-15-actions-4-guided-stages-and-a-draft-3oei</guid>
      <description>&lt;h1&gt;
  
  
  How I built slash commands for my desktop AI companion: 15 actions, 4 guided stages, and a draft that survives the menu
&lt;/h1&gt;

&lt;p&gt;Ankita AI is the desktop AI assistant I build, by Krish Verma — a little companion that lives on your desktop and gets things done while you are away. For months its desktop app had a command palette and a chat box that did not know about each other. The palette could do everything; the composer could only type. So every action meant leaving the conversation, finding the right menu, and coming back. I built slash commands to close that gap: type &lt;code&gt;/&lt;/code&gt; at the start of a message and the app's real actions show up above the composer, searchable, keyboard-driven, and — the part that took the most care — without ever eating the text you had already typed.&lt;/p&gt;

&lt;p&gt;The menu is deliberately small. Fifteen commands, in five groups: Quick actions, Conversation, Workspace, Apps &amp;amp; settings, Skills. &lt;code&gt;/model&lt;/code&gt; switches the model, &lt;code&gt;/project&lt;/code&gt; picks a workspace, &lt;code&gt;/skill&lt;/code&gt; prepares a request with an installed skill, plus &lt;code&gt;/schedule&lt;/code&gt;, &lt;code&gt;/review&lt;/code&gt;, &lt;code&gt;/projects&lt;/code&gt;, &lt;code&gt;/new&lt;/code&gt;, &lt;code&gt;/export&lt;/code&gt;, &lt;code&gt;/clear&lt;/code&gt;, &lt;code&gt;/plugins&lt;/code&gt;, &lt;code&gt;/browser&lt;/code&gt;, &lt;code&gt;/skills&lt;/code&gt;, &lt;code&gt;/settings&lt;/code&gt;, &lt;code&gt;/updates&lt;/code&gt;, &lt;code&gt;/commands&lt;/code&gt;. The number is a design decision: the menu only offers actions the desktop app already has a handler for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four stages, not one list
&lt;/h2&gt;

&lt;p&gt;Typing &lt;code&gt;/&lt;/code&gt; opens the command list, but three commands open a guided picker instead of running immediately. The stages are &lt;code&gt;commands&lt;/code&gt;, &lt;code&gt;model&lt;/code&gt;, &lt;code&gt;project&lt;/code&gt;, and &lt;code&gt;skill&lt;/code&gt;, and the parser is strict about getting there. &lt;code&gt;slashQuery()&lt;/code&gt; accepts one line only: a second &lt;code&gt;/&lt;/code&gt; anywhere, or a newline, means it is not a command at all. A stage opens only when the first word is a stage name followed by a space — &lt;code&gt;/model&lt;/code&gt; alone shows the command; &lt;code&gt;/model g&lt;/code&gt; opens the model picker filtered to &lt;code&gt;g&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Each picker is honest about what it can actually do. &lt;code&gt;/model&lt;/code&gt; lists discovered provider models with vendor and id, and marks text-only models where the provider reports no tools. On the ChatGPT browser route, it does not offer fake local switching: it explains that model choice belongs to the selected ChatGPT chat. &lt;code&gt;/project&lt;/code&gt; lists active projects and always offers an explicit "No project" choice, because working without a project is a real state, not an error. &lt;code&gt;/skill&lt;/code&gt; loads enabled installed skills through the existing palette index and prepares an editable request — the draft literally reads "Use the &amp;lt;skill&amp;gt; skill. …" — and nothing sends until you are ready. Search covers names, aliases, and descriptions, so &lt;code&gt;/settings&lt;/code&gt; also answers to &lt;code&gt;config&lt;/code&gt; and &lt;code&gt;/commands&lt;/code&gt; answers to &lt;code&gt;help&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The draft is the hard part
&lt;/h2&gt;

&lt;p&gt;The menu is easy. The draft is where the bugs live. The moment you open the menu, the composer holds text you may have spent a minute writing, and every path through the menu has to decide what happens to it. The rule I landed on: the toolbar saves your ordinary draft while you browse commands, and dismissal, a model or project selection, or a navigation action restores it. A skill instruction is added &lt;em&gt;before&lt;/em&gt; the saved text, so your words stay yours and the skill's framing stays first. Attachments stay with their original teammate throughout.&lt;/p&gt;

&lt;p&gt;There is one exception, and it is the decision I am least sure about: if you replace the command with ordinary text, the suspended old text is discarded. The menu treats typing over the command as changing your mind. That is the only path where text is silently lost, and it is the only path I could not make safe without a second confirmation dialog — which would have made the menu feel like a form. Arrow keys navigate and wrap around the list, Enter or Tab chooses, Escape dismisses, Backspace from an empty guided picker returns to all commands, and IME composition never submits a command mid-character. &lt;code&gt;/clear&lt;/code&gt; still asks for confirmation and &lt;code&gt;/export&lt;/code&gt; still goes through the protected transcript save dialog; the menu never shortcuts a guard the action already had.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bounded by design
&lt;/h2&gt;

&lt;p&gt;The menu is capped at 320 CSS pixels, its scrollbar is hidden while scrolling still works, and small windows drop the selected-action preview rather than overflowing the pane. A command menu that covers the conversation it is supposed to serve has failed at its one job.&lt;/p&gt;

&lt;p&gt;Verification: 7/7 catalog, parser, search, runtime, choice, draft, and selection unit tests; 31/31 checks in a real app in Chromium with zero renderer errors; 5/5 in a built renderer under native Electron; 62/62 across the focused CLI suites. The full serial suite ran 1,366 tests with 1,362 passing — the 3 failures are pre-existing browser-workflow failures reproduced on a clean baseline, unrelated to the slash UI.&lt;/p&gt;

&lt;p&gt;The honest limits: no installer or packaged ASAR check was run, physical screen-reader behaviour was not exercised, and macOS, Linux, and mixed-DPI monitors were not tested.&lt;/p&gt;

&lt;p&gt;The code is in &lt;a href="https://github.com/akyourowngames/A.N.K.I.T.A" rel="noopener noreferrer"&gt;Ankita on GitHub&lt;/a&gt;, and the desktop app itself is at &lt;a href="https://ankita-sable.vercel.app" rel="noopener noreferrer"&gt;ankita-sable.vercel.app&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Tell me I'm wrong: when you type ordinary text over a suspended draft, my menu discards it silently instead of asking. Is that the right call for a menu that is supposed to stay out of the way — or should a command menu never be allowed to throw away words you already typed, whatever the cost in clicks?&lt;/p&gt;

&lt;p&gt;— Krish Verma, creator of Ankita AI&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>ai</category>
      <category>showdev</category>
      <category>electron</category>
    </item>
    <item>
      <title>How I built the recommendation engine behind CineHindi (there is a surprise, click the link and see magic happen)</title>
      <dc:creator>Krish Verma</dc:creator>
      <pubDate>Sat, 21 Nov 2026 05:12:10 +0000</pubDate>
      <link>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-the-recommendation-engine-behind-cinehindi-there-is-a-surprise-click-the-link-and-see-4ok0</link>
      <guid>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-the-recommendation-engine-behind-cinehindi-there-is-a-surprise-click-the-link-and-see-4ok0</guid>
      <description>&lt;h1&gt;
  
  
  How I built the recommendation engine behind CineHindi
&lt;/h1&gt;

&lt;p&gt;CineHindi is a movie and TV discovery app I built with Next.js and the TMDB API. It covers Bollywood, South Indian cinema, Hollywood, K-dramas, anime and Indian web series — 28 curated categories in total — and the part I spent the most time on is the bit that decides what to show you next: the recommendation engine.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem: a catalogue is not a recommendation
&lt;/h2&gt;

&lt;p&gt;TMDB gives you metadata: titles, posters, genres, ratings, cast. What it does not give you is a reason to pick one row over another. A grid of posters is a catalogue, not a guide. I wanted the home page to feel like it knew what I had been watching, so I built a small scoring engine that runs over the user's own history and re-ranks everything into personal rows: "For You" and "Because You Watched …".&lt;/p&gt;

&lt;h2&gt;
  
  
  How the scoring works
&lt;/h2&gt;

&lt;p&gt;Every movie or show you open, like, or add to your watchlist feeds the engine. The score for a candidate title comes from three signals:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Genre affinity.&lt;/strong&gt; Genres you keep watching score higher. If you finish three South Indian action films in a row, the next row leans that way. Genres you skip or abandon decay instead of sticking around forever.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recency decay.&lt;/strong&gt; Something you watched last week counts more than something you watched two months ago. Taste moves, so the engine forgets gradually instead of freezing your first week of behaviour into a permanent profile.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Language preference.&lt;/strong&gt; The app covers Hindi, South Indian languages, English, Korean and Japanese content. Language is a first-class signal, not a filter you have to set by hand — if you keep watching K-dramas, more K-dramas surface.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The engine lives in a single module (&lt;code&gt;lib/recommend.ts&lt;/code&gt;) and is shared by the browse UI and the API routes, so the rows you see on the home page and the rows the API returns are always scored the same way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Guest-first: recommendations without an account
&lt;/h2&gt;

&lt;p&gt;Most apps make you sign up before they personalise anything. CineHindi does it the other way round. There is no signup wall — your watch history, likes and watchlist are saved in &lt;code&gt;localStorage&lt;/code&gt;, and the recommendation engine runs entirely off that local store. The profile page and the personal rows work for a guest exactly as they do for a signed-in user.&lt;/p&gt;

&lt;p&gt;Signing in is optional, and when you do, your guest library merges into your account. The rule is simple: existing cloud rows win, everything else carries over. Cloud writes are fire-and-forget, so browsing never waits on the network, and every table is locked down with row-level security so a user can only ever read their own rows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resume, categories and deep links
&lt;/h2&gt;

&lt;p&gt;TV shows remember the last season and episode you opened and jump straight back to it. Playback runs through third-party iframe servers, so resume is tracked at the episode level rather than to the exact second — the schema is ready for position-based resume the moment a player exposes playback events.&lt;/p&gt;

&lt;p&gt;The 28 categories are curated, not auto-generated, and every one of them is shareable: a link like &lt;code&gt;/browse?category=anime&amp;amp;type=all&lt;/code&gt; opens exactly that shelf. The discovery UI is ranked rows, carousels, genre pages and live search with filters — all fed by the same scoring.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would do differently
&lt;/h2&gt;

&lt;p&gt;Two things. First, I would add position-based resume from the start — episode-level resume is fine, but second-level resume is what people actually expect. Second, I would put the scoring behind a small test suite earlier. The engine is one module with clear inputs and outputs, which is exactly the kind of code that is easy to test and easy to let drift.&lt;/p&gt;

&lt;p&gt;The repo is open source: &lt;a href="https://github.com/akyourowngames/Movix" rel="noopener noreferrer"&gt;github.com/akyourowngames/Movix&lt;/a&gt;. If you build something similar, I would love to hear how you score — did you weight recency, or genres, or something else entirely?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;— Krish Verma&lt;/em&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>opensource</category>
      <category>typescript</category>
    </item>
    <item>
      <title>How I built a 2,048-byte receipt for every turn my desktop AI companion takes: 20 tools, 20 files, 0 arguments</title>
      <dc:creator>Krish Verma</dc:creator>
      <pubDate>Fri, 20 Nov 2026 10:27:51 +0000</pubDate>
      <link>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-a-2048-byte-receipt-for-every-turn-my-desktop-ai-companion-takes-20-tools-20-files-3aeo</link>
      <guid>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-a-2048-byte-receipt-for-every-turn-my-desktop-ai-companion-takes-20-tools-20-files-3aeo</guid>
      <description>&lt;h1&gt;
  
  
  How I built a 2,048-byte receipt for every turn my desktop AI companion takes: 20 tools, 20 files, 0 arguments
&lt;/h1&gt;

&lt;p&gt;Ankita AI is the desktop AI assistant I build — a little companion, a lot more possible — by Krish Verma. It does real work while I'm away: edits files, runs commands, answers in my voice. The problem is what I come back to. The conversation transcript is pages long, and "what did you actually change?" shouldn't require re-reading all of it. So every turn now leaves a receipt: a bounded record of what it did, stored next to the transcript, in &lt;a href="https://github.com/akyourowngames/A.N.K.I.T.A" rel="noopener noreferrer"&gt;the repo&lt;/a&gt; and on &lt;a href="https://ankita-sable.vercel.app" rel="noopener noreferrer"&gt;the website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The receipt lives in &lt;code&gt;src/memory/turn-audit.mjs&lt;/code&gt;, and its first design choice is what it refuses to record. The file header says it plainly: the journal stores the conversation; the audit stores only evidence of work — tool names and touched paths. No arguments, no output, no commands. A receipt is a "what changed" line, not a transcript, and the moment it starts carrying command text it stops being a receipt and becomes a second journal with worse provenance.&lt;/p&gt;

&lt;h2&gt;
  
  
  The shape: 20 tools, 20 files, 2,048 bytes
&lt;/h2&gt;

&lt;p&gt;A fresh audit is created at the start of every turn in &lt;code&gt;src/core/agent.mjs&lt;/code&gt;, with the caps taken from config: &lt;code&gt;projectAuditMaxTools&lt;/code&gt; and &lt;code&gt;projectAuditMaxFiles&lt;/code&gt;, both defaulting to 20 and hard-capped at 100. The byte bound is fixed at 2,048 — &lt;code&gt;AUDIT_MAX_BYTES&lt;/code&gt; — and individual paths are cut at 200 characters.&lt;/p&gt;

&lt;p&gt;Two functions feed it. &lt;code&gt;noteToolUse&lt;/code&gt; runs on every tool call, in both &lt;code&gt;runToolCall&lt;/code&gt; and &lt;code&gt;runMcpToolCall&lt;/code&gt;, and it dedupes: the same tool called five times is recorded once. Past 20 distinct tools it stops recording and increments a &lt;code&gt;dropped&lt;/code&gt; counter instead of growing. &lt;code&gt;noteFileEffects&lt;/code&gt; runs only when a tool result comes back, and only when the result doesn't start with &lt;code&gt;Error:&lt;/code&gt; — a failed write is not a change, and the audit refuses to claim otherwise.&lt;/p&gt;

&lt;p&gt;Which tools count as file effects is decided in one place, &lt;code&gt;src/core/tool-effects.mjs&lt;/code&gt;, so the audit and the desktop's workspace watcher agree on what a change is. The list is short: &lt;code&gt;write_file&lt;/code&gt;, &lt;code&gt;edit_file&lt;/code&gt;, &lt;code&gt;edit_lines&lt;/code&gt;, &lt;code&gt;apply_patch&lt;/code&gt;, &lt;code&gt;move_file&lt;/code&gt;, &lt;code&gt;delete_file&lt;/code&gt;, &lt;code&gt;restore_file&lt;/code&gt; — plus &lt;code&gt;image_generate&lt;/code&gt; and &lt;code&gt;image_download&lt;/code&gt;, which write into the workspace but get recorded as "changed" with no paths, because their paths are generated artifacts rather than project source.&lt;/p&gt;

&lt;p&gt;Paths are extracted without ever looking at the arguments as data. &lt;code&gt;move_file&lt;/code&gt; records both ends. &lt;code&gt;apply_patch&lt;/code&gt; parses the diff headers — &lt;code&gt;rename from&lt;/code&gt;/&lt;code&gt;rename to&lt;/code&gt; lines and &lt;code&gt;+++&lt;/code&gt;/&lt;code&gt;---&lt;/code&gt; lines — to recover the files a patch touched. Everything else takes the &lt;code&gt;path&lt;/code&gt; argument. Each path is then made workspace-relative when it lives inside the workspace, absolute when it doesn't, because a relative path is the useful form and an absolute one is the only honest form outside it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the receipt lands
&lt;/h2&gt;

&lt;p&gt;At the end of the turn, &lt;code&gt;finishTurnAudit&lt;/code&gt; freezes the record. If the JSON is over 2,048 bytes it pops files first, then tools, until it fits — and every pop increments &lt;code&gt;dropped&lt;/code&gt;, so the receipt says how much evidence it threw away. The finished audit is attached to the journal entry (&lt;code&gt;sessions.mjs&lt;/code&gt; stores it as &lt;code&gt;entry.audit&lt;/code&gt;), and handed to project maintenance.&lt;/p&gt;

&lt;p&gt;That last step is the whole point. &lt;code&gt;maintainTurn&lt;/code&gt; in &lt;code&gt;src/memory/project-maintenance.mjs&lt;/code&gt; is deterministic and costs zero model calls: if the audit says the turn changed something, it appends one work-log line to the project — the termination reason, a file count, and up to five paths, like &lt;code&gt;model_answer · 3 file(s) · src/a.js, src/b.js, docs/c.md&lt;/code&gt;. The project view then shows what actually happened, turn by turn, without anyone re-reading a transcript. And if anything in that bookkeeping fails, the failure is swallowed into a return value — a turn must never break because the bookkeeping did.&lt;/p&gt;

&lt;p&gt;The whole thing is switchable. &lt;code&gt;PROJECT_WORK_CAPTURE=false&lt;/code&gt; turns the audit off entirely and the journal goes back to being a plain transcript. The caps are env-tunable (&lt;code&gt;PROJECT_AUDIT_MAX_TOOLS&lt;/code&gt;, &lt;code&gt;PROJECT_AUDIT_MAX_FILES&lt;/code&gt;), but never above 100 — a receipt that can grow without bound is a log file with a nicer name.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest limits
&lt;/h2&gt;

&lt;p&gt;Six tests in &lt;code&gt;test/memory/turn-audit.test.mjs&lt;/code&gt; pin the behaviour: tools capped and deduped, file-effect tools marking a turn changed, paths relative and deduped, moves and patches recorded without arguments, the byte bound holding under many long paths, and a null audit still producing a stable shape. What the tests can't pin is the hole I know is there: &lt;code&gt;run_command&lt;/code&gt; and &lt;code&gt;git&lt;/code&gt; can rewrite files without naming them. The audit cannot record paths for them — the desktop still refreshes the file tree when they run, because &lt;code&gt;WORKSPACE_EFFECT_TOOLS&lt;/code&gt; includes them, but the work log can't say which file changed. The receipt is evidence of tool calls, not proof of intent: a tool can report success while doing nothing, and the audit will faithfully record the nothing.&lt;/p&gt;

&lt;p&gt;Tell me I'm wrong: a receipt that can't see &lt;code&gt;run_command&lt;/code&gt; rewrites is a receipt that lies by omission. Should the audit record the command text so the hole is at least visible, or is quoting an untrusted shell string into a permanent project record worse than saying nothing at all?&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Krish Verma, creator of Ankita AI — a personal AI companion for the desktop. The code is open source at &lt;a href="https://github.com/akyourowngames/A.N.K.I.T.A" rel="noopener noreferrer"&gt;github.com/akyourowngames/A.N.K.I.T.A&lt;/a&gt;, and the project lives at &lt;a href="https://ankita-sable.vercel.app" rel="noopener noreferrer"&gt;ankita-sable.vercel.app&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>ai</category>
      <category>showdev</category>
      <category>architecture</category>
    </item>
    <item>
      <title>How I built model-aware recaps for my desktop AI companion: 85% pressure, a 1,048,576-token window, and 42 messages down to 12</title>
      <dc:creator>Krish Verma</dc:creator>
      <pubDate>Thu, 19 Nov 2026 10:26:58 +0000</pubDate>
      <link>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-model-aware-recaps-for-my-desktop-ai-companion-85-pressure-a-1048576-token-window-2925</link>
      <guid>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-model-aware-recaps-for-my-desktop-ai-companion-85-pressure-a-1048576-token-window-2925</guid>
      <description>&lt;h1&gt;
  
  
  How I built model-aware recaps for my desktop AI companion: 85% pressure, a 1,048,576-token window, and 42 messages down to 12
&lt;/h1&gt;

&lt;p&gt;Ankita AI is a desktop AI assistant by Krish Verma — a little companion that lives on your desktop and gets things done while you're away. It holds long conversations: hours of planning, tool calls, and decisions. Last week I wrote about how it compacts those conversations at 36 messages into one 2,000-byte recap. That article was honest about the trigger, but the trigger was only half the story. The recap counted messages. A chat with five enormous turns could hit the model's real limit long before the 36th message arrived — and the trimmer would quietly drop the oldest turns before any recap ran. So the recap now reads the budget, not the count.&lt;/p&gt;

&lt;h2&gt;
  
  
  The budget comes from the model, not a constant
&lt;/h2&gt;

&lt;p&gt;The fix lives in &lt;code&gt;src/core/model-capabilities.mjs&lt;/code&gt;, in a function called &lt;code&gt;modelContextWindow()&lt;/code&gt;. It resolves the window in three steps, in order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Your explicit choice wins.&lt;/strong&gt; If &lt;code&gt;CONTEXT_WINDOW&lt;/code&gt; is set in the environment, that number is the window, full stop. A deliberate setting must never lose to a catalogue.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The model's advertised window.&lt;/strong&gt; The provider's model catalogue reports &lt;code&gt;context_length&lt;/code&gt;, &lt;code&gt;context_window&lt;/code&gt;, or &lt;code&gt;capabilities.limits.max_context_window_tokens&lt;/code&gt;. &lt;code&gt;declaredContext()&lt;/code&gt; takes the first positive integer among them. Baseten's Muse Spark and the Modal DeepSeek deployment both advertise 1,048,576 tokens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A fallback of 32,768 tokens.&lt;/strong&gt; If the catalogue says nothing usable — or says something malformed — the fallback stands. The comment in the code is blunt: malformed provider metadata must not erase the fallback.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Switching models refreshes the limit everywhere it matters: the chat agent, the tool planner, and the voice session all re-resolve the window when the model changes (&lt;code&gt;src/core/bootstrap.mjs&lt;/code&gt;, &lt;code&gt;src/core/voice-session.mjs&lt;/code&gt;). A small model and a million-token model in the same session get different budgets, because they are different budgets.&lt;/p&gt;

&lt;h2&gt;
  
  
  85% is when the recap fires
&lt;/h2&gt;

&lt;p&gt;The trigger is &lt;code&gt;COMPACTION_PRESSURE_RATIO = 0.85&lt;/code&gt; in &lt;code&gt;src/core/agent.mjs&lt;/code&gt;. The recap runs when history reaches 85% of the &lt;em&gt;available&lt;/em&gt; budget — available meaning after everything else has taken its share first:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The reply itself.&lt;/strong&gt; &lt;code&gt;outputReserve()&lt;/code&gt; holds back room for the model's answer. An explicit &lt;code&gt;MAX_TOKENS&lt;/code&gt; wins; otherwise the provider's own request default (&lt;code&gt;requestDefaults.max_tokens&lt;/code&gt;) and its enforced minimum (&lt;code&gt;minMaxTokens&lt;/code&gt;) are counted — the tokens the provider will actually send, not the ones I guessed. With neither, the reserve is capped at a quarter of the window, never less than 256 tokens, so a small window is never starved by a 4,096-token default.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool schemas, personal memory, the system prompt.&lt;/strong&gt; &lt;code&gt;toolBudgetBytes()&lt;/code&gt; subtracts those before history gets a byte.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1,024 bytes of protocol overhead&lt;/strong&gt; (&lt;code&gt;CONTEXT_OVERHEAD_BYTES&lt;/code&gt;), for the framing nobody remembers to count.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Only then does the pressure check run: &lt;code&gt;cost &amp;gt;= available * 0.85&lt;/code&gt;. The old message-count trigger (36 messages) still exists as a backstop, but the budget check is what fires first on a chat full of large turns. A recap that used to arrive too late now arrives while there is still room to write it.&lt;/p&gt;

&lt;p&gt;The recap also learned manners. It appears immediately in the chat and in the companion island, with a separate label, instead of only showing up after a reload. And an independent review caught the recap counter climbing &lt;code&gt;1 → 2 → 3&lt;/code&gt; on unchanged history; after the fix it stays &lt;code&gt;1 → 1 → 1&lt;/code&gt;, with an 8-turn cooldown between recaps.&lt;/p&gt;

&lt;h2&gt;
  
  
  The check that convinced me
&lt;/h2&gt;

&lt;p&gt;The verification record (&lt;code&gt;docs/verification/context-and-subagents.md&lt;/code&gt;) has a hosted run that is the whole point in one paragraph. A real &lt;code&gt;Agent.send&lt;/code&gt; against an anonymous free Kilo model — &lt;code&gt;reflection/beam-free&lt;/code&gt;, advertising a context of 1,048,576 — compacted 42 messages down to 12, stored the recap, and then correctly recalled the synthetic detail "Juniper Harbour" from the compacted history. The recap call returned HTTP 200 with &lt;code&gt;max_tokens=400&lt;/code&gt;, prompt usage 724 tokens, completion usage 338 including 224 reasoning tokens, and a reported cost of 0. The reply that followed used &lt;code&gt;max_tokens=1024&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The short-history case is the other half of the proof: with a small configured history it first failed with zero recap calls, then passed with exactly one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I still don't trust
&lt;/h2&gt;

&lt;p&gt;The recap is written by the same model that later reads it as fact. The summariser prompt says "Do not invent facts" — but that is an instruction, not a verification pass, and the recap wears the user's role in history. If the model hallucinates a decision into the recap, every later turn treats it as something you said.&lt;/p&gt;

&lt;p&gt;And 0.85 is a guess, not a measurement. It leaves 15% of the budget for the next response to grow into — but on a 32,768-token window that is under 5,000 tokens, and on a million-token window it is a small city. The ratio is the same; the slack is not. The window itself also depends on the provider telling the truth in its catalogue, and nothing in this code checks that claim against reality.&lt;/p&gt;

&lt;p&gt;The code is in &lt;a href="https://github.com/akyourowngames/A.N.K.I.T.A" rel="noopener noreferrer"&gt;Ankita on GitHub&lt;/a&gt;, and the project lives at &lt;a href="https://ankita-sable.vercel.app" rel="noopener noreferrer"&gt;ankita-sable.vercel.app&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Tell me I'm wrong: is a pressure ratio the right trigger, or should the recap fire on the &lt;em&gt;cost of the next message&lt;/em&gt; instead — summarise when the incoming turn won't fit, not when the history is 85% full? And would you trust a recap written by the same model that reads it, or does that need an independent check before it enters history?&lt;/p&gt;

&lt;p&gt;— Krish Verma, creator of Ankita AI&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>ai</category>
      <category>showdev</category>
      <category>architecture</category>
    </item>
    <item>
      <title>How I built phone continuity for my desktop AI companion: 2-minute pairing codes, a 4-file browser, and 0 native-app installs</title>
      <dc:creator>Krish Verma</dc:creator>
      <pubDate>Wed, 18 Nov 2026 10:27:42 +0000</pubDate>
      <link>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-phone-continuity-for-my-desktop-ai-companion-2-minute-pairing-codes-a-4-file-browser-36ml</link>
      <guid>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-phone-continuity-for-my-desktop-ai-companion-2-minute-pairing-codes-a-4-file-browser-36ml</guid>
      <description>&lt;h1&gt;
  
  
  How I built phone continuity for my desktop AI companion: 2-minute pairing codes, a 4-file browser, and 0 native-app installs
&lt;/h1&gt;

&lt;p&gt;Ankita AI is a desktop AI assistant by Krish Verma, and its work lives on the desktop — which is fine until you walk away from the desk. The obvious fix is a phone app. I built the other thing instead: the phone's browser becomes a window into the desktop, with no app to install, no second account, and a pairing code that dies after two minutes. The project is open source at &lt;a href="https://github.com/akyourowngames/A.N.K.I.T.A" rel="noopener noreferrer"&gt;https://github.com/akyourowngames/A.N.K.I.T.A&lt;/a&gt;, and the site is &lt;a href="https://ankita-sable.vercel.app" rel="noopener noreferrer"&gt;https://ankita-sable.vercel.app&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The decision: a browser, not an app
&lt;/h2&gt;

&lt;p&gt;Desktop Settings → Phone → Create pairing code now defaults to a phone-browser QR/link. The selector still offers the native app's QR/link and v1 request, but the default is the browser. That choice does most of the security work for me: a browser tab has no background life of its own, no stored credentials beyond the tab, and nothing to update. The phone holds its token only in that tab's &lt;code&gt;sessionStorage&lt;/code&gt; and in-memory state. Disconnect revokes it on the desktop; Forget clears local access. And a stale response cannot restore a forgotten connection — the client carries a connection-generation guard, added after a delayed successful pairing response reconnected a forgotten tab in testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four files, and nothing else
&lt;/h2&gt;

&lt;p&gt;The same HTTPS listener serves a fixed allowlist at &lt;code&gt;/v1/ankita-companion/phone&lt;/code&gt;: &lt;code&gt;index.html&lt;/code&gt;, &lt;code&gt;app.mjs&lt;/code&gt;, &lt;code&gt;style.css&lt;/code&gt;, and the shared contract module. Four files, mapped in code — no request path ever becomes a filesystem path. The responses carry a strict content policy (&lt;code&gt;default-src 'none'&lt;/code&gt;, no framing, no inline or remote scripts, no camera, microphone, or geolocation), and the browser DOM renders untrusted messages with &lt;code&gt;textContent&lt;/code&gt;, never HTML.&lt;/p&gt;

&lt;p&gt;Pairing itself is guarded at the network layer before any asset or auth operation runs. &lt;code&gt;phone-pairing.mjs&lt;/code&gt; validates the Host header against discovered addresses and names, the leaf certificate's SANs, and the actual bound port. A Browser Origin, when present, must exactly match the served HTTPS origin. Arbitrary or null origins, rebinding names, wrong ports, and cross-site fetch metadata all fail first. There is no wildcard CORS and no cookie auth. The invitation code lives for 120 seconds — long enough to scan, short enough to limit guessing — and a pending approval waits the same 120 seconds on the desktop owner before it expires.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the phone actually sees
&lt;/h2&gt;

&lt;p&gt;After the desktop owner approves, the phone shows recent assigned-conversation messages and saved work: the checklist, bounded receipts, and selected context excerpts. Hidden and tool chat entries are excluded, and arbitrary owner or thread selectors are refused — the server never accepts a caller-selected owner. A missing assignment is an actionable error, not an empty screen.&lt;/p&gt;

&lt;p&gt;The numbers are the boundary. A task's goal is excerpted at 8,000 characters, run events are capped at 128 with 2,400 characters of detail each, and selected context for review is named and bounded: a 120-character title, 4,000 characters of text, a redacted server preview, and a visible review checkbox. The server issues an expiring preview identity bound to the device, the owner, and the task — consumed by exactly one accepted request. Editing or removing the selection invalidates the preview, and the preview itself expires after two minutes without a send, so reviewed context cannot sit around waiting to be replayed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Review and continue, inside the same custody
&lt;/h2&gt;

&lt;p&gt;Continuing from the phone does not create a second assistant. Review and continue route through &lt;code&gt;assistant.resume&lt;/code&gt; inside the normal phone run owner, so engine event and turn custody, tool approval, timeout, cancellation, and revocation all stay active. New requests without context create no new saved references; existing task context follows the original task on continuation.&lt;/p&gt;

&lt;p&gt;Reassignment is where the old behaviour broke. The first version returned old run events after a device was reassigned — a &lt;code&gt;200&lt;/code&gt; where a &lt;code&gt;404&lt;/code&gt; belonged. Now reassignment cancels and removes old runs, approvals, and previews before changing authority, and both old events and old approvals return 404. That regression has its own test, alongside the endpoint tests that first failed with &lt;code&gt;401 !== 200&lt;/code&gt; on the phone page and &lt;code&gt;404 !== 200&lt;/code&gt; on history, and the surface-propagation fix that stopped phone tasks being marked as desktop.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest limits
&lt;/h2&gt;

&lt;p&gt;The phone browser is a window, not a second desktop. The desktop must approve the phone first, and the pairing code expires in two minutes, so a slow scan means generating a new code. You install and trust the desktop's saved public certificate on the phone and compare the desktop fingerprint — do not bypass a browser warning. Production TLS verification was not disabled, and the desktop still exports only its public CA and fingerprint. And the two-minute preview expiry cuts both ways: reviewed context that is not sent promptly has to be reviewed again.&lt;/p&gt;

&lt;p&gt;Tell me I'm wrong: is a 2-minute expiring preview identity the right line, or should the phone be allowed to hold reviewed context longer — and where would a longer-lived token first get abused?&lt;/p&gt;

&lt;p&gt;— Krish Verma, creator of Ankita AI&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>ai</category>
      <category>showdev</category>
      <category>security</category>
    </item>
    <item>
      <title>How I built streaming voice for my desktop AI companion: first audio in 491 ms, and a queue that reads ahead</title>
      <dc:creator>Krish Verma</dc:creator>
      <pubDate>Tue, 17 Nov 2026 10:28:32 +0000</pubDate>
      <link>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-streaming-voice-for-my-desktop-ai-companion-first-audio-in-491-ms-and-a-queue-that-470n</link>
      <guid>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-streaming-voice-for-my-desktop-ai-companion-first-audio-in-491-ms-and-a-queue-that-470n</guid>
      <description>&lt;p&gt;Ankita AI is a desktop AI assistant by Krish Verma, and it talks back: when a background job finishes, it reads the result out loud. The problem was the wait before the first word. Buffered text-to-speech fetches the entire MP3, then plays it — so a three-sentence progress report sat silent while the provider finished rendering audio nobody had heard yet. I wanted the first word out while the rest was still arriving. The fix is streaming synthesis: on the live check the first audio chunk arrived in 491 ms, and the player was already speaking while the response was still open.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prepare one chunk, not the whole file
&lt;/h2&gt;

&lt;p&gt;The core of it is &lt;code&gt;prepareVoiceStreamClip&lt;/code&gt; in &lt;code&gt;src/channels/voice-stream-clip.mjs&lt;/code&gt;. It does not wait for the audio. It opens the Sarvam streaming request (&lt;code&gt;synthesizeSarvamStream&lt;/code&gt; in &lt;code&gt;src/channels/voice.mjs&lt;/code&gt;, model &lt;code&gt;bulbul:v4-flash&lt;/code&gt;, one POST, subscription-key header, binary MP3 bytes), awaits exactly one chunk from the async iterator, and stops. That first chunk is the seed: a reusable clip descriptor holding the live iterator, its abort controller, and the measured &lt;code&gt;firstChunkMs&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Playback then pulls from that iterator. &lt;code&gt;playMp3Stream&lt;/code&gt; pipes chunks into the native player's stdin as they arrive, so the speaker starts on the first chunk instead of the last. When the stream ends, the chunks collected along the way are concatenated into a cached buffer — the whole clip, kept for free replays.&lt;/p&gt;

&lt;p&gt;The honesty in the design is the fallback. If the provider answers with an unsupported status or content type before the first audio, the code falls back to the existing buffered Sarvam request and records &lt;code&gt;fallback: 'provider'&lt;/code&gt;. But authentication and rate-limit failures stay errors, and a stream that dies halfway never replays the phrase through the buffered path — the user would hear it twice and never know which copy was real.&lt;/p&gt;

&lt;h2&gt;
  
  
  The queue reads the next sentence while this one plays
&lt;/h2&gt;

&lt;p&gt;Streaming one sentence is only half the latency story. A report is several sentences, and fetching sentence two after sentence one finishes speaking puts the gap back. So the speech queue in &lt;code&gt;src/automation/voice-speech-queue.mjs&lt;/code&gt; prepares the next part while the current one plays:&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="n"&gt;nextPart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cursor&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nextPart&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preparePart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nextPart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&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="o"&gt;=&amp;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;Each part's &lt;code&gt;prepare&lt;/code&gt; opens its own stream and waits for its own first chunk, so by the time the player finishes sentence one, sentence two's audio is already waiting. Text is split into sentences first and each chunk is capped at 2,000 characters (&lt;code&gt;SARVAM_TTS_MAX_CHARS&lt;/code&gt;), the provider's per-request bound — the same chunker the buffered path already used, so streaming changed the transport, not the text handling.&lt;/p&gt;

&lt;p&gt;Repeating a completed report costs nothing: the clip's cached buffer replays and the panel reports mode &lt;code&gt;cached&lt;/code&gt;. Interrupting a sentence reopens its stream from the saved descriptor; sentences already delivered keep their cursor, so a resume does not restart the report. Ending voice, interrupting a report, or losing the native player aborts the owned cloud request, and late chunks from a dead session cannot publish delivery state or play. The abort signal is shared end to end — one &lt;code&gt;AbortSignal.any&lt;/code&gt; joins the caller's signal and the clip's own controller — so cancellation is a single gesture, not a flag checked in five places.&lt;/p&gt;

&lt;h2&gt;
  
  
  The panel shows what actually happened
&lt;/h2&gt;

&lt;p&gt;The voice panels in the desktop app display the observed delivery, not a prediction: &lt;code&gt;{ mode, fallback, firstChunkMs }&lt;/code&gt;. The modes are &lt;code&gt;pending&lt;/code&gt;, &lt;code&gt;streaming&lt;/code&gt;, &lt;code&gt;buffered&lt;/code&gt;, and &lt;code&gt;cached&lt;/code&gt;, and only that bounded object crosses IPC — no audio, provider errors, or credentials reach the renderer. If the provider fell back, the panel says so and names the reason. I would rather show "buffered" honestly than claim streaming that never happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I measured
&lt;/h2&gt;

&lt;p&gt;The focused suite covering the provider, player, clip, session, controls, and queue passes 162/162, and the renderer/service boundary checks pass 4/4 with zero added planner requests. The live journey — a synthetic phrase through the real desktop capture and report path, audio routed to an ffmpeg WAV decoder, then transcribed back — came back &lt;code&gt;mode=streaming&lt;/code&gt;, &lt;code&gt;firstChunkMs=567&lt;/code&gt;, &lt;code&gt;firstConsumedMs=26&lt;/code&gt;, 4 chunks, 21,315 bytes in, 42,710 decoded WAV bytes out, transcript exactly "Voice streaming is ready." A re-verification on 10 November repeated it: &lt;code&gt;firstChunkMs=491&lt;/code&gt;, &lt;code&gt;firstConsumedMs=32&lt;/code&gt;, same chunk and byte counts, same transcript. No person's speech was recorded and nothing played through speakers; the microphone was injected synthetic input.&lt;/p&gt;

&lt;p&gt;The limits matter as much as the numbers. Those two first-chunk timings are single samples, not a latency claim — I am not saying streaming is X% faster, because one run cannot prove that. Speech recognition is still the recorded-clip REST path: no live partial transcripts, and the app copy says words appear after a pause rather than pretending otherwise. Physical audio quality, Bluetooth routing, and real acoustic interruptions are untested, because verification used injected audio. The feature adds no dependency: Node streams, fetch, and the installed native audio binaries were enough.&lt;/p&gt;

&lt;p&gt;Ankita is open source under MIT at &lt;a href="https://github.com/akyourowngames/A.N.K.I.T.A" rel="noopener noreferrer"&gt;github.com/akyourowngames/A.N.K.I.T.A&lt;/a&gt;, and the desktop app lives at &lt;a href="https://ankita-sable.vercel.app" rel="noopener noreferrer"&gt;ankita-sable.vercel.app&lt;/a&gt;. The streaming code is in &lt;code&gt;src/channels/voice.mjs&lt;/code&gt;, &lt;code&gt;src/channels/voice-stream-clip.mjs&lt;/code&gt;, and &lt;code&gt;src/automation/voice-speech-queue.mjs&lt;/code&gt;, with the findings in &lt;code&gt;docs/findings/everyday-voice-streaming.md&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Tell me I'm wrong: is preparing only the first chunk the right unit of work, or should the queue pre-fetch the whole report's audio up front and trade memory for zero mid-report gaps? And where would you draw the line on fallback — is silently dropping to buffered synthesis honest enough when the panel says so, or should a failed stream surface as an error instead?&lt;/p&gt;

&lt;p&gt;— Krish Verma, creator of Ankita AI&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>ai</category>
      <category>showdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How I built resume for my desktop AI companion: 2 attempts, 1 blocked write, and 0 repeated effects</title>
      <dc:creator>Krish Verma</dc:creator>
      <pubDate>Mon, 16 Nov 2026 10:26:49 +0000</pubDate>
      <link>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-resume-for-my-desktop-ai-companion-2-attempts-1-blocked-write-and-0-repeated-effects-3pp0</link>
      <guid>https://dev.to/krish_verma_77e28d3fd63ca/how-i-built-resume-for-my-desktop-ai-companion-2-attempts-1-blocked-write-and-0-repeated-effects-3pp0</guid>
      <description>&lt;h1&gt;
  
  
  How I built resume for my desktop AI companion: 2 attempts, 1 blocked write, and 0 repeated effects
&lt;/h1&gt;

&lt;p&gt;Ankita AI is a desktop AI assistant by Krish Verma — a little companion, a lot more possible — and it does real work on your machine: it writes files, edits code, sends messages. That is the whole point of it, and it is also the reason a crash used to be dangerous. If the process died halfway through a job and you asked it to continue, the honest thing to do was start over — and starting over meant replaying effects that had already happened. A file written twice, a message sent twice, a payment step retried blind. I built durable tasks so that never happens again: every foreground request becomes a checkpointed task, and on resume the completed work is blocked from running again, not repeated.&lt;/p&gt;

&lt;p&gt;The mechanism lives in &lt;code&gt;src/assistant/tasks.mjs&lt;/code&gt;, a 242-line &lt;code&gt;AssistantTaskStore&lt;/code&gt;. Every request gets one task record — one &lt;code&gt;task.json&lt;/code&gt; inside a folder named by a random UUID — holding the original goal, the owner, the project, the workspace, a persistent checklist, and a receipt for every tool call. The record is written atomically: temp file, &lt;code&gt;fsync&lt;/code&gt;, rename, &lt;code&gt;0o600&lt;/code&gt; permissions, &lt;code&gt;0o700&lt;/code&gt; directories. The record is capped at 512 KB and 240 steps; admission fails before work starts if the record is full, rather than halfway through.&lt;/p&gt;

&lt;p&gt;Each step moves through five phases: &lt;code&gt;requested&lt;/code&gt;, &lt;code&gt;started&lt;/code&gt;, &lt;code&gt;settled&lt;/code&gt;, &lt;code&gt;uncertain&lt;/code&gt;, &lt;code&gt;not_run&lt;/code&gt;. Admission is saved &lt;em&gt;before&lt;/em&gt; the action runs, and the start is saved only after ordinary approval — so a denial never becomes a started effect, and a failed admission prevents native and MCP execution outright. The record is the source of truth about what happened, not the conversation transcript, which can be trimmed, compacted, or lost.&lt;/p&gt;

&lt;p&gt;The replay guard is a hash. &lt;code&gt;taskActionHash&lt;/code&gt; takes the tool name and its arguments — keys sorted recursively, so argument order cannot disguise a repeat — and SHA-256s them. Before any mutation runs, &lt;code&gt;guard()&lt;/code&gt; checks the record: if the same hash already settled without error in an earlier attempt, it throws — "This exact action already completed in this task. Read current state and continue only the remaining work." If a step with the same hash is sitting in &lt;code&gt;started&lt;/code&gt; or &lt;code&gt;uncertain&lt;/code&gt;, it throws too: check its effect and resolve that receipt before retrying. An uncertain step blocks &lt;em&gt;all&lt;/em&gt; further changes in the task until the owner reviews it with observed evidence — &lt;code&gt;resolve()&lt;/code&gt; takes the owner, an outcome of &lt;code&gt;completed&lt;/code&gt; or &lt;code&gt;not_done&lt;/code&gt;, and the evidence, and only then flips the receipt.&lt;/p&gt;

&lt;p&gt;Interruption has its own path. When a task finishes, any step still in &lt;code&gt;started&lt;/code&gt; becomes &lt;code&gt;uncertain&lt;/code&gt; if it was a mutation, and the task lands in &lt;code&gt;needs_review&lt;/code&gt; instead of &lt;code&gt;completed&lt;/code&gt; whenever anything is unfinished. And recovery is careful about ownership: &lt;code&gt;recoverInterrupted()&lt;/code&gt; only touches tasks whose owning process is actually dead — it checks the PID is alive and that the runtime ID differs from its own. A live process keeps its lease; a second process cannot steal a running task by declaring it interrupted.&lt;/p&gt;

&lt;p&gt;I tested it the way the failure actually happens. The CLI test starts a real process against a local model fixture, saves a real file, gets killed while its next decision is pending, then starts again as a new process and resumes the same task. The result line reads: &lt;code&gt;ASSISTANT_CLI_RESTART_OK original_goal=kept completed_write=blocked remaining_file=saved attempts=2&lt;/code&gt;. The goal survived, the completed write was blocked instead of repeated, and the one remaining file was saved. The focused gates pass clean: 17/17 on the task store and execution tests, 23/23 on the assistant/CLI/voice-worker gate, 87/87 on the shared core gate, 36/36 on desktop assistant/phone/voice, and 46/46 on core assistant/skills.&lt;/p&gt;

&lt;p&gt;Where you see it: the Today page lists unfinished and recent requests with Continue and review, and the terminal has &lt;code&gt;ankita work list&lt;/code&gt;, &lt;code&gt;ankita work show &amp;lt;task-id&amp;gt;&lt;/code&gt;, and &lt;code&gt;--resume-task &amp;lt;task-id&amp;gt;&lt;/code&gt;, which restores the goal, project, and workspace under ordinary tool permissions. Resume validates the owner and the original project first — a task belongs to one conversation. The same store backs the opt-in daily briefing, which creates a paused draft, injects fresh saved commitments plus an explicit "not checked" notice for external sources, and posts the finished briefing directly instead of paying for a second model rewrite.&lt;/p&gt;

&lt;p&gt;The honest limits. The guard hashes exact arguments, so a reworded equivalent call — same file, same intent, different argument spelling — has a different hash and runs again. A ChatGPT Browser request with no saved native operation ID cannot resume automatically at all; it needs a fresh reviewed request, which is a deliberate safety limit, not a silent replay. The recovery prompt handed to the model on resume is labelled untrusted historical data, never instructions — but the model still has to be trusted to follow that label. And this is process-and-filesystem evidence, not a live-model quality benchmark; the full repository suite was not rerun to completion after the last fixture fix.&lt;/p&gt;

&lt;p&gt;Tell me I'm wrong: should the guard hash the &lt;em&gt;effect&lt;/em&gt; instead of the arguments — check the file's current state and skip the write if it already matches — or is an exact-argument match the only honest line, since anything looser lets the model decide what counts as "the same" write? The hash is cheap and certain; the effect check is smarter and guessier. Which failure would you rather ship?&lt;/p&gt;

&lt;p&gt;Ankita is open source (MIT) at &lt;a href="https://github.com/akyourowngames/A.N.K.I.T.A" rel="noopener noreferrer"&gt;github.com/akyourowngames/A.N.K.I.T.A&lt;/a&gt;, and the site is &lt;a href="https://ankita-sable.vercel.app" rel="noopener noreferrer"&gt;ankita-sable.vercel.app&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;— Krish Verma, creator of Ankita AI&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>ai</category>
      <category>showdev</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
