Skip to main content

Module experience

Module experience 

Source
Expand description

Experience-memory tier (DocTrace, arXiv:2606.10921).

DocTrace’s two-tier idea: tier 1 is the raw memory store (everything mnemo already does); tier 2 is an experience memory that caches a successful retrieval/reasoning plan — the query signature, the steps taken, the chunks that led to a confirmed-good outcome, and an outcome score — and replays that plan when a structurally-similar query recurs, instead of re-running full retrieval from scratch.

This is implemented as a mode, not a new store: plans are persisted as ordinary [MemoryRecord]s carrying the reserved EXPERIENCE_PLAN_TAG with the plan payload in metadata. That buys backend-agnosticism (DuckDB + PostgreSQL, unchanged schema) and RBAC/consent (scope + ACL) for free, and lets the existing remember write-path handle hashing, embedding, and audit events.

§Two new ops (gated)

Both are gated behind MnemoEngine::with_experience_memory; with the mode off (the default) REMEMBER_PLAN is a validation error and RECALL_PLAN always misses, so default behaviour is unchanged. Plan records are also excluded from ordinary recall (they are replayed only via RECALL_PLAN).

§Signature & similarity

A query signature is its normalized significant-token set (signature_tokens); structural similarity is the jaccard overlap of two signatures. This is deterministic and backend-/embedder-agnostic (works under NoopEmbedding), which is what the v0 replay gate needs; a learned signature is a later knob.

Structs§

CachedPlan
A replayable plan plus the similarity that matched it.
PlanPayload
The cached plan payload, serialized into the record metadata.
RecallPlanRequest
RECALL_PLAN input.
RecallPlanResponse
RECALL_PLAN output.
RememberPlanRequest
REMEMBER_PLAN input.
RememberPlanResponse
REMEMBER_PLAN output.

Constants§

DEFAULT_SIMILARITY_THRESHOLD
Default Jaccard threshold above which a stored plan is replayed.
DEFAULT_SUCCESS_THRESHOLD
Plans scoring below this outcome are treated as failures and never cached.
EXPERIENCE_PLAN_TAG
Reserved tag stamped on every experience-tier plan record. Plans are excluded from ordinary recall and read back only via RECALL_PLAN.
PLAN_METADATA_KEY
Metadata key under which the PlanPayload is serialized.

Functions§

execute_recall_plan
RECALL_PLAN — return the best replayable plan for a query, or a miss.
execute_remember_plan
REMEMBER_PLAN — persist a successful plan into the experience tier.
jaccard
Jaccard overlap |A∩B| / |A∪B| of two signature token sets. Returns 0.0 when both are empty.
signature_tokens
Normalize a query into its signature token set: lowercase, split on non-alphanumerics, drop tokens shorter than 3 chars, dedup, and sort so the signature is order-independent.