Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion skills/brain-page/bin/brain.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <brain-page-skill-dir>/bin/brain.mjs <subcommand> [flags]`, resolving `<brain-page-skill-dir>` 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.",
Expand All @@ -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 <brain-page-skill-dir>/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");
Expand Down
2 changes: 1 addition & 1 deletion skills/brain-page/test/cli-hooks.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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(), "");

Expand Down
10 changes: 10 additions & 0 deletions skills/brain-page/test/cli-init-wire.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <brain-page-skill-dir>\/bin\/brain\.mjs <subcommand> \[flags\]/,
);
assert.match(
agents,
/node <brain-page-skill-dir>\/bin\/brain\.mjs init/,
);
assert.doesNotMatch(agents, /Prefer `brain init`/);
});

test("wire fails loudly on a damaged block (one marker without its pair)", (t) => {
Expand Down
Loading