Commit e538d6d
feat(core): v2 union-find with overlap window and deferred summarization
Architectural changes:
- Forest.union() is now synchronous — structural merge only, no LLM calls
- ContextWindow.append() is now synchronous — no blocking
- ContextWindow.render() returns cached summaries (synchronous)
- New resolveDirty() method — async fire-and-forget batch summarization
- Overlap window (graduateAt/evictAt) eliminates staleness
Key improvements over v1:
- O(n) cost instead of O(n²) — each message summarized at most once
- Zero blocking on append or render
- Background resolveDirty runs during main LLM call wait
89/89 tests pass, 0 type errors.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 4520529 commit e538d6d
3 files changed
Lines changed: 484 additions & 130 deletions
File tree
- packages/core/src
- context
- services
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
166 | 165 | | |
167 | 166 | | |
168 | 167 | | |
169 | 168 | | |
170 | 169 | | |
171 | | - | |
172 | 170 | | |
173 | 171 | | |
174 | 172 | | |
| |||
237 | 235 | | |
238 | 236 | | |
239 | 237 | | |
240 | | - | |
241 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
242 | 243 | | |
243 | 244 | | |
244 | 245 | | |
| |||
610 | 611 | | |
611 | 612 | | |
612 | 613 | | |
613 | | - | |
| 614 | + | |
| 615 | + | |
614 | 616 | | |
615 | 617 | | |
616 | 618 | | |
| |||
628 | 630 | | |
629 | 631 | | |
630 | 632 | | |
631 | | - | |
| 633 | + | |
632 | 634 | | |
633 | 635 | | |
634 | 636 | | |
635 | | - | |
| 637 | + | |
636 | 638 | | |
637 | 639 | | |
638 | 640 | | |
639 | 641 | | |
640 | 642 | | |
641 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
642 | 649 | | |
643 | 650 | | |
644 | 651 | | |
| |||
0 commit comments