Skip to content

feat(memory): add version-aware development history core - #456

Draft
Anduin9527 wants to merge 17 commits into
libra-tools:mainfrom
Anduin9527:codex/memory-m2-core-draft-pr
Draft

feat(memory): add version-aware development history core#456
Anduin9527 wants to merge 17 commits into
libra-tools:mainfrom
Anduin9527:codex/memory-m2-core-draft-pr

Conversation

@Anduin9527

Copy link
Copy Markdown
Contributor

Summary

  • add repository-local, event-sourced Memory storage with immutable revisions,
    append-only events, CAS-protected refs and rebuildable SQLite projections
  • automatically compile terminal Task and Intent development history into
    version-bound Episodes with structured evidence
  • add deterministic FTS5/BM25 retrieval, Git applicability checks and audited
    context injection through ContextSelectionReceiptV1

Architecture

The implementation follows the design accepted in #454:

  1. Git objects and the protected Memory ref preserve authoritative history.
  2. SQLite stores rebuildable projections, bounded compiler jobs, FTS5 indexes
    and context-selection receipts.
  3. Task Episodes summarize one development task.
  4. Intent Episodes pin contributing Task revisions and summarize requirement
    iteration across tasks.
  5. Episode retrieval freezes repository, code and projection state before
    ranking and context injection.

Upstream integration

The branch includes the latest upstream main.

Upstream now owns migration 2026082401 for Agent Bridge link relations, so
the unpublished Memory migrations were renumbered to:

  • 2026082501_memory_core
  • 2026082502_memory_fts_search
  • 2026082503_context_selection_receipt

No Memory schema semantics changed during the renumbering.

Verification

  • cargo test --test db_migration_test -- --test-threads=1: 80 passed
  • cargo test --lib internal::ai::memory: 114 passed
  • cargo test --lib internal::ai::context_budget: 96 passed
  • cargo test --lib internal::ai::prompt::builder: 14 passed
  • FTS5 capability test: passed
  • Agent Bridge migration compatibility: 4 passed
  • worktree-doctor and agent-capture migration boundaries: passed
  • cargo +nightly fmt --all --check: passed
  • cargo clippy --all-targets --all-features -- -D warnings: passed

Review guide

Suggested review order:

  1. migrations, domain contracts, writer and projection replay
  2. bounded evidence sources, generation jobs and Episode compilers
  3. FTS5/BM25 reader, frozen views and audited context injection

Scope

This Draft PR ends at M2-12.

The public libra memory CLI, benchmark, coverage gate and release closeout
remain in M2-13 through M2-15.

Refs #451
Builds on #454

Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
Signed-off-by: anduin9527 <anduin9527@gmail.com>
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