Anchor context prompt builder
Long conversations eventually outgrow the context window — the earliest messages, where the important decisions were made, fall off or get summarized away, and the model starts contradicting things it agreed to earlier. The anchor context prompt builder solves this by generating a compact, structured “anchor” of the conversation’s durable facts and decisions that you re-inject into each new context window. It runs entirely in your browser, no API key.
How it works
You list the key facts and decisions the model must carry forward — constraints, names, choices already made, open questions. You set a token budget and a placement (top or bottom of the new context). The builder then:
- Formats your facts into a clearly labeled, easy-to-parse anchor block.
- Adds a one-line instruction telling the model to treat the anchor as authoritative ground truth.
- Estimates the anchor’s token cost (~4 characters per token) and warns you if it exceeds your budget.
- Positions the block according to your placement choice.
Paste the result at the start (or end) of your next message and the model resumes with continuity intact.
Tips and examples
Keep anchors lean — only facts that change the model’s behavior belong there. “We decided to use Postgres, not Mongo,” “the tone is formal,” “the deadline is Friday” are load-bearing; restating an entire discussion is not. A good rule is to cap the anchor at a few hundred tokens so it costs little and stays scannable. Re-generate the anchor whenever a new durable decision is made, and prefer top placement unless your new input is very long, in which case bottom placement keeps the facts freshest right before the model answers.
The context window problem this solves
Every language model has a context window — the maximum amount of text it can “see” at once. In a long conversation, earlier messages fall off the edge as the window fills. This is where models start to contradict earlier commitments: “But you said we were using TypeScript” — “I never said that.” From the model’s perspective, it genuinely did not: that message no longer exists in context.
The anchor is a manual workaround. You extract the decisions that matter, compress them into a short summary, and re-inject them at the start of each new message. The model can always see the anchor because you always put it there — it doesn’t depend on chat history.
What belongs in an anchor vs. what doesn’t
Include in the anchor:
- Technology and tooling decisions (“using React, not Vue”)
- Tone, audience, and constraints (“formal tone, UK English, avoid jargon”)
- Business rules the model needs to respect (“never recommend competitor X”)
- Open questions and their current status (“awaiting confirmation on budget”)
- Key names, roles, or entities that recur throughout the conversation
Leave out of the anchor:
- Background or context that doesn’t change the model’s output
- Long explanations already captured in the current context window
- Tentative thoughts the model should feel free to reconsider
The anchor is not a summary of the conversation — it’s a list of load-bearing facts that constrain what comes next.
Anchor vs. retrieval augmented generation (RAG)
An anchor prompt is a manual, zero-infrastructure technique. For a single long conversation, it is the right tool: fast, free, and no setup required. RAG is the right tool when you need to inject facts from a large external knowledge base into many different conversations — it retrieves relevant chunks at query time rather than manually curating what to include.
For production applications, neither technique is a substitute for purpose-built memory systems that track conversation state across sessions. The anchor is best understood as a reliable habit for individual power users of AI assistants, not an architectural pattern for production systems.