Repository navigation
spec: H2 amendment, scope and abstention (#119) - #155
Merged
Merged
Conversation
The design for H2 before any code (D5): how retain names a scope, what a record the caller cannot see answers, wiki export, hook checkpoints scoped to MEMKERNEL_AGENT_ID (and what that means for tools sharing a store, #107), filtering in Python, storage, the caller on each path, every read and write path, exclusion counts with out_of_scope and capped, and empty_reason. B1-B5 await the owner.
A private record supersedes only its own scope (explicit and code's automatic supersede; one live snapshot per source and scope); a checkpoint retain without a scope defaults to the caller's agent scope under B4; parts take their owner's scope and a document chunk resolves only to a visible summary; empty_reason for order="newest"; receipt entries show a non-project scope.
The owner confirmed B1, B2, B3 and B5 and revised B4: automatic and implicit checkpoints use the caller's effective scope (task when it has a task id, otherwise agent when it has an agent id, otherwise project); latest-checkpoint recovery uses only that scope; scope="project" is an explicit shared handoff. Tools continuing the same work share a task id; tools acting as the same logical agent share an agent id.
…ids, a new scope starts empty; unsaved-session report store-wide (#119)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The design for H2, scope and abstention (issue #119's FR-001, FR-005, SC-1, SC-4, SC-6), as a spec amendment before any code (D5). Spec only: one section appended to
specs/memkernel-0-15-harness-foundations/spec.md, after H1's amendment. It leaves #119 open; the H2 build follows once the owner has decided B1–B5.Decisions for the owner (B1–B5)
retain(scope=…)takesproject(default),agentortask, meaning the caller's own id; stored asagent:<id>/task:<id>; refused without that id.get/asknot found,forgetdeleted: false, asupersedes=orpromotetarget ignored or not found. The cost (a mistyped id gets "not found", not a scope error) is stated.wiki_exportdrafts fromprojectrecords only, whoever calls it.agent:<MEMKERNEL_AGENT_ID>when that variable is set,projectotherwise, so two agents on one project each recover their own. Tools sharing one store (One memkernel store across several coding tools (Claude Code, Codex, Cursor, Antigravity) #107) must set the same agent id or none; the README and the Codex and Cursor templates will say so. The alternative (all hook checkpointsproject) and its limit are written beside it.top_kvisible results or the store runs out.Stated so the review can check them (B6–B11)
scope, written only when notproject; no migration: every path, dedup included, reads a missing key asproject.agent_id/task_idonrecall,retain,get,ask,forget,promote,consolidate(from the call or the process), the process's for hook blocks, the settings' for the Python API. Neither:projectonly. The admin API sees every record,/health/storeincluded.recall(both orders),get,list_memories,ask,consolidate's candidates, the hook blocks,wiki_export. Health reaches callers as counts only.promotekeeps scope,scope="project"publishes; targets must be visible; wiki import and capture writeproject;withdrawis the wiki import's own, with no caller.excludedaddsout_of_scopeandcapped(the captured-records limit H1 left out); each candidate counts once, in the order out of scope, superseded, flagged, expired, capped; out-of-scope candidates never reach the receipt'smemoriesorreturned_chars.recallrecordsempty_reason:no_match,out_of_scope(every candidate) orexcluded; the MCP response stays a JSON list.Review so far
The reviewer's pre-review points are answered in the text: B4's recommendation and its #107 interaction, B5's widening and legacy records, the admin API and health,
promoteandwithdraw. DeepSeek (two rounds, plan review): PASS; acted on: one reason per excluded candidate, the not-found answers per path, no migration and dedup on legacy records.Review round 1 (4d139d3 → a730733)
agent:/task:record supersedes only that scope; aprojectrecord anything the caller can see (project records and the caller's own private ones). A breakingsupersedes=is refused with an error. Code's automatic supersede follows the rule: one live snapshot persourceand scope.retain(checkpoint=true)withoutscopeisagentwhen the caller has an agent id (a task id alone does not change it); explicitscope="project"shares it. B1 points to it.out_of_scope.order="newest"(B11): an empty one recordsno_matchorout_of_scope.scopewhen it is notproject.Owner's decisions (2026-11-23) → f4bfe26
task:<task_id>when it has a task id, otherwiseagent:<agent_id>when it has an agent id, otherwiseproject. Automatic (hook) and implicit (retain(checkpoint=true)withoutscope) checkpoints are saved there; latest-checkpoint recovery (session start, compaction recovery,recall(checkpoint_only=true, order="newest")) uses only that scope, with no fallback toproject;scope="project"is an explicit shared handoff, visible to everyone through relevancerecall. Tools continuing the same work share a task id; tools acting as the same logical agent share an agent id (One memkernel store across several coding tools (Claude Code, Codex, Cursor, Antigravity) #107).order="newest",empty_reason: out_of_scopemeans live checkpoints exist but none in the caller's effective scope (B11).Review round 2 (f4bfe26 → 19c7264)
B4's consequences, written into the spec for the build: checkpoint recovery needs the ids in the environment of both the server and the hooks; a task id stays the same across sessions continuing the same work; setting an id the first time starts that scope empty. B8: the startup report of ended sessions without a checkpoint counts checkpoints in any scope.