Feature request: hierarchical archived context with rehydration and user-controlled compression
Summary
Sub-agents help keep the main window less cluttered, but they do not fully solve the core context-limit problem in long-running Codex CLI sessions.
I would like a first-class way to turn completed work or selected conversation ranges into reusable context units that can be summarized at user-controlled levels, while always preserving the full original transcript for later rehydration.
This feels related to scoped compaction and compaction-fidelity discussions, but broader: the main request here is a recoverable, hierarchical context model rather than a better one-shot summary.
Problem
In longer sessions, the active thread accumulates a lot of material:
- exploration and failed attempts
- detailed implementation discussion
- intermediate decisions that are no longer immediately relevant
- sub-agent conversations that are useful historically, but too expensive to keep fully active
Sub-agents reduce visible clutter, but the parent session still has a bounded active context window. A one-shot summary helps, but it is lossy: if an important rationale, constraint, or edge case is omitted, there is no structured way to reintroduce exactly the right level of detail later.
What I want is not "delete history", but "archive it into a recoverable, mountable form".
Proposed Feature
Introduce a concept like archived context units / memory capsules / child work units.
A user should be able to:
- Select a completed conversation span, task branch, or sub-agent session.
- Archive it as a named context unit.
- Generate summaries at different compression levels.
- Mount one of those summaries back into the active session as working context.
- Rehydrate from the preserved raw transcript when more detail is needed.
- Re-run or refine the compression later, either manually or automatically.
Important Property
The raw/original conversation should remain preserved by default.
The summary should be a derived layer, not the only surviving artifact.
Compression Levels
The useful part here is user-controlled summarization depth, for example:
- Compact: key conclusions, constraints, open questions, and next steps
- Standard: the above plus rationale and rejected alternatives
- Detailed: the above plus implementation details, relevant outputs, and notable decisions
This would let users trade off context cost vs fidelity depending on what they need in the current session.
Example UX
Something along these lines in the CLI would already be very powerful:
codex archive --from <message-id> --to <message-id> --name auth-refactor
codex compress auth-refactor --level compact
codex mount auth-refactor --level compact
codex mount auth-refactor --level detailed
codex rehydrate auth-refactor
Or with an assisted flow:
- Codex detects that a branch of work is mostly complete
- It suggests archiving it
- The user chooses a compression level
- Later the user can remount a compact or detailed version depending on the current task
Why This Would Help
This would make long-running sessions feel much closer to "infinite context" in practice, without requiring the active window to carry the entire raw history all the time.
It would also make sub-agents much more useful, because their completed work could become reusable context assets instead of remaining isolated transcripts.
Safeguards / Requirements
A few things seem important:
- Never discard raw history by default
- Keep links from summaries back to original messages or task runs
- Allow pinning critical constraints so they survive compression
- Make it visible what each compression level omits
- Support refreshing or regenerating summaries when the underlying work changes
- Make it possible to merge multiple archived units into a new working context
Expected Outcome
The result would be a more structured, hierarchical context model instead of a purely linear chat history.
That would help users keep working across long tasks without either:
- carrying too much inactive detail in the active context, or
- losing important historical information to an overly aggressive summary
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