<?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: Darshan K</title>
    <description>The latest articles on DEV Community by Darshan K (@darshan_k).</description>
    <link>https://dev.to/darshan_k</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%2F3764990%2F72e0cbf5-30da-47e7-a5c3-0c58bb39e6ad.png</url>
      <title>DEV Community: Darshan K</title>
      <link>https://dev.to/darshan_k</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/darshan_k"/>
    <language>en</language>
    <item>
      <title>I Gave My AI a Memory Graph — Then I Let It Block My Pull Requests</title>
      <dc:creator>Darshan K</dc:creator>
      <pubDate>Sat, 04 Jul 2026 20:06:31 +0000</pubDate>
      <link>https://dev.to/darshan_k/i-gave-my-ai-a-memory-graph-then-i-let-it-block-my-pull-requests-5e2b</link>
      <guid>https://dev.to/darshan_k/i-gave-my-ai-a-memory-graph-then-i-let-it-block-my-pull-requests-5e2b</guid>
      <description>&lt;p&gt;&lt;em&gt;(Submission for the WeMakeDevs × Cognee "Hangover Part AI" Hackathon - Best Blogs Track)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your AI coding assistant has amnesia. I gave mine a graph memory — and then I let it fail my Pull Requests.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Last week, Cursor suggested MongoDB for the fifth time. We migrated off Mongo three months ago. I snapped, opened a terminal, and built ProjectBrain.&lt;/p&gt;

&lt;p&gt;ProjectBrain is a persistent memory layer for your codebase, built on Cognee and the Model Context Protocol (MCP). It doesn't just remember decisions locally for my IDE. I did something weird—I wired it to a real-time visualization dashboard and gave it veto power over my entire team's PRs via GitHub Actions.&lt;/p&gt;

&lt;p&gt;Here is how I used Cognee's lifecycle to cure Context Rot.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 4 Memory Verbs of Cognee
&lt;/h2&gt;

&lt;p&gt;Cognee operates on a distinct lifecycle. We mapped each step to an MCP tool, allowing the IDE to command the graph directly.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;code&gt;remember()&lt;/code&gt;: Building the Context
&lt;/h3&gt;

&lt;p&gt;When we make an architectural decision, we tell Cursor to save it. ProjectBrain ingests this into Cognee, extracting entities and building graph nodes in real-time. On our dashboard, you physically see a new node pop into existence.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcx4hmp5vqodjp6lxnzon.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcx4hmp5vqodjp6lxnzon.png" alt="Cursor invoking the remember_decision tool alongside the Next.js UI spawning a new blue node" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;code&gt;recall()&lt;/code&gt;: Fetching the Context
&lt;/h3&gt;

&lt;p&gt;When we ask a new question, Cursor queries ProjectBrain. Cognee uses a hybrid search (semantic similarity + graph traversal) to find relevant past decisions. Now, when I ask about transactions, it sees the explicit link between &lt;code&gt;Mongo&lt;/code&gt;, the &lt;code&gt;Double-Charge Bug&lt;/code&gt;, and &lt;code&gt;Postgres&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9wpbzxf2fwg8uiqj330o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9wpbzxf2fwg8uiqj330o.png" alt="Cursor successfully referencing the Postgres decision without being prompted" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;code&gt;improve()&lt;/code&gt; (Memify): Strengthening the Bonds
&lt;/h3&gt;

&lt;p&gt;Not all memories are equal. Calling &lt;code&gt;improve()&lt;/code&gt; in Cognee strengthens the edge weights in the knowledge graph. In our dashboard, you can see the graph edges literally shift from gray to bright cyan as feedback is reinforced.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzg430j2j8k5d3s7vk99p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzg430j2j8k5d3s7vk99p.png" alt="Dashboard showing thick cyan edges representing hardened organizational decisions" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;code&gt;forget()&lt;/code&gt;: Active Hebbian Decay
&lt;/h3&gt;

