<?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>Forem: Russell Moss</title>
    <description>The latest articles on Forem by Russell Moss (@mossrussell).</description>
    <link>https://forem.com/mossrussell</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3784378%2Fe959617d-7cbd-4ea9-bf71-8765694d8fa8.png</url>
      <title>Forem: Russell Moss</title>
      <link>https://forem.com/mossrussell</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mossrussell"/>
    <language>en</language>
    <item>
      <title>I Built a Tool That Forces AI Coding Agents to Keep Documentation in Sync</title>
      <dc:creator>Russell Moss</dc:creator>
      <pubDate>Sun, 29 Mar 2026 17:28:32 +0000</pubDate>
      <link>https://forem.com/mossrussell/i-built-a-tool-that-forces-ai-coding-agents-to-keep-documentation-in-sync-310i</link>
      <guid>https://forem.com/mossrussell/i-built-a-tool-that-forces-ai-coding-agents-to-keep-documentation-in-sync-310i</guid>
      <description>&lt;p&gt;Second commit passes because docs are now staged alongside code. The hook doesn't need to call any AI — it just checks whether the right files are included.&lt;/p&gt;

&lt;p&gt;The self-invocation guard is critical: if the hook tried to spawn Claude Code as a subprocess while Claude Code is already running, you'd get a deadlock. By detecting the &lt;code&gt;CLAUDECODE&lt;/code&gt; env var and skipping all engines, the hook avoids this entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  API Auto-Fix for Human Commits
&lt;/h2&gt;

&lt;p&gt;When &lt;em&gt;you&lt;/em&gt; commit from the terminal (no &lt;code&gt;CLAUDECODE&lt;/code&gt; env var), the hook calls the Anthropic API directly to update your docs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"autoFix"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hook"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"mode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"blocking"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"narrative"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"engine"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"api"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"model"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"claude-sonnet-4-20250514"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It reads your staged source files, reads the current &lt;code&gt;ARCHITECTURE.md&lt;/code&gt;, sends both to the API, and writes back the updated sections. About 20 seconds and ~$0.10 per commit. The hook stages the updated docs and the commit proceeds without you doing anything.&lt;/p&gt;

&lt;p&gt;If the API is down or your key is missing, the hook degrades to advisory mode — it prints a warning but lets the commit through. You don't get punished for infrastructure failures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Session Context: Continuity Between Sessions
&lt;/h2&gt;

&lt;p&gt;Every commit generates &lt;code&gt;.agent-guard/session-context.md&lt;/code&gt; — a rolling summary that gives AI agents memory between sessions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Session Context — agent-guard&lt;/span&gt;
&lt;span class="gt"&gt;&amp;gt; Auto-generated by agent-guard. Do not edit manually.&lt;/span&gt;
&lt;span class="gt"&gt;&amp;gt; Last updated: 2026-03-29T16:46:40.973Z&lt;/span&gt;

&lt;span class="gu"&gt;## Recent Commits&lt;/span&gt;

| Hash | Date | Message | Categories | Docs Updated |
|------|------|---------|------------|--------------|
| f622d60 | 2026-03-29 | fix: session context on all paths | source | ARCHITECTURE.md |
| 29f8f9f | 2026-03-29 | fix: session-context staging | source | ARCHITECTURE.md |
| 174323f | 2026-03-29 | feat: auto-generate session context | source | — |

&lt;span class="gu"&gt;## Documentation Health&lt;/span&gt;
&lt;span class="p"&gt;
-&lt;/span&gt; &lt;span class="gs"&gt;**Hook mode:**&lt;/span&gt; blocking
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Engine:**&lt;/span&gt; claude-code
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Stale marker:**&lt;/span&gt; none
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Categories:**&lt;/span&gt; env (.env), source (src/)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The standing instructions tell Claude Code to read this file before making any changes. Now when you start a new session, the agent knows what happened last time — which files changed, whether docs were updated, and whether anything is stale.&lt;/p&gt;

&lt;h2&gt;
  
  
  Standing Instructions That Update Themselves
&lt;/h2&gt;

&lt;p&gt;agent-guard injects a documentation maintenance section into your AI config files. It writes to &lt;code&gt;.cursorrules&lt;/code&gt;, &lt;code&gt;CLAUDE.md&lt;/code&gt;, and any &lt;code&gt;additionalAgentConfigs&lt;/code&gt; simultaneously. Here's what the generated table looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;| If You Changed… | Update This | And Run… |
|---|---|---|
| &lt;span class="sb"&gt;`.env`&lt;/span&gt; | Environment Variables section in &lt;span class="sb"&gt;`docs/ARCHITECTURE.md`&lt;/span&gt; | Run &lt;span class="sb"&gt;`npm run gen:env`&lt;/span&gt; |
| &lt;span class="sb"&gt;`src/*`&lt;/span&gt; | Architecture section in &lt;span class="sb"&gt;`docs/ARCHITECTURE.md`&lt;/span&gt; | — |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the hook runs auto-fix, it regenerates this table from the current config categories. Add a new category for &lt;code&gt;src/services/&lt;/code&gt; and the standing instructions automatically include it on the next commit. No manual editing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Behavior Matrix
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;What Happens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Human commits, docs current&lt;/td&gt;
&lt;td&gt;Silent pass&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Human commits, docs stale&lt;/td&gt;
&lt;td&gt;API auto-fix (~20s), commit proceeds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Human commits, API down&lt;/td&gt;
&lt;td&gt;Degrade to advisory + warning&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Code commits, docs current&lt;/td&gt;
&lt;td&gt;Silent pass&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Code commits, docs stale&lt;/td&gt;
&lt;td&gt;Block + remediation instructions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rebase/merge in progress&lt;/td&gt;
&lt;td&gt;Auto-downgrade to advisory&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What It Doesn't Do
&lt;/h2&gt;

