Tombstone the remaining forget paths (close the immutability arc)
Phase 1 tombstoned memory/delete + node/delete, but the generic forget
path was still destructive. This routes every forget through the same
tombstone semantics so nothing in the daemon can hard-delete an engram
node anymore.
Canonical helper: mem_tombstone (memory.el, imported first so every module
can call it) — keep the node + its edges, record a Tombstone marker, never
engram_forget. neuron-api's tombstone_node now delegates to it (single
source of truth).
Per-path before -> after:
- memory.el `mem_forget` hard delete (engram_forget) -> tombstone. This
alone fixes both callers: the /api/neuron/memory/forget route
(handle_api_forget) and the cultivate op=="forget".
- awareness.el autonomous `forget` action engram_forget -> mem_tombstone.
The soul can no longer autonomously hard-delete a memory.
- mcp-wrapper tool_forget was a FAKE no-op that returned {"ok","deleted"}
without deleting OR tombstoning -> now routes to the soul's tombstoning
/api/neuron/memory/delete; tool description fixed to say it
supersedes/tombstones (recoverable), not "Remove a node".
Left intentionally as hard deletes (internal GC / lifecycle, not user
memory, all call engram_forget directly): session-summary replace
(chat.el), mem_consolidate dedup (memory.el), session-start telemetry
pruning (soul.el), session lifecycle (sessions.el).
Regenerated both ship paths under a 3GB physical-RSS watchdog (peak ~32MB):
dist/soul.c (single-TU amalgamation, macOS/Linux) and the per-module
dist/{memory,awareness,neuron-api}.c (Windows/Linux build). Verified: no
forget handler calls engram_forget; a forget leaves the node present +
tombstone marker. Gate (neuron-ui verify-soul-contract.sh, new memory-forget
row): PRESENCE + IMMUTABILITY PASS.
This commit is contained in:
@@ -43,8 +43,32 @@ fn mem_strengthen(node_id: String) -> Void {
|
||||
engram_strengthen(node_id)
|
||||
}
|
||||
|
||||
// mem_tombstone — immutable "delete": KEEP the node and all its edges; record a
|
||||
// Tombstone marker (content = target id, label "tombstone:<id>", wired with a
|
||||
// "tombstones" edge). Never engram_forget. Default bounded list reads hide
|
||||
// tombstoned nodes; ?include_deleted=1 recovers them. This is the ONE canonical
|
||||
// tombstone helper — every forget path routes through it. Defined here in
|
||||
// memory.el (imported first) so awareness.el and neuron-api.el can both call it.
|
||||
fn mem_tombstone(node_id: String) -> String {
|
||||
let tags: String = "[\"Tombstone\",\"status:deleted\"]"
|
||||
let marker: String = engram_node_full(
|
||||
node_id, "Tombstone", "tombstone:" + node_id,
|
||||
el_from_float(0.01), el_from_float(0.01), el_from_float(1.0),
|
||||
"Episodic", tags)
|
||||
if !str_eq(marker, "") {
|
||||
engram_connect(marker, node_id, el_from_float(1.0), "tombstones")
|
||||
}
|
||||
return marker
|
||||
}
|
||||
|
||||
// mem_forget — NOTE: no longer a hard delete. Engram nodes are immutable, so
|
||||
// this now TOMBSTONES (via mem_tombstone): the node and its edges are kept and
|
||||
// stay recoverable. Every caller (the /memory/forget route and the cultivate
|
||||
// forget op) is non-destructive as a result. Internal GC that genuinely needs
|
||||
// removal (session-summary replace, telemetry pruning) calls engram_forget
|
||||
// directly and is unaffected by this.
|
||||
fn mem_forget(node_id: String) -> Void {
|
||||
engram_forget(node_id)
|
||||
let _marker: String = mem_tombstone(node_id)
|
||||
}
|
||||
|
||||
// mem_consolidate — structural scan plus salience-evolution pass.
|
||||
|
||||
Reference in New Issue
Block a user