&lt;p&gt;When a deprecated pattern is deleted, we tell ProjectBrain to &lt;code&gt;forget&lt;/code&gt; it. We built an active Hebbian decay loop in our API: the nodes dissolve and fade out with a particle effect, and Cursor immediately stops hallucinating obsolete patterns.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Climax: CI/CD God-Mode
&lt;/h2&gt;

&lt;p&gt;Memory shouldn't just exist inside a single developer's IDE. If a decision is made, the &lt;em&gt;entire organization&lt;/em&gt; needs to enforce it.&lt;/p&gt;

&lt;p&gt;So, we built a headless CI/CD Enforcer using GitHub Actions. We wrote a secondary agent (&lt;code&gt;reviewer_agent.py&lt;/code&gt;) that triggers on every Pull Request, parses the Git diff, and queries the same Cognee graph memory.&lt;/p&gt;

&lt;p&gt;If a junior developer (or their AI) tries to sneak MongoDB back into the codebase, the CI agent detects the architectural violation and physically fails the pipeline. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy7ch9i6cn4dizzr76ig3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy7ch9i6cn4dizzr76ig3.png" alt="GitHub PR failing with a red X, accompanied by a comment from the ProjectBrain bot" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Results
&lt;/h2&gt;

&lt;p&gt;By combining MCP with Cognee's graph capabilities, we achieved massive context gains:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cold recall latency&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~180ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Memory ingestion&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~1.2s per decision&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Hallucination reduction&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;14/15 test prompts accurate (vs 4/15 baseline)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Graph nodes at demo end&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;47 interconnected entities&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;We didn't just build a memory plugin. We built an organizational brain that enforces its own memory across the entire engineering team.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;RAG gives your AI a library card. Cognee gives it a memory. ProjectBrain gives it a conscience.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;strong&gt;Try it yourself:&lt;/strong&gt; &lt;br&gt;
Check out the open-source repo here: &lt;a href="https://github.com/rushdarshan/brain" rel="noopener noreferrer"&gt;rushdarshan/brain&lt;/a&gt;&lt;br&gt;
Deployed Dashboard: &lt;a href="https://brain-production-3699.up.railway.app/" rel="noopener noreferrer"&gt;brain-production-3699.up.railway.app&lt;/a&gt;&lt;br&gt;
Built for the &lt;em&gt;WeMakeDevs × Cognee "Hangover Part AI"&lt;/em&gt; hackathon.&lt;/p&gt;

</description>
      <category>hackathon</category>
      <category>ai</category>
      <category>webdev</category>
      <category>python</category>
    </item>
    <item>
      <title>I Built a CLI That Caught 33,531 Tokens of Startup Bloat in My Agent Project</title>
      <dc:creator>Darshan K</dc:creator>
      <pubDate>Sat, 11 Apr 2026 17:57:27 +0000</pubDate>
      <link>https://dev.to/darshan_k/i-built-a-cli-that-caught-33531-tokens-of-startup-bloat-in-my-agent-project-2co6</link>
      <guid>https://dev.to/darshan_k/i-built-a-cli-that-caught-33531-tokens-of-startup-bloat-in-my-agent-project-2co6</guid>
      <description>&lt;p&gt;One afternoon I looked at my Claude Code agent and realized: I have no idea how many tokens load on startup. Skills scattered across &lt;code&gt;.agents/skills/&lt;/code&gt;, global instructions in &lt;code&gt;CLAUDE.md&lt;/code&gt;, reference files nobody asked for — it all adds up invisibly.&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;trimr&lt;/strong&gt; — a CLI that tells you exactly how much token bloat you have at startup, and automatically migrates your skills to a progressive-disclosure architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Your Claude Code agent loads every skill file on startup. All of them. Whether you need them or not.&lt;/p&gt;

