<?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: PRIYANSHU GHOSH</title>
    <description>The latest articles on DEV Community by PRIYANSHU GHOSH (@priyanshu_ghosh_bed532788).</description>
    <link>https://dev.to/priyanshu_ghosh_bed532788</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%2F4237694%2F06ef762d-89d6-4545-bbba-3617e729fe8f.jpg</url>
      <title>DEV Community: PRIYANSHU GHOSH</title>
      <link>https://dev.to/priyanshu_ghosh_bed532788</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/priyanshu_ghosh_bed532788"/>
    <language>en</language>
    <item>
      <title>I built AegisBrain: A local memory bus and token arbitrage engine for AI coding agents</title>
      <dc:creator>PRIYANSHU GHOSH</dc:creator>
      <pubDate>Tue, 10 Nov 2026 18:38:18 +0000</pubDate>
      <link>https://dev.to/priyanshu_ghosh_bed532788/i-built-aegisbrain-a-local-memory-bus-and-token-arbitrage-engine-for-ai-coding-agents-4ml9</link>
      <guid>https://dev.to/priyanshu_ghosh_bed532788/i-built-aegisbrain-a-local-memory-bus-and-token-arbitrage-engine-for-ai-coding-agents-4ml9</guid>
      <description>&lt;p&gt;I built AegisBrain (GPLv3) to solve two practical frustrations I kept encountering while using AI coding agents (Claude Code, Gemini CLI, Cursor, and Antigravity):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Context Amnesia &amp;amp; Token Waste: Every time an agent starts a new session or compacts context, it typically crawls multi-megabyte JSONL session transcripts (often 40k–60k tokens) just to recall past architectural decisions, rules, and invariants. This wastes tokens and increases latency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Frontier Token Waste on Boilerplate: Paying frontier model API pricing to generate repetitive boilerplate, DTOs, and unit test suites felt inefficient when quantized local models (such as Qwen 2.5 Coder 7B/14B or Hermes on Ollama) can synthesize raw code locally for free.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;How it works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Sub-Second Neural Memory Bus (&amp;lt; 25ms):&lt;br&gt;
Instead of dumping full session histories into the prompt, AegisBrain indexes decisions, code anchors, and invariants into a local SQLite database using FTS5 (Full-Text Search) with a Porter stemmer in WAL mode. When an agent needs context, "aegis recall " queries the FTS5 index and injects a deterministic summary in under 400 tokens (~18ms query latency on NVMe).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Adaptive Dual-Mode Triage:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Quick Mode: For surgical one-line fixes, typos, or direct pair-programming, the frontier model operates directly as the lead engineer without delegation latency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Arbitrage Mode: For heavy boilerplate or multi-file test suites, the frontier model specifies architectural invariants and delegates raw code generation to local Tier 3 workers (via Ollama or Hermes CLI).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;4-Stage Quality Gate Architecture:&lt;br&gt;
Before any local candidate draft is committed to the host workspace, it must pass four automated verification gates:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Karpathy Simplicity Doctrine: Blocks speculative wrappers and unnecessary abstractions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unslop Filter: Strips conversational filler and LLM preambles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AST Security Scanner: Detects and rejects dangerous sinks (e.g. shell=True, unsanitized command interpolations).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dual-Environment Verification: Compiles and runs unit tests in an isolated sandbox before host application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Zero-Residue Snapshot Engine:&lt;br&gt;
Before any agent modifies configurations (e.g., GEMINI.md, CLAUDE.md, .cursorrules), AegisBrain creates a restore snapshot. Running "aegis restore" displays all historical points with timestamps and allows single-key rollback with zero leftover residue.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lightweight Background Daemon:&lt;br&gt;
An asynchronous local HTTP daemon runs on 127.0.0.1:8765 using ~35MB RAM, providing health checks, an optional Telegram bridge for remote status checks, and scheduling.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Benchmarks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Memory Query Latency: ~18.2 ms on local SSD (vs 8,500ms+ for unindexed log parsing).&lt;/li&gt;
&lt;li&gt;Context Overhead: ~350 tokens injected into ACTIVE_CONTEXT.md vs 50,000+ tokens for full-transcript crawling.&lt;/li&gt;
&lt;li&gt;Local Daemon Footprint: ~35 MB RSS memory, &amp;lt; 0.1% idle CPU.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/PG300604/aegis-brain" rel="noopener noreferrer"&gt;https://github.com/PG300604/aegis-brain&lt;/a&gt;&lt;br&gt;
Project &amp;amp; Documentation: &lt;a href="https://aegis-brain-alpha.vercel.app" rel="noopener noreferrer"&gt;https://aegis-brain-alpha.vercel.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;100% open source under GPLv3. I would appreciate&lt;br&gt;
feedback and critique of the architectural trade-offs!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>python</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