&lt;p&gt;agent-guard keeps documentation in sync — it doesn't write your architecture for you. If your &lt;code&gt;ARCHITECTURE.md&lt;/code&gt; is empty, it stays empty. The tool maintains what you've written, not what you should write.&lt;/p&gt;

&lt;p&gt;It's designed for solo devs and small teams, not enterprise collaboration. It doesn't work outside git. It has zero dependencies — the whole thing is git hooks and API calls, not a platform. Node 20+ built-ins only.&lt;/p&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;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; @mossrussell/agent-guard
npx agent-guard init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;npm:&lt;/strong&gt; &lt;a href="https://www.npmjs.com/package/@mossrussell/agent-guard" rel="noopener noreferrer"&gt;npmjs.com/package/@mossrussell/agent-guard&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/russellmoss/agent-guard" rel="noopener noreferrer"&gt;github.com/russellmoss/agent-guard&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MIT licensed. Zero dependencies. Node 20+.&lt;/p&gt;

</description>
      <category>vibecoding</category>
      <category>documentation</category>
      <category>claudecode</category>
    </item>
    <item>
      <title>Your AI Agent is Coding Against Fiction — How I Fixed Doc Drift with a Pre-Commit Hook</title>
      <dc:creator>Russell Moss</dc:creator>
      <pubDate>Sat, 21 Feb 2026 21:35:29 +0000</pubDate>
      <link>https://forem.com/mossrussell/your-ai-agent-is-coding-against-fiction-how-i-fixed-doc-drift-with-a-pre-commit-hook-1acn</link>
      <guid>https://forem.com/mossrussell/your-ai-agent-is-coding-against-fiction-how-i-fixed-doc-drift-with-a-pre-commit-hook-1acn</guid>
      <description>&lt;p&gt;If you're vibe coding with Claude Code, Cursor, or Copilot, you've probably experienced this:&lt;/p&gt;

&lt;p&gt;Start a project. Write a nice ARCHITECTURE.md.&lt;br&gt;
Feed it to your AI agent as context.&lt;br&gt;
Ship 20 commits.&lt;br&gt;
Realize half the API routes in your docs don't exist anymore.&lt;/p&gt;

&lt;p&gt;Your agent is now making decisions based on documentation that's completely wrong. I call this doc drift, and it's the silent killer of AI-assisted development.&lt;br&gt;
The Problem&lt;br&gt;
AI coding agents are only as good as the context you give them. When your .cursorrules or CLAUDE.md reference an architecture doc that hasn't been updated in two weeks, every suggestion your agent makes is built on a foundation of lies.&lt;br&gt;
Manual doc maintenance doesn't scale — especially for solo devs who are moving fast.&lt;br&gt;
What I Built&lt;br&gt;
agent-guard is a zero-dependency CLI that creates a self-healing documentation layer for your project. It works in four layers:&lt;br&gt;
Standing Instructions — Writes rules into your AI agent config (.cursorrules, CLAUDE.md, etc.) telling the agent to update docs alongside code changes.&lt;br&gt;
Generated Inventories — Deterministic scripts extract truth directly from your source code. API routes, Prisma models, env vars — all auto-generated into markdown files that can't lie.&lt;br&gt;
Pre-commit Hook — Catches drift before it reaches your repo. If Claude Code is installed, it auto-updates your narrative docs. If not, it prints a ready-made prompt you can paste into your editor.&lt;br&gt;
CI/CD Audits — GitHub Actions that run on every push and PR, plus weekly scheduled health checks.&lt;br&gt;
Setup&lt;br&gt;
bashnpm install --save-dev &lt;a class="mentioned-user" href="https://dev.to/mossrussell"&gt;@mossrussell&lt;/a&gt;/agent-guard&lt;br&gt;
npx agent-guard init&lt;br&gt;
npx agent-guard sync&lt;br&gt;
The init wizard auto-detects your framework and sets everything up. The hook never blocks commits — it always exits cleanly.&lt;br&gt;
What It Looks Like in Practice&lt;br&gt;
When you commit with Claude Code available:&lt;br&gt;
✓ Doc-relevant changes detected — docs also updated. Nice!&lt;br&gt;
When Claude Code isn't available:&lt;br&gt;
⚠️  Documentation may need updating&lt;/p&gt;

&lt;p&gt;Changed:&lt;br&gt;
  📡 API Routes (1 file):&lt;br&gt;
     - src/app/api/users/route.ts&lt;/p&gt;

&lt;p&gt;┌─────────────────────────────────────┐&lt;br&gt;
│ Claude Code Prompt (copy-paste):     │&lt;br&gt;
└─────────────────────────────────────┘&lt;br&gt;
Why Zero Dependencies Matters&lt;br&gt;
For solo devs doing vibe coding, every dependency is a liability. agent-guard uses only Node.js built-ins. No runtime overhead, no supply chain risk, no version conflicts.&lt;br&gt;
Try It&lt;/p&gt;

&lt;p&gt;npm: &lt;a href="https://www.npmjs.com/package/@mossrussell/agent-guard" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/@mossrussell/agent-guard&lt;/a&gt;&lt;br&gt;
GitHub: &lt;a href="https://github.com/russellmoss/agent-guard" rel="noopener noreferrer"&gt;https://github.com/russellmoss/agent-guard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'd love feedback — especially from other solo devs fighting doc drift. What's your current approach?&lt;/p&gt;

</description>
      <category>vibecoding</category>
      <category>ai</category>
      <category>devops</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