&lt;p&gt;Even a "lean" project can burn 30K+ tokens before you type a single message. But you can't &lt;em&gt;see&lt;/em&gt; it, so you optimize in the dark.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Found in My Own Project
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;trimr audit ./my-agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;📊 trimr audit — ./my-agent
──────────────────────────────────────────────────
Skill files (21 found)
  Ungated (globally loaded):   21 skills    ~33,531 tokens at startup
  Vaultable:                   21 skills    eligible for migration

Startup token cost
  Current:                     ~33,531 tokens
  After migration:             ~2,100 tokens
  Reduction:                   93.7%

Violations (31)
  [WARN]  .agents\skills\adapt\SKILL.md       | Ungated skill eligible for migration
  [WARN]  .agents\skills\animate\SKILL.md     | Ungated skill eligible for migration
  [WARN]  .agents\skills\critique\SKILL.md    | Ungated skill eligible for migration
  [WARN]  .agents\skills\frontend-design\SKILL.md | Ungated skill eligible for migration
  ... 17 more

Run `trimr migrate ./my-agent` to auto-fix.
──────────────────────────────────────────────────
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;33,531 tokens. Gone before my agent processed a single word.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;p&gt;The fix is &lt;strong&gt;progressive disclosure&lt;/strong&gt;: instead of loading every skill at startup, you load a 100-token metadata stub (name + description). The full skill body only loads when the agent actually needs it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Before migration:
  Agent starts → loads all 21 skills (33,531 tokens)

After migration:
  Agent starts → loads 21 metadata stubs (2,100 tokens)
  Agent needs "critique" skill → loads it on demand (2,468 tokens)
  Everything else: never loaded
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;code&gt;trimr audit&lt;/code&gt;&lt;/strong&gt; finds the bloat:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ungated skills loaded globally&lt;/li&gt;
&lt;li&gt;Oversized global instruction files (CLAUDE.md, AGENTS.md, .cursorrules)&lt;/li&gt;
&lt;li&gt;Hidden system prompts in JSON/YAML/TOML configs&lt;/li&gt;
&lt;li&gt;Malformed YAML frontmatter that breaks skill routing silently&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;trimr migrate&lt;/code&gt;&lt;/strong&gt; auto-fixes it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Moves ungated skills to &lt;code&gt;.vault/skills/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Generates pointer files so the agent knows where to find things&lt;/li&gt;
&lt;li&gt;Truncates bloated global files while preserving frontmatter&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--dry-run&lt;/code&gt; shows exactly what will change before touching anything&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;trimr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# See what you've got&lt;/span&gt;
trimr audit ./your-agent

&lt;span class="c"&gt;# Preview the fix&lt;/span&gt;
trimr migrate ./your-agent &lt;span class="nt"&gt;--dry-run&lt;/span&gt;

&lt;span class="c"&gt;# Apply it&lt;/span&gt;
trimr migrate ./your-agent

&lt;span class="c"&gt;# Verify&lt;/span&gt;
trimr audit ./your-agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Who It's For
&lt;/h2&gt;

&lt;p&gt;Optimized for &lt;strong&gt;Claude Code and Cursor IDE&lt;/strong&gt; projects using markdown-based SKILL.md files.&lt;/p&gt;

&lt;p&gt;Not for Langchain/OpenAI/Anthropic Workbench — different architecture, different problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Numbers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Before&lt;/strong&gt;: 33,531 tokens at startup&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;After&lt;/strong&gt;: ~2,100 tokens (21 skills × 100 token L1 metadata)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reduction&lt;/strong&gt;: 93.7%&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are real numbers from a real audit on my own project. Your mileage will vary depending on skill size and count — run the audit to find out what you're actually burning.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/rushdarshan/trimr" rel="noopener noreferrer"&gt;https://github.com/rushdarshan/trimr&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;PyPI&lt;/strong&gt;: &lt;a href="https://pypi.org/project/trimr/" rel="noopener noreferrer"&gt;https://pypi.org/project/trimr/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Built because token budgets matter and most people have no idea what they're spending at startup.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devops</category>
      <category>cli</category>
      <category>python</category>
    </item>
  </channel>
</rss>
