<?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: Pavel Moukhataev</title>
    <description>The latest articles on DEV Community by Pavel Moukhataev (@mpashka).</description>
    <link>https://dev.to/mpashka</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%2F801204%2Ff6bf27e7-0a8b-4c34-8ed5-3ca5fbfd218b.jpeg</url>
      <title>DEV Community: Pavel Moukhataev</title>
      <link>https://dev.to/mpashka</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mpashka"/>
    <language>en</language>
    <item>
      <title>A low-tech repo context pattern for AI coding agents</title>
      <dc:creator>Pavel Moukhataev</dc:creator>
      <pubDate>Wed, 08 Jul 2026 20:23:42 +0000</pubDate>
      <link>https://dev.to/mpashka/a-low-tech-repo-context-pattern-for-ai-coding-agents-4k25</link>
      <guid>https://dev.to/mpashka/a-low-tech-repo-context-pattern-for-ai-coding-agents-4k25</guid>
      <description>&lt;p&gt;I have been trying to keep repository context useful for AI coding agents without turning it into a large prompt file or depending on a specific vendor index.&lt;/p&gt;

&lt;p&gt;The pattern I ended up with is deliberately boring: Markdown plus text search.&lt;/p&gt;

&lt;p&gt;AI assistance disclosure: I used an AI assistant to help draft this post, then reviewed and edited it before publishing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;When a coding agent starts working in a repository, it needs at least two kinds of context:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;where things are in the codebase;&lt;/li&gt;
&lt;li&gt;which files belong to the same concept, even when they live in different directories.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A single &lt;code&gt;AGENTS.md&lt;/code&gt;, &lt;code&gt;CLAUDE.md&lt;/code&gt;, or project rules file is useful as an entry point, but it does not scale well if we keep adding every architecture note, domain concept, setup detail, and workflow rule to it.&lt;/p&gt;

&lt;p&gt;At some point it becomes a context dump.&lt;/p&gt;

&lt;h2&gt;
  
  
  The directory tree layer
&lt;/h2&gt;

&lt;p&gt;The first layer is close to Andrej Karpathy's llm-wiki idea: every meaningful directory gets an &lt;code&gt;index.md&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That file should be short. It describes the files and subdirectories nearby, links to related docs, and tells an agent what to read before changing that part of the code.&lt;/p&gt;

&lt;p&gt;This helps the agent navigate top-down instead of blindly searching the whole repository.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/payments/
  index.md
  PaymentService.ts
  RetryPolicy.ts
  tests/
    index.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The root agent instruction file can then stay small:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Before editing code, read the nearest index.md files and follow their links.
After changing behavior, update the affected docs and indexes.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The cross-cutting layer
&lt;/h2&gt;

&lt;p&gt;Directory navigation is not enough for concepts that span the tree.&lt;/p&gt;

&lt;p&gt;For example, &lt;code&gt;tenant isolation&lt;/code&gt;, &lt;code&gt;billing retries&lt;/code&gt;, &lt;code&gt;auth bootstrap&lt;/code&gt;, or &lt;code&gt;audit logging&lt;/code&gt; might involve service code, tests, migrations, config, documentation, and deployment scripts.&lt;/p&gt;

&lt;p&gt;Those concepts do not fit neatly into one folder.&lt;/p&gt;

&lt;p&gt;For that, I use explicit tags:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@tag:billing-retries
@tag:tenant-isolation
@tag:audit-logging
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same token appears in both code comments and docs.&lt;/p&gt;

&lt;p&gt;Example in code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// @tag:billing-retries&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;RetryPolicy&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example in docs:&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="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@tag:billing-retries&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;@tag:payments"&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now plain search works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-rn&lt;/span&gt; &lt;span class="s2"&gt;"@tag:billing-retries"&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That gives the agent, or a human, all code and documentation connected to the same concept.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep a tag registry
&lt;/h2&gt;

&lt;p&gt;Tags need names and meanings, otherwise they drift.&lt;/p&gt;

&lt;p&gt;I keep a simple registry such as:&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;# Tags&lt;/span&gt;
&lt;span class="p"&gt;
-&lt;/span&gt; &lt;span class="sb"&gt;`@tag:billing-retries`&lt;/span&gt; - retry behavior for failed payment operations.
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`@tag:tenant-isolation`&lt;/span&gt; - boundaries that prevent cross-tenant data access.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes the tag set reviewable and prevents slightly different names for the same idea.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not just rely on the IDE index?
&lt;/h2&gt;

&lt;p&gt;IDE and agent indexes are useful, but they mostly understand code structure: symbols, files, references, imports, definitions.&lt;/p&gt;

&lt;p&gt;They are weaker at human concepts.&lt;/p&gt;

&lt;p&gt;A domain concept can cut across files that do not reference each other directly. A visible tag is a cheap human-maintained signal that says: these things belong together.&lt;/p&gt;

&lt;h2&gt;
  
  
  The convention
&lt;/h2&gt;

&lt;p&gt;I wrote the full convention here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/mpashka/llm-wiki-tags" rel="noopener noreferrer"&gt;https://github.com/mpashka/llm-wiki-tags&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The short version:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;keep &lt;code&gt;AGENTS.md&lt;/code&gt; small;&lt;/li&gt;
&lt;li&gt;use &lt;code&gt;index.md&lt;/code&gt; files for directory navigation;&lt;/li&gt;
&lt;li&gt;use &lt;code&gt;@tag:&amp;lt;slug&amp;gt;&lt;/code&gt; tokens for cross-cutting concepts;&lt;/li&gt;
&lt;li&gt;register tags in &lt;code&gt;docs/tags.md&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;update docs and tags in the same change as code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is not a framework and there is nothing to run. It is just a repo convention that works with Codex, Cursor, Claude Code, or plain grep.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tradeoffs
&lt;/h2&gt;

&lt;p&gt;The obvious risk is stale documentation.&lt;/p&gt;

&lt;p&gt;The only way I have found to reduce that is to make documentation updates part of the same change as code updates. If a task changes behavior, the agent should update the nearby &lt;code&gt;index.md&lt;/code&gt;, the relevant page, and any tags affected by the change.&lt;/p&gt;

&lt;p&gt;The other risk is tag noise. I would not tag every function. Tags are useful for stable concepts that cut across the directory tree.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I am still unsure about
&lt;/h2&gt;

&lt;p&gt;I am still experimenting with where the line should be between useful tags and clutter.&lt;/p&gt;

&lt;p&gt;I would be interested in how other people structure persistent context for AI coding agents:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do you keep most repo knowledge in &lt;code&gt;AGENTS.md&lt;/code&gt; / &lt;code&gt;CLAUDE.md&lt;/code&gt;, or in separate docs?&lt;/li&gt;
&lt;li&gt;Do you have a pattern for concepts that span many directories?&lt;/li&gt;
&lt;li&gt;Do visible code comments like &lt;code&gt;@tag:...&lt;/code&gt; feel useful or noisy?&lt;/li&gt;
&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>documentation</category>
    </item>
  </channel>
</rss>
