Skip to content

feat: memory↔document cross-entity linking via [[doc-slug]] wikilinks#691

Merged
ajianaz merged 2 commits into
developfrom
feat/memory-document-crossref-689
Jul 15, 2026
Merged

feat: memory↔document cross-entity linking via [[doc-slug]] wikilinks#691
ajianaz merged 2 commits into
developfrom
feat/memory-document-crossref-689

Conversation

@ajianaz

@ajianaz ajianaz commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Memories and documents now inter-link when memory content contains [[doc-slug]] patterns.

How it works

  1. When remember() auto-wires edges, [[slug]] patterns are extracted from memory content
  2. If the slug matches a memory → creates references edge (existing behavior)
  3. If the slug matches a document → creates references_doc edge (new)
  4. Both edge types are auto-backlinked as referenced_by

New API endpoints

Endpoint Body Response
POST /memory/doc-refs {memory_id} {memory_id, doc_slugs: [...]}
POST /doc/mem-refs {doc_slug} {doc_slug, memory_ids: [...]}

New public methods

  • Uteke::recall_memories_for_document(doc_slug) → Vec<String>
  • Uteke::recall_documents_for_memory(memory_id) → Vec<String>
  • Store::edge_targets(source_id, edge_type) → Vec<String>
  • Store::edge_sources(target_id, edge_type) → Vec<String>

UnifiedSearchResult enrichment

Two new optional fields for cross-entity context:

  • linked_doc_slugs: Option<Vec<String>> — for memory results
  • linked_memory_ids: Option<Vec<String>> — for document results

Test results

  • 299/303 total tests pass ✅
  • 4 pre-existing dream::tests failures (ONNX backend unavailable)

Refs #689

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

No issues found. Code looks good!


Review powered by cora-cli · BYOK · MIT

ajianaz added 2 commits July 15, 2026 16:06
When [[slug]] in memory content doesn't match any memory, Uteke now
checks if it matches a document slug. If so, creates a 'references_doc'
edge (auto-backlinked as 'referenced_by').

New API:
- POST /memory/doc-refs → document slugs referenced by a memory
- POST /doc/mem-refs → memory IDs referencing a document
- Uteke::recall_memories_for_document(slug)
- Uteke::recall_documents_for_memory(memory_id)
- Store::edge_targets() / edge_sources() — generic typed edge queries

UnifiedSearchResult enriched with:
- linked_doc_slugs (for memory results)
- linked_memory_ids (for document results)

Refs #689
- Replace read_json() (nonexistent) with read_body<T>() pattern in
  /memory/doc-refs and /doc/mem-refs handlers
- Add missing let ns = parse_query_namespace(&path) in /tags handler
- Apply cargo fmt
@ajianaz
ajianaz force-pushed the feat/memory-document-crossref-689 branch from fa3089b to 978c9f2 Compare July 15, 2026 09:07
@ajianaz
ajianaz merged commit dcf13d7 into develop Jul 15, 2026
8 checks passed
@ajianaz
ajianaz deleted the feat/memory-document-crossref-689 branch July 15, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant