Skip to content
This repository was archived by the owner on Jun 3, 2026. It is now read-only.

Add deterministic code and snippet memory identity - #181

Open
hunterbastian wants to merge 3 commits into
XortexAI:mainfrom
hunterbastian:codex-code-snippet-schema
Open

hunterbastian wants to merge 3 commits into
XortexAI:mainfrom
hunterbastian:codex-code-snippet-schema

Conversation

@hunterbastian

Copy link
Copy Markdown
Contributor

Summary

Implements deterministic identity metadata for code annotations and personal snippets so XMem can avoid re-judging exact code/snippet memories with an LLM.

Changes:

  • add stable Pinecone metadata helpers for snippet identity, snippet search text, code annotation identity keys, and code annotation content hashes
  • route code and snippet memory through deterministic judge paths using metadata lookups
  • store snippet_hash, annotation_key, and annotation_hash in Pinecone metadata
  • keep snippet code exact in metadata while embedding only the searchable description/language/tags text
  • add regression coverage for repeated snippets across sessions and same-target code annotation updates

This addresses the edge case discussed in #141 where a user sends a snippet, then asks for the same snippet in another session. The normalized snippet_hash lets the judge no-op the duplicate without another model call.

Verification

  • python3 -m compileall src/schemas/code.py src/agents/judge.py src/pipelines/ingest.py src/pipelines/weaver.py tests/unit/test_schemas.py tests/test_deterministic_memory_layer.py
  • uv run --extra dev pytest tests/unit/test_schemas.py tests/test_deterministic_memory_layer.py -> 12 passed
  • uv run --extra dev pytest -> 44 passed
  • uv run ruff check --select F401 src/schemas/code.py src/agents/judge.py src/pipelines/ingest.py src/pipelines/weaver.py tests/unit/test_schemas.py tests/test_deterministic_memory_layer.py
  • git diff --check

/claim #141

Loading
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants