Grow a mem from a source
A binding is a standing obligation: this source belongs in that mem. Creating one reads nothing — what fills the mem is the ingest loop, an agent session that asks the engine what to work on, works one batch, and stops. This guide runs that loop end to end, from a binding to a mem with entities in it that you can measure.
Every command below was executed against the workspace this guide builds.
1. Have a binding
Section titled “1. Have a binding”memstead quickstart --repo . (Getting started) scaffolds one over the repository you ran it in, and its receipt names the binding id — <mem>/<stem>, both halves derived from your folder names.
The rest of this guide uses a workspace called my-graph beside a source repository called some-repo, so the binding id is my-graph/some-repo. To follow it literally:
mkdir my-graph && cd my-graphmemstead quickstart --name my-graphmemstead projection init --mem my-graph --source ../some-repo --medium-type codebaseSubstitute your own names throughout if you came from quickstart --repo ..
Confirm what you have:
memstead projection verify my-graph/some-repo --fullOn a fresh binding this reports 0% anchored and says so plainly — that is onboarding, not drift. The number it gives you is the denominator: how many source artifacts are in scope after the binding’s deny list.
2. Render a batch brief
Section titled “2. Render a batch brief”memstead projection brief my-graph/some-repoThe output is not for you — it is the prompt an agent works from. It names the source, the destination mem and its schema, the anchoring rules, and what changed since the last pass. Hand it to an agent session verbatim.
Two things in it matter for the loop to work:
- The destination. If the mem does not exist yet, the brief says so and gives you the fix for the workspace shape you are in — a
mem init(and, where the workspace admits no name yet, theworkspace allow-createthat must precede it) in a mem-repo workspace; in a filesystem-mem workspace, which holds exactly one mem and cannot add another, the commands to re-declare the binding against the mem you have. Do that before working the batch: until the destination resolves, every write this brief asks for refuses. - Anchors. The brief tells the agent to attach an
anchorslist to every write, naming the source artifact the entity is drawn from and the binding source name it came from. This is what makes the next two steps possible: unanchored writes leave coverage blind.
3. Work one batch
Section titled “3. Work one batch”The agent reads the source, then creates entities through the normal mutation surface — memstead_create over MCP, or the CLI:
memstead create --type concept \ --title "Token issuing" \ --section definition="Auth issues and verifies bearer tokens." \ --section explanation="Both entry points live in src/auth.rs." \ --anchor '{"artifact":"src/auth.rs","grain":"file","class":"anchored","source":"some-repo"}'The source value is the binding’s declared source name, which the brief prints. It selects the pointer the artifact path is joined onto, so a wrong name usually refuses INVALID_ANCHOR — the path resolves under no candidate join. It is not refused when the path happens to resolve workspace-relative anyway, so write both exactly as the brief lists them.
One batch is one bounded piece of work — depth on a coherent area beats breadth across unrelated ones. Stop when the area is covered.
4. Measure, then go again
Section titled “4. Measure, then go again”memstead projection verify my-graph/some-repo --fullCoverage moves as anchors land. On the repository this guide was verified against — three files in scope — the first batch took it from 0/3 to 1/3 and the second to 2/3, with anchor resolution at 100% throughout: every anchor still pointing at a file that exists.
Then render the next brief and repeat. The mem is your continuity: each run is a fresh agent with no memory of the last one, and the graph is what persists between them. Stopping mid-loop loses nothing; the next run picks up against the coverage that is already there.
memstead projection brief my-graph/some-repoNaming a binding renders that binding’s brief — it does not consult the rotation, so it never reports “nothing due”. The rotation — memstead projection brief --all --consume, which is what /ingest runs — is the surface that skips a binding whose source has not moved since its last worked pass, rather than inventing work for it.
What this loop does not do
Section titled “What this loop does not do”- It does not keep the mem current. Growing a mem and maintaining it as the source changes are separate jobs; the second is
memstead projection brief <binding> --sync, the sole maintenance writer. - It does not run itself. Memstead ships no scheduler. The loop is an agent session on whatever cadence you choose — a
/loop, a cron’d run, a CI job. - It does not batch by itself. One invocation is one batch. Repetition is yours to drive.
Where next
Section titled “Where next”- Agent recipes — the MCP tool sequences an agent actually runs, with real payloads.
- The fidelity contract — what coverage, drift and freshness mean, and what the engine will and will not claim about them.