-
Notifications
You must be signed in to change notification settings - Fork 2
research(memory): schema-based trajectory summarization for hard compaction (Manus pattern) #1738
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or requestmemoryzeph-memory crate (SQLite)zeph-memory crate (SQLite)researchResearch-driven improvementResearch-driven improvement
Description
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
- Manus context engineering: https://rlancemartin.github.io/2025/10/15/manus/
- Related: research(memory): failure-driven context compression guidelines (ACON) #1647 (ACON failure-driven compression)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestmemoryzeph-memory crate (SQLite)zeph-memory crate (SQLite)researchResearch-driven improvementResearch-driven improvement