From 112d66d5ae355bbb8cc501b6ec77a0f812907f6c Mon Sep 17 00:00:00 2001 From: w1n5t0n Date: Sun, 27 Sep 2026 12:20:39 +0300 Subject: [PATCH] memo: optional note-gate hook beside the store A host may place an executable note-gate next to the memory directory to classify or refuse notes before they are written. The gate records accepted notes itself by calling memo with MEMO_UNGATED=1, so the check never recurses. --- memo | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/memo b/memo index 224409b..4a725dc 100755 --- a/memo +++ b/memo @@ -838,6 +838,13 @@ def main(): print("No such command: %s\n" % cmd, file=sys.stderr) print(usage, file=sys.stderr) sys.exit(1) + if cmd == "note" and not os.environ.get("MEMO_UNGATED"): + # An optional host hook beside the store may classify or refuse a note + # before it is written. It records accepted notes itself by calling + # back with MEMO_UNGATED=1, so this check never recurses. + gate = os.path.join(os.path.dirname(memory_dir()), "note-gate") + if os.access(gate, os.X_OK): + os.execv(gate, [gate] + sys.argv[2:]) try: # `init` is the only command that may run without an existing memory: # it is the one that creates it. Every other command refuses, so a