A self-organizing Obsidian vault that gives AI coding agents persistent memory.
TypeScript ai-agentsclaude-codecodex-cligemini-cliknowledge-managementobsidianobsidian-vaultpersistent-memorysecond-braintemplate
fix: build the mod report preface from the mod's name (#324)
YingNing5ec8644deb74
diff --git a/.claude/scripts/lib/stop-report.ts b/.claude/scripts/lib/stop-report.tsindex 62da41d..ea41293 100644--- a/.claude/scripts/lib/stop-report.ts+++ b/.claude/scripts/lib/stop-report.ts@@ -13,12 +13,17 @@ const DECIDE = `then decide what the report calls for: act on what bears on theexport const AGENT_PREFACE = `Stop hook report, handed over with this message: when your previous response ended, these findings were new or changed since the last report this session. The user saw only a one-line summary of each section. Deal with the user's message first, ${DECIDE}`;/**- * Framing for the agent under the obsidian-mind mod (`om_mod: "report"`), whose+ * Framing for the agent under a vault's mod (`om_mod: "report"`), whose* delivery differs: the user saw one line under an earlier answer, the report* rides a later prompt (not always the next one), and that prompt may be the- * mod's own notice rather than the user's.+ * mod's own notice rather than the user's. `modName` is the mod's plugin name.*/-export const MOD_PREFACE = `Stop hook report, handed over with this message: when one of your earlier responses this session ended, these findings were new or changed since the last report. The user saw one line naming them under that response. Deal with this message first (it may be the user's, or a vault notice from the obsidian-mind plugin), ${DECIDE}`;+export function modPreface(modName: string): string {+ return `Stop hook report, handed over with this message: when one of your earlier responses this session ended, these findings were new or changed since the last report. The user saw one line naming them under that response. Deal with this message first (it may be the user's, or a vault notice from the ${modName} plugin), ${DECIDE}`;+}++/** The framing under obsidian-mind's own mod. */+export const MOD_PREFACE = modPreface("obsidian-mind");/** The closing line of the summary: where the detail went. */export const SUMMARY_TRAILER = "The full report reaches the agent with your next message.";diff --git a/.claude/scripts/tests/stop-report.test.ts b/.claude/scripts/tests/stop-report.test.tsindex d6ae7f7..654a5eb 100644--- a/.claude/scripts/tests/stop-report.test.ts+++ b/.claude/scripts/tests/stop-report.test.ts@@ -6,7 +6,7 @@import { test, describe } from "node:test";import assert from "node:assert/strict";-import { AGENT_PREFACE, SUMMARY_TRAILER, stopSummary } from "../lib/stop-report.ts";+import { AGENT_PREFACE, MOD_PREFACE, modPreface, SUMMARY_TRAILER, stopSummary } from "../lib/stop-report.ts";import {type ActiveHygieneReport,formatActiveHygiene,@@ -80,3 +80,18 @@ describe("AGENT_PREFACE", () => {assert.match(AGENT_PREFACE, /The user saw only a one-line summary of each section/);});});++describe("modPreface", () => {+ test("MOD_PREFACE keeps this template's literal framing", () => {+ assert.equal(+ MOD_PREFACE,+ "Stop hook report, handed over with this message: when one of your earlier responses this session ended, these findings were new or changed since the last report. The user saw one line naming them under that response. Deal with this message first (it may be the user's, or a vault notice from the obsidian-mind plugin), then decide what the report calls for: act on what bears on the current work, ask the user when something needs their call, or leave it unmentioned if nothing needs doing. Never move or delete notes without asking, and do not recite the report back.",+ );+ });++ test("modPreface names the mod, and nothing else differs", () => {+ const preface = modPreface("x");+ assert.match(preface, /a vault notice from the x plugin/);+ assert.equal(preface.replace("the x plugin", "the obsidian-mind plugin"), MOD_PREFACE);+ });+});