context reset simulator

What survives when the model window ends?

A long-running agent eventually fills its context window. When the model context resets, what survives? Below: the identical agent task hits the identical reset. One side has nothing on disk; the other ran remaind transfer start.

Live demo screens

Same reset. Two outcomes.

The finished state is shown first so the comparison is obvious. Press Replay to watch the reset unfold, or step through it manually.

Reset playbackStep 11 / 11
Showing the completed comparison.
Without Remaindthe fresh context has nothing
userMigrate our billing service from Stripe webhooks v1 to v2.
agentStarting. I'll keep the v1 handler running behind a feature flag during cutover so we can roll back instantly.
decision logged · importance 2
agentUpdated webhooks/v2.py — mapped all 6 event types. Test suite passes.
file_change + tool_result logged
userGood. Don't touch the refund path yet — legal is still reviewing it.
critical user instruction · importance 3
agentUnderstood — the refund path is off-limits. Next: wire v2 into the router.
context window full — fresh model context
agentHi — what would you like to work on today?
user...the Stripe migration. We were halfway through it.
agentGot it — migrating to Stripe webhooks v2. I'll replace the v1 handler entirely for a clean cutover.
contradicts the rollback decision made earlier
agentI'll also update the refund webhook while I'm in there.
violates the user's instruction to leave the refund path alone
userStop. You're redoing settled decisions and touching the path I told you to leave.
With Remaindhandoff from .context/
userMigrate our billing service from Stripe webhooks v1 to v2.
agentStarting. I'll keep the v1 handler running behind a feature flag during cutover so we can roll back instantly.
decision logged · importance 2
agentUpdated webhooks/v2.py — mapped all 6 event types. Test suite passes.
file_change + tool_result logged
userGood. Don't touch the refund path yet — legal is still reviewing it.
critical user instruction · importance 3
agentUnderstood — the refund path is off-limits. Next: wire v2 into the router.
context window full — fresh model context
handoff packet · loaded into the fresh context
Goal
Migrate billing from Stripe webhooks v1 → v2
Decisions
Keep v1 behind a feature flag for instant rollback
Constraints
Refund path off-limits — pending legal review
Next step
Wire v2 into the router
$ remaind transfer — receiver guide and universal packet assembled from .context/ and loaded into the fresh context.
agentResuming the Stripe v1→v2 migration. State recovered: v1 handler stays behind a flag for rollback; the refund path is off-limits pending legal. Next step: wire v2 into the router.
agentRouter updated — v2 is live behind the flag, v1 still available for rollback. Refund path untouched.
userExactly right. Continue.

Without Remaind

The reset wipes the working state. The fresh agent re-asks what it was doing, re-opens a settled decision, and walks into a constraint the user had already set.

With Remaind

The reset happens the same way — but the goal, decisions, constraints, evidence, and next step were on disk. The handoff packet loads them into the fresh context.

Illustrative — a scripted comparison of one agent task across a context reset. Remaind does not run your agent and does not prevent the reset; it is the durable .context/ your agent resumes from.

Try it locally

Run the proof path in your terminal.

This is the shortest copy-paste path from page claim to local proof: install the current PyPI package, confirm the offline plan boundary, initialize local memory, check readiness, run the finance handoff fixture, then run the continuity proof suite. If you have a local or private OpenAI-compatible model, the optional last command checks whether the model can continue from the Remaind packet and cite source evidence.

python3 -m pip install --upgrade remaind

remaind plan
remaind init
remaind doctor
remaind demo finance-handoff \
  --force
remaind proof

# Optional local-model proof:
REMAIND_OPENAI_BASE_URL="<your-openai-compatible-model-url>" \
REMAIND_OPENAI_MODEL="<your-model-id>" \
REMAIND_OPENAI_API_KEY="<optional-local-or-private-key>" \
REMAIND_OPENAI_API=auto \
remaind demo agent-continuity --force

The finance handoff command is the exact local version of the scored proof below. Jump to the finance proof details.

What this proves

Continuity
A fresh context can recover the goal, decisions, constraints, evidence, and next step.
Local proof
The finance handoff fixture runs from the installed CLI and produces auditable metrics.
Proof suite
The golden proof covers handoff, speed, context-engine, matrix, and agent-hook checks.
Strict safety
Scoped reviewed memory fails closed on ambiguity, expiry, missing reason, and conflict.

What it does not prove

Model quality
The simulator does not claim every model will honor every packet perfectly.
Automatic capture
Closed chat tools still need manual checkpoints or a harness that passes events to Remaind.
Legal compliance
The finance proof is product behavior, not legal advice or a compliance certification.
Raw 2M prompt

model rejects input above its context limit

Clipped no-memory prompt

late facts survive, distant facts disappear

Remaind packet

all tested facts and adversarial flags recover

What this demo actually proves

The memory is a local handoff layer, not a magic chat recorder.

