Memory Governance and Write
This page describes the stable responsibilities of LingXi's memory midstream: how durable candidates enter governance, how they are written, and why that layer exists.
Module Position
The LingXi memory mainline can be understood in three parts:
- upstream extraction and adjudication
- midstream governance and write
- downstream retrieval and application
The governance-and-write layer is the part that turns adjudicated durable candidates into stable memory notes.
What This Layer Does
The current write layer is responsible for:
- accepting structured candidates
- deciding create, merge, or skip
- assigning note ids
- writing note files
- rebuilding
INDEX.md - updating runtime state and operation logs
It works from structured candidates and carries the persistence contract of the memory system.
Current Governance Actions
In the current LingXi mainline, the primary governance actions are:
createmerge_into_existingskip_as_not_durable
This means the main job of the governance layer is to:
- write new high-value judgment into memory
- merge semantically equivalent or stronger judgment into existing notes
- actively skip content that should not become long-lived memory
What Governance Uses To Decide
The governance layer considers signals such as:
- the candidate's semantic meaning
content_typevalue_scoressuggested_storage_kind- the existing notes already present in the memory store
It cares about semantic relation. For example:
- whether two candidates express the same engineering judgment
- whether a candidate is a stronger version of an existing note
- whether a candidate is still too transient or noisy
Why Governance Is Separate From Distillation
LingXi separates upstream distillation from midstream governance so the system keeps a cleaner contract:
Upstream answers
- is this worth treating as durable engineering judgment
- what kind of judgment is it
- in what scene is it useful
Midstream answers
- should this become a new note
- should it merge into an existing note
- should it be skipped to avoid polluting memory
If these are collapsed into one step, the system easily degrades into direct note generation, which is weaker for both quality control and long-term governance.
Stable Artifacts After Write
After governance succeeds, LingXi writes notes into:
.lingxi/memory/project/.lingxi/memory/share/
And maintains:
.lingxi/memory/INDEX.md
It also updates runtime state such as:
.lingxi/state/processed-sessions.json.lingxi/state/distill-journal.jsonl.lingxi/state/memory-ops.jsonl(created on demand)
So this layer writes notes and maintains the consistency of the whole memory runtime.
Why The Write Layer Is Deterministic
LingXi lets LLMs handle extraction, adjudication, governance judgment, and ranking, but it keeps persistence deterministic.
That is because:
- semantic judgment needs model reasoning
- ids, files, indexes, and state need stability
- repeated runs must not silently corrupt memory
- the memory runtime must remain auditable and testable
So the write layer is optimized less for cleverness and more for consistency and safety.
How It Relates To Retrieval
The point of write governance is to keep the notes useful for downstream application.
Those notes are ultimately consumed by retrieval:
taskuses them while draftingvetuses them while challenging tasks- other meaningful repository work can use them through memory brief primitives
So the write layer is always in service of better downstream judgment.