From 6b5176f023cdc94456cdaf992e576a0733011303 Mon Sep 17 00:00:00 2001 From: Muhamed Isabegovic Date: Sun, 25 Oct 2026 11:17:02 +0100 Subject: [PATCH 01/10] Template update fallback: replace owned directories in place, one shared owned-path list --- extensions/pi-brain/template-update.ts | 41 +++-------------- tests/template-update.test.ts | 64 ++++++++++++++++++++++++++ tools/lib/template-owned.d.mts | 1 + tools/lib/template-owned.mjs | 35 ++++++++++++++ tools/migrate-clone.mjs | 23 +-------- 5 files changed, 108 insertions(+), 56 deletions(-) create mode 100644 tests/template-update.test.ts create mode 100644 tools/lib/template-owned.d.mts create mode 100644 tools/lib/template-owned.mjs diff --git a/extensions/pi-brain/template-update.ts b/extensions/pi-brain/template-update.ts index 7df06c3..5eb0f0c 100644 --- a/extensions/pi-brain/template-update.ts +++ b/extensions/pi-brain/template-update.ts @@ -1,32 +1,13 @@ -import { readFile, writeFile, stat, mkdir, copyFile } from "node:fs/promises"; +import { readFile, writeFile, mkdir, cp, rm } from "node:fs/promises"; import { join, dirname } from "node:path"; import type { BrainHome } from "./types.ts"; import { execFilePromise, pathExists, extractSimpleYamlValue } from "./utils.ts"; +import { TEMPLATE_OWNED_PATHS } from "../../tools/lib/template-owned.mjs"; export const TEMPLATE_OWNER = "misabegovic"; export const TEMPLATE_REPO = "pi-brain"; -export const TEMPLATE_OWNED_PATHS = [ - "AGENTS.md", - "GETTING_STARTED.md", - "README.md", - "extensions", - "skills", - "prompts", - "themes", - "tools/templates", - "tools/connectors", - "tools/brain-convert.mjs", - "tools/brain-ingest-repo.mjs", - "tools/brain-links.mjs", - "tools/brain-state.mjs", - "tools/brain-sync.mjs", - "tools/clone-pi-brain.sh", - "tools/setup-local.sh", - "tools/git-hooks", - ".github", - "personas", -]; +export { TEMPLATE_OWNED_PATHS }; export interface TemplateChange { path: string; @@ -112,16 +93,8 @@ export async function diffTemplatePaths(home: BrainHome, upstreamDir: string): P export async function applyTemplateChange(home: BrainHome, upstreamDir: string, change: TemplateChange) { const localPath = join(home.path, change.path); const upstreamPath = join(upstreamDir, change.path); - if (change.status === "removed") { - await execFilePromise("rm", ["-rf", localPath]); - } else { - const parent = dirname(localPath); - await mkdir(parent, { recursive: true }); - const s = await stat(upstreamPath); - if (s.isDirectory()) { - await execFilePromise("cp", ["-R", upstreamPath, localPath]); - } else { - await copyFile(upstreamPath, localPath); - } - } + await rm(localPath, { recursive: true, force: true }); + if (change.status === "removed") return; + await mkdir(dirname(localPath), { recursive: true }); + await cp(upstreamPath, localPath, { recursive: true }); } diff --git a/tests/template-update.test.ts b/tests/template-update.test.ts new file mode 100644 index 0000000..10e28e5 --- /dev/null +++ b/tests/template-update.test.ts @@ -0,0 +1,64 @@ +/** + * Template update tests: the GitHub-release fallback places owned paths + * correctly (no nesting on an existing directory) and the owned-path list + * covers every tool the package ships. + */ + +import { mkdtemp, mkdir, writeFile, readFile, readdir, rm } from "node:fs/promises"; +import { join } from "node:path"; +import { tmpdir } from "node:os"; +import { applyTemplateChange, diffTemplatePaths, TEMPLATE_OWNED_PATHS } from "../extensions/pi-brain/template-update.ts"; +import { pathExists } from "../extensions/pi-brain/utils.ts"; + +async function put(root: string, rel: string, text: string) { + const full = join(root, rel); + await mkdir(join(full, ".."), { recursive: true }); + await writeFile(full, text, "utf-8"); +} + +async function main() { + const root = await mkdtemp(join(tmpdir(), "pi-brain-template-update-")); + const clone = join(root, "clone"); + const upstream = join(root, "upstream"); + await mkdir(clone, { recursive: true }); + await mkdir(upstream, { recursive: true }); + + await put(clone, "extensions/pi-brain/index.ts", "old"); + await put(clone, "extensions/pi-brain/stale.ts", "stale"); + await put(upstream, "extensions/pi-brain/index.ts", "new"); + await put(upstream, "tools/lib/resolve-home.mjs", "export {};"); + await put(upstream, "tools/run-tasks.mjs", "// runner"); + + const home = { path: clone } as any; + const changes = await diffTemplatePaths(home, upstream); + const byPath = new Map(changes.map((c) => [c.path, c.status])); + if (byPath.get("extensions") !== "modified") throw new Error("Expected extensions modified"); + if (byPath.get("tools/lib") !== "added") throw new Error("Expected tools/lib added"); + if (byPath.get("tools/run-tasks.mjs") !== "added") throw new Error("Expected tools/run-tasks.mjs added"); + + for (const change of changes) await applyTemplateChange(home, upstream, change); + + if (await pathExists(join(clone, "extensions", "extensions"))) throw new Error("Applying onto an existing directory nested it"); + if ((await readFile(join(clone, "extensions/pi-brain/index.ts"), "utf-8")) !== "new") throw new Error("Expected upstream file content"); + if (await pathExists(join(clone, "extensions/pi-brain/stale.ts"))) throw new Error("Expected file gone upstream to be removed"); + if (!(await pathExists(join(clone, "tools/lib/resolve-home.mjs")))) throw new Error("Expected tools/lib placed"); + if (!(await pathExists(join(clone, "tools/run-tasks.mjs")))) throw new Error("Expected tools/run-tasks.mjs placed"); + if ((await diffTemplatePaths(home, upstream)).length !== 0) throw new Error("Expected no remaining diff after apply"); + console.log("✓ applyTemplateChange replaces directories in place and places new paths"); + + await applyTemplateChange(home, upstream, { path: "tools/run-tasks.mjs", status: "removed" }); + if (await pathExists(join(clone, "tools/run-tasks.mjs"))) throw new Error("Expected removed path deleted"); + console.log("✓ applyTemplateChange removes paths gone upstream"); + + const toolEntries = await readdir(join(import.meta.dirname, "..", "tools")); + const missing = toolEntries.filter((name) => !TEMPLATE_OWNED_PATHS.includes(`tools/${name}`)); + if (missing.length > 0) throw new Error(`tools/ entries not in TEMPLATE_OWNED_PATHS: ${missing.join(", ")}`); + console.log("✓ every file under tools/ is covered by the owned-path list"); + + await rm(root, { recursive: true, force: true }); +} + +main().catch((err) => { + console.error(err); + process.exit(1); +}); diff --git a/tools/lib/template-owned.d.mts b/tools/lib/template-owned.d.mts new file mode 100644 index 0000000..2476d86 --- /dev/null +++ b/tools/lib/template-owned.d.mts @@ -0,0 +1 @@ +export const TEMPLATE_OWNED_PATHS: string[]; diff --git a/tools/lib/template-owned.mjs b/tools/lib/template-owned.mjs new file mode 100644 index 0000000..d53e66e --- /dev/null +++ b/tools/lib/template-owned.mjs @@ -0,0 +1,35 @@ +/** + * template-owned — the one list of paths a pi-brain release owns. + * + * A clone's content (wiki/, sources/, log/, brain.config.yml) is never in this + * list. Both the GitHub-release update fallback (extensions/pi-brain/template-update.ts) + * and tools/migrate-clone.mjs read it, so they cannot disagree about what the + * template owns. tests/template-update.test.ts fails when a file under tools/ + * is not covered here. + */ +export const TEMPLATE_OWNED_PATHS = [ + "AGENTS.md", + "GETTING_STARTED.md", + "README.md", + "extensions", + "skills", + "prompts", + "themes", + "tools/templates", + "tools/connectors", + "tools/lib", + "tools/git-hooks", + "tools/brain-convert.mjs", + "tools/brain-ingest-repo.mjs", + "tools/brain-intent.mjs", + "tools/brain-links.mjs", + "tools/brain-projects.mjs", + "tools/brain-state.mjs", + "tools/brain-sync.mjs", + "tools/clone-pi-brain.sh", + "tools/migrate-clone.mjs", + "tools/run-tasks.mjs", + "tools/setup-local.sh", + ".github", + "personas", +]; diff --git a/tools/migrate-clone.mjs b/tools/migrate-clone.mjs index 648d22a..4b46b5f 100644 --- a/tools/migrate-clone.mjs +++ b/tools/migrate-clone.mjs @@ -20,31 +20,10 @@ import { readFile, readdir, stat, mkdir, rm, copyFile, writeFile } from "node:fs import { join, relative, dirname } from "node:path"; import { fileURLToPath } from "node:url"; import { execFile } from "node:child_process"; +import { TEMPLATE_OWNED_PATHS } from "./lib/template-owned.mjs"; const __dirname = dirname(fileURLToPath(import.meta.url)); const PACKAGE_ROOT = dirname(__dirname); -const TEMPLATE_OWNED_PATHS = [ - "AGENTS.md", - "GETTING_STARTED.md", - "README.md", - "extensions", - "skills", - "prompts", - "themes", - "tools/templates", - "tools/connectors", - "tools/brain-convert.mjs", - "tools/brain-ingest-repo.mjs", - "tools/brain-links.mjs", - "tools/brain-projects.mjs", - "tools/brain-state.mjs", - "tools/brain-sync.mjs", - "tools/clone-pi-brain.sh", - "tools/setup-local.sh", - "tools/git-hooks", - ".github", - "personas", -]; const clonePath = process.argv[2]; const dryRun = process.argv.includes("--dry-run"); From 953d0776be644bc42491be8b5800f518ce9b964b Mon Sep 17 00:00:00 2001 From: Muhamed Isabegovic Date: Sun, 25 Oct 2026 11:17:18 +0100 Subject: [PATCH 02/10] One template version: package.json is read by setup, clone script and the repo config --- brain.config.yml | 2 +- extensions/pi-brain/commands/shape.ts | 3 +- package-lock.json | 4 +-- package.json | 2 +- tests/version-consistency.test.ts | 41 +++++++++++++++++++++++++++ tools/clone-pi-brain.sh | 8 +++++- 6 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 tests/version-consistency.test.ts diff --git a/brain.config.yml b/brain.config.yml index c9fcc56..cfe7f81 100644 --- a/brain.config.yml +++ b/brain.config.yml @@ -81,4 +81,4 @@ brain_session_shutdown: true # pi-brain template version this clone was created from or last updated to. # Used by /brain:update to diff against upstream releases. -template_version: "v0.5.0" +template_version: "v0.5.2" diff --git a/extensions/pi-brain/commands/shape.ts b/extensions/pi-brain/commands/shape.ts index f5ad110..0663a7c 100644 --- a/extensions/pi-brain/commands/shape.ts +++ b/extensions/pi-brain/commands/shape.ts @@ -5,6 +5,7 @@ import { pathExists } from "../utils.ts"; import { readOrg } from "../brain-home.ts"; import { validateMarkdown, regenerateViews } from "../views.ts"; import { requireBrain } from "../context.ts"; +import { readPackageVersion } from "../resources.ts"; export function registerShapeCommands(pi: ExtensionAPI) { pi.registerCommand("brain:shape", { @@ -109,7 +110,7 @@ export function registerShapeCommands(pi: ExtensionAPI) { "brain_session_shutdown: true", "", "# pi-brain template version this clone was created from or last updated to.", - `template_version: "v0.3.2"`, + `template_version: "v${await readPackageVersion()}"`, "", ]; await writeFile(join(cwd, "brain.config.yml"), configLines.join("\n"), "utf-8"); diff --git a/package-lock.json b/package-lock.json index 3f098ae..7edaaf5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@misabegovic/pi-brain", - "version": "0.5.1", + "version": "0.5.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@misabegovic/pi-brain", - "version": "0.5.1", + "version": "0.5.2", "license": "MIT", "devDependencies": { "@earendil-works/pi-coding-agent": "1.4.0", diff --git a/package.json b/package.json index 3df5103..b039f1a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@misabegovic/pi-brain", - "version": "0.5.1", + "version": "0.5.2", "description": "A cozy knowledge home for pi. Distributed as a global package; brain clones are content-only and inherit skills, prompts, themes, tools, and the extension from the install.", "keywords": [ "pi-package", diff --git a/tests/version-consistency.test.ts b/tests/version-consistency.test.ts new file mode 100644 index 0000000..e027680 --- /dev/null +++ b/tests/version-consistency.test.ts @@ -0,0 +1,41 @@ +/** + * One template version: package.json is the source, and every place that + * stamps a template_version reads it instead of carrying its own literal. + */ + +import { readFile, mkdtemp, rm } from "node:fs/promises"; +import { join } from "node:path"; +import { tmpdir } from "node:os"; +import { spawnSync } from "node:child_process"; + +const ROOT = join(import.meta.dirname, ".."); + +async function main() { + const version = JSON.parse(await readFile(join(ROOT, "package.json"), "utf-8")).version; + + const config = await readFile(join(ROOT, "brain.config.yml"), "utf-8"); + const stamped = config.match(/^template_version:\s*"([^"]+)"/m)?.[1]; + if (stamped !== `v${version}`) throw new Error(`brain.config.yml template_version ${stamped} != v${version}`); + console.log("✓ brain.config.yml template_version matches package.json"); + + const shape = await readFile(join(ROOT, "extensions/pi-brain/commands/shape.ts"), "utf-8"); + if (/template_version: "v\d/.test(shape)) throw new Error("/brain:setup carries a literal template version"); + console.log("✓ /brain:setup reads the version from package.json"); + + const tmp = await mkdtemp(join(tmpdir(), "pi-brain-clone-version-")); + try { + const target = join(tmp, "clone"); + const result = spawnSync("bash", [join(ROOT, "tools/clone-pi-brain.sh"), target, "Test"], { encoding: "utf-8" }); + if (result.status !== 0) throw new Error(`clone-pi-brain.sh failed: ${result.stderr}`); + const cloneConfig = await readFile(join(target, "brain.config.yml"), "utf-8"); + if (!cloneConfig.includes(`template_version: "v${version}"`)) throw new Error("clone-pi-brain.sh did not stamp the package version"); + console.log("✓ clone-pi-brain.sh stamps the package version"); + } finally { + await rm(tmp, { recursive: true, force: true }); + } +} + +main().catch((err) => { + console.error(err); + process.exit(1); +}); diff --git a/tools/clone-pi-brain.sh b/tools/clone-pi-brain.sh index cd5facf..721dd9d 100755 --- a/tools/clone-pi-brain.sh +++ b/tools/clone-pi-brain.sh @@ -34,6 +34,12 @@ fi TARGET_DIR="$(mkdir -p "$(dirname "${TARGET_DIR}")" && cd "$(dirname "${TARGET_DIR}")" && pwd)/$(basename "${TARGET_DIR}")" ORG_NAME="${ORG_NAME:-$(basename "${TARGET_DIR}")}" +TEMPLATE_VERSION="$(node -p "require('${TEMPLATE_REPO}/package.json').version" 2>/dev/null || true)" +if [[ -z "${TEMPLATE_VERSION}" ]]; then + echo "Error: could not read the template version from ${TEMPLATE_REPO}/package.json" + exit 1 +fi + mkdir -p "${TARGET_DIR}" cd "${TARGET_DIR}" @@ -66,7 +72,7 @@ connectors: structure: repos: [] -template_version: "v0.3.0" +template_version: "v${TEMPLATE_VERSION}" EOF # Core wiki pages From 0829aa9b34eaf4ad4050e027f6a0e298bd5f721e Mon Sep 17 00:00:00 2001 From: Muhamed Isabegovic Date: Sun, 25 Oct 2026 11:17:40 +0100 Subject: [PATCH 03/10] Describe the regenerative loop at its real size; remove the unproducible Matched count --- GETTING_STARTED.md | 8 ++++---- README.md | 14 ++++++++------ extensions/pi-brain/diff.ts | 4 +--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index d077d65..e670dd0 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -89,19 +89,19 @@ This gives every pi session the brain extension, skills, prompts, themes, templa ## 7. Generate and sync code from intent -If your PRD/ADR uses YAML intent blocks, pi-brain can generate and track code: +If your PRD/ADR carries a `data_model` YAML intent block, pi-brain can generate TypeScript interfaces from it and track drift against your code. `types` is the only target today; other block types are not rendered: - [ ] Build from approved intent. ```bash - /brain:build + /brain:build types ``` - [ ] Check for drift between intent and existing code. ```bash - /brain:diff + /brain:diff types ``` - [ ] Reconcile drift with proposals. ```bash - /brain:sync-code + /brain:sync-code types ``` - [ ] Propose revisions to intent based on new evidence. ```bash diff --git a/README.md b/README.md index a521bfa..572e0ea 100644 --- a/README.md +++ b/README.md @@ -23,20 +23,22 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for the PR-first workflow and local valid ## Regenerative intent workflow -pi-brain is evolving from a static intent store into a regenerative system where approved intent drives code and agents maintain intent over time: +A small, working loop exists for one kind of intent: data models. A PRD or ADR can carry a fenced YAML intent block of type `data_model` (a name plus typed fields). The other block types the parser reads (`api_surface`, `behavior`, `invariant`) are collected and listed, but nothing renders or diffs them yet. ``` -PRD/ADR with YAML intent blocks +PRD/ADR with a data_model intent block ↓ - /brain:build → generated code + /brain:build types → generated TypeScript interfaces (a draft under ai-suggestions/) ↓ - /brain:diff → drift report + /brain:diff types → drift report against the interfaces in your code ↓ - /brain:sync-code → proposals / apply + /brain:sync-code types → one proposal per drift item, for a human to decide ↓ - /brain:revise → updated intent + /brain:revise → suggested updates to intent ``` +`types` is the only build and diff target. The drift report compares interface and field names, types and optionality, and lists what is missing in code, extra in code, or mismatched. It does not generate application code beyond those interfaces, and it never edits your code on its own. + Commands: `/brain:build`, `/brain:diff`, `/brain:sync-code`, `/brain:revise`, `/brain:collaborate`, `/brain:rfc-contribute`, `/brain:enqueue`, `/brain:run-tasks`, `/brain:tasks`, `/brain:bg-agent`, `/brain:enola-status`, `/brain:enola-check`, `/brain:enola-capture`, `/brain:enola-generate`, `/brain:enola-diff`, `/brain:enola-citations`, `/brain:enola-baseline`, `/brain:enola-query`, `/brain:enola-impact`. ## Vision: how pi-brain manages knowledge diff --git a/extensions/pi-brain/diff.ts b/extensions/pi-brain/diff.ts index 921327e..c57a3d6 100644 --- a/extensions/pi-brain/diff.ts +++ b/extensions/pi-brain/diff.ts @@ -74,7 +74,7 @@ function intentToInterface(block: IntentBlock): TsInterface { } export interface DriftItem { - kind: "missing_in_code" | "extra_in_code" | "type_mismatch" | "optional_mismatch" | "matched"; + kind: "missing_in_code" | "extra_in_code" | "type_mismatch" | "optional_mismatch"; interfaceName: string; fieldName?: string; intentType?: string; @@ -127,7 +127,6 @@ export function diffInterfaces(intent: TsInterface[], code: TsInterface[]): Drif } export function formatDriftReport(scope: string, target: string, items: DriftItem[]): string { - const matched = items.filter((i) => i.kind === "matched"); const missing = items.filter((i) => i.kind === "missing_in_code"); const extra = items.filter((i) => i.kind === "extra_in_code"); const mismatches = items.filter((i) => i.kind === "type_mismatch" || i.kind === "optional_mismatch"); @@ -138,7 +137,6 @@ export function formatDriftReport(scope: string, target: string, items: DriftIte `Generated at: ${new Date().toISOString()}`, "", "## Summary", - `- Matched: ${matched.length}`, `- Missing in code: ${missing.length}`, `- Extra in code: ${extra.length}`, `- Mismatches: ${mismatches.length}`, From 225159cfed011ac41e8d6ae4ea458b5e7b615c69 Mon Sep 17 00:00:00 2001 From: Muhamed Isabegovic Date: Sun, 25 Oct 2026 11:19:47 +0100 Subject: [PATCH 04/10] Fix connector runner for content-only clones and empty config, resolve the task runner from the package, correct README tool, command, test and connector docs --- AGENTS.md | 2 +- GETTING_STARTED.md | 4 ++-- README.md | 14 +++++++++----- brain.config.yml | 2 ++ extensions/pi-brain/tasks.ts | 10 +++++++++- tests/background-tasks.test.ts | 14 ++++++++++++++ tests/connectors.test.ts | 34 ++++++++++++++++++++++++++++++++++ tools/connectors/github.mjs | 2 +- tools/connectors/run.mjs | 13 +------------ wiki/org/roadmap.md | 2 +- 10 files changed, 74 insertions(+), 23 deletions(-) create mode 100644 tests/connectors.test.ts diff --git a/AGENTS.md b/AGENTS.md index 9adf0a8..da0c6d1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -73,7 +73,7 @@ When autonomy is ON, the agent may perform low-risk maintenance silently (batchi pi-brain supports two delivery modes, controlled by `LOCAL_FIRST` in `.env`: -- **LOCAL_FIRST=true (default for solo operators):** land each phase as a local commit on the current branch. Do not open PRs unless the user explicitly asks. Keep commits small and focused on one ADR/PRD/bet at a time. +- **LOCAL_FIRST=true (opt-in for solo operators; `.env.example` ships `false`):** land each phase as a local commit on the current branch. Do not open PRs unless the user explicitly asks. Keep commits small and focused on one ADR/PRD/bet at a time. - **LOCAL_FIRST=false (team/CI mode):** open a PR per phase or per bet. Each PR must link to the approved ADR/PRD/bet in the brain. ### PR conventions diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index e670dd0..8e13fcb 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -43,7 +43,7 @@ This gives every pi session the brain extension, skills, prompts, themes, templa - [ ] Configure a provider API key so pi can use an LLM. - Set `GOOGLE_API_KEY`, `ANTHROPIC_API_KEY`, etc. in `.env` or via `/login`. - [ ] Decide on delivery mode. - - Solo/local-first: set `LOCAL_FIRST="true"` in `.env` (default). Land small commits directly. + - Solo/local-first: set `LOCAL_FIRST="true"` in `.env` (`.env.example` ships `"false"`, so this is opt-in). Land small commits directly. - Team/CI mode: set `LOCAL_FIRST="false"`. Open a PR per bet, using `.github/pull_request_template.md`. ## 3. Configure the brain @@ -51,7 +51,7 @@ This gives every pi session the brain extension, skills, prompts, themes, templa - [ ] Edit `brain.config.yml`: - set `org` - add active repos/scopes - - enable connectors and list repos/pages/channels if needed + - list repos under `connectors.github.repos` if you want GitHub snapshots (the only connector that exists; the notion, slack, datadog, langfuse and structure keys are reserved placeholders that nothing reads yet) - set `auto_connect: true` only if you want connectors to run opportunistically - [ ] Run `/brain:setup` if you want the wizard. diff --git a/README.md b/README.md index 572e0ea..837f1ce 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ PRD/ADR with a data_model intent block `types` is the only build and diff target. The drift report compares interface and field names, types and optionality, and lists what is missing in code, extra in code, or mismatched. It does not generate application code beyond those interfaces, and it never edits your code on its own. -Commands: `/brain:build`, `/brain:diff`, `/brain:sync-code`, `/brain:revise`, `/brain:collaborate`, `/brain:rfc-contribute`, `/brain:enqueue`, `/brain:run-tasks`, `/brain:tasks`, `/brain:bg-agent`, `/brain:enola-status`, `/brain:enola-check`, `/brain:enola-capture`, `/brain:enola-generate`, `/brain:enola-diff`, `/brain:enola-citations`, `/brain:enola-baseline`, `/brain:enola-query`, `/brain:enola-impact`. +Commands: `/brain:build`, `/brain:diff`, `/brain:sync-code`, `/brain:revise`, `/brain:collaborate`, `/brain:rfc-contribute`, `/brain:enqueue`, `/brain:run-tasks`, `/brain:tasks`, `/brain:bg-agent`, `/brain:enola-status`, `/brain:enola-check`, `/brain:enola-capture`, `/brain:enola-generate`, `/brain:enola-diff`, `/brain:enola-citations`, `/brain:enola-baseline`, `/brain:enola-query`, `/brain:enola-impact`, `/brain:enola-govern`, `/brain:enola-plan`, `/brain:enola-findings`, `/brain:enola-judge`. ## Vision: how pi-brain manages knowledge @@ -252,10 +252,11 @@ The **package** (installed globally via `pi install @misabegovic/pi-brain`) prov | `/brain:ingest-repo [scope]` | Onboard a repository as a maintained project. | | `/brain:projects` | List onboarded projects. | | `/brain:convert [subdir]` | Convert current repo into a pi-brain clone. | +| `/brain:dump-prompt` | Dump the last system prompt seen to `tests/fixtures/` (a development baseline tool). | ## Tools -The extension registers these tools for the agent: +The extension registers these 19 tools for the agent: - `brain_status` — read the status dashboard. - `brain_capture` — append an item to the inbox. @@ -272,6 +273,9 @@ The extension registers these tools for the agent: - `brain_convert` — convert current repo into a pi-brain clone. - `brain_pull_connectors` — run configured pull connectors. - `brain_autonomy` — read or toggle autonomous brain-maintenance mode. +- `brain_update` — update pi-brain (package manager first, GitHub release diff as fallback). +- `brain_enola` — run an enola operation (check, baseline, generate, diff, citations, query, impact or govern). +- `brain_enola_capture` — run enola check and capture structural regressions as an ai-suggestion. - `brain_ingest` — ingest a file, directory, or URL into `sources/`. ## Design principles @@ -296,10 +300,10 @@ Or let `/brain:setup` install it for you. It runs `tools/brain-sync.mjs` before ## Testing ```bash -NODE_PATH=/path/to/pi-coding-agent/node_modules \ - node --import /path/to/jiti-register.mjs tests/load.test.ts +npm test # runs every tests/*.test.ts through tsx +npm run validate # type check, tests, wiki sync, link graph, intent check ``` ## Roadmap -pi-brain-specific evolutions — multi-repo aggregation, connector producers, richer TUI widgets, and customer packaging — are tracked in this repo's own `wiki/` as the shell is inhabited. +Possible evolutions (multi-repo aggregation, more connectors beyond GitHub, richer TUI widgets, customer packaging) are not committed work; the roadmap is tracked in this repo's own `wiki/` as the shell is inhabited. diff --git a/brain.config.yml b/brain.config.yml index cfe7f81..5dae5eb 100644 --- a/brain.config.yml +++ b/brain.config.yml @@ -40,6 +40,8 @@ enola.auto_baseline: false archived_repos: [] # Connector configuration (all pull-only, off until configured). +# Only the github connector exists today; the other keys are reserved +# placeholders that nothing reads yet. # Credentials live in .env (read-only-scoped tokens), never in this file. connectors: github: diff --git a/extensions/pi-brain/tasks.ts b/extensions/pi-brain/tasks.ts index 515d41d..be2eb8b 100644 --- a/extensions/pi-brain/tasks.ts +++ b/extensions/pi-brain/tasks.ts @@ -5,6 +5,7 @@ import * as path from "node:path"; import { randomUUID } from "node:crypto"; import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; import type { BrainHome, AutonomyTrustConfig } from "./types.ts"; +import { resolveResource } from "./resources.ts"; import { requireBrain } from "./context.ts"; import { getTrustLevel, shouldProceed } from "./autonomy.ts"; import { isValidIdentifier } from "./utils.ts"; @@ -310,7 +311,14 @@ export async function runTasksDetached( return { started: false, pids: [], message: "No pending background tasks." }; } - const runnerPath = path.join(home.path, "tools", "run-tasks.mjs"); + const runnerPath = await resolveResource(path.join("tools", "run-tasks.mjs"), home); + if (runnerPath.split(path.sep).includes("node_modules")) { + return { + started: false, + pids: [], + message: "The detached runner cannot start from an npm install (Node does not load TypeScript from node_modules). Run /brain:run-tasks without --detach to process the pending tasks in this session.", + }; + } const command = process.execPath; const baseArgs: string[] = []; diff --git a/tests/background-tasks.test.ts b/tests/background-tasks.test.ts index 5afb1aa..af9e4ba 100644 --- a/tests/background-tasks.test.ts +++ b/tests/background-tasks.test.ts @@ -88,6 +88,20 @@ async function main() { } await rm(emptyHome.path, { recursive: true, force: true }); + // 6b. A runner that would load from node_modules is refused with an explanation, not spawned silently + const nmRoot = await mkdtemp(join(tmpdir(), "pi-brain-bg-nm-")); + const nmHome = { path: join(nmRoot, "node_modules", "home") }; + await mkdir(join(nmHome.path, "wiki", "_state"), { recursive: true }); + await mkdir(join(nmHome.path, ".brain", "overrides", "tools"), { recursive: true }); + await writeFile(join(nmHome.path, "brain.config.yml"), "org: test\n", "utf-8"); + await writeFile(join(nmHome.path, ".brain", "overrides", "tools", "run-tasks.mjs"), "// override\n", "utf-8"); + await enqueueTask(nmHome, "run sync", "sync", "brain"); + const refused = await runTasksDetached(nmHome, nmHome.path); + if (refused.started !== false || !refused.message.includes("without --detach")) { + throw new Error(`Expected node_modules runner to be refused, got ${JSON.stringify(refused)}`); + } + await rm(nmRoot, { recursive: true, force: true }); + // 7. Verify agent operation is allowed const agentHome = await createTestHome(); const agentTask = await enqueueTask(agentHome, "research something", "agent", "brain"); diff --git a/tests/connectors.test.ts b/tests/connectors.test.ts new file mode 100644 index 0000000..956e25e --- /dev/null +++ b/tests/connectors.test.ts @@ -0,0 +1,34 @@ +/** + * Connector runner tests: it works from the package against a content-only + * clone (no tools/ in the clone) and a clone with nothing configured is a + * clean no-op, not a silent failure. + */ + +import { mkdtemp, writeFile, rm } from "node:fs/promises"; +import { join } from "node:path"; +import { tmpdir } from "node:os"; +import { spawnSync } from "node:child_process"; + +const ROOT = join(import.meta.dirname, ".."); + +async function main() { + const home = await mkdtemp(join(tmpdir(), "pi-brain-connectors-")); + try { + await writeFile(join(home, "brain.config.yml"), 'org: "x"\nactive_repos: []\n', "utf-8"); + const result = spawnSync("node", [join(ROOT, "tools/connectors/run.mjs")], { + cwd: home, + env: { ...process.env, PI_BRAIN_HOME: home }, + encoding: "utf-8", + }); + if (result.status !== 0) throw new Error(`Expected exit 0, got ${result.status}: ${result.stderr}`); + if (!result.stdout.includes("No GitHub repos configured")) throw new Error(`Expected the no-repos message, got: ${result.stdout}`); + console.log("✓ connector runner no-ops cleanly from the package against a content-only clone"); + } finally { + await rm(home, { recursive: true, force: true }); + } +} + +main().catch((err) => { + console.error(err); + process.exit(1); +}); diff --git a/tools/connectors/github.mjs b/tools/connectors/github.mjs index 2791d35..6eed6b2 100755 --- a/tools/connectors/github.mjs +++ b/tools/connectors/github.mjs @@ -195,7 +195,7 @@ async function main() { const configText = await readFile(join(CWD, "brain.config.yml"), "utf-8"); const repoSet = collectRepoSlugs(configText, process.argv.slice(2)); - if (repoSet.size === 0) { + if (repoSet.length === 0) { console.log("No GitHub repos configured. Add them to active_repos or connectors.github.repos in brain.config.yml."); return; } diff --git a/tools/connectors/run.mjs b/tools/connectors/run.mjs index 83acd7e..ceb7148 100755 --- a/tools/connectors/run.mjs +++ b/tools/connectors/run.mjs @@ -9,7 +9,6 @@ */ import { execFile } from "node:child_process"; -import { readFile } from "node:fs/promises"; import { join, dirname } from "node:path"; import { resolveHome } from "../lib/resolve-home.mjs"; @@ -17,11 +16,6 @@ import { resolveHome } from "../lib/resolve-home.mjs"; // dirname(import.meta.dirname) (= tools/) and let resolveHome take its parent. const CWD = resolveHome(import.meta.dirname ? dirname(import.meta.dirname) : undefined); -function getYamlValue(text, key) { - const match = text.match(new RegExp(`^${key}:\\s*(.*)$`, "m")); - return match?.[1].trim(); -} - function runConnector(script) { return new Promise((resolve, reject) => { const child = execFile("node", [script], { cwd: CWD }); @@ -33,15 +27,10 @@ function runConnector(script) { } async function main() { - const configText = await readFile(join(CWD, "brain.config.yml"), "utf-8"); - const githubSite = getYamlValue(configText, "connectors") - ? getYamlValue(configText.split("connectors:")[1], "site") - : ""; - // GitHub connector runs if there are repos configured or active_repos look like owner/repo slugs. const githubEnabled = true; // always try; the connector itself no-ops if nothing to do if (githubEnabled) { - const code = await runConnector(join(CWD, "tools", "connectors", "github.mjs")); + const code = await runConnector(join(import.meta.dirname, "github.mjs")); if (code !== 0) process.exitCode = code; } } diff --git a/wiki/org/roadmap.md b/wiki/org/roadmap.md index 3472441..de525d4 100644 --- a/wiki/org/roadmap.md +++ b/wiki/org/roadmap.md @@ -10,7 +10,7 @@ enola_intent: # Roadmap — org -The regenerative-intent epic is delivered and the link graph is clean. Next committed work is test coverage and real-world exercise of the new commands, plus a v0.3.3 release once that stabilizes. +The regenerative-intent epic delivered a working loop for `data_model` blocks only (build, diff and sync-code on `types`); the link graph is clean. The package is at 0.5.2 and no further feature work is committed; see the sections below for what was decided. ## Committed From b7038d3cb5ee1702bd091258c6976e221874956d Mon Sep 17 00:00:00 2001 From: Muhamed Isabegovic Date: Sun, 25 Oct 2026 11:21:50 +0100 Subject: [PATCH 05/10] Remove private-project and home-path references from the wiki, config and receipts --- brain.config.yml | 3 +- extensions/pi-brain/enola.ts | 2 +- wiki/_state/enola/receipts.json | 2 +- wiki/_state/links.json | 110 +++++++++--------- wiki/brain/adrs/background-task-runner.md | 6 + wiki/brain/adrs/brain-diff-drift-detection.md | 6 + .../brain/adrs/structured-intent-and-build.md | 6 + wiki/brain/adrs/upstream-template-sync.md | 6 + .../refinement/enola-grader-version-drift.md | 2 +- .../enola-self-repo-anchor-resolution.md | 2 +- ...ngthen-enola-integration-from-prior-art.md | 20 ++-- wiki/brain/epics/enola-integration.md | 2 +- wiki/brain/epics/regenerative-intent.md | 2 +- .../brain/records/enola-receipts-and-drift.md | 2 +- wiki/index.md | 2 +- wiki/org/state.md | 2 +- 16 files changed, 100 insertions(+), 75 deletions(-) diff --git a/brain.config.yml b/brain.config.yml index 5dae5eb..7fd09bf 100644 --- a/brain.config.yml +++ b/brain.config.yml @@ -31,7 +31,8 @@ enola.enabled: true # The PATH copy is a downstream/dev build (0.4.10 at the time of pinning). # enola-oss is the stock upstream build, upgraded in place; the baseline is # re-pinned after every upgrade (extractor versions must match to grade). -enola.binary: ~/.local/bin/enola-oss +# enola.binary: /path/to/enola +# (or set ENOLA_BINARY in .env, which takes precedence and keeps a local path out of the repo) enola.gate_build: false enola.gate_sync_code: false enola.auto_baseline: false diff --git a/extensions/pi-brain/enola.ts b/extensions/pi-brain/enola.ts index 1c08f1f..9525655 100644 --- a/extensions/pi-brain/enola.ts +++ b/extensions/pi-brain/enola.ts @@ -297,7 +297,7 @@ export async function captureEnolaRegressions(home: BrainHome): Promise<{ captur } // --------------------------------------------------------------------------- -// Receipt-based architecture state (inspired by an earlier brain) +// Receipt-based architecture state (patterns from a more mature multi-repo integration) // --------------------------------------------------------------------------- export interface EnolaReceipt { diff --git a/wiki/_state/enola/receipts.json b/wiki/_state/enola/receipts.json index 8ee53b9..0cef017 100644 --- a/wiki/_state/enola/receipts.json +++ b/wiki/_state/enola/receipts.json @@ -4,7 +4,7 @@ "enola_version": "0.2.9", "generated_at": "2026-07-31T11:14:12Z", "duration": "41.055996ms", - "repo_path": "~/projects/pi-brain", + "repo_path": "pi-brain", "git": { "ref": "main", "commit": "bfe65dfb2ce52408ab2bf38b192451c873d446b7", diff --git a/wiki/_state/links.json b/wiki/_state/links.json index 9e59ea8..ab4a961 100644 --- a/wiki/_state/links.json +++ b/wiki/_state/links.json @@ -1,5 +1,5 @@ { - "generated_at": "2026-10-22T11:51:00.173Z", + "generated_at": "2026-10-25T10:21:42.674Z", "node_count": 109, "edge_count": 658, "nodes": [ @@ -242,18 +242,18 @@ "title": "> Unreviewed ai-suggestion — promote only via /brain:tend." }, { - "path": "brain/ai-suggestions/refinement/strengthen-enola-integration-from-prior-art.md", + "path": "brain/ai-suggestions/refinement/release-bookkeeping-drift.md", "kind": "refinement", "status": "closed", - "confidence": "high", - "title": "Learn from an earlier brain enola integration and strengthen pi-brain's" + "confidence": "low", + "title": "> Unreviewed ai-suggestion — promote only via /brain:tend." }, { - "path": "brain/ai-suggestions/refinement/release-bookkeeping-drift.md", + "path": "brain/ai-suggestions/refinement/strengthen-enola-integration-from-prior-art.md", "kind": "refinement", "status": "closed", - "confidence": "low", - "title": "> Unreviewed ai-suggestion — promote only via /brain:tend." + "confidence": "high", + "title": "Strengthen pi-brain's enola integration from a more mature multi-repo integration" }, { "path": "brain/bets/agent-maintained-intent.md", @@ -1078,79 +1078,79 @@ { "source": "brain/adrs/background-task-runner", "target": "brain/prds/background-task-runner", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/prds/background-task-runner.md" + "context": "Related section" }, { "source": "brain/adrs/background-task-runner", "target": "brain/bets/background-task-runner", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/bets/background-task-runner.md" + "context": "Related section" }, { "source": "brain/adrs/background-task-runner", "target": "brain/epics/regenerative-intent", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/epics/regenerative-intent.md" + "context": "Related section" }, { "source": "brain/adrs/background-task-runner", "target": "brain/adrs/smarter-autonomy", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/adrs/smarter-autonomy.md" + "context": "Related section" }, { "source": "brain/adrs/background-task-runner", "target": "brain/adrs/autonomous-colleague-mode", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/adrs/autonomous-colleague-mode.md" + "context": "Related section" }, { "source": "brain/adrs/background-task-runner", "target": "brain/constraints/adr-before-structural-changes", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/constraints/adr-before-structural-changes.md" + "context": "Related section" }, { "source": "brain/adrs/brain-diff-drift-detection", "target": "brain/prds/brain-diff-drift-detection", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/prds/brain-diff-drift-detection.md" + "context": "Related section" }, { "source": "brain/adrs/brain-diff-drift-detection", "target": "brain/bets/brain-diff-drift-detection", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/bets/brain-diff-drift-detection.md" + "context": "Related section" }, { "source": "brain/adrs/brain-diff-drift-detection", "target": "brain/epics/regenerative-intent", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/epics/regenerative-intent.md" + "context": "Related section" }, { "source": "brain/adrs/brain-diff-drift-detection", "target": "brain/adrs/structured-intent-and-build", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/adrs/structured-intent-and-build.md" + "context": "Related section" }, { "source": "brain/adrs/brain-diff-drift-detection", "target": "brain/constraints/adr-before-structural-changes", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/constraints/adr-before-structural-changes.md" + "context": "Related section" }, { "source": "brain/adrs/brain-state-preserves-custom-content", @@ -1449,44 +1449,44 @@ { "source": "brain/adrs/structured-intent-and-build", "target": "brain/prds/structured-intent-and-build", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/prds/structured-intent-and-build.md" + "context": "Related section" }, { "source": "brain/adrs/structured-intent-and-build", "target": "brain/bets/structured-intent-and-build", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/bets/structured-intent-and-build.md" + "context": "Related section" }, { "source": "brain/adrs/structured-intent-and-build", "target": "brain/epics/regenerative-intent", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/epics/regenerative-intent.md" + "context": "Related section" }, { "source": "brain/adrs/structured-intent-and-build", "target": "brain/adrs/autonomous-refinement-protocol", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/adrs/autonomous-refinement-protocol.md" + "context": "Related section" }, { "source": "brain/adrs/structured-intent-and-build", "target": "brain/adrs/multi-agent-intent-collaboration", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/adrs/multi-agent-intent-collaboration.md" + "context": "Related section" }, { "source": "brain/adrs/structured-intent-and-build", "target": "brain/constraints/adr-before-structural-changes", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/constraints/adr-before-structural-changes.md" + "context": "Related section" }, { "source": "brain/adrs/tap-pi-extension-surface", @@ -1526,30 +1526,30 @@ { "source": "brain/adrs/upstream-template-sync", "target": "brain/prds/upstream-template-sync", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/prds/upstream-template-sync.md" + "context": "Related section" }, { "source": "brain/adrs/upstream-template-sync", "target": "brain/bets/upstream-template-sync", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/bets/upstream-template-sync.md" + "context": "Related section" }, { "source": "brain/adrs/upstream-template-sync", "target": "brain/pitches/upstream-template-sync", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/pitches/upstream-template-sync.md" + "context": "Related section" }, { "source": "brain/adrs/upstream-template-sync", "target": "brain/constraints/adr-before-structural-changes", - "kind": "markdown", + "kind": "related", "provenance": "body", - "context": "wiki/brain/constraints/adr-before-structural-changes.md" + "context": "Related section" }, { "source": "brain/adrs/versioning-and-releases", @@ -2060,7 +2060,7 @@ "target": "brain/ai-suggestions/refinement/strengthen-enola-integration-from-prior-art", "kind": "markdown", "provenance": "body", - "context": "Lessons from an earlier brain enola integration" + "context": "Strengthen pi-brain's enola integration from a more mature m" }, { "source": "brain/epics/regenerative-intent", @@ -3793,17 +3793,17 @@ }, { "source": "index", - "target": "brain/ai-suggestions/refinement/strengthen-enola-integration-from-prior-art", + "target": "brain/ai-suggestions/refinement/release-bookkeeping-drift", "kind": "markdown", "provenance": "body", - "context": "Learn from an earlier brain enola integration and strengthe" + "context": "> Unreviewed ai-suggestion — promote only via /brain:tend." }, { "source": "index", - "target": "brain/ai-suggestions/refinement/release-bookkeeping-drift", + "target": "brain/ai-suggestions/refinement/strengthen-enola-integration-from-prior-art", "kind": "markdown", "provenance": "body", - "context": "> Unreviewed ai-suggestion — promote only via /brain:tend." + "context": "Strengthen pi-brain's enola integration from a more mature m" }, { "source": "index", @@ -4727,7 +4727,7 @@ "target": "brain/ai-suggestions/refinement/strengthen-enola-integration-from-prior-art", "kind": "markdown", "provenance": "body", - "context": "Learn from an earlier brain enola integration and strengthe" + "context": "Strengthen pi-brain's enola integration from a more mature m" }, { "source": "org/state", diff --git a/wiki/brain/adrs/background-task-runner.md b/wiki/brain/adrs/background-task-runner.md index f2f26de..fa3555b 100644 --- a/wiki/brain/adrs/background-task-runner.md +++ b/wiki/brain/adrs/background-task-runner.md @@ -84,3 +84,9 @@ Scheduling is the responsibility of the host environment (cron, systemd timer, l - [wiki/brain/adrs/smarter-autonomy.md](../adrs/smarter-autonomy.md) - [wiki/brain/adrs/autonomous-colleague-mode.md](../adrs/autonomous-colleague-mode.md) - [wiki/brain/constraints/adr-before-structural-changes.md](../constraints/adr-before-structural-changes.md) + +## Amendments + +### 2026-10-25: the runner is resolved from the package, with one stated limit + +The direction is unchanged. The detached runner was looked up at `tools/run-tasks.mjs` inside the clone, which a content-only clone does not contain. It is now resolved through the package (with `.brain/overrides` honoured), like every other tool script. A limit is stated rather than hidden: Node does not load TypeScript from under `node_modules`, so when the resolved runner sits in an npm install, `/brain:run-tasks --detach` declines with a message to run `/brain:run-tasks` without `--detach` in the session, instead of spawning a worker that exits silently. diff --git a/wiki/brain/adrs/brain-diff-drift-detection.md b/wiki/brain/adrs/brain-diff-drift-detection.md index c5888e8..18168d2 100644 --- a/wiki/brain/adrs/brain-diff-drift-detection.md +++ b/wiki/brain/adrs/brain-diff-drift-detection.md @@ -62,3 +62,9 @@ pi-brain will add `/brain:diff ` that regenerates expected code - [wiki/brain/epics/regenerative-intent.md](../epics/regenerative-intent.md) - [wiki/brain/adrs/structured-intent-and-build.md](../adrs/structured-intent-and-build.md) - [wiki/brain/constraints/adr-before-structural-changes.md](../constraints/adr-before-structural-changes.md) + +## Amendments + +### 2026-10-25: no Matched count + +The drift report declared a `Matched` count, but the diff never produces a matching item, so it always read zero. The `matched` drift kind and the summary line are removed; the report lists missing, extra and mismatched items, which are the only outcomes the diff computes. diff --git a/wiki/brain/adrs/structured-intent-and-build.md b/wiki/brain/adrs/structured-intent-and-build.md index b65c83a..2f0f8b1 100644 --- a/wiki/brain/adrs/structured-intent-and-build.md +++ b/wiki/brain/adrs/structured-intent-and-build.md @@ -93,3 +93,9 @@ Generated files include: - [wiki/brain/adrs/autonomous-refinement-protocol.md](../adrs/autonomous-refinement-protocol.md) - [wiki/brain/adrs/multi-agent-intent-collaboration.md](../adrs/multi-agent-intent-collaboration.md) - [wiki/brain/constraints/adr-before-structural-changes.md](../constraints/adr-before-structural-changes.md) + +## Amendments + +### 2026-10-25: the loop's real size is stated + +The direction is unchanged; the documentation claimed more than the code does. Only `data_model` blocks are rendered (to TypeScript interfaces, target `types`); `api_surface`, `behavior` and `invariant` blocks are collected and listed but have no renderer, and no new renderers are added by this amendment. The README and GETTING_STARTED now describe the loop at that size. diff --git a/wiki/brain/adrs/upstream-template-sync.md b/wiki/brain/adrs/upstream-template-sync.md index 04923ca..1c8e1b4 100644 --- a/wiki/brain/adrs/upstream-template-sync.md +++ b/wiki/brain/adrs/upstream-template-sync.md @@ -60,3 +60,9 @@ This mechanism is exposed as a `/brain:update` command and a matching extension - [wiki/brain/bets/upstream-template-sync.md](../bets/upstream-template-sync.md) - [wiki/brain/pitches/upstream-template-sync.md](../pitches/upstream-template-sync.md) - [wiki/brain/constraints/adr-before-structural-changes.md](../constraints/adr-before-structural-changes.md) + +## Amendments + +### 2026-10-25: one owned-path list, in-place replacement, one version + +The direction is unchanged; the GitHub-release fallback did not do what this decision describes. Copying a directory onto an existing directory nested it (`extensions/extensions/`), and the list of template-owned paths in the extension had drifted from the second copy in the clone migration tool, so tools such as `tools/lib`, `tools/brain-intent.mjs`, `tools/brain-projects.mjs` and `tools/run-tasks.mjs` were never placed. The decision is that one list (`tools/lib/template-owned.mjs`) serves both consumers, that applying a change replaces the owned path in place (remove, then copy), and that `tests/template-update.test.ts` fails when a file under `tools/` is not covered by the list. The recorded `template_version` now comes from `package.json` everywhere: the repository config, `/brain:setup` and `tools/clone-pi-brain.sh` previously stamped three different values (checked by `tests/version-consistency.test.ts`). diff --git a/wiki/brain/ai-suggestions/refinement/enola-grader-version-drift.md b/wiki/brain/ai-suggestions/refinement/enola-grader-version-drift.md index 4735eb3..c28e545 100644 --- a/wiki/brain/ai-suggestions/refinement/enola-grader-version-drift.md +++ b/wiki/brain/ai-suggestions/refinement/enola-grader-version-drift.md @@ -38,7 +38,7 @@ The v0.5.0 baseline was pinned with **enola 0.4.11** (extractors v258, see `.eno ## Resolution -Closed 2026-09-14. `enola.binary: ~/.local/bin/enola-oss` set in `brain.config.yml` — a stock 0.4.11 build (extractors v258) matching the pinned baseline; the PATH copy was a 0.4.10 downstream build. The stale 0.3.6-era `.enola-b/` directory was removed (unreferenced by any code). `enola check` now grades: PASS. +Closed 2026-09-14. `enola.binary` pointed at a stock `enola-oss` build in `brain.config.yml` — a stock 0.4.11 build (extractors v258) matching the pinned baseline; the PATH copy was a 0.4.10 downstream build. The stale 0.3.6-era `.enola-b/` directory was removed (unreferenced by any code). `enola check` now grades: PASS. ## Related diff --git a/wiki/brain/ai-suggestions/refinement/enola-self-repo-anchor-resolution.md b/wiki/brain/ai-suggestions/refinement/enola-self-repo-anchor-resolution.md index 8008518..3d5d738 100644 --- a/wiki/brain/ai-suggestions/refinement/enola-self-repo-anchor-resolution.md +++ b/wiki/brain/ai-suggestions/refinement/enola-self-repo-anchor-resolution.md @@ -34,7 +34,7 @@ anchors: path: wiki/brain/adrs/autonomous-refinement-protocol.md ``` -The 2026-09-14 check flags ~45 of these as `Dangling code anchor` — yet every target path exists on disk (verified for `wiki/brain/adrs/autonomous-refinement-protocol.md` and siblings). `enola doctor` reports "no mcp-arch.yaml in ~/projects/pi-brain, using built-in defaults", and the same check notes "148 depends_on targets outside the graph; 352 imports targets outside the graph" — consistent with a repo-name that enola cannot map to a checkout. `active_repos` in `brain.config.yml` is empty, so nothing declares `pi-brain` to enola either. +The 2026-09-14 check flags ~45 of these as `Dangling code anchor` — yet every target path exists on disk (verified for `wiki/brain/adrs/autonomous-refinement-protocol.md` and siblings). `enola doctor` reports "no mcp-arch.yaml in the repository root, using built-in defaults", and the same check notes "148 depends_on targets outside the graph; 352 imports targets outside the graph" — consistent with a repo-name that enola cannot map to a checkout. `active_repos` in `brain.config.yml` is empty, so nothing declares `pi-brain` to enola either. ## Why it matters diff --git a/wiki/brain/ai-suggestions/refinement/strengthen-enola-integration-from-prior-art.md b/wiki/brain/ai-suggestions/refinement/strengthen-enola-integration-from-prior-art.md index 58b42e2..68ea672 100644 --- a/wiki/brain/ai-suggestions/refinement/strengthen-enola-integration-from-prior-art.md +++ b/wiki/brain/ai-suggestions/refinement/strengthen-enola-integration-from-prior-art.md @@ -1,30 +1,30 @@ --- -title: Learn from an earlier brain enola integration and strengthen pi-brain's +title: Strengthen pi-brain's enola integration from a more mature multi-repo integration kind: refinement status: closed confidence: high -source: comparison with an earlier brain enola architecture-graph substrate +source: comparison with a more mature multi-repo enola integration (architecture-graph substrate) enola_intent: page: type: refinement status: closed --- -# Learn from an earlier brain enola integration and strengthen pi-brain's +# Strengthen pi-brain's enola integration from a more mature multi-repo integration ## Observation -pi-brain now has an optional enola integration (tool, commands, build/sync-code gates, auto-baseline, capture). `an earlier brain` has a more mature enola integration called the "architecture-graph substrate". Comparing the two surfaces concrete improvements pi-brain could adopt without breaking its optional, low-dependency design. +pi-brain now has an optional enola integration (tool, commands, build/sync-code gates, auto-baseline, capture). A larger, multi-repo knowledge base has a more mature enola integration, called here the "architecture-graph substrate". Comparing the two surfaces concrete improvements pi-brain could adopt without breaking its optional, low-dependency design. -## How an earlier brain uses enola +## How the mature integration uses enola -- **Native enola config**: `mcp-arch.yaml` at the brain root lists a multi-repo cluster (`../app`, `../cli`, `../agent`, etc.), ignore globs, and output settings. +- **Native enola config**: `mcp-arch.yaml` at the brain root lists a multi-repo cluster of sibling repositories, ignore globs, and output settings. - **Receipts as state**: `wiki/_state/enola/receipts.json` records per-repo snapshot metadata (snapshot_id, enola_version, git commit, fact_count, content_digest). -- **Determinism handling**: `brain.py enola generate` computes order-independent `content_digest` hashes over `facts.jsonl` because upstream `snapshot_id` proved nondeterministic for TypeScript repos with duplicate candidate import paths. -- **Drift detection**: `brain.py enola diff` compares live receipts against recorded ones and reports repo-level fact-count deltas. -- **Citation verification**: `brain.py enola citations` scans wiki prose for `enola receipt sha256:... @ , ` citations and verdicts them as `ok`, `stale`, or `malformed`. +- **Determinism handling**: its generate step computes order-independent `content_digest` hashes over `facts.jsonl` because upstream `snapshot_id` proved nondeterministic for TypeScript repos with duplicate candidate import paths. +- **Drift detection**: its diff step compares live receipts against recorded ones and reports repo-level fact-count deltas. +- **Citation verification**: its citations step scans wiki prose for `enola receipt sha256:... @ , ` citations and verdicts them as `ok`, `stale`, or `malformed`. - **Skill integration**: `/sync` runs architecture drift, `/shape` consults the graph in Phase 1, `/ask coverage:` compares wiki pages against the graph inventory, and groom flags stale/malformed citations. -- **MCP registration**: the enola server is registered beside `brain-mcp` so any sibling repo can reach it. +- **MCP registration**: the enola server is registered beside the knowledge base's own MCP server so any sibling repo can reach it. - **Skip-when-absent**: all graph-dependent checks exit 0 with a one-line message if the binary, config, or state is missing, so remote CI never depends on enola. ## How pi-brain's integration differs today diff --git a/wiki/brain/epics/enola-integration.md b/wiki/brain/epics/enola-integration.md index 2c5ddd0..2d2065a 100644 --- a/wiki/brain/epics/enola-integration.md +++ b/wiki/brain/epics/enola-integration.md @@ -76,4 +76,4 @@ Build on the optional enola integration introduced in v0.3.3 (PR #68). Expand it - [wiki/brain/records/optional-enola-integration.md](../records/optional-enola-integration.md) - `skills/brain-enola/SKILL.md` - [wiki/brain/records/version-0-3-3.md](../records/version-0-3-3.md) -- [Lessons from an earlier brain enola integration](../ai-suggestions/refinement/strengthen-enola-integration-from-prior-art.md) +- [Strengthen pi-brain's enola integration from a more mature multi-repo integration](../ai-suggestions/refinement/strengthen-enola-integration-from-prior-art.md) diff --git a/wiki/brain/epics/regenerative-intent.md b/wiki/brain/epics/regenerative-intent.md index bf6aa59..8bb206a 100644 --- a/wiki/brain/epics/regenerative-intent.md +++ b/wiki/brain/epics/regenerative-intent.md @@ -84,7 +84,7 @@ Research into the pi coding-agent extension surface shows that most of the build - **Session state persistence:** `pi.appendEntry()` can store custom state (e.g., todo lists, running tasks) in the session file. - **Context handoff:** `ctx.newSession()` and `ctx.fork()` support moving accumulated context to a fresh session. -(pi extension docs: `~/.nvm/versions/node/v22.22.2/lib/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md`) +(pi extension docs: the `docs/extensions.md` file shipped in the `@earendil-works/pi-coding-agent` package) ### Relevant pi examples diff --git a/wiki/brain/records/enola-receipts-and-drift.md b/wiki/brain/records/enola-receipts-and-drift.md index da7f780..e370092 100644 --- a/wiki/brain/records/enola-receipts-and-drift.md +++ b/wiki/brain/records/enola-receipts-and-drift.md @@ -28,7 +28,7 @@ enola_intent: ## What changed -Strengthened pi-brain's optional enola integration with patterns learned from `an earlier brain`: +Strengthened pi-brain's optional enola integration with patterns learned from a more mature multi-repo enola integration: 1. **Receipt state** — `/brain:enola-generate` runs enola and records snapshot metadata in `wiki/_state/enola/receipts.json`. 2. **Content-digest drift detection** — `/brain:enola-diff` compares live snapshots to recorded receipts and reports fact-count deltas. diff --git a/wiki/index.md b/wiki/index.md index 09f730e..c8ad81e 100644 --- a/wiki/index.md +++ b/wiki/index.md @@ -69,8 +69,8 @@ This is the synthesis layer for this pi-brain instance. - [> Unreviewed ai-suggestion — promote only via /brain:tend.](brain/ai-suggestions/refinement/enola-self-repo-anchor-resolution.md) - [Integrate optional enola intelligence into relevant pi-brain skills](brain/ai-suggestions/refinement/integrate-enola-into-relevant-skills.md) - [> Unreviewed ai-suggestion — promote only via /brain:tend.](brain/ai-suggestions/refinement/intent-stamp-test-order-sensitivity.md) -- [Learn from an earlier brain enola integration and strengthen pi-brain's](brain/ai-suggestions/refinement/strengthen-enola-integration-from-prior-art.md) - [> Unreviewed ai-suggestion — promote only via /brain:tend.](brain/ai-suggestions/refinement/release-bookkeeping-drift.md) +- [Strengthen pi-brain's enola integration from a more mature multi-repo integration](brain/ai-suggestions/refinement/strengthen-enola-integration-from-prior-art.md) ### constraint - [Constraint — ADR before structural changes](brain/constraints/adr-before-structural-changes.md) diff --git a/wiki/org/state.md b/wiki/org/state.md index 2626b25..a12b2e0 100644 --- a/wiki/org/state.md +++ b/wiki/org/state.md @@ -28,7 +28,7 @@ Be honest about gaps: end-to-end tests for `/brain:build`, `/brain:diff`, `/brai - [Audit shared utility hotspots flagged by enola](../brain/ai-suggestions/refinement/enola-insights-reduce-shared-utility-hotspots.md) - [Split high-complexity registration functions in extensions/pi-brain](../brain/ai-suggestions/refinement/enola-insights-split-heavy-registration-functions.md) - [Integrate optional enola intelligence into relevant pi-brain skills](../brain/ai-suggestions/refinement/integrate-enola-into-relevant-skills.md) -- [Learn from an earlier brain enola integration and strengthen pi-brain's](../brain/ai-suggestions/refinement/strengthen-enola-integration-from-prior-art.md) +- [Strengthen pi-brain's enola integration from a more mature multi-repo integration](../brain/ai-suggestions/refinement/strengthen-enola-integration-from-prior-art.md) - [Constraint — Explicit approval required for commits](../brain/constraints/explicit-approval-for-commits.md) - [Constraint — Remote promotion requires a pull request](../brain/constraints/remote-promotion-requires-pr.md) - [Epic — Full enola integration for pi-brain v0.4.0](../brain/epics/enola-integration.md) From 0de900ca75d89aa7babd8fcd17b44c0e06d8e133 Mon Sep 17 00:00:00 2001 From: Muhamed Isabegovic Date: Sun, 25 Oct 2026 11:21:58 +0100 Subject: [PATCH 06/10] Drop the owner's home path from source snapshot header lines --- sources/doc/2026-07-27--extensions-md.md | 2 +- sources/doc/2026-07-27--keybindings-md.md | 2 +- sources/doc/2026-07-27--pi-brain-embed-plan-md.md | 2 +- sources/doc/2026-07-27--tui-md.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sources/doc/2026-07-27--extensions-md.md b/sources/doc/2026-07-27--extensions-md.md index 9ce5909..2adf4e7 100644 --- a/sources/doc/2026-07-27--extensions-md.md +++ b/sources/doc/2026-07-27--extensions-md.md @@ -1,7 +1,7 @@ --- kind: source source_kind: doc -source_path: ~/.nvm/versions/node/v22.22.2/lib/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md +source_path: @earendil-works/pi-coding-agent/docs/extensions.md ingested_at: 2026-07-27 summary: Pi extension API documentation covering events, hooks, context injection, tool result interception, custom UI, shortcuts, flags, and session lifecycle. --- diff --git a/sources/doc/2026-07-27--keybindings-md.md b/sources/doc/2026-07-27--keybindings-md.md index c9a0bf2..ddd26dd 100644 --- a/sources/doc/2026-07-27--keybindings-md.md +++ b/sources/doc/2026-07-27--keybindings-md.md @@ -1,7 +1,7 @@ --- kind: source source_kind: doc -source_path: ~/.nvm/versions/node/v22.22.2/lib/node_modules/@earendil-works/pi-coding-agent/docs/keybindings.md +source_path: @earendil-works/pi-coding-agent/docs/keybindings.md ingested_at: 2026-07-27 summary: Pi keybinding documentation for registerShortcut and custom keyboard actions. --- diff --git a/sources/doc/2026-07-27--pi-brain-embed-plan-md.md b/sources/doc/2026-07-27--pi-brain-embed-plan-md.md index 176515e..14b9f0a 100644 --- a/sources/doc/2026-07-27--pi-brain-embed-plan-md.md +++ b/sources/doc/2026-07-27--pi-brain-embed-plan-md.md @@ -1,7 +1,7 @@ --- kind: source source_kind: doc -source_path: ~/projects/pi-brain-embed-plan.md +source_path: pi-brain-embed-plan.md ingested_at: 2026-07-27 summary: pi-brain embedding/vector search plan document. --- diff --git a/sources/doc/2026-07-27--tui-md.md b/sources/doc/2026-07-27--tui-md.md index 06c2199..73308c2 100644 --- a/sources/doc/2026-07-27--tui-md.md +++ b/sources/doc/2026-07-27--tui-md.md @@ -1,7 +1,7 @@ --- kind: source source_kind: doc -source_path: ~/.nvm/versions/node/v22.22.2/lib/node_modules/@earendil-works/pi-coding-agent/docs/tui.md +source_path: @earendil-works/pi-coding-agent/docs/tui.md ingested_at: 2026-07-27 summary: Pi TUI component documentation for custom entry renderers, widgets, status, footer, and overlays. --- From 984fefc6183f14a01c71f9bb3f80c9319466650e Mon Sep 17 00:00:00 2001 From: Muhamed Isabegovic Date: Sun, 25 Oct 2026 11:21:58 +0100 Subject: [PATCH 07/10] Release 0.5.2: changelog and log entry --- CHANGELOG.md | 11 ++++++++++- log/log.md | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61b1124..760ad88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## [0.5.2] - 2026-10-25 + +- Fixed: the GitHub-release update fallback (`/brain:update` when the package manager path fails) nested directories on apply (`extensions/extensions/`) and never placed `tools/lib`, `tools/brain-intent.mjs`, `tools/brain-projects.mjs`, `tools/run-tasks.mjs` or `tools/migrate-clone.mjs`. One shared owned-path list (`tools/lib/template-owned.mjs`) now serves the fallback and `tools/migrate-clone.mjs`, and apply replaces the owned path in place. Covered by `tests/template-update.test.ts`, which also fails when a file under `tools/` is missing from the list. +- Fixed: the template version was stamped as four different values (package 0.5.1, repo config v0.5.0, clone script v0.3.0, `/brain:setup` v0.3.2). `package.json` is now the single source, read by `/brain:setup` and `tools/clone-pi-brain.sh`; `tests/version-consistency.test.ts` guards it. +- Fixed: `tools/connectors/run.mjs` looked for `github.mjs` inside the clone, so `brain_pull_connectors` failed in a content-only clone; it now runs the one beside it. The GitHub connector exited 1 silently when no repos were configured (it tested `.size` on an array); it now prints its no-repos message and exits 0. Covered by `tests/connectors.test.ts`. +- Fixed: the detached background-task runner was looked up inside the clone. It is resolved through the package like other tool scripts, and declines with an explanation when it would load from `node_modules` (Node cannot load TypeScript there) instead of spawning a worker that dies silently. +- Changed: the drift report no longer declares a `Matched` count that nothing produced. +- Docs: the README describes the regenerative loop at its real size (`data_model` blocks, target `types`; other block types are listed but not rendered), lists all 19 tools and every command, and gives the real test commands (`npm test`, `npm run validate`); GETTING_STARTED and AGENTS no longer call `LOCAL_FIRST=true` a default (`.env.example` ships `false`); connector docs say only GitHub exists; the org roadmap opening line is current. +- Hygiene: a refinement page that named a private project and a former employer is rewritten and renamed (`strengthen-enola-integration-from-prior-art.md`, links updated); owner-specific home paths are removed from the repository config, source snapshot headers, receipts and wiki pages. The `enola.binary` pin in `brain.config.yml` is commented out; set `ENOLA_BINARY` in `.env` to pin a build locally. +- Folded: refinement on pi's `agent_before_settle` hook instead of the `triggerTurn` send (raises the supported pi floor and changes when refinement fires; needs a design pass), and a `files` whitelist for the npm package (the published tarball includes `wiki/`, `sources/` and `log/`). Both are stated limits, not fixed. - Changed: `@earendil-works/pi-coding-agent` and `@earendil-works/pi-tui` dev dependencies move from ^0.83.0 to 1.4.0; type check and the full validate pass unchanged. - Fixed: since pi 1.2.0 `before_agent_start` also fires for runs started by `pi.sendMessage` with `triggerTurn`, which is how the refinement protocol starts its scan. The handler now leaves a `"custom"` run untouched, so the refinement run no longer receives the autonomy prompt and no longer consumes the one-shot intent debt or session briefing meant for the next user prompt. Covered by `tests/lifecycle-hooks.test.ts`; recorded as an amendment to the autonomous-refinement-protocol ADR. diff --git a/log/log.md b/log/log.md index b07ebc3..ceed5e6 100644 --- a/log/log.md +++ b/log/log.md @@ -45,3 +45,4 @@ Append-only operations log for this pi-brain instance. - 2026-09-14: Released v0.5.1 — enola grading restored (stock binary pinned via enola.binary, upgraded to 0.4.19; mcp-arch.yaml excludes .pi/upstream-ref; brain-intent compiles page-to-code anchors only), release records for v0.4.0/v0.5.0 written, template_version bumped to v0.5.0. - 2026-09-14: capture: npm publish for @misabegovic/pi-brain@0.5.1 is pending: registry auth is expired (npm whoami → 401 against registry.npmj - 2026-09-14: Published @misabegovic/pi-brain@0.5.1 to npm (registry verified); inbox task archived. +- 2026-10-25: Final polish pass for 0.5.2: update fallback and owned-path list fixed, one template version, connector runner and task runner resolved from the package, docs aligned with the code, private-project and home-path references removed (two files under sources/doc/ had only their source_path header lines edited for that reason). Refinement on agent_before_settle and an npm files whitelist folded. See CHANGELOG. From ac5722bc3690f5ab9160a0dec7e139bd61babedf Mon Sep 17 00:00:00 2001 From: Muhamed Isabegovic Date: Sun, 25 Oct 2026 11:22:20 +0100 Subject: [PATCH 08/10] Regenerate link graph --- wiki/_state/links.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wiki/_state/links.json b/wiki/_state/links.json index ab4a961..33e3efb 100644 --- a/wiki/_state/links.json +++ b/wiki/_state/links.json @@ -1,5 +1,5 @@ { - "generated_at": "2026-10-25T10:21:42.674Z", + "generated_at": "2026-10-25T10:22:15.159Z", "node_count": 109, "edge_count": 658, "nodes": [ From d018c7bf98c1b9dec4ca36b4510dd6483c3b7302 Mon Sep 17 00:00:00 2001 From: Muhamed Isabegovic Date: Sun, 25 Oct 2026 11:23:21 +0100 Subject: [PATCH 09/10] Header comment punctuation in the owned-path list --- tools/lib/template-owned.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/template-owned.mjs b/tools/lib/template-owned.mjs index d53e66e..d57b77e 100644 --- a/tools/lib/template-owned.mjs +++ b/tools/lib/template-owned.mjs @@ -1,5 +1,5 @@ /** - * template-owned — the one list of paths a pi-brain release owns. + * template-owned: the one list of paths a pi-brain release owns. * * A clone's content (wiki/, sources/, log/, brain.config.yml) is never in this * list. Both the GitHub-release update fallback (extensions/pi-brain/template-update.ts) From dc0cd41328848118e2e44dbdcf36713d21028be2 Mon Sep 17 00:00:00 2001 From: Muhamed Isabegovic Date: Sun, 25 Oct 2026 11:32:23 +0100 Subject: [PATCH 10/10] Ship only the tool in the npm package: a files whitelist --- CHANGELOG.md | 3 ++- package.json | 18 +++++++++++++++++- wiki/_state/links.json | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 760ad88..3082c5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Changed: the drift report no longer declares a `Matched` count that nothing produced. - Docs: the README describes the regenerative loop at its real size (`data_model` blocks, target `types`; other block types are listed but not rendered), lists all 19 tools and every command, and gives the real test commands (`npm test`, `npm run validate`); GETTING_STARTED and AGENTS no longer call `LOCAL_FIRST=true` a default (`.env.example` ships `false`); connector docs say only GitHub exists; the org roadmap opening line is current. - Hygiene: a refinement page that named a private project and a former employer is rewritten and renamed (`strengthen-enola-integration-from-prior-art.md`, links updated); owner-specific home paths are removed from the repository config, source snapshot headers, receipts and wiki pages. The `enola.binary` pin in `brain.config.yml` is commented out; set `ENOLA_BINARY` in `.env` to pin a build locally. -- Folded: refinement on pi's `agent_before_settle` hook instead of the `triggerTurn` send (raises the supported pi floor and changes when refinement fires; needs a design pass), and a `files` whitelist for the npm package (the published tarball includes `wiki/`, `sources/` and `log/`). Both are stated limits, not fixed. +- Changed: `package.json` declares a `files` whitelist, so the npm package carries the extension, tools, skills, prompts, themes, personas, types, CI templates and docs (146 files), and no longer this repository's own `wiki/`, `sources/`, `log/` or `.enola/` state (320 files in 0.5.1). +- Folded: refinement on pi's `agent_before_settle` hook instead of the `triggerTurn` send. It raises the supported pi floor and changes when refinement fires, so it needs a design pass; it is a stated limit, not fixed. - Changed: `@earendil-works/pi-coding-agent` and `@earendil-works/pi-tui` dev dependencies move from ^0.83.0 to 1.4.0; type check and the full validate pass unchanged. - Fixed: since pi 1.2.0 `before_agent_start` also fires for runs started by `pi.sendMessage` with `triggerTurn`, which is how the refinement protocol starts its scan. The handler now leaves a `"custom"` run untouched, so the refinement run no longer receives the autonomy prompt and no longer consumes the one-shot intent debt or session briefing meant for the next user prompt. Covered by `tests/lifecycle-hooks.test.ts`; recorded as an amendment to the autonomous-refinement-protocol ADR. diff --git a/package.json b/package.json index b039f1a..d3c2bc5 100644 --- a/package.json +++ b/package.json @@ -48,5 +48,21 @@ "peerDependencies": { "@earendil-works/pi-coding-agent": "*", "typebox": "*" - } + }, + "files": [ + "extensions", + "skills", + "prompts", + "themes", + "personas", + "tools", + "types", + ".github", + ".env.example", + "AGENTS.md", + "GETTING_STARTED.md", + "README.md", + "CHANGELOG.md", + "tsconfig.json" + ] } diff --git a/wiki/_state/links.json b/wiki/_state/links.json index 33e3efb..2bc4dfa 100644 --- a/wiki/_state/links.json +++ b/wiki/_state/links.json @@ -1,5 +1,5 @@ { - "generated_at": "2026-10-25T10:22:15.159Z", + "generated_at": "2026-10-25T10:32:21.252Z", "node_count": 109, "edge_count": 658, "nodes": [