feat: improve Graphiti memory quality - #8
Conversation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e4919b1eec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| input: DistinctMemoryInput, | ||
| ): Promise<MemoryWriteOutcome> { | ||
| try { | ||
| const lookup = await store.searchMemories(input.content, input.groupId); |
There was a problem hiding this comment.
Serialize deduplication checks with writes
When two automatic saves in the same group contain identical content and run concurrently—for example, matching idle digests from separate sessions—both can complete this lookup before either reaches addMemory, observe no candidate, and then both write. This defeats persistDistinctMemory and allows duplicate episodes to accumulate; reserve the normalized group/content key or otherwise serialize the lookup-and-write sequence.
Useful? React with 👍 / 👎.
| purge(): void { | ||
| try { | ||
| rmSync(filePath, { force: true }); |
There was a problem hiding this comment.
Order purges after already queued writes
If a caller starts write() and invokes purge() before awaiting that write—for example, when deleting state while persistence is queued—purge() removes the current file immediately, but the queued callback subsequently recreates it. The final state therefore contradicts the later purge request; serialize purge through writeChain or invalidate pending writes so deleted state cannot reappear.
Useful? React with 👍 / 👎.
Summary\n- add safe, deduplicated automatic turn and compaction persistence\n- enforce user/project memory isolation and provenance labels\n- filter expired, invalid, duplicate profile facts and report profile retrieval failures\n- release @happycastle/opencode-graphiti v0.6.0 with CI publish checks\n\n## Validation\n- bun test (90 passing)\n- bun run typecheck\n- bun run build\n- node dist/cli.js --help\n- npm pack --dry-run