diff --git a/skills/brain-page/bin/brain.mjs b/skills/brain-page/bin/brain.mjs index a2a0af6..013b31e 100755 --- a/skills/brain-page/bin/brain.mjs +++ b/skills/brain-page/bin/brain.mjs @@ -402,6 +402,8 @@ function brainWireBlock(agent) { "", "This project keeps a **Project Brain**: a persistent memory layer of its durable decisions, requirements, and constraints. Read `./BRAIN.md` for the full read/write contract.", "", + "The `brain` CLI is not guaranteed to be on `PATH`. From the project root, invoke it as `node /bin/brain.mjs [flags]`, resolving `` to the installed `brain-page` skill directory.", + "", "Maintain the brain as part of normal coding work — not as a separate task. While discussing or implementing features:", "- **Start of a task:** load relevant context with the `brain` CLI (`list-pages`, `read-page`, `read-root`). Prefer a narrow read over scanning everything.", "- **When a decision, requirement, constraint, or durable insight settles** (in chat or while coding): capture it immediately via the `brain` CLI. Do not wait to be asked and do not batch it for later.", @@ -410,7 +412,7 @@ function brainWireBlock(agent) { "- Only store what will still matter in six months and is hard to reconstruct from the code alone.", "- All reads and writes go through the `brain` CLI — never hand-edit brain files.", "", - "The brain skills (`brain-setup`, `brain-page`, `brain-ingest`, `brain-bootstrap`) are installed in your global skills directory. Prefer `brain init` to scaffold a new project.", + "The brain skills (`brain-setup`, `brain-page`, `brain-ingest`, `brain-bootstrap`) are installed in your global skills directory. To scaffold a new project, run `node /bin/brain.mjs init` from its root.", ]; if (agent === "claude-code") lines.splice(3, 0, "@import ./BRAIN.md"); return [WIRE_BEGIN, ...lines, WIRE_END].join("\n"); diff --git a/skills/brain-page/test/cli-hooks.test.mjs b/skills/brain-page/test/cli-hooks.test.mjs index 9ea8e0f..3baac53 100644 --- a/skills/brain-page/test/cli-hooks.test.mjs +++ b/skills/brain-page/test/cli-hooks.test.mjs @@ -268,7 +268,7 @@ test("hook failure-opens: missing CLI, failing brain-dir, failing list-pages", ( const rInstall = runBrain(project, ["install-hooks"]); assert.equal(rInstall.status, 0, rInstall.stderr || rInstall.stdout); - const missing = runHook(project, { brainCli: join(project, "no-such-cli.mjs"), path: "/usr/bin" }); + const missing = runHook(project, { brainCli: join(project, "no-such-cli.mjs"), path: "/usr/bin:/bin" }); assert.equal(missing.status, 0, missing.stderr); assert.equal((missing.stdout || "").trim(), ""); diff --git a/skills/brain-page/test/cli-init-wire.test.mjs b/skills/brain-page/test/cli-init-wire.test.mjs index ec8eec7..332fdba 100644 --- a/skills/brain-page/test/cli-init-wire.test.mjs +++ b/skills/brain-page/test/cli-init-wire.test.mjs @@ -113,6 +113,16 @@ test("wire is idempotent: second run replaces the marked block only once", (t) = const agents = readFileSync(join(project, "AGENTS.md"), "utf8"); assert.match(agents, /Keep PRs small/); assertCompanionBlock(agents); + assert.match(agents, /not guaranteed to be on `PATH`/); + assert.match( + agents, + /node \/bin\/brain\.mjs \[flags\]/, + ); + assert.match( + agents, + /node \/bin\/brain\.mjs init/, + ); + assert.doesNotMatch(agents, /Prefer `brain init`/); }); test("wire fails loudly on a damaged block (one marker without its pair)", (t) => {