Skip to content

feat(memory): unsupersede action (thread-identity slice 4 prereq)#380

Merged
velvetmonkey merged 1 commit into
mainfrom
feat/thread-identity-slice4-unsupersede
Jun 7, 2026
Merged

feat(memory): unsupersede action (thread-identity slice 4 prereq)#380
velvetmonkey merged 1 commit into
mainfrom
feat/thread-identity-slice4-unsupersede

Conversation

@velvetmonkey

Copy link
Copy Markdown
Owner

Adds memory(action:"unsupersede", thread_id) — the undo consumer the engine's unresolveThread needs to reverse a thread resolution.

What

  • unsupersedeMemories (core/write/memory.ts): clears superseded_by + supersede_reason ONLY on self-tombstoned rows (superseded_by = id) carrying the thread_id. Rows superseded by a successor (replaced, not thread-tombstoned) stay closed and count in skipped. Idempotent via the SQL superseded_by = id guard. Restores graph edges from stored entities_json for shared/global rows (mirrors storeMemory). Same visibility scope as supersede.
  • Tool (tools/write/memory.ts): unsupersede added to the action enum + handler.

Manifest / contract safety

The tool description string is unchanged, so the catalog descriptionHash and the tool-embeddings.generated.ts manifest stay valid — no regeneration, and the tier-1 description-length contract holds. Verified against tool-routing / tool-tiering / tool-counts suites (74 passed).

Tests

6 new cases in memoryUnsupersede.test.ts: round-trip restore, idempotency, successor-skip, thread_id-required, visibility scope, graph-edge restore. Full memory suite 16/16.

Pre-existing traces/no-refresh failures (8, "MCP error … is not valid JSON") reproduce on clean main — sandbox artifact, unrelated to this change.

🤖 Generated with Claude Code

Thread-identity slice 4 prerequisite. Adds memory(action:"unsupersede",
thread_id) so the engine's unresolveThread undo path can restore facts a
prior thread resolution tombstoned.

- unsupersedeMemories: clears superseded_by + supersede_reason ONLY on
  self-tombstoned rows (superseded_by = id) carrying the thread_id. Rows
  superseded by a successor (replaced, not thread-tombstoned) are left
  closed and counted in `skipped`. Idempotent via the SQL `superseded_by =
  id` guard. Restores graph edges from stored entities_json for
  shared/global rows (mirrors storeMemory). Same visibility scope as
  supersede.
- Tool: 'unsupersede' added to the action enum + handler. Tool description
  string untouched, so the catalog descriptionHash and embeddings manifest
  stay valid (no regeneration needed) and the tier-1 length contract holds.
- Tests: 6 cases — round-trip restore, idempotency, successor-skip,
  thread_id-required, visibility scope, graph-edge restore.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@velvetmonkey velvetmonkey merged commit 3d180c2 into main Jun 7, 2026
18 checks passed
@velvetmonkey velvetmonkey deleted the feat/thread-identity-slice4-unsupersede branch June 7, 2026 17:17
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