Continue where you left off. Every time.
Complex tasks don't fit in one context window. MemexAI gives long-running agents a checkpoint layer — completed steps, open questions, and hard-won constraints that survive resets and carry forward on resumption.
Context resets are silent progress destroyers.
Research pipelines, legal document analysis, multi-step code audits — tasks that take hours or days can't complete in a single context window. The agent hits the limit, the context resets, and the next run starts from scratch.
This isn't just inefficient. It actively causes regressions. The agent re-runs steps it already completed. It tries API calls it already learned fail with a specific error. It makes architectural decisions that contradict conclusions from earlier in the task.
The most expensive part of a long-horizon task is the discovery work — understanding what's in the codebase, learning how a specific API behaves, figuring out which approach doesn't work. When that knowledge doesn't persist, you pay the discovery cost on every run.
Some teams work around this by manually injecting state into prompts, or by writing custom "resume from step N" logic. That's brittle, hard to maintain, and specific to one task shape. It doesn't generalize.
What you actually need is a memory layer the agent writes to as it works, and that gets loaded before the first tool call on resumption — without custom glue code per task.
Write checkpoints as you work. Load them on resumption.
During execution
As the agent completes steps and discovers constraints, it writes to task memory. Completed sub-goals, open questions, dead ends, learned API behaviors — structured into files the agent can read back quickly on next run.
// Agent writes a checkpoint mid-task
await memory_write({
path: "user/task-audit/progress.md",
content: `## Completed
- Scanned 847 routes — no auth middleware on /api/admin/*
- Confirmed rate limit: 100 req/min on /search endpoint
## Open
- Need to check /webhooks handler for input validation
- Dependency audit incomplete (stopped at line 2300)
## Learned constraints
- pg-core version mismatch breaks migration runner`
})On resumption
getPromptBlock injects the current task state before the first tool call. The agent reads the progress file, picks up at the right step, and continues without re-discovering what it already knows.
Background dreaming runs between sessions to compact and organize task memory — merging fragmented notes, removing completed items, restructuring the task file as understanding deepens. The agent returns to a clean, current state rather than an accumulation of session noise.
Revision history means the full evolution of the task state is preserved. You can trace when a specific constraint was discovered, see what the agent knew at each checkpoint, and roll back if dreaming compacted something important.