Most of what the hook stored, nobody typed

Maple’s prompt hook sends the start of every message in a Maple session to the memory search, which embeds it and keeps it. On 2026-10-30 Richard noticed that non-MODS work was sitting there beside the MODS work, with nothing to tell the two apart. On the 31st he approved seven leans on #1352, and a side session (this one) built the first PR.

Counting before choosing

One lean was to skip messages Richard didn’t type, but its instructions said to count the stored rows of that kind before picking the patterns. The count changed the size of the job. Of the 3,307 prompts the hook had stored since June, 2,190 open with a machine tag. Background task notices alone were 1,330, and scheduled prompts another 361. Cross-session messages, agent messages and CI events made up most of the rest. In all, about 59% of what the hook embedded and kept was text Richard never typed. None of the 5,062 rows carried a session id.

The count also caught a trap. 257 rows open with a system reminder, but 122 of those have Richard’s own words after it. A rule that skipped anything opening with a tag would have dropped his prompts. So the hook now strips leading reminders, judges what follows, and searches on that.

It settled a design question too. A /private command only works if the hook sees the slash command as typed, before any expansion. The stored rows showed that it does: 75 begin /steward and 43 begin /loop. So the hook writes the private flag before anything is posted, and the command itself is never sent.

What was built

  • Every post carries the session id.
  • A private session sends nothing at all. That covers harvest_privacy’s list and any session that ran /private. The memory tools are refused there, and the harvesters skip its transcript.
  • A component is stored only when a session declares one, from a five-name allowlist.
  • Migration 122 adds the columns. Like every migration merge, it waits for Richard.

The tests run the real hook as a subprocess against a stub server that counts requests. To check that “nothing was posted” could fail, I removed each opt-out in turn and re-ran them: three tests failed on the prompt side, one at session start, five on the tool refusal.

What it can’t do

Rows from before this PR have no session id, so purging by session can’t reach them; Richard chose to keep those for now. Two choices went past the lean’s wording, so they are flagged for him: skipping scheduled prompts, and skipping a side session’s opening brief. One more he should see is that the “component filter” on search and recall only records the tag so far. Filtering which memories come back needs a component on the memories themselves, which is the second PR.

Sunday: the first PR live, the second built

Richard approved all three calls on 2026-11-01 and the first PR merged. Its migration then reached prod. His next typed message was the first row in the logs to carry a session id. A background notice that arrived in between left no row, because the new hook now skips those.

He then chose how scoping should work: a session that declares a component recalls that component’s memories plus untagged ones. The second PR builds that. Memories can now carry a component, and search, recall and the four memory tools scope by it. Since the hook already sends the declared component, a declared session’s injected notes are scoped with no change to the hook. Every existing memory is untagged, so nothing changes until memories are saved with a component. To confirm the tests could catch a broken scope, I disabled it, and six failed.