Skip to content

feat: identity memory source type — auto-capture when users express identity-significant feelings#106

Merged
AxDSan merged 1 commit into
mainfrom
feat/identity-memory-source
May 13, 2026
Merged

feat: identity memory source type — auto-capture when users express identity-significant feelings#106
AxDSan merged 1 commit into
mainfrom
feat/identity-memory-source

Conversation

@AxDSan
Copy link
Copy Markdown
Owner

@AxDSan AxDSan commented May 13, 2026

Closes #104

What

Adds identity as a first-class memory source type in Mnemosyne. The auto-memory system now detects when a user expresses identity-significant feelings and saves them with high importance for durable recall.

Why

The current auto-memory system only captures:

  • Preferences ("user prefers short responses")
  • Environment facts ("project uses pytest")
  • Conventions ("tags use kebab-case")

It has no awareness of emotional or identity-relevant conversations. When a user talks about feeling unsure about their work, questioning their expertise, or expressing pride in a feature they shipped — those are the most important things to remember, and Mnemosyne currently misses them all.

Changes

Tool schemas

  • REMEMBER_SCHEMA source description now includes identity
  • System prompt blurb updated: "durable fact, preference, identity, or insight"
  • Plugin tools source description updated

Auto-capture in sync_turn()

New _capture_identity_signals() method runs after every user turn. Detects identity-significant expressions via keyword matching:

  • "feeling like", "imposter/impostor", "barely know"
  • "don't know my own", "don't even know how"
  • "i'm proud", "want them to feel"

When a match is found, saves as:

  • source="identity" — new source type
  • importance=0.85 — high priority for recall
  • scope="global" — survives session boundaries
  • veracity="stated" — direct user assertion

Only one identity memory per turn (break after first match).

Tests

5 test cases in tests/test_identity_memory.py:

  • Detects imposter syndrome expressions
  • Detects pride expressions
  • No false positives on neutral conversation
  • Only one identity memory per turn
  • Identity memory persists to database and is recallable

Impact

  • Breaking change: No. New source type, existing memories unchanged.
  • Storage: Minimal — identity memories in the tens per user.
  • Runtime: Negligible — simple string contains checks, no LLM calls.

- Add 'identity' to valid source types in tool schemas and descriptions

- Auto-detect identity-significant expressions (imposter feelings, pride, uncertainty)

- Save as source=identity, importance=0.85, scope=global for durable recall

- Tests: 5 test cases covering detection, false positives, dedup, and DB persistence
@AxDSan AxDSan merged commit 6e1655b into main May 13, 2026
1 of 5 checks passed
@AxDSan AxDSan deleted the feat/identity-memory-source branch May 13, 2026 01:20
AxDSan pushed a commit that referenced this pull request May 13, 2026
PR #106 added tests/test_identity_memory.py whose fixture errors on
every PR's CI matrix with two separate setup failures, blocking all
five currently-open PRs (#98, #101, #102, #105, #107):

  1. AttributeError: 'str' object has no attribute 'parent'
     The fixture does `BeamMemory(db_path=db_path)` where db_path is
     a string from tempfile. BeamMemory.__init__ stored it as-is, then
     _get_connection at beam.py:326 did `path.parent.mkdir(...)` --
     strings don't have .parent.

  2. AttributeError: 'BeamMemory' object has no attribute 'initialize'
     The fixture then calls `beam.initialize()`. BeamMemory has no
     such method; __init__ already opens the connection and runs
     init_beam() (schema setup, sleep_log, etc.). The .initialize()
     call must have been left over from a refactor where the test
     was rewritten to use BeamMemory directly instead of
     MnemosyneMemoryProvider (which DOES have an initialize()).

Both bugs caused 5 ERROR records in CI, marking the run failed even
though the actual test bodies are correct.

Fixes:

  - mnemosyne/core/beam.py BeamMemory.__init__: coerce non-Path
    db_path via Path(db_path) before storage. Backward-compatible --
    real Path inputs stay Path, strings get coerced, None still falls
    back to _default_db_path(). The implicit Path-only contract is
    now explicit and tolerant.

  - tests/test_identity_memory.py fixture: drop the spurious
    beam.initialize() call. __init__ already does the setup work.

Regression test: tests/test_beam_db_path_string_coercion.py pins the
db_path acceptance contract across str / Path / None inputs, plus an
end-to-end smoke that exercises the .parent.mkdir(parents=True) path
that the original AttributeError hit.

Empirics:
  - 9/9 in the targeted slice (4 new coercion tests + 5 PR #106
    identity tests now pass)
  - 143/143 in the broader slice across
    hermes_memory_provider/plugin_session/plugins/integration/
    data_dir_scripts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AxDSan added a commit that referenced this pull request May 13, 2026
…ercion

fix: two bugs in PR #106's identity-memory test fixture blocking CI
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.

Feature: auto-memory should capture identity-significant conversations (not just preferences/facts)

1 participant