# Self-contained project: the repository that explains itself

> Where we are, what changed and why usually live in a ticket, a chat and an agent's memory. A self-contained project keeps all of it in the repository, so any person or agent can pick up the work.

- Aguinelo Koczkodai · 2026-12-02
- https://www.codeplain.dev/en/article/self-contained-project

![Isometric illustration of an open cream crate divided into compartments holding stacks of cream pieces. A single orange piece is sliding into one of the compartments.](https://www.codeplain.dev/imagens/self-contained.7c1edfd8.webp "Every part of the project in a fixed compartment, inside the same crate. The orange piece is today's change, stored with the rest.")

You come back to a project after two weeks and open a new session with the agent. Its first
question is the same as yours: where are we with this? The answer exists, just scattered. The
state is in a ticket, the reason behind a decision is in a chat from three weeks ago, and an
important detail stayed in the agent's local memory, in a file on your machine that nobody else
reads.

So you spend the first half hour rebuilding context, and so does the agent. Can the repository
itself answer that question, without depending on anyone's head?

## Where a project's state lives

In the [article on the context window](https://www.codeplain.dev/en/article/context-window-why-the-agent-forgets), we saw
that the agent only knows what's on its desk, and that a warning said once in the chat gets lost.
A project has the same problem, at a larger scale. What the team knows about it lives in four
places: the project management tool, conversations, documentation someone updates when they
remember, and now each agent's memory.

We know the first three. The fourth is more recent and easy to miss: the tool stores what it
learned about the project in a folder on the machine of whoever was using it. It works for that
person, on that machine, with that agent. Someone else, or the same project opened in Codex
instead of Claude, starts from zero.

On my team this showed up in a very concrete way: the state and the why of things were scattered
across the task board, conversations, the living docs and the agent's local memory. The decision
was to bring all of it into the repository. We call it a self-contained project.

## Five questions, five places

A self-contained project answers five questions using only what's in it. Each one has a fixed
place:

| Question | Where it lives |
|---|---|
| What is it, and for whom? | `README.md` |
| How do we work here, what are today's rules? | `AGENTS.md` |
| Where are we, what's next, what was left out? | `ROADMAP.md` |
| What changed for people who use it? | `changelog/` |
| What changed in the project, and why? | `memories/` |

Almost every project already has the first two. `AGENTS.md` has become an open standard: a file
at the root with the instructions any agent reads when it comes in, whatever the tool. The new
parts are the other three.

`ROADMAP.md` is short and has three sections: where we are, next steps, and what's out of scope,
with the reason. Every PR that changes the project's state updates this file. It's the one that
answers the opening question.

## One file per change

`changelog/` and `memories/` are folders, not one file each. Every change becomes a new file with
the date and time in its name, like `2026-12-01T1500-queue-swap.md`.

The reason is very practical. With a single `CHANGELOG.md`, two or three PRs open at the same
time touch the same line at the top of the file, and every merge becomes a conflict. With one file
per change, nobody steps on anybody's toes. We didn't invent this: towncrier, in the Python world,
calls these little files news fragments, and Changesets does the same in JavaScript.

The difference between the two folders is who you're writing for. `changelog/` talks to people who
use the project: what came in, what went out, what breaks. `memories/` talks to people who work on
it: the rule that changed, the decision that was made, the structure that got reorganized, the
attempt that didn't work. One change may call for both.

Each memory has three parts: what changed, why, and what the next person needs to know. The third
is the most useful, because it's the warning nobody would give in a meeting, and it saves the
afternoon of whoever picks up the project next.

## The memory records, the rule decides

To keep this from turning into a dead archive, a memory is never the source of a rule. The rule
in force is in `AGENTS.md`. The memory only records that it changed, when and why. If the two
disagree, `AGENTS.md` wins.

That's why an old memory is never edited or deleted. If the decision changed again, you write
another one. Michael Nygard proposed the same thing for architecture decision records back in
2011: a reversed decision doesn't disappear, it's marked as superseded, because it's still useful
to know it was once that way.

And that's also why nobody needs to read the whole history. When opening the project, a person
or an agent reads `AGENTS.md`, `ROADMAP.md` and the ten most recent memories. No rule in force
depends on an old memory, because the rule is already where it belongs.

## Any person or agent can pick up the work

The conclusion of that article was that the way not to lose a warning is to put it somewhere it
can't fall off. A self-contained project is the same idea, applied to the whole project. What
used to sit in one agent's local memory goes into the repository: versioned, reviewed in the PR,
and the same for everyone.

And the context stops belonging to the tool, which is the part I like most. An agent running
Claude, Codex, GLM, MiniMax or DeepSeek reads the same files and gets to the same starting point.
Switching agents, machines or people on the project no longer costs the first half hour.

And this goes well beyond the agent. People take vacations, get sick, move teams, change jobs. In
a project that depends on someone's head, each of those stops the work or makes someone start over.
In a self-contained project, whoever arrives, person or agent, opens the same files and carries on
from where things stopped. The project stays alive regardless of who, or what, is working on it.

To keep it from becoming bureaucracy, the check is light. A step in the pipeline looks at whether
the files are there, whether the roadmap has its sections and hasn't sat still for months, and
whether the branch recorded what changed. For now it only warns and doesn't block the merge: the
idea is for the team to adopt it without slowing delivery.

## Will whoever picks up the project tomorrow know where it stands?

Back to the session at the start: in a self-contained project, the answer to "where are we with
this?" is opening three files. The state is in `ROADMAP.md`, the rules in `AGENTS.md`, and the why
behind the latest changes in the most recent memories, each with its warning for the next person.
And whoever asks can be you after a vacation, the person who took your place, or an agent that has
never seen the project: the answer is the same for all three.

What I don't know yet is how this ages. In a project with years behind it, the memories folder
will hold thousands of files, and reading the last ten may not be enough to understand an old
decision. For now search handles it, but that's the part I want to see a year from now.

## To go deeper

- [AGENTS.md](https://agents.md/), the open format for agent instructions
- Michael Nygard, [Documenting Architecture Decisions](https://www.cognitect.com/blog/2011/11/15/documenting-architecture-decisions), Cognitect
- [towncrier](https://towncrier.readthedocs.io/en/stable/), a changelog built from news fragments
- [Changesets](https://github.com/changesets/changesets), the same principle in the JavaScript ecosystem
- [Keep a Changelog](https://keepachangelog.com/), the changelog format many people use as a base
