Conversation
…on (#1607) Add `AnchoredSummary` typed schema replacing free-form prose compaction summaries when `[memory] structured_summaries = true` (off by default). - New `AnchoredSummary` struct (5 fields: session_intent, files_modified, decisions_made, open_questions, next_steps) with JSON serialization, Markdown rendering, and per-field length validation - `try_summarize_structured()` on `Agent` calls `chat_typed_erased` for structured output; falls back to prose on any failure or invalid fields - Chunked path: per-chunk summaries stay prose, final consolidation uses structured output (IMP-01) - `summarize_messages_with_budget()` also uses structured path (IMP-02) - `is_complete()` requires only `session_intent` + `next_steps` (IMP-03) - `validate()` enforces per-field length limits: session_intent <= 2000 chars, Vec entries <= 500 chars, Vec length <= 50 entries - `cap_summary()` applied to all structured return sites (matches prose path) - Debug dump writes `{N}_anchored-summary.json` with section completeness - `AnchoredSummary` parse attempt on summary load for legacy detection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AnchoredSummarytyped struct (5 fields:session_intent,files_modified,decisions_made,open_questions,next_steps) replacing free-form prose compaction summariescompact_context()→summarize_messages()andcompact_context_with_budget()→summarize_messages_with_budget()is_complete()requires onlysession_intent+next_steps;files_modifiedanddecisions_madeare soft expectations (IMP-03)validate()enforces per-field length limits to guard against bloated LLM outputcap_summary()applied at all structured return sites to match prose path behavior{N}_anchored-summary.jsonwith section completeness and fallback flag[memory] structured_summaries = trueFiles changed
crates/zeph-memory/src/anchored_summary.rs(new) —AnchoredSummarystruct,is_complete(),validate(),to_markdown(),to_json(), 12 unit testscrates/zeph-memory/src/lib.rs— pub re-exportcrates/zeph-config/src/memory.rs—structured_summaries: boolfieldcrates/zeph-core/src/agent/state/mod.rs—MemoryState.structured_summariescrates/zeph-core/src/agent/mod.rs— initializercrates/zeph-core/src/agent/builder.rs—with_structured_summaries()builder methodcrates/zeph-core/src/agent/context/summarization.rs—try_summarize_structured(), structured paths in all 3 summarization methodscrates/zeph-core/src/debug_dump/mod.rs—dump_anchored_summary()src/runner.rs— wire config into agent builderTest plan
cargo +nightly fmt --checkpassescargo clippy --workspace --features full -- -D warningspasses (0 warnings)cargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins— 5961 passed