Every new context window starts cold. Decisions get re-made. Bugs appear in code that looked correct. ContextStitch maintains a living state ledger across sessions so your LLM picks up exactly where it left off.
LLMs are powerful within a session. Across sessions, they're amnesiac. Every time you start a new conversation, you lose the accumulated understanding of your codebase — and you pay for it in bugs, repeated decisions, and drift.
The LLM re-derives decisions already made — sometimes reaching different conclusions, introducing subtle inconsistencies.
Constraints established in session 1 are unknown in session 4. The LLM writes code that violates them and it looks correct until runtime.
Conventions established early in a project dissolve. New sessions introduce inconsistent naming that propagates through the codebase.
The workaround — dumping the whole codebase into context — burns tokens and still misses implicit decisions that never made it into code.
ContextStitch wraps your LLM workflow with a continuity harness derived from production use in narrative AI systems — adapted for the structure of real coding projects.
A structured, compressed representation of everything that matters about your project — active interfaces, known invariants, open decisions, naming conventions, file structure. Updated after each session. Fits in a prompt prefix.
# .contextstitch/state.yml
interfaces:
UserAuth: "JWT, refresh token rotation, /auth/*"
DataStore: "SQLite in dev, Postgres in prod via env flag"
invariants:
- "All writes go through store.commit(), never direct DB"
- "API responses always wrap in {data:, error:, meta:}"
open_decisions:
- "Rate limiting: per-user vs per-IP — undecided"
conventions:
naming: "snake_case vars, PascalCase classes, kebab-case routes"
errors: "raise typed exceptions, never return error strings"
At the end of each session, ContextStitch generates a compressed summary of what changed, what was decided, and what's open. Injected at the start of the next session so the LLM picks up mid-stream.
# Session 3 → Session 4 handoff
## What changed
- Implemented /auth/refresh endpoint (see auth.py:84)
- Added UserSession model, migration in 0004_sessions.py
- Decided: JWT expiry = 15min access, 7d refresh
## Still open
- Rate limiting decision (see open_decisions)
- Error handling in /data/* routes — inconsistent, needs pass
## Do not re-derive
- Auth flow: documented in state.yml, don't change without flag
A prompt template that reconstitutes context reliably — regardless of which session, which model, or which developer is continuing the work. Consistent behavior from a cold start.
# Injected at session start
You are continuing work on [project]. The state ledger and
session handoff below define all established decisions and
conventions. Do not re-derive anything marked in state.yml.
Flag any conflict between a new request and an invariant
before proceeding.
[STATE LEDGER — 2.1K tokens]
[SESSION HANDOFF — 0.8K tokens]
---
Continue from: implement rate limiting on /auth/* endpoints
Same task. Same model. Same codebase. The difference is continuity.
ContextStitch is in private development. Leave your email and we'll reach out when the beta opens — priority given to teams actively using LLMs for coding.
No spam. No marketing list. Direct contact when beta opens.