<?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: Jeonghun Mun</title>
    <description>The latest articles on DEV Community by Jeonghun Mun (@jeonghun917).</description>
    <link>https://dev.to/jeonghun917</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%2F4219942%2Fd5fd21e8-5e0a-4419-812a-2fac2d65c82c.jpg</url>
      <title>DEV Community: Jeonghun Mun</title>
      <link>https://dev.to/jeonghun917</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jeonghun917"/>
    <language>en</language>
    <item>
      <title>140 PRs to stop my AI coding agent from forgetting my codebase. The fix was one file.</title>
      <dc:creator>Jeonghun Mun</dc:creator>
      <pubDate>Sun, 01 Nov 2026 04:01:59 +0000</pubDate>
      <link>https://dev.to/jeonghun917/140-prs-to-stop-my-ai-coding-agent-from-forgetting-my-codebase-the-fix-was-one-file-41gi</link>
      <guid>https://dev.to/jeonghun917/140-prs-to-stop-my-ai-coding-agent-from-forgetting-my-codebase-the-fix-was-one-file-41gi</guid>
      <description>&lt;p&gt;I'm building a Bannerlord-like strategy game on my own, with AI coding agents doing a lot of the typing.&lt;/p&gt;

&lt;p&gt;Every new session went the same way. The agent lost track of how the game was put together, "fixed" code that&lt;br&gt;
was working, and when I pointed it out I got the classic &lt;em&gt;"You're right, my mistake."&lt;/em&gt; Then it happened again.&lt;/p&gt;

&lt;p&gt;Over about 140 PRs I tried most of the obvious fixes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Feed it my best session.&lt;/strong&gt; I pasted in the whole chat from the session where everything went right, like a
Space Marine gene-seed. Same agent, same mistakes. I had only swapped the code for chat history.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inject best practices and past failures.&lt;/strong&gt; It turned into a pile of exceptions, and work slowed to a crawl.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A report and a handover doc for every task.&lt;/strong&gt; Keeping the docs up to date became more work than the code, and
soon the docs contradicted each other.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What worked in the end was much simpler.&lt;/p&gt;
&lt;h2&gt;
  
  
  What agents miss
&lt;/h2&gt;

&lt;p&gt;Coding agents follow imports well. Ask one to change a function and it finds the callers, reads the tests and makes&lt;br&gt;
a reasonable edit.&lt;/p&gt;

&lt;p&gt;What it can't find is what the team knows but never wrote down next to the code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"amounts in this module are in cents"&lt;/li&gt;
&lt;li&gt;"the mobile app reads this table; don't drop columns"&lt;/li&gt;
&lt;li&gt;"run the payment e2e after touching this"&lt;/li&gt;
&lt;li&gt;"this file is generated; edit the template instead"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That knowledge lives in someone's head, an old Slack thread, or a README nobody opens before editing.&lt;/p&gt;
&lt;h2&gt;
  
  
  One file, handed out per file
&lt;/h2&gt;

&lt;p&gt;The structure had to be so simple that neither I nor the model has to think about using it. So I turned it into a&lt;br&gt;
small open-source CLI, &lt;a href="https://github.com/jeonghun917/readfirst" rel="noopener noreferrer"&gt;readfirst&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It keeps that knowledge in &lt;code&gt;.readfirst/map.json&lt;/code&gt;. Files are grouped, and each group lists:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;checks&lt;/strong&gt;: the commands to run after changing it, and what each one covers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;risks&lt;/strong&gt;: the traps a newcomer would fall into&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;rules&lt;/strong&gt;: promises the code must keep, and what breaks if it doesn't
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"src-billing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"charging cards"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"files"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"src/billing/**"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"checks"&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;"run"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npm test -- billing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"why"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"charges and refunds"&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;"risks"&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;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"amounts are in cents"&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;Before changing a file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx readfirst &lt;span class="nb"&gt;read &lt;/span&gt;src/billing/charge.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It prints only what applies to that file: the rules, risks and checks, plus the tests and callers that reach it&lt;br&gt;
through imports (JS/TS and Python).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpqog8mvxsmnu134obsy2.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpqog8mvxsmnu134obsy2.gif" alt="npx readfirst read prints the rules, risks, checks, tests and callers for one file" width="800" height="745"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To make an agent use it, add one line to &lt;code&gt;CLAUDE.md&lt;/code&gt;, &lt;code&gt;AGENTS.md&lt;/code&gt; or &lt;code&gt;.cursorrules&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Before changing a file, run &lt;span class="sb"&gt;`npx readfirst read &amp;lt;file&amp;gt;`&lt;/span&gt; and follow what it says.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Keeping it from going stale
&lt;/h2&gt;

&lt;p&gt;A map that rots is worse than no map. So there's a GitHub Action:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jeonghun917/readfirst@v0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On every pull request it posts one comment, updated on each push, with the rules, risks and checks for the files that&lt;br&gt;
changed. It also &lt;strong&gt;fails the check when the map stops covering the code&lt;/strong&gt;, for example when a new file isn't in any&lt;br&gt;
group. The map gets fixed in the same PR that made it stale.&lt;/p&gt;

&lt;p&gt;The CLI and the Action are MIT licensed, have no runtime dependencies, make no network or model calls, and need no&lt;br&gt;
account.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first map
&lt;/h2&gt;

&lt;p&gt;The hard part is writing the first map, because the useful parts are exactly the ones nobody wrote down.&lt;br&gt;
&lt;code&gt;npx readfirst init&lt;/code&gt; drafts groups from your folders, and &lt;code&gt;npx readfirst prompt&lt;/code&gt; gives your own agent a brief to fill in&lt;br&gt;
the rest.&lt;/p&gt;

&lt;p&gt;There's also a hosted option. Install a GitHub App, comment &lt;code&gt;/readfirst fill&lt;/code&gt; on an issue, and it reads the repository&lt;br&gt;
plus your existing notes (README, CLAUDE.md, docs) and opens the map as a pull request. Each risk lists the file and&lt;br&gt;
line it came from, so you can check it before merging. Here's the map it wrote for a copy of Express:&lt;br&gt;
&lt;a href="https://github.com/jeonghun917/express/pull/2" rel="noopener noreferrer"&gt;jeonghun917/express#2&lt;/a&gt;. A couple of the risks it found:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;res.sendFile throws unless the path is absolute or opts.root is given, and dotfiles are denied by default;&lt;br&gt;
relaxing this exposes files from user-supplied paths&lt;/p&gt;

&lt;p&gt;test/acceptance/ runs the examples through the real app, so editing an example can break npm test&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The first hosted map per account is free: &lt;a href="https://readfirst-cloud.vercel.app" rel="noopener noreferrer"&gt;readfirst-cloud.vercel.app&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd like to hear
&lt;/h2&gt;

&lt;p&gt;Is "groups + checks + risks + rules" the right shape for this kind of knowledge? What would you want an agent, or a&lt;br&gt;
new teammate, to see before touching a file in your codebase?&lt;/p&gt;

&lt;p&gt;The longer version of the 140-PR story is&lt;br&gt;
&lt;a href="https://github.com/jeonghun917/ai-development-control-plane" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

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