One of the things that has been frustrating me for quite some time when working with coding agents is documentation. Not necessarily because there is too little documentation. In larger repositories there is usually plenty of it. The problem is that you have very little certainty that what the agent is reading is actually still correct. The code may have changed three weeks ago. The architecture may have changed six months ago. Some Markdown file may still very confidently explain how the system worked before either of those things happened.
And the AI will read it.
It has no inherent reason to know that this particular document is stale. So now you have given the agent more context, but possibly worse context.
This becomes quite painful in a larger brownfield codebase, because the alternative is also not particularly good. If the agent does not trust the documentation, it has to read a lot of source code again. It has to find implementations, follow callers, inspect tests, look at contracts and configuration, and basically reconstruct what this part of the system is doing.
And then the session ends.
The next agent may do much of the same work again. That was more or less the starting point for Span.
Span is a local MCP server that maintains a coding agent's established understanding of a repository and keeps it connected to the code it came from. When the supporting code changes, it stops treating that understanding as current rather than letting the next session trust it.
I first tried to solve this with better documentation discipline
My first attempt at solving this was much simpler.
I started introducing .AI directories throughout the codebase.
The idea was that a module would have a local Markdown file specifically written to explain that area of code to an AI agent. It would contain the context that is often difficult to get just by opening one source file: why the module exists, what it owns, what other parts of the system depend on it, what its important boundaries are, and so on.
Then I would put instructions in AGENTS.md telling the agent that when it changed the code, it also needed to update this documentation.
I reinforced the same requirement in skills.
So essentially the model was:
code changes
↓
agent updates code-specific documentation
↓
next agent reads that documentation
↓
less code needs to be rediscoveredThis sounded quite reasonable.
In practice, it did not really solve the problem.
Different agents produced different kinds of documentation. Some became very detailed. Some barely explained anything. Structures drifted. Information was repeated. Some files were updated properly, others were not. As the codebase grew, there were simply more and more documentation files that had to remain synchronized with the implementation.
And, perhaps more importantly, telling an AI that updating documentation is mandatory does not actually prove that the documentation was updated correctly.
Eventually I was back at the original problem.
There was documentation.
But could the agent trust it?
I didn't really know.
That made me think about documentation differently
The useful realization for me was that we treat source code very differently from documentation. With source code, we have all sorts of mechanisms that tell us when something no longer satisfies its contract. We compile it. We type-check it. We test it. We have CI. A change that breaks something has a reasonable chance of producing some sort of visible signal.
Documentation generally has none of this. A Markdown file can remain perfectly valid Markdown while becoming completely wrong about the software it describes.
Nothing fails, nothing turns red, and nothing necessarily tells the next agent that it should stop trusting it.
That is really the problem I wanted to solve. Not: how do I generate more documentation? And not even: how do I force agents to maintain documentation more diligently?
The more important question became:
Can codebase understanding tell us when the evidence underneath it has changed?
That is what Span is built around.
Span keeps the understanding connected to the code it came from
When an agent investigates part of a repository and records the result in Span, the result is not stored as an isolated note. Span keeps the established understanding together with the repository evidence it rests on. The thing being kept is not a cached copy of the source or a previous model response. It is the conclusion the agent established, together with what that conclusion rests on.
So, for example, the agent may establish that a particular service owns a certain decision, or that a piece of information flows through a particular set of components, or that one module is responsible for a particular part of a lifecycle.
If the evidence supporting that understanding later changes, Span does not keep presenting the old answer as though nothing happened. It stops treating the conclusion as current, and it names the supporting evidence that changed.
The distinction matters. It does not mean Span has determined that the old conclusion is now false. It means the thing that made the conclusion supportable changed, so the conclusion needs another look. A conclusion can be current, it can need reassessment, or its required support may no longer be establishable at all. Span calls those states CURRENT, REASSESSMENT_REQUIRED, and UNVERIFIABLE. The names matter less than the difference: only the first means the declared support still checks out. It does not mean the explanation is complete or correct, and even then the agent still has to judge whether the conclusion applies to the task in front of it.
For example:
AuthenticationService owns session issuance.
REASSESSMENT_REQUIRED
Supporting evidence changed:
auth/session.py
Re-check this scope before relying on it.The agent now knows exactly what sort of situation it is dealing with. It does not have to assume the old answer is correct. It also does not have to assume the entire repository is now unknowable. The affected understanding needs to be checked again. Unaffected understanding can remain usable.
For me, this is the important difference.
How the agent uses it
The way I think about it now is that the agent works from a surface: a file, a symbol, a service, or a domain. That is what understanding is attached to. The agent does not have to remember a saved identifier or the wording of an earlier question. It asks about the surface.
That is what ask does. It returns the understanding that is still current for that surface, together with the state of the support behind it. If there is nothing usable for that surface, it says so and, where it can, points at the source that would have to be investigated. It does not take an arbitrary new question and synthesize an answer from first principles. It also does not decide that a differently worded question means the same as one that was recorded earlier. If the agent needs the actual bytes of a file during an investigation, it can ask for that evidence explicitly; Span does not flood every retrieval with source material.
When the agent has established something useful, it records it. The unit is one supported conclusion: the statement, the question it answers, the scope it applies to, and the evidence it rests on. record keeps that conclusion with a durable identity and version history. If the conclusion later needs to change, the agent can confirm it, correct it, replace it, or withdraw it. Those are not silent overwrites. The earlier version remains part of the record.
The third operation is the one that matters after the work is done. reconsider takes the paths that were just edited and works out which retained understanding may have been affected, and why. It does not decide what the code now means. It tells the agent which conclusions need another look. Being listed there is not a verdict: a conclusion can be included because its surface was considered and still be CURRENT. Only the ones whose support actually changed or became unverifiable need to be investigated again. The agent then does that investigation and records the disposition.
So the lifecycle is: obtain the current understanding, retain what was established, and re-align it after change. ask, record, and reconsider are the three operations that implement those moments. Setup belongs to the installer, and structural navigation belongs to the agent's own tooling.
A fresh session can therefore start from a file, symbol, service, or domain and recover what previous work established around it. If the conclusion is still current, the agent can use it. If its support changed, the agent gets a qualified answer instead of a confident one. And if nobody has investigated that surface yet, the agent knows it is starting from zero.
That last part matters. Span never turns an unexamined area into an answer. The first investigation still has to happen. What changes is that the result of that investigation does not necessarily disappear when the session ends.
The division of responsibility is deliberate. The coding agent chooses what to inspect, decides whether the evidence supports a conclusion, makes the edit, and runs whatever tools or tests its environment provides. Span keeps the conclusions and the support the agent declared, exposes them to later sessions, checks whether that support still holds, and preserves the history. It does not call or select a model, reason on the agent's behalf, edit the target repository, or run the user's tests. When support changes, it does not quietly rewrite the explanation either. It marks what needs reassessment and leaves the meaning to the agent.
What that looks like in practice
I think the easiest way to make this concrete is a short sequence from a normal piece of work. I have kept the exchange small and illustrative rather than pretending it is a transcript; the exact wire grammar belongs to the installed schemas. The shape is what matters.
> ask surface=src/alpha.py
Gap unassessed
no retained understanding for src/alpha.py
source: src/alpha.py
# the agent reads the file and establishes its purpose
> record kind=understanding
question="What is src/alpha.py for?"
scope_paths=[src/alpha.py]
conclusion="alpha computes the value."
locator=src/alpha.py
UnderstandingRecorded version 1 CURRENT
> ask surface=src/alpha.py
Answer
"What is src/alpha.py for?"
alpha computes the value. CURRENT
# edit src/alpha.py
> reconsider changed_paths=[src/alpha.py]
Changed
src/alpha.py
containment, direct
"alpha computes the value." REASSESSMENT_REQUIRED
context: <bounded re-establishment context>
# the agent reads the change and records the new conclusion
> record kind=understanding understanding_id=u:... expected_version=1
actions.correct conclusion_id=<returned id>
conclusion="alpha computes the value and normalizes it."
locator=src/alpha.py
UnderstandingRecorded version 2 CURRENT
history: version 1 retainedThe first ask does not invent an answer. It reports that the surface has not been assessed and points at the file. The record call is the only place where a new conclusion enters the system. The next ask is the ordinary reuse path: a later session can ask about the same surface and read the conclusion back with its support state.
Then the file changes. reconsider does not rewrite the conclusion. It names the affected surface, says why it was considered, and reports that the conclusion's support needs reassessment. The result already carries the version and context the correction needs, so there is no extra lookup between the edit and the update. The agent investigates the change and records a correction. The correction becomes version 2, and version 1 remains history rather than disappearing.
The exact wording of the claim is not the important part. What matters is that the edit did not invalidate the whole repository, and it did not leave the old conclusion looking current. It marked the affected understanding, and it kept the old conclusion visible as history.
That is the part I care about, and it is not really about the first session. The first investigation still has to happen, because Span cannot know something that has never been investigated. What changes is that the work does not necessarily disappear when the session ends. If the relevant implementation has not changed, a later agent can reuse the established understanding. If it has changed, the affected area becomes the thing to investigate again.
I think that is the more useful way to look at it. The cost I am trying to reduce is not the first read. It is the repeated reconstruction of the same understanding in later sessions, and the uncertainty about whether an older note can still be trusted. I am not claiming a general measured multiplier here; the measurements I have are class-specific. What I am claiming is that the work is organized differently: the investigation is kept with its evidence, and a change narrows the part that needs another look.
So the agent remains the thing doing the reasoning. Span is not secretly running another AI behind the scenes. That separation is important to me because it also makes the stored understanding usable by a different agent later.
This is also why Span is not really a documentation system
The original problem came from documentation, but Span is not a Markdown generator. The source code remains the source of truth for what the software actually does. There are also things where normative documents remain the authority: architectural decisions, contracts, ownership rules, and other things that cannot simply be inferred from structure. What Span is trying to replace is narrower: the unchecked explanation of a code surface that nothing validates and that quietly goes out of date. For the surfaces it covers, that understanding lives in Span instead of accumulating as another Markdown file.
What Span persists is the agent's established understanding of the codebase, along with what that understanding depends on. That can include things such as:
- what a subsystem is responsible for;
- how data moves through a part of the system;
- what owns a decision;
- which other conclusions depend on this one;
- which contracts or decisions govern something;
- what an edit affected, and which understanding now needs another look.
And importantly, it also keeps uncertainty visible. If something has never been examined, that does not magically become understood. If the required support cannot be established, Span can say that. If previously established understanding has lost supporting evidence, it can say that too.
I would much rather have an agent tell me, "this area has not been assessed yet," than confidently fill in the missing parts from whatever happens to be in its context window.
The larger the repository becomes, the more interesting this gets
I think this is particularly useful for brownfield repositories. In a small project, reading the code may simply be the easiest thing to do. If the whole application has twenty files and a fairly obvious architecture, adding another system for retained understanding may not buy you very much.
But that changes as the repository becomes larger. A mature codebase may contain hundreds of modules, multiple services, historical architectural decisions, cross-cutting infrastructure, implicit ownership boundaries, and functionality whose existence is not immediately obvious from where you happen to be looking.
This is also where I see coding agents occasionally reimplement functionality that already exists. It is not necessarily because the model cannot write the required code. It simply did not know the repository already had something that solved the same problem. And discovering that from source can require quite a bit of work.
The goal with Span is that an agent can ask about the surface first and get the understanding that has already been established, together with its current state. If it is still current, use it. If its support has changed, investigate that surface again. If nobody has examined the relevant area yet, then the agent knows it actually needs to do the work.
That should reduce the amount of guessing involved. It should also reduce repeated code archaeology and make accidental duplication less likely. I deliberately say should here because I do not have a universal benchmark claiming that Span makes agents some percentage faster or more accurate. What the current measurements support is narrower: on the tested tasks, repeated reuse of a covered surface breaks even at two uses, while a single-use implementation is currently more expensive than reading. That is a result for one task class, not a general multiplier, and I am not claiming one. The point is that it changes the information available to the agent before it starts making those decisions.
It also gives me something closer to code-specific memory
Another reason I wanted this outside normal agent memory is that the information is very specifically about the repository. A conversation memory might remember that we discussed authentication last week. That is useful, but it is not quite the same thing as knowing:
this conclusion applies to this area of this repository,
it was established from these sources,
these other conclusions depend on it,
and one of those sources has now changedThat is much closer to the kind of memory I want when modifying software. It also means that the understanding does not have to belong to one particular conversation or one particular model.
Span is a local MCP server. The reasoning still happens in the coding agent you are already using. Span itself does not call an LLM, choose a model, or require model-provider credentials.
Its job is different. It owns the persisted understanding, its relationship to repository evidence, support state, uncertainty, and the bounded context for investigating again when understanding has to be re-established.
Because it is MCP, it is not tied to one model vendor. The installer can register Span with Codex, OpenCode, and Claude Code, and other MCP-capable agents can connect manually over stdio. Registration is not the same thing as verified model delivery, though. For this beta, the installed server and its stdio lifecycle are verified; host-specific live model delivery is a separate claim, and it is currently unverified for the current build on these hosts.
The state also lives outside the repositories Span is analyzing, which was another deliberate choice. I did not want to recreate the original .AI directory problem by filling every project with another collection of files that themselves had to be maintained.
I would like people to try it on real repositories
Span is open source under Apache-2.0. The repository is here: https://github.com/pontivus-com/span
The currently verified installation path is Linux with Python 3.12 or newer, Node.js, and npm. The installer provisions Span's runtime, the managed structural indexer, skills, and the host integration. For a published package release, install the package and then run the installer against the repository you want Span to work on:
pipx install span-mcp # or: pip install span-mcp
span-install \
--repo <TARGET_REPO> \
--data-dir <DATA_DIR>If you leave out --data-dir, Span uses the platform default (~/.local/share/span/data on Linux). You can inspect the installation without changing anything:
span-install --verify-onlyIf you are working from a source checkout instead, run python3 scripts/install-span.py --repo <TARGET_REPO> --data-dir <DATA_DIR> from the repository root. Installation only establishes that Span is operationally ready. It does not mean Span already understands the repository.
If you prefer to register Codex manually, the MCP command is still the same server:
codex mcp add span -- \
span-mcp \
--data-dir <DATA_DIR> \
--repo <TARGET_REPO>After that, restart or reload the coding agent and use Span on an actual repository rather than a toy project. That is where I am most interested in feedback.
In particular, I would like to know:
- whether the installation worked cleanly in your environment;
- which OS, agent, and roughly what size of repository you were using when something failed;
- whether Span flagged something as needing reassessment that you had otherwise continued trusting;
- whether it flagged something as needing reassessment that, in practice, did not materially need another look.
If you try it, open an issue on GitHub or reply on the dev.to version of this article. If you want to help other people find it, a star does that, but what I care about most is feedback from real repositories.
The project is still beta, and feedback from real repositories is much more useful to me than trying to anticipate every possible workflow in advance.
The basic idea behind Span is ultimately quite simple. AI coding agents need a working understanding of a codebase, particularly as the codebase becomes larger. We can write that context down. We can ask agents to maintain it. We can store it in memory. But if the agent is going to rely on that understanding when changing software, I want it to know something else as well:
does the repository still support what we think we know?
Span's answer is to keep the conclusion and its support together, and to make the loss of that support explicit when the code changes. That is the problem Span is attempting to solve.
