Skip to content

feat: add one operations surface over the memory core - #13

Merged
Musyg merged 1 commit into
mainfrom
feat/operations-surface
Nov 15, 2026
Merged

Musyg merged 1 commit into
mainfrom
feat/operations-surface

Conversation

@Musyg

@Musyg Musyg commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Why

The Hermes Agent provider (#11) and the remote MCP endpoint (#12) each talk to the core on their own and only expose flat sources: remember, search, withdraw. Derived artifacts, exact parents, corrections, cascade and lessons stay out of reach. This PR adds the one class every integration should go through, so they all expose the whole memory.

What

hermes_memory.persistent.PersistentMemory, one workspace of one store:

# Operation Methods
1 Read an exact version, with the refusal reason and a reader state read
2 Search current, admissible versions; validity windows checked now; stale index rebuilt once search
3 Admit a new source remember
4 Derive from exact parents (derives, indexes, cites) derive
5 Compare-and-swap correction, metadata and parents kept correct
6 Parents, upstream graph, versions, dependents; metadata only explain
7 Plan, then withdraw: source revoked or derived artifact invalidated, dependents blocked plan_withdrawal, withdraw
8 Lesson from a task trace and its feedback; parents stay out of search; withdrawing either blocks the lesson learn
9 Exposure ledger and one-time notices for withdrawn, invalidated or superseded versions record_exposure, notices, exposure_report
  • core.py is unchanged (80c55792...). The surface relies on the hash pin TypedMemory already enforces.
  • index.db and ledger.db are sidecars: deleting them loses notices, never safety.
  • Docs: docs/OPERATIONS.md and docs/OPERATIONS.fr.md; README links them and updates the public test count; PROVENANCE.json records the new and changed files.

Checks

  • 33 new unittest methods (199 for the memory package), synthetic data only.
  • Thirteen mutations of the surface (no cascade on derived, no projection purge, repeated notices, indexed lesson parents, ignored CAS version, no scope check, no completeness rule, no rollback, no resync, no search exposure, cites by default, no validity check, metadata dropped on correction): each one turns the suite red.
  • scripts/check_distributions.py: four installed suites passed (wheel and rebuilt sdist, memory 199 and registry 49), test-source parity true, on Python 3.11 and 3.12 (Linux, official python Docker images). Hosted CI minutes are exhausted until 3 December.

Next

Step 2 puts a full stdio MCP server on this surface; step 3 moves #11 and #12 onto it and adds a Qdrant projection. #11 and #12 stay open until then.

hermes_memory.persistent.PersistentMemory gathers the memory's operations
behind one class, so every integration (MCP, agent plugins, HTTP) exposes
the same memory instead of a flat subset:

1. read an exact version through current authority, with the reason and a
   reader state when it is refused;
2. search current, admissible versions (validity windows checked now,
   preconditions, kinds), rebuilding a stale index once;
3. remember a new source;
4. derive an artifact from exact parent versions (derives, indexes, cites);
5. correct with compare-and-swap, keeping metadata and parents;
6. explain parents, upstream graph, versions and dependents, metadata only;
7. plan a withdrawal, then withdraw: a source is revoked, a derived
   artifact is invalidated, and everything derived from it is blocked;
8. learn a lesson from a task trace and its feedback: both stay raw
   provenance outside search, the lesson is derived from them, and
   withdrawing either blocks it;
9. an exposure ledger that tells a session, once, which versions it was
   shown that are withdrawn, invalidated or superseded.

core.py is unchanged (sha256 80c55792...); the surface relies on the pin
TypedMemory already enforces. The search index and ledger.db are sidecars
and never decide what may be read.

33 new unittest methods, 199 for the memory package. Thirteen mutations of
the surface were each caught by the suite. check_distributions.py passes
all four installed suites on Python 3.11 and 3.12 (Linux, official python Docker images).

docs/OPERATIONS.md and OPERATIONS.fr.md document the surface; README links
it and updates the public test count; PROVENANCE.json records the new and
changed files.
@Musyg
Musyg merged commit 646a4a9 into main Nov 15, 2026
8 checks passed
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