Background
The Manus agent (2025/10) uses a two-stage compaction strategy:
- Observation masking (soft compaction): Replace stale tool results with file-path references as context fills. Recent results stay in full.
- Schema-based trajectory summarization (hard compaction): When masking reaches diminishing returns, summarize the full trajectory using a structured schema that defines required fields (goal, decisions made, open questions, current state, last action, next steps).
Source: Context Engineering in Manus (Lance Martin, Oct 2025)
Problem
Zeph's current hard compaction () generates a free-form LLM summary with no schema. This produces variable-quality summaries — sometimes verbose, sometimes missing critical context (e.g., what tools were called, what decisions were made, what files were modified).
Proposal
Add a structured summarization schema to CompactionTier::Hard in crates/zeph-core/src/agent/context/summarization.rs:
## Summary Schema
- **Goal**: What the user asked for
- **Completed**: Actions/tools that succeeded (with results)
- **Decisions**: Key choices made with rationale
- **Open**: Unresolved questions or pending steps
- **Files modified**: List with brief descriptions
- **Next**: Recommended immediate action
The schema is injected into the compaction prompt as a response format requirement.
Applicability
- Impact: High — structured summaries prevent loss of critical context (e.g., which files were modified) that causes agents to repeat work
- Complexity: Low — prompt engineering change in
build_compaction_prompt(), no structural changes
- Risk: Low — existing tests cover compaction output; schema adds constraints, doesn't remove behavior
References
Background
The Manus agent (2025/10) uses a two-stage compaction strategy:
Source: Context Engineering in Manus (Lance Martin, Oct 2025)
Problem
Zeph's current hard compaction () generates a free-form LLM summary with no schema. This produces variable-quality summaries — sometimes verbose, sometimes missing critical context (e.g., what tools were called, what decisions were made, what files were modified).
Proposal
Add a structured summarization schema to
CompactionTier::Hardincrates/zeph-core/src/agent/context/summarization.rs:The schema is injected into the compaction prompt as a response format requirement.
Applicability
build_compaction_prompt(), no structural changesReferences