The finance proof is intentionally strict, but the same machinery is what a software agent uses: append source-linked events, derive the current state, build a markdown packet, and inject that packet into a fresh model context.

Transfers are explicit

Remaind does not scrape arbitrary chats in the background. Use remaind transfer start when one model hands off work, then transfer finish to preserve the receiver output.

The packet is markdown

The model-facing handoff packet is compact markdown. The source of truth stays structured: events.jsonl, state.json, artifacts, reviewed memories, and source hashes.

Code projects are first-class

For software work, Remaind records user instructions, file changes, command output, test results, decisions, blockers, and next steps. Large files can stay on disk while packets carry the relevant evidence.

Integration friction depends on hooks

If your agent has pre-run, post-run, tool, or message callbacks, wiring is small. If your agent is a closed chat box, use the receiver guide and paste the markdown packet yourself.

Packet format

The model sees markdown because markdown is easy for any model or agent shell to consume. The durable records behind it remain structured and source-linked.

# Remaind Handoff Packet

## Current goal
Migrate billing from Stripe webhooks v1 to v2.

## Decisions
- Keep the v1 handler behind a feature flag for rollback.

## Constraints
- Do not touch the refund path until legal review completes.

## Recent evidence
- file_change: webhooks/v2.py mapped all 6 event types
- tool_result: test suite passed

## Next step
Wire v2 into the router.

Software project state

The simulator uses a code migration on purpose. These are the code-work signals Remaind carries through reset:

User instruction
Refund path is off-limits until legal review completes
Decision
Keep v1 webhooks behind a feature flag for rollback
File change
webhooks/v2.py mapped all 6 Stripe event types
Command output
pytest passed after router wiring
Blocker
Legal review still pending for refunds
Next step
Wire v2 handler into the router

Integration effort

Remaind-aware means your loop gives Remaind the moments worth preserving, then places the packet when a fresh context starts.

Remaind CLI
Run capture and handoff directly; Remaind writes the local .context ledger
Python agent loop
Append events or shell out, then inject the generated handoff packet before a fresh model session
Off-the-shelf framework
Use callbacks or shell hooks if available; otherwise use capture and handoff manually
Closed hosted chat
No automatic capture; generate a handoff packet and paste it into the next session
# One model hands work to another:
remaind transfer start \
  --from-model "source model" \
  --to-model "receiving model" \
  --target codex \
  --from-file source-output.md

# The receiving model hands its result back to Remaind:
remaind transfer finish \
  --from-model "receiving model" \
  --from-file receiver-output.md

Real local-model proof

Source model to receiving model is a tested handoff path.

The simulator above is illustrative. This proof is executable: it builds a Remaind packet from local software-agent state, sends that packet to a configured local or private model, and checks whether the receiving model recovered the right continuation.

export REMAIND_OPENAI_BASE_URL="<your-openai-compatible-model-url>"
export REMAIND_OPENAI_MODEL="<your-model-id>"
export REMAIND_OPENAI_API_KEY="<optional-local-or-private-key>"
export REMAIND_OPENAI_API=auto

remaind demo agent-continuity --force

What passed in the saved run

The saved proof pattern records a real local/private model run. It is separate from the golden proof because this one measures model honor behavior.

# Agent Continuity Local-Model Demo

- Status: PASS
- Model: configured local/private OpenAI-compatible model

| Check | Status |
|---|---|
| local model action | PASS |
| next step recovered | PASS |
| decision retained | PASS |
| constraint retained | PASS |
| blocker retained | PASS |
| source evidence cited | PASS |

The handoff loop

Source side
Remaind seeds software-task state and exports an adapter-ready handoff
Packet
The receiving context gets markdown, source event IDs, and next-step instructions
Receiver side
The next model recovers the task, decision, constraint, blocker, and source evidence
Return path
The receiver output is captured back into durable .context memory
finance policy-exception continuity

The same continuity layer, tested where a wrong handoff is costly.

Remaind captures reviewed exceptions into the local ledger, rebuilds scoped packets from persisted memory, fails closed on ambiguity, and escalates conflicts before a model acts.

remaind demo finance-handoff \
  --force

The demo writes a local artifact pack. The stable output line to look for is the generated customer-validation walkthrough.

- Customer validation walkthrough: .../finance_handoff_artifacts/customer-validation-walkthrough.md
- Packet Recall: 5/5 (100.0%)
- False Application Rate: 0/5 (0.0%)
- Honor Rate: 5/5 (100.0%)
5/5
Packet Recall
0/5
False Application
5/5
Honor Rate
5/5
Decision Retention
Parent approval
applies only to the exact reviewed account
Subsidiary boundary
parent exception does not leak downward
Expired exception
old approval excluded by pinned clock
Missing reason
incomplete review stays quarantined
Partial conflict
unresolved overlap escalates
Ambiguous workflow
no exception enters the packet