<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <title>Favo Yang&#39;s Blog</title>
  <subtitle>Writing about AI-native building, games, open source, and trade.</subtitle>
  <link href="https://favoyang.com/feed.xml" rel="self" />
  <link href="https://favoyang.com/" />
  <updated>2026-06-18T00:00:00Z</updated>
  <id>https://favoyang.com/</id>
  <author>
    <name>Favo Yang</name>
  </author>
  <entry>
    <title>A Two-Layer Project Structure for AI Coding Agents</title>
    <link href="https://favoyang.com/a-two-layer-project-structure-for-ai-coding-agents/" />
    <updated>2026-06-18T00:00:00Z</updated>
    <id>https://favoyang.com/a-two-layer-project-structure-for-ai-coding-agents/</id>
    <content type="html">&lt;p&gt;Recently, I have been experimenting with a two-layer project structure for working with AI coding agents.&lt;/p&gt;
&lt;p&gt;The key idea is simple: keep the source code in focused repositories, but run the agent from a higher-level workspace that understands how those repositories fit together. That top-level folder is not another source repository. It is an operating layer for the work around the code: saved plans, internal notes, private instructions, and cross-repo context.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;project-workspace/
  repo              # main repo, open source
  repo-devops       # server deployment stuff, closed source
  related-repo1
  related-repo2
  related-repo3
  ...
  AGENTS.md         # knowledge about how each sub-repo works
  plans/            # agent plans
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Each sub-repo can still have its own &lt;code&gt;AGENTS.md&lt;/code&gt;. But in practice, I rarely enter the individual repo folder to prompt the agent. Most of the time, I work from the workspace root and use it as the starting point.&lt;/p&gt;
&lt;h2&gt;Why the workspace exists&lt;/h2&gt;
&lt;p&gt;This becomes useful once a project grows beyond one codebase. A real product often has the main app, deployment scripts, infrastructure configuration, documentation, marketing material, support tools, experiments, and private operational notes. These pieces are connected, but they should not always live in the same public repository.&lt;/p&gt;
&lt;p&gt;From the workspace, I can ask the agent something like:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;/goal implement this feature, then write a blog post, and schedule a tweet about it
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That kind of request does not belong cleanly inside a single repo. The implementation may happen in the app repo, the deployment change in the DevOps repo, the product explanation in docs or a blog draft, and the launch message in a publishing plan.&lt;/p&gt;
&lt;p&gt;From the workspace level, the agent can plan the sequence before dropping into any one folder.&lt;/p&gt;
&lt;h2&gt;What improves&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Project memory has a home.&lt;/strong&gt; Saved plans, internal notes, and workflow instructions can live above the repos instead of being copied into each one.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Private context stays private.&lt;/strong&gt; For open-source projects, deployment details and internal planning notes do not need to sit inside the public codebase.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cross-repo work becomes natural.&lt;/strong&gt; A feature may need code, deployment changes, docs, changelog entries, and launch notes. Starting from the workspace keeps those related tasks visible.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Prompting becomes higher level.&lt;/strong&gt; Instead of asking, &amp;quot;What file should I edit in this repo?&amp;quot;, I can ask, &amp;quot;What needs to happen across the project?&amp;quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Tradeoff&lt;/h2&gt;
&lt;p&gt;The risk is that the agent can see too much. It may search across too many folders, pull in unrelated context, or treat every task as a whole-project problem.&lt;/p&gt;
&lt;p&gt;That makes the workspace-level &lt;code&gt;AGENTS.md&lt;/code&gt; important. It should describe what each sub-folder is for, which repos are public or private, where plans belong, and when the agent should stay inside a single repo instead of searching the whole workspace.&lt;/p&gt;
&lt;p&gt;For example, a workspace-level &lt;code&gt;AGENTS.md&lt;/code&gt; might look like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;# Project Workspace Agent Notes

This directory is an operator workspace that groups multiple independent Git
repositories. Treat each child directory with its own `.git/` as a separate
repository, not as source owned by this root workspace repository.

## Workspace Shape

Known child repositories:

- `&amp;lt;app-repo&amp;gt;`: application codebase. Read `&amp;lt;app-repo&amp;gt;/AGENTS.md` before
  changing application, docs, package, job, or shared library code.
- `&amp;lt;deploy-repo&amp;gt;`: deployment and operations. Read `&amp;lt;deploy-repo&amp;gt;/AGENTS.md`
  before changing deployment, infrastructure, service, or production
  verification behavior.
- `&amp;lt;pipeline-repo&amp;gt;`: build and publish pipelines. Read
  `&amp;lt;pipeline-repo&amp;gt;/AGENTS.md` before changing pipeline scripts or YAML.
- Other child directories with their own `.git/`: independent repositories.
  Check for repo-local guidance before editing.
- `plans/`: workspace planning notes and cross-repo coordination material.

## Working Rules

- Do not add child repositories, their contents, or embedded repo gitlinks to
  the root workspace Git repository.
- Make source changes inside the owning child repository and use that
  repository&#39;s Git history for commits and branches.
- Use this root only for workspace-level guidance, notes, and coordination
  files.
- Before cross-repo changes, inspect the relevant child repo status with
  `git -C &amp;lt;repo&amp;gt; status --short` so unrelated local work is not disturbed.
- Never revert or overwrite changes in a child repository unless the user
  explicitly asks for that exact repo and change.
- Prefer repo-local commands from the repo root, for example
  `cd &amp;lt;repo&amp;gt; &amp;amp;&amp;amp; npm test` or `cd &amp;lt;deploy-repo&amp;gt; &amp;amp;&amp;amp; just verify`.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The exact names do not matter. What matters is that the agent understands the boundary between the root workspace and the child repositories: where instructions live, where plans belong, which Git history owns a change, and which local or secret state must not leak into public work.&lt;/p&gt;
&lt;h2&gt;Potential possibilities&lt;/h2&gt;
&lt;p&gt;A few directions seem possible from here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A workspace-level agent could act as an orchestrator instead of doing everything itself. It could pass a goal to a sub-agent running inside the relevant repo folder, then let that sub-agent handle the focused implementation.&lt;/li&gt;
&lt;li&gt;The same structure could become a personal vault for loosely connected knowledge: notes, relationships, blog drafts, high-level projects, and other information that does not fit cleanly into one repo.&lt;/li&gt;
&lt;li&gt;At the extreme, the workspace could become a project root for all projects. It would act like a poor man&#39;s OpenClaw: one local operating layer for many projects, with enough memory to understand how they relate.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Right now, I find the workspace layer useful enough that I keep using it. It turns the project folder into more than a collection of repositories. It becomes the place where the AI agent can understand the product before choosing where to act.&lt;/p&gt;
</content>
  </entry>
</feed>