Files
openhuman/src
51406535cf feat(memory): conversation segmentation, event extraction, and user profile accumulation (#176)
* feat: enhance archivist functionality with conversation segmentation and event extraction

- Updated the Archivist to manage conversation segments, including boundary detection and lifecycle management.
- Implemented event extraction from closed segments to update user profiles with preferences and facts.
- Added new methods for loading user profile context and integrating it into the bootstrap context.
- Introduced new database tables for storing events and user profiles, along with necessary SQL initialization scripts.
- Enhanced memory query capabilities to include episodic and event data, improving retrieval accuracy.

This update significantly improves the system's ability to maintain context and extract meaningful insights from conversations.

* style: apply cargo fmt formatting to new memory modules

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(tests): add comprehensive tests for archivist and memory modules

- Introduced new tests for the Archivist to validate turn accumulation and preference event extraction during conversation segmentation.
- Enhanced event handling tests to ensure idempotency in event insertion and correct filtering by event type.
- Added profile management tests to verify upsert behavior and retrieval of multiple facet types.
- Implemented query tests to confirm retrieval of episodic and event hits, ensuring accurate memory querying.
- Expanded segment management tests to validate segment ordering and summary handling.

These additions improve test coverage and reliability of the memory and archivist functionalities.

* style: apply cargo fmt to new test code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(archivist, memory): enhance segment management and event handling

- Updated the `manage_segment` function to utilize the current episodic ID for turn appending and segment creation, ensuring accurate tracking of conversation turns.
- Improved event extraction logic to run outside of transactions, allowing for better handling of SQLite connection locks.
- Added `episodic_relevance` to chunk metadata for improved memory hit scoring.
- Enhanced FTS5 event search to be scoped by namespace, improving query accuracy.
- Introduced a new utility function for safe UTF-8 string truncation, enhancing content display consistency.

These changes improve the reliability and accuracy of conversation segmentation and memory operations.

* fix(archivist): use <= for segment end_timestamp filter bound

The strict < bound excluded entries at the exact end_timestamp, causing
extraction to miss content when turns have near-identical timestamps
(common in tests and rapid interactions).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* style: apply cargo fmt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:29:40 -07:00
..