Alexander Whitestone
|
13ef670c05
|
feat: session compaction with fact extraction (#748)
Contributor Attribution Check / check-attribution (pull_request) Successful in 29s
Docker Build and Publish / build-and-push (pull_request) Has been skipped
Supply Chain Audit / Scan PR for supply chain risks (pull_request) Successful in 33s
Tests / e2e (pull_request) Successful in 3m26s
Tests / test (pull_request) Failing after 1h28m50s
Before compressing conversation context, extract durable facts
(user preferences, corrections, project details) and save to
fact store so they survive compression.
New agent/session_compactor.py:
- extract_facts_from_messages(): scans user messages for
preferences, corrections, project/infra facts using regex
- 3 pattern categories: user_pref (5 patterns), correction
(3 patterns), project (4 patterns)
- ExtractedFact: category, entity, content, confidence, source_turn
- save_facts_to_store(): saves to fact store (callback or auto-detect)
- extract_and_save_facts(): one-call extraction + persistence
- Deduplication by category+content
- Skips tool results, short messages, system messages
- format_facts_summary(): human-readable summary
Tests: tests/test_session_compactor.py (9 tests)
Closes #748
|
2026-04-15 22:41:54 -04:00 |
|