The mempalace-side half of the #360 deferral, flagged while implementing mempalace checkpoint in #406. techempower-org/palace-daemon#240 asks for the indexed query; this is the part that has to exist first, because today there is nothing to index.
session_id is a write-only dead slot
Every reference to it in mempalace/mcp_server.py, exhaustively:
5024: session_id: str = "", # tool_diary_write parameter
5125: if session_id: # the only write
5126: base_metadata["session_id"] = session_id
That is the whole surface. Which means:
-
Nothing can set it through MCP. Neither mempalace_diary_write nor mempalace_checkpoint declares session_id in its input_schema, so no MCP client can pass it. Only a direct Python call reaches the parameter.
-
Nothing reads it. mempalace/searcher.py and mempalace/cli.py contain zero references, and no tool filters on it.
-
tool_checkpoint drops it even where it could. It writes its diary entry via
out["diary"] = tool_diary_write(
agent_name=diary.get("agent_name", "cursor-ide"),
entry=entry,
topic=diary.get("topic", "session-checkpoint"),
wing=diary.get("wing", ""),
)
— stopping one argument short of the session_id that tool_diary_write is already able to store. The default topic is literally "session-checkpoint", so the call site knows it is filing a session; it just has no way to say which.
The drawers tool_checkpoint files through tool_add_drawer carry no session metadata at all, so even a fully-threaded diary entry would leave the batch it summarizes unlinked.
Ask
- Accept
session_id on tool_checkpoint and pass it to tool_diary_write.
- Attach it to the drawers filed in the same call, so a session's diary entry and its drawers can be recovered together rather than the summary alone.
- Declare it in the
mempalace_checkpoint and mempalace_diary_write input schemas, so MCP clients — the actual writers in practice — can set it.
With those, mempalace checkpoint --session <id> becomes a real flag rather than one with nothing behind it, and techempower-org/palace-daemon#240 gets a populated key to index.
Worth a maintainer decision, not an assumption
Whether session_id should be free-form or validated. Every other name-shaped field on this path goes through sanitize_name/sanitize_kg_value; session_id currently goes through neither, because nothing reachable ever populated it. If it becomes an indexed key it becomes a query surface, and an unvalidated one is worth deciding on deliberately rather than inheriting by default. Happy to implement whichever way it should go.
Also unresolved: whether existing diary drawers should be backfilled. Hook-written entries have never carried the field, so a --session query would silently return nothing for any session predating this change — arguably fine, but it should be a choice rather than a surprise.
Related
The mempalace-side half of the #360 deferral, flagged while implementing
mempalace checkpointin #406. techempower-org/palace-daemon#240 asks for the indexed query; this is the part that has to exist first, because today there is nothing to index.session_idis a write-only dead slotEvery reference to it in
mempalace/mcp_server.py, exhaustively:That is the whole surface. Which means:
Nothing can set it through MCP. Neither
mempalace_diary_writenormempalace_checkpointdeclaressession_idin itsinput_schema, so no MCP client can pass it. Only a direct Python call reaches the parameter.Nothing reads it.
mempalace/searcher.pyandmempalace/cli.pycontain zero references, and no tool filters on it.tool_checkpointdrops it even where it could. It writes its diary entry via— stopping one argument short of the
session_idthattool_diary_writeis already able to store. The default topic is literally"session-checkpoint", so the call site knows it is filing a session; it just has no way to say which.The drawers
tool_checkpointfiles throughtool_add_drawercarry no session metadata at all, so even a fully-threaded diary entry would leave the batch it summarizes unlinked.Ask
session_idontool_checkpointand pass it totool_diary_write.mempalace_checkpointandmempalace_diary_writeinput schemas, so MCP clients — the actual writers in practice — can set it.With those,
mempalace checkpoint --session <id>becomes a real flag rather than one with nothing behind it, and techempower-org/palace-daemon#240 gets a populated key to index.Worth a maintainer decision, not an assumption
Whether
session_idshould be free-form or validated. Every other name-shaped field on this path goes throughsanitize_name/sanitize_kg_value;session_idcurrently goes through neither, because nothing reachable ever populated it. If it becomes an indexed key it becomes a query surface, and an unvalidated one is worth deciding on deliberately rather than inheriting by default. Happy to implement whichever way it should go.Also unresolved: whether existing diary drawers should be backfilled. Hook-written entries have never carried the field, so a
--sessionquery would silently return nothing for any session predating this change — arguably fine, but it should be a choice rather than a surprise.Related
mempalace checkpointcommand #360 — the CLI issue whose--session/checkpoint listshape this unblocksmempalace checkpointover the real schema, without those flags