# opencode · Context recovery

> Levels are per column and must not be summed, averaged or ranked. A level states which written criterion the runtime's source meets. It is not a measure of quality or task success. Higher is not always preferable.

Source: "Agent runtime comparison: ten open-source agent runtimes, source review", study of 2026-11-28. Mark notation: `3` is the level in the default deployment; `1→4 [opt: …]` is level 1 by default and level 4 in the named configuration; `s` source-verified, `d` documented or test only. Service dependencies are classes (E embedded, O on demand, R resident service, X external server required), not levels.

- Runtime: [opencode](https://ai-agents-review.com/runtime/opencode.md)
- Column: [Context recovery](https://ai-agents-review.com/column/context-recovery.md) (Evidence and memory)
- Mark: 2→3 [dev-only: sqlite_fts flag] s
- Default deployment: 2
- Best supported configuration: 3 (dev-only: sqlite_fts flag)
- Page: https://ai-agents-review.com/cell/opencode/context-recovery

## Rationale

Release: summary plus re-reading saved tool-output paths; session search/read only under sqlite_fts

## Rubric criteria for this column

- 0: Evidence that leaves the prompt is gone, or never stored
- 1: Only an in-prompt summary; originals not stored, or stored but unreachable by the agent
- 2: Originals stored, reachable only through generic means (re-reading files, temp-file paths named in the summary) or through a retrieval tool that is off by default
- 3: Default-on retrieval tool or command over stored transcript/memory (search plus read)
- 4: Level 3, plus automatic relevance-based injection of stored evidence **or** stable references (ids/paths) that survive restart and compaction

## Review finding

Built in. Auto-compaction writes a summary checkpoint and keeps about 15k tokens verbatim. Recovery is the in-prompt summary plus re-reading files and the saved tool-output paths. Session search/read tools need `sqlite_fts`, a dev-only flag (off in release) [E81][E78][E82][E83].

## Evidence cited by the mark

- [E81] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/core/src/session/compaction.ts#L275 — compaction defaults `auto: true, keep: 15_000, background: true` — [S]
- [E82] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/core/src/tool/plugin/session-search.ts#L57 — session search/read gated on `sqlite_fts` — [S]
- [E83] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/schema/src/config/flag.ts#L6-L9 — flags on in local/dev builds, off in releases — [S]

## Evidence also cited by the review finding

- [E78] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/core/src/tool-output.ts#L13-L16 — 2,000 lines / 50 KiB inline, rest saved to `tool-output/`, 7-day retention — [S]

## Grading record

- Grader A (default / best): 2 / 3
- Grader B (default / best): 2 / 3
