Skip to content

feat(memory): add durable memory store with provenance and supersession #171

@hadamrd

Description

@hadamrd

Parent: #164

Goal

Add a durable project-memory store for semantic decisions, rejected paths, episodic lessons, and procedural skills, with provenance and supersession.

This is not a transcript archive. It is the curated memory layer that lets the maestro resume with load-bearing facts and old rejected approaches without carrying low-level worker context forever.

Scope

Expected owned surface:

  • src/forge_loop/memory/models.py
  • src/forge_loop/memory/curator.py
  • a new memory store module under src/forge_loop/memory/;
  • focused tests under tests/test_memory_store.py or equivalent.

Keep the first implementation small and explicit. SQLite is acceptable if it follows the existing eventlog style; YAML/JSON is acceptable only if the tests cover durable reopen and supersession correctly.

Required Behavior

  • Persist memory items with:
    • memory_id;
    • kind: semantic, episodic, procedural;
    • title/body;
    • tags;
    • provenance/source event or source task reference;
    • active/superseded state;
    • created timestamp.
  • Query active memory items.
  • Query rejected-path memory independently.
  • Supersede an item and exclude superseded records from active boot context.
  • Preserve supersession provenance so old rationale is still inspectable.
  • Keep the curator strict: only promote candidates with a real reason to remember.

Acceptance Tests

  • Active semantic/episodic/procedural items round-trip after reopening the store.
  • Superseding a memory item removes it from active results but leaves it inspectable.
  • Rejected-path query returns only rejected-path tagged/typed items.
  • Invalid confidence/provenance is rejected using the existing model constraints.
  • Curator promotion policy does not promote empty "reason to remember" candidates.

Non-goals

  • Do not save raw transcripts.
  • Do not implement embedding search yet.
  • Do not generate summaries with an LLM in this ticket.
  • Do not make memory promotion automatic from every worker event.

Verification

Run at minimum:

  • New memory store tests.
  • env -u VIRTUAL_ENV uv run --extra dev pytest tests/test_eventlog_sqlite.py -q if using event refs.
  • env -u VIRTUAL_ENV uv run --extra dev ruff check <changed files>
  • env -u VIRTUAL_ENV uv run --extra dev ruff format --check <changed files>

Customer Story

A maestro resuming forge-loop after context loss benefits because load-bearing decisions and rejected approaches survive outside the model context.

Source

Expanded during Forge self-dogfood sprint planning on 2026-06-02.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions