diff --git a/test/fixtures/ship-queue/gbrain-stamp-pair.json b/test/fixtures/ship-queue/gbrain-stamp-pair.json new file mode 100644 index 000000000..80cc01f20 --- /dev/null +++ b/test/fixtures/ship-queue/gbrain-stamp-pair.json @@ -0,0 +1,28 @@ +{ + "source": { + "repo": "garrytan/gbrain", + "gated_commit": "2dcc32b4cb8d9685c80b8cf6e0f6768e9188cf4b", + "stamp_commit": "3ffce57b27539afca57eb601d70a4d03e2ec2f10", + "stamp_subject": "v0.60.270.0 chore(release): restamp onto master v0.60.269.0", + "policy_commit": "90feaab2949d266ed8afc17a9b5a8785b4704406", + "note": "stamp_files at the gated commit (the only paths the stamp commit touched) and that commit diff, byte for byte from the GitHub API" + }, + "policy": "{\n \"bump\": \"patch\",\n \"queue_mode\": \"stamp-at-merge\",\n \"changelog\": \"CHANGELOG.md\",\n \"stamp_files\": [\n \"VERSION\", \"package.json\", \"CHANGELOG.md\", \"openclaw.plugin.json\",\n \".claude-plugin/plugin.json\", \".codex-plugin/plugin.json\",\n \"plugin-variants/*/.claude-plugin/plugin.json\", \"plugin-variants/*/.codex-plugin/plugin.json\",\n \"plugin-variants/*/README.md\", \"plugin/README.md\",\n \"BOOTSTRAP_FOR_AGENTS.md\", \"templates/bootstrap/template-repo/README.md\",\n \"src/core/behavior-change-notice.ts\"\n ],\n \"stamp_patterns\": [\n \"\\\"version\\\": \\\"{version}\\\"\",\n \"since: '{version}'\",\n \"\",\n \"\",\n \"\"\n ],\n \"migrations\": { \"dir\": \"src/core/schema-migrations\", \"id\": \"^v(\\\\d+)-\" }\n}\n", + "gated": { + ".claude-plugin/plugin.json": "{\n \"name\": \"gbrain\",\n \"version\": \"0.60.269.0\",\n \"description\": \"Personal knowledge brain for your coding agent — hybrid search, synthesis, graph traversal, and durable cross-session memory over Postgres/PGLite with pgvector, plus a curated brain-first skill set.\",\n \"author\": {\n \"name\": \"Garry Tan\",\n \"url\": \"https://github.com/garrytan\"\n },\n \"homepage\": \"https://github.com/garrytan/gbrain\",\n \"repository\": \"https://github.com/garrytan/gbrain\",\n \"license\": \"MIT\",\n \"keywords\": [\n \"memory\",\n \"knowledge-base\",\n \"mcp\",\n \"search\",\n \"agent\",\n \"brain\",\n \"pgvector\"\n ],\n \"skills\": \"./plugin/skills/\",\n \"mcpServers\": {\n \"gbrain\": {\n \"command\": \"${CLAUDE_PLUGIN_ROOT}/.agents/gbrain-launcher\",\n \"args\": [\n \"serve\",\n \"--surface\",\n \"full\",\n \"--source-guard\"\n ],\n \"cwd\": \"${CLAUDE_PLUGIN_ROOT}\"\n }\n }\n}\n", + ".codex-plugin/plugin.json": "{\n \"name\": \"gbrain\",\n \"version\": \"0.60.269.0\",\n \"description\": \"Personal knowledge brain for your coding agent — hybrid search, synthesis, graph traversal, and durable cross-session memory over Postgres/PGLite with pgvector, plus a curated brain-first skill set.\",\n \"author\": {\n \"name\": \"Garry Tan\",\n \"url\": \"https://github.com/garrytan\"\n },\n \"homepage\": \"https://github.com/garrytan/gbrain\",\n \"repository\": \"https://github.com/garrytan/gbrain\",\n \"license\": \"MIT\",\n \"keywords\": [\n \"memory\",\n \"knowledge-base\",\n \"mcp\",\n \"search\",\n \"agent\",\n \"brain\",\n \"pgvector\"\n ],\n \"skills\": \"./plugin/skills/\",\n \"mcpServers\": \"./.codex-plugin/mcp.json\",\n \"interface\": {\n \"displayName\": \"GBrain\",\n \"shortDescription\": \"Give your agent a persistent brain: search, synthesis, memory\",\n \"longDescription\": \"GBrain wires a personal knowledge brain into every session: hybrid keyword+vector search, entity graph traversal, synthesis, and memory your agent writes itself — served on the starter MCP surface (the seven memory verbs plus the daily-driver brain ops). Bundles the curated brain-first skill set: setup (walks install + gbrain init), cold-start day-one brain filling, ingest, query, briefing, upgrade, and more. Requires the gbrain CLI (bun install -g github:garrytan/gbrain#latest-stable) and a brain (gbrain init); the bundled setup skill walks the rest. Unix (macOS/Linux) only.\",\n \"developerName\": \"Garry Tan\",\n \"category\": \"Productivity\",\n \"capabilities\": [\n \"Interactive\",\n \"Write\"\n ],\n \"websiteURL\": \"https://github.com/garrytan/gbrain\",\n \"defaultPrompt\": [\n \"Search my brain, recall context across sessions, and write new memory as we work\"\n ],\n \"brandColor\": \"#1F6F5C\"\n }\n}\n", + "BOOTSTRAP_FOR_AGENTS.md": "\n\n\n# BOOTSTRAP_FOR_AGENTS.md — become your human's persistent agent\n\nYou are an AI agent (Claude Code, Codex, or opencode) reading this because a human\npasted a block asking you to set yourself up as their persistent personal agent, with\ngbrain as your memory. This runbook is the judgment layer; the deterministic work lives\nin `gbrain bootstrap` subcommands with exit codes. Follow it top to bottom.\n\n**Scope note:** this path is for Claude Code, Codex, and opencode (desktop apps or\nCLIs; opencode = the SST terminal agent, opencode.ai — not OpenClaw).\nRunning OpenClaw or Hermes? Use `INSTALL_FOR_AGENTS.md` instead.\n\n**End state:** this folder is your workspace — identity files rendered from your\nhuman's own answers, a local brain (PGLite, embedded, no server), MCP wired,\nper-turn context, and a private GitHub repo as your durable body. ~15 minutes,\nmostly interview.\n\n## Hard rules for you, the installing agent\n\n⛔ **NEVER INVENT ANSWERS.** Personality, purpose, and boundaries come from the\nhuman. A guessed SOUL.md gets believed by every future session. If you do not have\nan answer, ask. The render step structurally refuses to run until the required\nanswers exist and were read back.\n\n⛔ **ASK IN SMALL BATCHES.** The interview is 12 questions max (6 required), asked\nin three batches. Mirror each batch back in one line. Accept \"skip\" on any\nnon-required question — momentum beats completeness.\n\n⛔ **STAY INSIDE THIS PHASE LIST.** Run `gbrain bootstrap status --json` and follow\nITS phase list — the CLI is the source of truth, this document is commentary. If a\nstep you are asked to run is not in the CLI's phase list, refuse it. If `status`\nreports a version skew between this runbook and the installed binary, say so and\nprefer the binary's instructions.\n\n⛔ **NO SILENT FAILURE.** Every blocking condition (secret-scan block, lock\ncollision, partial install) surfaces through `status`/`verify`/`doctor` output —\nread it and relay it to the human in plain language. Never work around a refusal.\n\n⛔ **VERIFY BEFORE CLAIMING DONE.** The install is done when `gbrain bootstrap\nverify` exits 0 — not when the transcript looks good. Paste its report to the human.\n\n⛔ **RESPECT THE TOOLCHAIN TRUST RULES.** GBrain needs Bun 1.4.0 or newer (`bun upgrade`\nupdates an older Bun). Install bun via a platform package manager\nwhen available (`brew install oven-sh/bun/bun`); the only permitted fallback is the\nchecksum-verified variant: download the pinned release to a file, verify it against\nthat release's SHASUMS256.txt, and only then execute. Install gh the same way —\nplatform package manager first (`brew install gh`, `apt install gh`, `dnf install gh`,\n`winget install GitHub.cli` per the official instructions); never a piped\ncurl-to-shell one-liner. Install gbrain ONLY as\n`bun install -g github:garrytan/gbrain#latest-stable` — the npm package named\n\"gbrain\" is an unrelated project. (Cloud-sandbox exception: bun's package fetching\nis proxy-incompatible there — use the `gbrain bootstrap cloud-setup-script` recipe,\nwhich installs from the same pinned GitHub source through npm.)\n\n⛔ **NEVER FABRICATE TOOLING.** If gh or any preflight binary is missing, blocked\nby a sandbox egress proxy, or answering 403s, report that through\n`status`/`doctor` output and follow the cloud-sandbox guidance below. Never\nhand-roll a gh shim, stub a fake binary into /usr/local/bin, or fake a passing\ncheck — a fabricated tool poisons every later verification, and the one time it\nwas tried it masked a real silent-persistence failure. The CLI degrades honestly\non its own; your job is to relay, not to bridge.\n\n## Codex preflight (ChatGPT desktop / Codex CLI only)\n\nCodex sandboxes command execution. Before starting, tell the human: \"I'll need\napproval to run install commands (bun, gh, gbrain) and to write in this folder —\napprove those prompts when they appear.\" If approvals are globally disabled, ask the\nhuman to enable workspace-write + network for this session. Count the approval taps\nyou needed; report the count at the end (it feeds the install-time measurement).\n\nIf the gbrain PLUGIN is already installed and enabled (codex: `[plugins.\"gbrain@…\"]\nenabled = true`; Claude Code: `enabledPlugins[\"gbrain@…\"] = true`), the hooks phase\nskips its own `mcp add` on that harness — the plugin already provides the MCP server\n(one owner per name). That skip is healthy, not an error; force the hand-wired\nregistration only with `--mcp-even-if-plugin`.\n\n## Phase walkthrough (commentary — the CLI's list wins)\n\n1. **Preflight.** `git`, `bun`, `gh` present. Install what's missing per the trust\n rules above: bun via a platform package manager or the checksum-verified download\n — the checksum-verified install is the ONLY permitted non-package-manager\n variant; gh via the platform package manager. (On a clean Mac, `git` may trigger\n the Xcode tools dialog — that download does not count against the 15 minutes,\n tell the human to let it run.)\n `gh auth status` — if logged out, the human's ONE manual step:\n `gh auth login -h github.com -p https -w` (you run it; they click Authorize).\n Then `gbrain bootstrap status` — it is idempotent and resume-aware; after any\n partial failure, re-run it and continue where it points.\n2. **Engine.** Two lanes; default to the first:\n - **PGLite (default):** `gbrain init --pglite` (2 seconds, no server). The\n per-turn hook context injection works whenever a `gbrain serve` for the\n brain is running.\n - **Postgres-first (harness installs):** `gbrain init --prefer-postgres` walks\n a 5-rung ladder (env URL → Supabase token discovery → local Postgres →\n `--allow-docker` → PGLite floor) for installs that want concurrent\n connections or multi-machine access. A Postgres brain keeps the per-turn\n hook lane too: the IPC listener is engine-uniform and keys its socket off\n the connection URL, so the hooks fire whenever a `gbrain serve` for the\n brain is running, same as PGLite (the degradation matrix in\n `docs/guides/bootstrap.md` carries the row; INSTALL_FOR_AGENTS.md \"Engine\n preference for harness installs\" carries the ladder detail).\n\n Search mode is\n auto-selected silently (conservative when keyless, tokenmax with an\n expansion key) and printed with an `[AGENT]` cost matrix — surface that\n matrix to the human and confirm before running high-volume queries (see\n INSTALL_FOR_AGENTS.md Step 3.5); they can change it any time with\n `gbrain search modes`. The one thing to raise here is the OPTIONAL provider\n key — with no key you run keyless: keyword search plus memory you author\n yourself through the write tools; everything works. One key upgrades\n capabilities per provider: OpenAI unlocks semantic search + automatic fact\n extraction; Voyage unlocks semantic search; Anthropic unlocks automatic fact\n extraction. Never pressure for a key. If the\n human provides one, pass it to the CLI prompt — it goes to the 0600 config file,\n never into the interview answers, never into chat logs you keep.\n3. **Interview.** `gbrain bootstrap interview --init`, then ask the questions from\n the bank (the CLI prints them) in three batches, recording each answer verbatim\n with `--set KEY \"value\"`. Push once on vague answers to the required questions.\n Claude Code and opencode: with the final batch, also ask the ONE operational\n consent — MCP scope. It is not one of the 12 interview questions; consents ride\n alongside the bank. On Claude Code the choice: project (recommended — any other\n repo you open cannot read your brain) vs user (your agent everywhere, but any\n repo you open can reach it — read and write — and two open sessions contend for\n the database). On opencode the recommendation INVERTS: user-global is the\n default and the sharing-safe choice (opencode spawns project-config-defined\n servers with NO trust prompt, so a committed project entry executes on every\n collaborator's machine) — offer project only as a deliberate opt-in and state\n that consequence. Record it with\n `gbrain bootstrap interview --set MCP_SCOPE ` BEFORE the\n read-back, so the confirmation covers it. On Codex, skip this question\n entirely — the wiring step states the Codex reality instead.\n After the last batch: read ALL answers back in one compact block, ask \"Is this\n the thing you want in the room?\", and only then run\n `gbrain bootstrap interview --confirm ` with the hash `--status` printed\n for the read-back set. The gate fails if you confirm a set the human never saw.\n4. **Render.** `gbrain bootstrap render` — identity files appear. Show the human\n SOUL.md. Existing files are never overwritten (re-runs are safe; `--force`\n backs up first).\n5. **Skills.** `gbrain skillpack scaffold --all` — the CLI scaffolds the skill\n set. Nothing to judge here; relay the output.\n6. **Wire the harness + register the brain source.** `gbrain bootstrap hooks\n --harness ` creates `/brain` and prints the exact\n `gbrain sources add --path --force` command for THIS\n workspace — run it verbatim (don't guess a different id; a guessed id\n only surfaces as an FK error at `verify` time, by which point a wrong\n guess also blocks the correct id with an `overlapping_path` error). It\n also:\n - Claude Code: installs per-turn hooks ON by default — do NOT ask; loading the\n brain every turn is the whole point of installing gbrain for your agent. Tell\n the human it is on and how to turn it off (`GBRAIN_HOOKS=0`, or re-run with\n `--no-hooks`, or `gbrain bootstrap uninstall`). MCP scope is NOT asked here —\n `hooks` consumes the MCP_SCOPE answer recorded during the interview.\n - Codex: registers MCP (`codex mcp add`) and relies on the AGENTS.md protocol —\n say plainly that Codex gets pull-based context, not per-turn push.\n Do NOT offer an MCP scope choice: `codex mcp add` has no scope flag, so\n the registration is always user-global. State it as fact — any repo opened\n on this machine can reach the brain (read and write) through its MCP\n tools; the off-ramps are `codex mcp remove gbrain` (registration only) or\n `gbrain bootstrap uninstall` (full teardown).\n - opencode: writes the MCP entry directly into opencode's JSONC config (no\n CLI exec needed) and relies on the AGENTS.md protocol, which opencode loads\n natively — say plainly that opencode gets pull-based context, not per-turn\n push. Scope follows the recorded MCP_SCOPE answer (user-global default; a\n project answer writes the committed-candidate `opencode.json` and the CLI\n prints the sharing warning). Restart opencode after wiring — it reads config\n at session start. Off-ramps: the entry's `\"enabled\": false`, or\n `gbrain bootstrap uninstall`.\n7. **Private repo.** `gbrain bootstrap repo` — creates a PRIVATE GitHub repo from\n the workspace, verifies the privacy bit through the API, pushes. If the human\n started from a repo they created themselves (create-repo-first: an EMPTY private\n repo under their own account, cloned and opened here), this ADOPTS that repo\n instead of creating one — verifies it is private and pushes the workspace. A\n non-empty repo, or one owned by an org, is refused with a clear message (make an\n empty personal repo, or run `gbrain bootstrap attach` for an existing agent\n clone). Asks the background-persistence consent (a git post-commit auto-push\n plus a 30-minute pull job for multi-machine freshness; declining still persists\n via the per-turn and session-end pushes). If the human has no GitHub or declines:\n local-only mode with an honest warning; `bootstrap repo` can run any time later.\n Note: the per-turn/session push stays deferred until this phase records the\n verified repo, so nothing is ever pushed to an unverified-privacy origin.\n8. **Verify.** `gbrain bootstrap verify` — the whole contract: brain round-trip\n through the real write path, graph floor, token sweep, secret scan, repo\n privacy, hooks smoke, capability report (keyless or keyed). Exit 0 or it is not\n done. Paste the report. Then relay the first-run tour it prints (three prompts\n the human should try, starting with restarting the session) AND the hand-off\n block below it — the ownership line and the cold-start offer are the two\n things the human must actually understand, not fine print.\n\n\n## Multi-agent rules for a shared brain checkout\n\nSeveral agents, crons and hooks often commit to one brain checkout on the same\nmachine. In such a checkout:\n\n1. **Commit and push with one command, naming your files:**\n `scripts/brain-commit-push.sh \"\" `, or\n `gbrain git commit-push -m \"\" -- ` when the brain has no helper.\n It takes the checkout's writer lock, commits only those paths, merges remote\n commits without touching anyone else's files, and fails loudly if the push\n does not land.\n2. **Bring remote commits in with `--pull`** (`scripts/brain-commit-push.sh --pull`\n or `gbrain git commit-push --pull`) at session start and before a batch of writes.\n3. **On a non-zero exit, read the code.** Retry once on `commit_lock_busy`.\n Stop and relay to the user on `integrate_conflict` (they choose which\n version wins) and on `writer_coordinator_required` (a managed brain: save\n pages with `put_page` instead). `pushed_checkout_lagging` is a success.\n\n4. **Never run** `git pull --rebase`, `git stash`, `--autostash`, `git add -A`,\n `git commit -a`, `git reset --hard` or `git push --force` there, and never\n fall back to them when the command fails. Never delete `.git/rebase-merge`\n before saving its autostash with `git stash store`.\n\n\nOutcomes, conflict recovery, a stuck rebase and the lock contract for host\ndaemons: [docs/guides/shared-checkout-git.md](docs/guides/shared-checkout-git.md).\n\n\n## Machine two\n\nIf this workspace was cloned from an existing agent repo (agent.json says\ninitialized), run `gbrain bootstrap attach` instead of the interview/render/repo\nphases — it wires this machine (source, hooks, MCP) and verifies. If agent.json\nsays it is an uninitialized template, proceed with the normal flow from phase 1.\n\n## Cloud sandboxes (claude.ai/code and similar proxied environments)\n\n**How you know:** `gbrain bootstrap status --json` reports\n`execution_environment: \"cloud-sandbox\"` (the CLI detects the documented\nsignals — the CLAUDE_CODE_REMOTE env var, the proxy-injected token\nplaceholder). Trust the CLI's detection over your own guesses.\n\n**Expected degradations — these are facts to relay, not bugs to bridge:**\n\n- **No crontab, no surviving background processes.** The VM is reclaimed after\n inactivity. The scheduled pull is skipped honestly; the per-turn (Stop hook)\n and session-end pushes carry persistence. Decline nothing, fabricate nothing.\n- **GitHub GraphQL is always blocked** by the egress proxy, and **REST reaches\n only repos attached to the session** — a repo created mid-session is NOT\n attached, so `gbrain bootstrap repo` refuses fast in cloud with the flow\n that works. Privacy verification falls back to pure git protocol on its own.\n- **`git push` works only against the session's working branch.** A user PAT \n does not bypass any of this.\n- **Only repo-committed files carry into the next session.** `~/.gbrain`,\n `~/.claude`, and the gitignored `.claude/settings.local.json` evaporate.\n Hooks therefore live in the COMMITTED `.claude/settings.json` (the CLI\n writes PATH-resolved, fail-open commands there in cloud); hook config is\n snapshotted at session start, so hooks written mid-session activate on the\n NEXT session — say so instead of debugging it.\n\n**The correct cloud flow:**\n\n1. The human creates the private repo from a normal machine (or github.com)\n and opens the cloud session ON that repo.\n2. The environment's setup script installs the gbrain binary — print it with\n `gbrain bootstrap cloud-setup-script` and have the human paste it into the\n environment config (npm-based; bun's fetching is proxy-incompatible there).\n3. Inside the session: `gbrain bootstrap attach`, then\n `gbrain bootstrap hooks --harness claude-code` (writes the committed\n carrier), commit + push, and tell the human the hooks go live next session.\n\n## Failure modes, and what they actually mean\n\n\n\n| Symptom | Real cause | Fix | Who acts | Consent | Verify |\n|---|---|---|---|---|---|\n| `interview --status` exits nonzero forever | A required answer is genuinely missing | Ask the human. Do not default it. | user (answers the question) | none | `gbrain bootstrap interview --status` |\n| Render refuses with unresolved tokens | Interview incomplete or a template edit broke a token | Finish the interview; `status` names the tokens. | user | none | `gbrain bootstrap status` |\n| `verify` fails the magic-moment check | The fact never landed (keyless: the Facts fence was not written) | Re-run the write step it names; check `gbrain doctor`. | agent | none | `gbrain doctor --only bootstrap_last_verify --json` |\n| Secret-scan block on push | A credential-shaped string in a tracked file | Fix or allowlist deliberately (`.gbrain-scan-allow`); never force. | user (decides what to allowlist) | none | the next push's scan output |\n| \"bootstrap already running (pid N)\" | A concurrent bootstrap holds the lock | Wait or investigate that pid; the lock self-clears when stale. | agent | none | `gbrain bootstrap status` |\n| Brain tools fail with a lock error | Another live session's serve owns the database | Close the other session; sequential use is the v1 contract. | user (closes the other session) | none | `gbrain doctor --only bootstrap_serve_lock --json` |\n| Hook reports \"brain context unavailable\" | serve not running or degraded | `gbrain doctor` names it; hooks fail open by design. | agent | none | `gbrain doctor --only bootstrap_hooks_heartbeat --json` |\n| gh answers 403 \"not enabled for this session\" | Cloud proxy scoping — the repo is not attached to the session | Expected in cloud; the visibility ladder falls back to git protocol. NEVER shim gh. | agent (nothing to fix) | none | none needed |\n| \"crontab: command not found\" / cron skipped | Containers and cloud sandboxes ship without a scheduler | Expected; event-driven pushes cover it — the skip message says exactly this. | agent (nothing to fix) | none | none needed |\n| A turn shows \"workspace push is FAILING\" | The background push is refusing (visibility, secret-scan, or network reasons) | Run `gbrain doctor`; the banner repeats every 30 min until fixed. | agent | none | `gbrain doctor --only bootstrap_push_health --json` |\n\n## Hand off\n\nTwo things the human must UNDERSTAND before you finish — say them plainly, in\nthis order, and confirm they landed:\n\n1. **They own the brain.** Their private GitHub repo holds the agent's identity\n files and committed Markdown pages — name the URL. They can read those files\n or clone the workspace on another machine and run `gbrain bootstrap attach`.\n Facts, corrections, jobs, and accounting can exist only in the database, so\n a Git clone is not a complete memory backup. Back up and restore the full\n database separately. Deleting the repository does not erase database records,\n history, source material, or backups. If they went local-only, say the files\n and database remain on this machine; `gbrain bootstrap repo` can add a private\n GitHub copy of the workspace files later.\n2. **The first skill to run is cold-start.** An empty brain is a database; a\n filled one is a memory — and every flagship skill (book-mirror, briefings,\n meeting prep) only becomes magical once the brain holds their real life.\n OFFER to run the cold-start skill now: it imports Gmail, calendar, and\n contacts through ClawVisor (clawvisor.com — an OAuth vault; you never hold\n raw tokens), or offline archives (Google Takeout, a notes folder) if they\n prefer no third-party gateway. Every phase is consent-gated and\n independently valuable — they can stop after any one. If they say \"later\",\n that is a complete install; they can say \"fill my brain\" any time.\n\nThen the routine facts: the capability mode (keyless vs keyed), and the three\ncommands they will actually reuse (`gbrain doctor`, `gbrain bootstrap verify`,\n`gbrain sources push`). Then delete nothing — this runbook was fetched, not\ninstalled.\n", + "VERSION": "0.60.269.0\n", + "openclaw.plugin.json": "{\n \"id\": \"gbrain-context-engine\",\n \"name\": \"gbrain\",\n \"version\": \"0.60.269.0\",\n \"description\": \"Personal knowledge brain with Postgres + pgvector hybrid search\",\n \"family\": \"bundle-plugin\",\n \"kind\": \"context-engine\",\n \"configSchema\": {\n \"type\": \"object\",\n \"properties\": {\n \"database_url\": {\n \"type\": \"string\",\n \"description\": \"PostgreSQL connection URL (Supabase recommended)\"\n },\n \"openai_api_key\": {\n \"type\": \"string\",\n \"description\": \"OpenAI API key for embeddings (uses OPENAI_API_KEY env var if not set)\"\n },\n \"workspaceDir\": {\n \"type\": \"string\",\n \"description\": \"Absolute workspace for legacy hosts without per-session workspace context; omit for multi-agent hosts\"\n }\n }\n },\n \"uiHints\": {\n \"database_url\": {\n \"sensitive\": true\n },\n \"openai_api_key\": {\n \"sensitive\": true\n }\n },\n \"mcpServers\": {\n \"gbrain\": {\n \"command\": \"./.agents/gbrain-launcher\",\n \"args\": [\n \"serve\"\n ]\n }\n },\n \"skills\": [\n \"skills/academic-verify\",\n \"skills/archive-crawler\",\n \"skills/article-enrichment\",\n \"skills/ask-user\",\n \"skills/blog-ingest\",\n \"skills/book-mirror\",\n \"skills/brain-ingest-gate\",\n \"skills/brain-link-discipline\",\n \"skills/brain-ops\",\n \"skills/brain-pdf\",\n \"skills/brain-taxonomist\",\n \"skills/briefing\",\n \"skills/bulk-ingestion\",\n \"skills/capture\",\n \"skills/chat-connectors\",\n \"skills/citation-fixer\",\n \"skills/citation-graph-ingest\",\n \"skills/cold-start\",\n \"skills/company-brainify\",\n \"skills/concept-synthesis\",\n \"skills/context-audit\",\n \"skills/conversation-archive\",\n \"skills/correction-pipeline\",\n \"skills/cron-scheduler\",\n \"skills/cross-modal-review\",\n \"skills/daily-task-manager\",\n \"skills/daily-task-prep\",\n \"skills/data-loss-gate\",\n \"skills/data-research\",\n \"skills/draft-in-voice\",\n \"skills/eiirp\",\n \"skills/enrich\",\n \"skills/fact-check\",\n \"skills/functional-area-resolver\",\n \"skills/gbrain-advisor\",\n \"skills/google-loops\",\n \"skills/idea-ingest\",\n \"skills/idea-lineage\",\n \"skills/ingest\",\n \"skills/maintain\",\n \"skills/mcp-access\",\n \"skills/measure-before-you-fix\",\n \"skills/media-ingest\",\n \"skills/meeting-ingestion\",\n \"skills/minion-orchestrator\",\n \"skills/perplexity-research\",\n \"skills/publish\",\n \"skills/query\",\n \"skills/repo-architecture\",\n \"skills/reports\",\n \"skills/research-compendium\",\n \"skills/resolve-before-asking\",\n \"skills/signal-detector\",\n \"skills/skill-autobench\",\n \"skills/skill-creator\",\n \"skills/skillify\",\n \"skills/skillpack-check\",\n \"skills/skillpack-harvest\",\n \"skills/soul-audit\",\n \"skills/strategic-reading\",\n \"skills/testing\",\n \"skills/two-tier-extraction\",\n \"skills/voice-note-ingest\",\n \"skills/webhook-transforms\"\n ],\n \"shared_deps\": [\n \"skills/conventions\",\n \"skills/_AGENT_README.md\",\n \"skills/_brain-filing-rules.md\",\n \"skills/_brain-filing-rules.json\",\n \"skills/_output-rules.md\"\n ],\n \"excluded_from_install\": [\n \"skills/setup\",\n \"skills/migrate\",\n \"skills/publish\"\n ],\n \"openclaw\": {\n \"compat\": {\n \"pluginApi\": \">=2026.4.0\"\n }\n },\n \"contracts\": {\n \"contextEngines\": [\n \"gbrain-context-engine\",\n \"gbrain-context\"\n ]\n }\n}\n", + "package.json": "{\n \"name\": \"gbrain\",\n \"description\": \"Postgres-native personal knowledge brain with hybrid RAG search\",\n \"type\": \"module\",\n \"imports\": {\n \"#postgres\": {\n \"types\": \"./vendor/postgres/types/index.d.ts\",\n \"require\": \"./vendor/postgres/cjs/src/index.js\",\n \"default\": \"./vendor/postgres/src/index.js\"\n }\n },\n \"main\": \"src/core/index.ts\",\n \"bin\": {\n \"gbrain\": \"src/cli.ts\"\n },\n \"exports\": {\n \".\": \"./src/core/index.ts\",\n \"./engine\": \"./src/core/engine.ts\",\n \"./types\": \"./src/core/types.ts\",\n \"./operations\": \"./src/core/operations.ts\",\n \"./minions\": \"./src/core/minions/index.ts\",\n \"./engine-factory\": \"./src/core/engine-factory.ts\",\n \"./pglite-engine\": \"./src/core/pglite-engine.ts\",\n \"./link-extraction\": \"./src/core/link-extraction.ts\",\n \"./import-file\": \"./src/core/import-file.ts\",\n \"./transcription\": \"./src/core/transcription.ts\",\n \"./embedding\": \"./src/core/embedding.ts\",\n \"./config\": \"./src/core/config.ts\",\n \"./markdown\": \"./src/core/markdown.ts\",\n \"./backoff\": \"./src/core/backoff.ts\",\n \"./search/hybrid\": \"./src/core/search/hybrid.ts\",\n \"./search/expansion\": \"./src/core/search/expansion.ts\",\n \"./search/evidence-delivery\": \"./src/core/search/evidence-delivery.ts\",\n \"./eval/longmemeval/reader\": \"./src/eval/longmemeval/reader.ts\",\n \"./think\": \"./src/core/think/index.ts\",\n \"./ai/gateway\": \"./src/core/ai/gateway.ts\",\n \"./ai/invocation-guard\": \"./src/core/ai/invocation-guard.ts\",\n \"./core/model-pricing\": \"./src/core/model-pricing.ts\",\n \"./extract\": \"./src/commands/extract.ts\",\n \"./ingestion\": \"./src/core/ingestion/index.ts\",\n \"./ingestion/test-harness\": \"./src/core/ingestion/test-harness.ts\",\n \"./core/guardrails\": \"./src/core/guardrails.ts\",\n \"./core/skillopt\": \"./src/core/skillopt/index.ts\",\n \"./pglite-lock\": \"./src/core/pglite-lock.ts\",\n \"./version\": \"./src/version.ts\"\n },\n \"scripts\": {\n \"dev\": \"bun run src/cli.ts\",\n \"build\": \"bun build --compile --no-compile-autoload-bunfig --outfile bin/gbrain src/cli.ts\",\n \"build:all\": \"bun build --compile --no-compile-autoload-bunfig --target=bun-darwin-arm64 --outfile bin/gbrain-darwin-arm64 src/cli.ts && bun build --compile --no-compile-autoload-bunfig --target=bun-linux-x64 --outfile bin/gbrain-linux-x64 src/cli.ts\",\n \"build:admin\": \"cd admin && bun run build && cd .. && bun run scripts/build-admin-embedded.ts\",\n \"build:admin-embedded\": \"bun run scripts/build-admin-embedded.ts\",\n \"build:schema\": \"bun run scripts/build-schema.ts\",\n \"build:schema-migrations\": \"bun run scripts/build-schema-migrations.ts\",\n \"new:migration\": \"bun run scripts/build-schema-migrations.ts --new\",\n \"build:llms\": \"bun run scripts/build-llms.ts\",\n \"wave-security-scan\": \"bash scripts/wave-security-scan.sh\",\n \"audit:contributors\": \"bun scripts/contributor-audit.ts\",\n \"build:flag-registry\": \"bun run scripts/generate-flag-registry.ts\",\n \"build:operation-manifest\": \"bun run scripts/build-operation-manifest.ts\",\n \"weights:mine\": \"bun run scripts/mine-shard-weights.ts\",\n \"build:pglite-snapshot\": \"bun run scripts/build-pglite-snapshot.ts\",\n \"bench:efficiency\": \"bash scripts/bench/efficiency/run-all.sh\",\n \"bench:parity\": \"bash scripts/bench/contract-parity.sh\",\n \"test\": \"bash scripts/run-unit-parallel.sh\",\n \"test:admin\": \"playwright test --config admin/playwright.config.ts\",\n \"eval:autocut\": \"bun test test/search/autocut-eval.test.ts\",\n \"test:full\": \"bun run verify && bash scripts/run-unit-parallel.sh && bun run test:slow && (if [ -n \\\"$DATABASE_URL\\\" ]; then bash scripts/run-e2e.sh; else echo '[test:full] skipped E2E (no DATABASE_URL); run docker-compose -f docker-compose.ci.yml up + bun run test:e2e to include' 1>&2; fi)\",\n \"verify\": \"bash scripts/run-verify-parallel.sh\",\n \"check:source-config-leak\": \"bash scripts/check-source-config-leak.sh\",\n \"check:no-pii-agent-voice\": \"bash scripts/check-no-pii-in-agent-voice.sh\",\n \"check:synthetic-corpus-privacy\": \"bash scripts/check-synthetic-corpus-privacy.sh\",\n \"check:system-of-record\": \"bash scripts/check-system-of-record.sh\",\n \"check:admin-scope-drift\": \"bash scripts/check-admin-scope-drift.sh\",\n \"check:cli-exec\": \"bash scripts/check-cli-executable.sh\",\n \"check:engine-dynamic-import\": \"bash scripts/check-engine-dynamic-import.sh\",\n \"check:grok-pin\": \"bash scripts/check-grok-pin.sh\",\n \"check:opencode-pin\": \"bash scripts/check-opencode-pin.sh\",\n \"check:pin-doc-privacy\": \"bash scripts/check-pin-doc-privacy.sh\",\n \"check:gateway-routed\": \"bash scripts/check-gateway-routed-no-direct-anthropic.sh\",\n \"check:worker-pool-atomicity\": \"bash scripts/check-worker-pool-atomicity.sh\",\n \"check:doc-history\": \"bash scripts/check-key-files-current-state.sh\",\n \"check:resolver\": \"bun src/cli.ts check-resolvable --strict --skills-dir skills/\",\n \"check:skill-brain-first\": \"bash scripts/check-skill-brain-first.sh\",\n \"check:skill-publication\": \"bun scripts/check-skill-publication.ts\",\n \"check:plugin-tree\": \"bash scripts/check-plugin-tree.sh\",\n \"check:wasm\": \"bash scripts/check-wasm-embedded.sh\",\n \"check:pglite-embedded\": \"bash scripts/check-pglite-embedded.sh\",\n \"check:image-decoders\": \"bash scripts/check-image-decoders-embedded.sh\",\n \"check:newlines\": \"bash scripts/check-trailing-newline.sh\",\n \"test:compile-smoke\": \"bun test test/binary-self-update-compiled.serial.test.ts\",\n \"test:agent-voice\": \"bash scripts/test-agent-voice.sh\",\n \"test:e2e\": \"bash scripts/run-e2e.sh\",\n \"trust:smoke\": \"bun scripts/trust-smoke.ts\",\n \"test:slow\": \"bash scripts/run-slow-tests.sh\",\n \"test:stress\": \"bun run scripts/stress/run.ts\",\n \"test:scale\": \"bun scripts/scale/run.ts\",\n \"test:heavy\": \"bash scripts/run-heavy.sh\",\n \"test:profile\": \"bash scripts/profile-tests.sh\",\n \"test:serial\": \"bash scripts/run-serial-tests.sh\",\n \"test:convergence\": \"GBRAIN_TEST_CONVERGENCE=1 bun --no-env-file test --timeout=3600000 test/sync-convergence.serial.test.ts\",\n \"ci:local\": \"bash scripts/ci-local.sh\",\n \"ci:local:diff\": \"bash scripts/ci-local.sh --diff\",\n \"ci:ubicloud\": \"bun run scripts/ci-ubicloud.ts\",\n \"ci:ubicloud:diff\": \"bun run scripts/ci-ubicloud.ts --diff\",\n \"ci:select-e2e\": \"bun run scripts/select-e2e.ts\",\n \"typecheck\": \"node --max-old-space-size=6144 node_modules/typescript/bin/tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/gbrain-typecheck.tsbuildinfo\",\n \"check:jsonb\": \"bash scripts/check-jsonb-pattern.sh\",\n \"check:jsonb-params\": \"node scripts/check-jsonb-params.mjs\",\n \"check:search-path\": \"bash scripts/check-search-path.sh\",\n \"check:no-double-retry\": \"bash scripts/check-no-double-retry.sh\",\n \"check:batch-audit-site\": \"bash scripts/check-batch-audit-site.sh\",\n \"check:worker-lock-renewal-shape\": \"bash scripts/check-worker-lock-renewal-shape.sh\",\n \"check:bootstrap-tag\": \"bash scripts/check-bootstrap-tag.sh\",\n \"check:bootstrap-templates\": \"bash scripts/check-bootstrap-templates.sh\",\n \"check:source-id-projection\": \"bash scripts/check-source-id-projection.sh\",\n \"check:privacy\": \"bash scripts/check-privacy.sh\",\n \"check:proposal-pii\": \"bash scripts/check-proposal-pii.sh\",\n \"check:eval-glossary\": \"bash scripts/check-eval-glossary-fresh.sh\",\n \"check:tool-catalog\": \"bash scripts/check-tool-catalog-fresh.sh\",\n \"check:skills-manifest\": \"bash scripts/check-skills-manifest-fresh.sh\",\n \"check:test-names\": \"bash scripts/check-test-real-names.sh\",\n \"check:progress\": \"bash scripts/check-progress-to-stdout.sh\",\n \"check:no-tracked-symlinks\": \"bash scripts/check-no-tracked-symlinks.sh\",\n \"check:admin-build\": \"bash scripts/check-admin-build.sh\",\n \"check:admin-embedded\": \"bash scripts/check-admin-embedded.sh\",\n \"check:test-isolation\": \"bash scripts/check-test-isolation.sh\",\n \"check:test-env-opt-ins\": \"bun scripts/check-test-env-opt-ins.ts\",\n \"check:postgres-lanes\": \"bun scripts/check-postgres-lane-coverage.ts\",\n \"check:weight-coverage\": \"bun scripts/check-weight-coverage.ts\",\n \"check:recipe-pricing\": \"bun scripts/check-recipe-pricing.ts\",\n \"check:fuzz-purity\": \"bash scripts/check-fuzz-purity.sh\",\n \"check:operations-filter-bypass\": \"bash scripts/check-operations-filter-bypass.sh\",\n \"check:fixture-privacy\": \"bash scripts/check-fixture-privacy.sh\",\n \"check:conversation-parser\": \"bun src/cli.ts eval conversation-parser test/fixtures/conversation-formats/all.jsonl --no-llm\",\n \"check:eval-chronicle\": \"bun src/cli.ts eval chronicle\",\n \"check:eval-canary\": \"bun run scripts/run-eval-canary.ts\",\n \"check:pg-url-redaction\": \"bash scripts/check-pg-url-redaction.sh\",\n \"check:source-scope-onboard\": \"bash scripts/check-source-scope-onboard.sh\",\n \"check:getpage-scope\": \"node scripts/check-getpage-scoped-write.mjs\",\n \"postinstall\": \"bun run scripts/postinstall.ts\",\n \"prepublish:clawhub\": \"bun run build:all\",\n \"publish:clawhub\": \"clawhub package publish . --family bundle-plugin\",\n \"check:skill-refs\": \"bun scripts/check-skill-refs.mjs\",\n \"gate:skills\": \"bash scripts/skills-commit-gate.sh\",\n \"check:guard-self-test\": \"bash scripts/guard-self-test.sh\",\n \"build:error-codes\": \"bun scripts/build-error-codes.ts\",\n \"check:error-codes\": \"bun scripts/build-error-codes.ts --check\",\n \"check:write-gate-regex\": \"bun scripts/check-write-gate-regex.ts\",\n \"build:agent-protocol\": \"bun scripts/build-agent-protocol.ts\",\n \"check:agent-protocol\": \"bun scripts/build-agent-protocol.ts --check\",\n \"check:agent-contract\": \"bun scripts/check-agent-contract.ts\",\n \"check:no-legacy-getconnection\": \"bash scripts/check-no-legacy-getconnection.sh\",\n \"check:module-size\": \"bash scripts/check-module-size.sh\",\n \"check:core-guard-coverage\": \"node scripts/check-core-guard-coverage.mjs\",\n \"check:function-size\": \"bun scripts/check-function-size.ts\",\n \"check:layering\": \"bun scripts/check-layering.ts\",\n \"check:ai-sdk-importers\": \"bun scripts/check-ai-sdk-importers.ts\",\n \"check:durable-flush\": \"bun scripts/check-durable-flush.ts\",\n \"check:schema-error-predicates\": \"bun scripts/check-schema-error-predicates.ts\",\n \"check:windows-hide\": \"bun scripts/check-windows-hide.ts\",\n \"check:engine-sql-ratchet\": \"bun scripts/check-engine-sql-ratchet.ts\",\n \"check:chunk-visibility\": \"bun scripts/check-chunk-visibility.ts\",\n \"check:page-body-readers\": \"bun scripts/check-page-body-readers.ts\",\n \"check:engine-sql-dynamic\": \"bun scripts/check-engine-sql-dynamic.ts\",\n \"check:engine-sql-brands\": \"bun scripts/check-engine-sql-brands.ts\",\n \"check:sync-run-state\": \"bun scripts/check-sync-run-state.ts\",\n \"check:schema-migrations\": \"bash scripts/check-schema-migrations-fresh.sh\",\n \"check:schema-fresh\": \"bash scripts/check-schema-fresh.sh\",\n \"check:retired-phrases\": \"bash scripts/check-retired-phrases.sh\",\n \"check:shared-tree-git\": \"bash scripts/check-shared-tree-git.sh\",\n \"check:bash32\": \"bash scripts/check-bash32.sh\",\n \"check:schema-migration-order\": \"bun scripts/check-schema-migration-order.ts\",\n \"check:compile-autoload\": \"bash scripts/check-compile-autoload.sh\",\n \"check:structural-manifest\": \"bash scripts/check-structural-manifest.sh\",\n \"regen:all\": \"bun scripts/regen-all.ts\",\n \"release:restamp\": \"bun scripts/release-restamp.ts\",\n \"check:regen-all\": \"bun scripts/regen-all.ts --check\",\n \"check:orphan-modules\": \"node scripts/check-orphan-modules.mjs\",\n \"check:test-placeholders\": \"node scripts/check-test-placeholders.mjs\",\n \"build:harness-docs\": \"bun run scripts/build-harness-docs.ts\"\n },\n \"openclaw\": {\n \"compat\": {\n \"pluginApi\": \">=2026.4.0\"\n },\n \"extensions\": [\n \"./src/openclaw-context-engine.ts\"\n ]\n },\n \"dependencies\": {\n \"@ai-sdk/anthropic\": \"^3.0.125\",\n \"@ai-sdk/google\": \"^3.0.64\",\n \"@ai-sdk/openai\": \"^3.0.53\",\n \"@ai-sdk/openai-compatible\": \"^2.0.41\",\n \"@ai-sdk/provider-utils\": \"4.0.56\",\n \"@anthropic-ai/sdk\": \"^0.30.0\",\n \"@aws-sdk/client-s3\": \"^3.1028.0\",\n \"@dqbd/tiktoken\": \"^1.0.22\",\n \"@electric-sql/pglite\": \"0.4.3\",\n \"@jsquash/avif\": \"^2.1.1\",\n \"@jsquash/png\": \"^3.1.1\",\n \"@modelcontextprotocol/sdk\": \"1.31.0\",\n \"ai\": \"^6.0.168\",\n \"chokidar\": \"^4.0.3\",\n \"cookie-parser\": \"^1.4.7\",\n \"cors\": \"^2.8.5\",\n \"detect-libc\": \"2.0.4\",\n \"eventsource-parser\": \"^3.0.8\",\n \"exifr\": \"^7.1.3\",\n \"express\": \"^5.1.0\",\n \"express-rate-limit\": \"^7.5.0\",\n \"heic-decode\": \"^2.1.0\",\n \"js-yaml\": \"^4.3.2\",\n \"jsonc-parser\": \"^3.3.1\",\n \"marked\": \"^18.0.2\",\n \"openai\": \"^4.0.0\",\n \"pgvector\": \"^0.2.0\",\n \"tree-sitter-wasms\": \"0.1.13\",\n \"web-tree-sitter\": \"0.22.6\",\n \"zod\": \"^4.3.6\"\n },\n \"devDependencies\": {\n \"@playwright/test\": \"1.63.0\",\n \"@types/bun\": \"latest\",\n \"@types/cookie-parser\": \"^1.4.7\",\n \"@types/cors\": \"^2.8.19\",\n \"@types/express\": \"^5.0.6\",\n \"@types/js-yaml\": \"^4.0.9\",\n \"bun-types\": \"^1.3.13\",\n \"fast-check\": \"^4.8.0\",\n \"typescript\": \"^5.6.0\"\n },\n \"trustedDependencies\": [\n \"@electric-sql/pglite\"\n ],\n \"engines\": {\n \"bun\": \">=1.4.0\"\n },\n \"license\": \"MIT\",\n \"version\": \"0.60.269.0\",\n \"overrides\": {\n \"@ai-sdk/provider-utils\": \"4.0.56\",\n \"@hono/node-server\": \"^2.0.5\",\n \"fast-uri\": \"3.1.8\",\n \"body-parser\": \"^2.3.0\",\n \"fast-xml-builder\": \"^1.1.7\",\n \"fast-xml-parser\": \"^5.7.0\",\n \"form-data\": \"^4.0.6\",\n \"hono\": \"^4.13.5\",\n \"ip-address\": \"^10.5.1\",\n \"qs\": \"6.16.0\",\n \"js-yaml\": \"^4.3.2\"\n }\n}\n", + "plugin-variants/gbrain-coding/.claude-plugin/plugin.json": "{\n \"name\": \"gbrain-coding\",\n \"version\": \"0.60.269.0\",\n \"description\": \"Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant. (persona variant of the gbrain plugin — 21 skills)\",\n \"author\": {\n \"name\": \"Garry Tan\",\n \"url\": \"https://github.com/garrytan\"\n },\n \"homepage\": \"https://github.com/garrytan/gbrain\",\n \"repository\": \"https://github.com/garrytan/gbrain\",\n \"license\": \"MIT\",\n \"keywords\": [\n \"memory\",\n \"knowledge-base\",\n \"mcp\",\n \"search\",\n \"agent\",\n \"brain\",\n \"pgvector\"\n ],\n \"skills\": \"./skills/\",\n \"mcpServers\": {\n \"gbrain\": {\n \"command\": \"${CLAUDE_PLUGIN_ROOT}/.agents/gbrain-launcher\",\n \"args\": [\n \"serve\",\n \"--surface\",\n \"full\",\n \"--source-guard\"\n ],\n \"cwd\": \"${CLAUDE_PLUGIN_ROOT}\"\n }\n }\n}\n", + "plugin-variants/gbrain-coding/.codex-plugin/plugin.json": "{\n \"name\": \"gbrain-coding\",\n \"version\": \"0.60.269.0\",\n \"description\": \"Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant. (persona variant of the gbrain plugin — 21 skills)\",\n \"author\": {\n \"name\": \"Garry Tan\",\n \"url\": \"https://github.com/garrytan\"\n },\n \"homepage\": \"https://github.com/garrytan/gbrain\",\n \"repository\": \"https://github.com/garrytan/gbrain\",\n \"license\": \"MIT\",\n \"keywords\": [\n \"memory\",\n \"knowledge-base\",\n \"mcp\",\n \"search\",\n \"agent\",\n \"brain\",\n \"pgvector\"\n ],\n \"skills\": \"./skills/\",\n \"mcpServers\": \"./.codex-plugin/mcp.json\",\n \"interface\": {\n \"displayName\": \"GBrain\",\n \"shortDescription\": \"Give your agent a persistent brain: search, synthesis, memory\",\n \"longDescription\": \"GBrain wires a personal knowledge brain into every session: hybrid keyword+vector search, entity graph traversal, synthesis, and memory your agent writes itself — served on the starter MCP surface (the seven memory verbs plus the daily-driver brain ops). Bundles the curated brain-first skill set: setup (walks install + gbrain init), cold-start day-one brain filling, ingest, query, briefing, upgrade, and more. Requires the gbrain CLI (bun install -g github:garrytan/gbrain#latest-stable) and a brain (gbrain init); the bundled setup skill walks the rest. Unix (macOS/Linux) only.\",\n \"developerName\": \"Garry Tan\",\n \"category\": \"Productivity\",\n \"capabilities\": [\n \"Interactive\",\n \"Write\"\n ],\n \"websiteURL\": \"https://github.com/garrytan/gbrain\",\n \"defaultPrompt\": [\n \"Search my brain, recall context across sessions, and write new memory as we work\"\n ],\n \"brandColor\": \"#1F6F5C\"\n }\n}\n", + "plugin-variants/gbrain-coding/README.md": "\n# gbrain-coding (generated persona variant — do not hand-edit)\n\nBrain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant.\n\n21 skills curated from the gbrain plugin lane (persona\n`coding-agent` in `skills/plugin-lanes.json#personas`, one recorded\nreason per skill). Install exactly ONE gbrain plugin per machine — every\nvariant serves the same `gbrain` MCP server name, so two installed variants\nwould double-serve. The full-lane plugin's README carries the MCP surface\nnote; it applies verbatim here.\n\nRegenerate with `bun run scripts/generate-plugin-tree.ts --out plugin\n--variants-out plugin-variants`.\n", + "plugin-variants/gbrain-daily/.claude-plugin/plugin.json": "{\n \"name\": \"gbrain-daily\",\n \"version\": \"0.60.269.0\",\n \"description\": \"Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant. (persona variant of the gbrain plugin — 20 skills)\",\n \"author\": {\n \"name\": \"Garry Tan\",\n \"url\": \"https://github.com/garrytan\"\n },\n \"homepage\": \"https://github.com/garrytan/gbrain\",\n \"repository\": \"https://github.com/garrytan/gbrain\",\n \"license\": \"MIT\",\n \"keywords\": [\n \"memory\",\n \"knowledge-base\",\n \"mcp\",\n \"search\",\n \"agent\",\n \"brain\",\n \"pgvector\"\n ],\n \"skills\": \"./skills/\",\n \"mcpServers\": {\n \"gbrain\": {\n \"command\": \"${CLAUDE_PLUGIN_ROOT}/.agents/gbrain-launcher\",\n \"args\": [\n \"serve\",\n \"--surface\",\n \"full\",\n \"--source-guard\"\n ],\n \"cwd\": \"${CLAUDE_PLUGIN_ROOT}\"\n }\n }\n}\n", + "plugin-variants/gbrain-daily/.codex-plugin/plugin.json": "{\n \"name\": \"gbrain-daily\",\n \"version\": \"0.60.269.0\",\n \"description\": \"Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant. (persona variant of the gbrain plugin — 20 skills)\",\n \"author\": {\n \"name\": \"Garry Tan\",\n \"url\": \"https://github.com/garrytan\"\n },\n \"homepage\": \"https://github.com/garrytan/gbrain\",\n \"repository\": \"https://github.com/garrytan/gbrain\",\n \"license\": \"MIT\",\n \"keywords\": [\n \"memory\",\n \"knowledge-base\",\n \"mcp\",\n \"search\",\n \"agent\",\n \"brain\",\n \"pgvector\"\n ],\n \"skills\": \"./skills/\",\n \"mcpServers\": \"./.codex-plugin/mcp.json\",\n \"interface\": {\n \"displayName\": \"GBrain\",\n \"shortDescription\": \"Give your agent a persistent brain: search, synthesis, memory\",\n \"longDescription\": \"GBrain wires a personal knowledge brain into every session: hybrid keyword+vector search, entity graph traversal, synthesis, and memory your agent writes itself — served on the starter MCP surface (the seven memory verbs plus the daily-driver brain ops). Bundles the curated brain-first skill set: setup (walks install + gbrain init), cold-start day-one brain filling, ingest, query, briefing, upgrade, and more. Requires the gbrain CLI (bun install -g github:garrytan/gbrain#latest-stable) and a brain (gbrain init); the bundled setup skill walks the rest. Unix (macOS/Linux) only.\",\n \"developerName\": \"Garry Tan\",\n \"category\": \"Productivity\",\n \"capabilities\": [\n \"Interactive\",\n \"Write\"\n ],\n \"websiteURL\": \"https://github.com/garrytan/gbrain\",\n \"defaultPrompt\": [\n \"Search my brain, recall context across sessions, and write new memory as we work\"\n ],\n \"brandColor\": \"#1F6F5C\"\n }\n}\n", + "plugin-variants/gbrain-daily/README.md": "\n# gbrain-daily (generated persona variant — do not hand-edit)\n\nPersonal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant.\n\n20 skills curated from the gbrain plugin lane (persona\n`daily-driver` in `skills/plugin-lanes.json#personas`, one recorded\nreason per skill). Install exactly ONE gbrain plugin per machine — every\nvariant serves the same `gbrain` MCP server name, so two installed variants\nwould double-serve. The full-lane plugin's README carries the MCP surface\nnote; it applies verbatim here.\n\nRegenerate with `bun run scripts/generate-plugin-tree.ts --out plugin\n--variants-out plugin-variants`.\n", + "plugin/README.md": "\n# gbrain plugin skill tree (generated — do not hand-edit)\n\nThis tree is the curated skill set for the gbrain Codex and Claude Code\nplugins. Regenerate with `bun run scripts/generate-plugin-tree.ts --out plugin`;\ncuration lives in `skills/plugin-lanes.json` (one recorded decision per\naddition/exclusion).\n\n## MCP surface note (read once)\n\nThe plugin's MCP server runs `gbrain serve --surface full` — 172\noperations, the same surface every stdio registration gbrain writes pins.\nEvery gbrain operation the bundled skills name is on it. A harness that caps\nits tool count can narrow this machine's plugin surface with\n`GBRAIN_SURFACE=starter` (or `verbs`); the server honors it and new sessions\npick it up. Skills keep their first-class `gbrain` CLI paths for anything a\nnarrowed list leaves out.\n\n## Requirements\n\n- gbrain CLI installed: `bun install -g github:garrytan/gbrain#latest-stable`\n (the npm package named `gbrain` is unrelated — never `npm install -g gbrain`).\n- A brain: `gbrain init` (the bundled `setup` skill walks the full path).\n", + "templates/bootstrap/template-repo/README.md": "# gbrain agent workspace — template\n\n\n\nThis repository is the **\"Use this template\"** distribution artifact for a\n[gbrain](https://github.com/garrytan/gbrain) personal-agent workspace — the same\nfile set `gbrain bootstrap render` produces, with every value still a\n`{{TOKEN}}` placeholder. Nothing in this tree is real data: your agent fills the\nplaceholders from YOUR interview answers, on your machine.\n\n## Use this template\n\n1. Click **Use this template → Create a new repository**, and make the new\n repository **Private**. The bootstrap flow refuses to put identity files in\n a public repository.\n2. Clone your new repository, then open Claude Code or Codex (desktop app or\n CLI) in that folder.\n3. Paste this into your agent:\n\n ```\n Read and follow every step of:\n https://raw.githubusercontent.com/garrytan/gbrain/latest-stable/BOOTSTRAP_FOR_AGENTS.md\n Goal: finish setting up this cloned template as my persistent personal\n agent, with gbrain as your memory. Interview me before writing any\n identity file — never invent answers. You are not done until\n `gbrain bootstrap verify` exits 0.\n ```\n\n Already running the gbrain CLI\n (`bun install -g github:garrytan/gbrain#latest-stable`)? Then the first\n step is always:\n\n ```\n gbrain bootstrap status\n ```\n\n `bootstrap status` hard-fails while this repository's `origin` is public,\n before any identity file lands.\n\n## What's in this tree\n\n- `agent.json` — workspace manifest with `initialized: false`; `gbrain\n bootstrap render` flips it to `true` on your machine. That flag (never the\n file's mere presence) is what distinguishes a fresh template clone from a\n machine-two clone of a live workspace.\n- Identity files (`SOUL.md`, `USER.md`, `MEMORY.md`, …) and operating\n contracts (`AGENTS.md`, `HEARTBEAT.md`, `ACCESS_POLICY.md`, `GITHUB.md`) —\n placeholder-only until your interview.\n- `.gitignore` — pre-configured so the local brain database, env files, and\n machine-local state never reach this repository.\n\nThis README is generated by gbrain's release pipeline; edits made here are\noverwritten on the next gbrain release. The stamp at the top records the\ngbrain version that generated this tree — `gbrain bootstrap status` compares\nit to your installed binary and warns on skew.\n" + }, + "stamp_diff": "diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json\nindex d624525846..f07db3983f 100644\n--- a/.claude-plugin/plugin.json\n+++ b/.claude-plugin/plugin.json\n@@ -1,6 +1,6 @@\n {\n \"name\": \"gbrain\",\n- \"version\": \"0.60.269.0\",\n+ \"version\": \"0.60.270.0\",\n \"description\": \"Personal knowledge brain for your coding agent — hybrid search, synthesis, graph traversal, and durable cross-session memory over Postgres/PGLite with pgvector, plus a curated brain-first skill set.\",\n \"author\": {\n \"name\": \"Garry Tan\",\ndiff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json\nindex b09a13b223..89a5e8aaa3 100644\n--- a/.codex-plugin/plugin.json\n+++ b/.codex-plugin/plugin.json\n@@ -1,6 +1,6 @@\n {\n \"name\": \"gbrain\",\n- \"version\": \"0.60.269.0\",\n+ \"version\": \"0.60.270.0\",\n \"description\": \"Personal knowledge brain for your coding agent — hybrid search, synthesis, graph traversal, and durable cross-session memory over Postgres/PGLite with pgvector, plus a curated brain-first skill set.\",\n \"author\": {\n \"name\": \"Garry Tan\",\ndiff --git a/BOOTSTRAP_FOR_AGENTS.md b/BOOTSTRAP_FOR_AGENTS.md\nindex bdf32f0f26..98b9788881 100644\n--- a/BOOTSTRAP_FOR_AGENTS.md\n+++ b/BOOTSTRAP_FOR_AGENTS.md\n@@ -1,4 +1,4 @@\n-\n+\n \ndiff --git a/VERSION b/VERSION\nindex f8c08a1cd2..3abf5505bd 100644\n--- a/VERSION\n+++ b/VERSION\n@@ -1 +1 @@\n-0.60.269.0\n+0.60.270.0\ndiff --git a/openclaw.plugin.json b/openclaw.plugin.json\nindex 767c75beef..1581a4201f 100644\n--- a/openclaw.plugin.json\n+++ b/openclaw.plugin.json\n@@ -1,7 +1,7 @@\n {\n \"id\": \"gbrain-context-engine\",\n \"name\": \"gbrain\",\n- \"version\": \"0.60.269.0\",\n+ \"version\": \"0.60.270.0\",\n \"description\": \"Personal knowledge brain with Postgres + pgvector hybrid search\",\n \"family\": \"bundle-plugin\",\n \"kind\": \"context-engine\",\ndiff --git a/package.json b/package.json\nindex 7f91d7bdd1..0f5f1f7018 100644\n--- a/package.json\n+++ b/package.json\n@@ -238,7 +238,7 @@\n \"bun\": \">=1.4.0\"\n },\n \"license\": \"MIT\",\n- \"version\": \"0.60.269.0\",\n+ \"version\": \"0.60.270.0\",\n \"overrides\": {\n \"@ai-sdk/provider-utils\": \"4.0.56\",\n \"@hono/node-server\": \"^2.0.5\",\ndiff --git a/plugin-variants/gbrain-coding/.claude-plugin/plugin.json b/plugin-variants/gbrain-coding/.claude-plugin/plugin.json\nindex 1e78079b00..681de7cc89 100644\n--- a/plugin-variants/gbrain-coding/.claude-plugin/plugin.json\n+++ b/plugin-variants/gbrain-coding/.claude-plugin/plugin.json\n@@ -1,6 +1,6 @@\n {\n \"name\": \"gbrain-coding\",\n- \"version\": \"0.60.269.0\",\n+ \"version\": \"0.60.270.0\",\n \"description\": \"Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant. (persona variant of the gbrain plugin — 21 skills)\",\n \"author\": {\n \"name\": \"Garry Tan\",\ndiff --git a/plugin-variants/gbrain-coding/.codex-plugin/plugin.json b/plugin-variants/gbrain-coding/.codex-plugin/plugin.json\nindex dbde499618..e1c48f33ab 100644\n--- a/plugin-variants/gbrain-coding/.codex-plugin/plugin.json\n+++ b/plugin-variants/gbrain-coding/.codex-plugin/plugin.json\n@@ -1,6 +1,6 @@\n {\n \"name\": \"gbrain-coding\",\n- \"version\": \"0.60.269.0\",\n+ \"version\": \"0.60.270.0\",\n \"description\": \"Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant. (persona variant of the gbrain plugin — 21 skills)\",\n \"author\": {\n \"name\": \"Garry Tan\",\ndiff --git a/plugin-variants/gbrain-coding/README.md b/plugin-variants/gbrain-coding/README.md\nindex b1930d5d09..9eca046758 100644\n--- a/plugin-variants/gbrain-coding/README.md\n+++ b/plugin-variants/gbrain-coding/README.md\n@@ -1,4 +1,4 @@\n-\n+\n # gbrain-coding (generated persona variant — do not hand-edit)\n \n Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant.\ndiff --git a/plugin-variants/gbrain-daily/.claude-plugin/plugin.json b/plugin-variants/gbrain-daily/.claude-plugin/plugin.json\nindex d0c9e119eb..bbbc9d3b63 100644\n--- a/plugin-variants/gbrain-daily/.claude-plugin/plugin.json\n+++ b/plugin-variants/gbrain-daily/.claude-plugin/plugin.json\n@@ -1,6 +1,6 @@\n {\n \"name\": \"gbrain-daily\",\n- \"version\": \"0.60.269.0\",\n+ \"version\": \"0.60.270.0\",\n \"description\": \"Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant. (persona variant of the gbrain plugin — 20 skills)\",\n \"author\": {\n \"name\": \"Garry Tan\",\ndiff --git a/plugin-variants/gbrain-daily/.codex-plugin/plugin.json b/plugin-variants/gbrain-daily/.codex-plugin/plugin.json\nindex db29fa2417..837da4a182 100644\n--- a/plugin-variants/gbrain-daily/.codex-plugin/plugin.json\n+++ b/plugin-variants/gbrain-daily/.codex-plugin/plugin.json\n@@ -1,6 +1,6 @@\n {\n \"name\": \"gbrain-daily\",\n- \"version\": \"0.60.269.0\",\n+ \"version\": \"0.60.270.0\",\n \"description\": \"Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant. (persona variant of the gbrain plugin — 20 skills)\",\n \"author\": {\n \"name\": \"Garry Tan\",\ndiff --git a/plugin-variants/gbrain-daily/README.md b/plugin-variants/gbrain-daily/README.md\nindex 9cc5059f83..c50d431558 100644\n--- a/plugin-variants/gbrain-daily/README.md\n+++ b/plugin-variants/gbrain-daily/README.md\n@@ -1,4 +1,4 @@\n-\n+\n # gbrain-daily (generated persona variant — do not hand-edit)\n \n Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant.\ndiff --git a/plugin/README.md b/plugin/README.md\nindex 63a55105ab..50389c7e00 100644\n--- a/plugin/README.md\n+++ b/plugin/README.md\n@@ -1,4 +1,4 @@\n-\n+\n # gbrain plugin skill tree (generated — do not hand-edit)\n \n This tree is the curated skill set for the gbrain Codex and Claude Code\ndiff --git a/templates/bootstrap/template-repo/README.md b/templates/bootstrap/template-repo/README.md\nindex 1d36546d93..0dfdf4a897 100644\n--- a/templates/bootstrap/template-repo/README.md\n+++ b/templates/bootstrap/template-repo/README.md\n@@ -1,6 +1,6 @@\n # gbrain agent workspace — template\n \n-\n+\n \n This repository is the **\"Use this template\"** distribution artifact for a\n [gbrain](https://github.com/garrytan/gbrain) personal-agent workspace — the same\n" +} diff --git a/test/helpers/ship-queue-fixture.ts b/test/helpers/ship-queue-fixture.ts new file mode 100644 index 000000000..e43fab794 --- /dev/null +++ b/test/helpers/ship-queue-fixture.ts @@ -0,0 +1,76 @@ +/** + * Fixtures for gstack-ship-queue and the gbrain stamp-pair acceptance: a + * hermetic repo (bare origin plus working clone under os.tmpdir(), its own git + * identity) seeded from test/fixtures/ship-queue/gbrain-stamp-pair.json, the + * stamp files of a real gbrain stamp commit at its parent plus that commit's + * diff and gbrain's committed .gstack/ship-policy.json, byte for byte. + */ +import { spawnSync } from 'node:child_process'; +import * as fs from 'node:fs'; +import * as os from 'node:os'; +import * as path from 'node:path'; +import { gitArgvIn } from './scratch-repo'; +import type { FixtureRepo } from './restamp-fixture'; + +export const ROOT = path.resolve(import.meta.dir, '..', '..'); + +export interface GbrainPair { + source: { repo: string; gated_commit: string; stamp_commit: string; stamp_subject: string; policy_commit: string; note: string }; + policy: string; + gated: Record; + stamp_diff: string; +} + +export function loadGbrainPair(): GbrainPair { + return JSON.parse(fs.readFileSync(path.join(ROOT, 'test', 'fixtures', 'ship-queue', 'gbrain-stamp-pair.json'), 'utf8')); +} + +/** A bare origin plus working clone with its own git identity; nothing committed yet. */ +export function emptyRepo(prefix: string): FixtureRepo { + const root = fs.mkdtempSync(path.join(os.tmpdir(), prefix)); + const origin = path.join(root, 'origin.git'); + const work = path.join(root, 'work'); + const home = path.join(root, 'home'); + fs.mkdirSync(home, { recursive: true }); + fs.mkdirSync(work, { recursive: true }); + const env = { GSTACK_HOME: home, GSTACK_STATE_DIR: home, HOME: home, GIT_CONFIG_GLOBAL: path.join(root, 'gitconfig'), GIT_CONFIG_NOSYSTEM: '1' }; + fs.writeFileSync(env.GIT_CONFIG_GLOBAL, '[user]\n\tname = t\n\temail = t@test\n[commit]\n\tgpgsign = false\n[init]\n\tdefaultBranch = main\n'); + const git = (...args: string[]): string => { + const r = gitArgvIn(work, args, 30_000, { ...process.env, ...env }); + if (r.status !== 0) throw new Error(`git ${args.join(' ')} failed: ${r.stderr?.toString()}`); + return r.stdout?.toString().trim() ?? ''; + }; + spawnSync('git', ['init', '-q', '--bare', origin], { timeout: 30_000, env: { ...process.env, ...env } }); + git('init', '-q', '-b', 'main'); + git('remote', 'add', 'origin', origin); + return { root, work, origin, home, git, env }; +} + +/** + * main holds gbrain's policy and the stamp files at the gated commit; HEAD + * is that commit (the gated head). Returns the repo and a function that + * commits the real stamp diff on top (the stamped head). + */ +export function gbrainPairRepo(): { repo: FixtureRepo; pair: GbrainPair; gated: string; stamp: () => string } { + const pair = loadGbrainPair(); + const repo = emptyRepo('gstack-gbrain-pair-'); + for (const [rel, text] of Object.entries(pair.gated)) { + fs.mkdirSync(path.dirname(path.join(repo.work, rel)), { recursive: true }); + fs.writeFileSync(path.join(repo.work, rel), text); + } + fs.mkdirSync(path.join(repo.work, '.gstack'), { recursive: true }); + fs.writeFileSync(path.join(repo.work, '.gstack', 'ship-policy.json'), pair.policy); + repo.git('add', '-A'); + repo.git('commit', '-q', '-m', `gated ${pair.source.gated_commit.slice(0, 10)}`); + repo.git('push', '-q', 'origin', 'main'); + repo.git('remote', 'set-head', 'origin', 'main'); + const gated = repo.git('rev-parse', 'HEAD'); + const stamp = () => { + const diff = path.join(repo.root, 'stamp.diff'); + fs.writeFileSync(diff, pair.stamp_diff); + repo.git('apply', '--index', diff); + repo.git('commit', '-q', '-m', pair.source.stamp_subject); + return repo.git('rev-parse', 'HEAD'); + }; + return { repo, pair, gated, stamp }; +} diff --git a/test/tree-receipt-gbrain-pair.test.ts b/test/tree-receipt-gbrain-pair.test.ts new file mode 100644 index 000000000..afa0334f7 --- /dev/null +++ b/test/tree-receipt-gbrain-pair.test.ts @@ -0,0 +1,64 @@ +/** + * Field list 2, W1 acceptance: gstack-tree-receipt proves a real gbrain stamp + * commit (gbrain 3ffce57b27, "v0.60.270.0 chore(release): restamp onto master + * v0.60.269.0", 14 one-line stamps) is `same-modulo-stamps` against its + * parent under gbrain's committed .gstack/ship-policy.json (stamp_files plus + * stamp_patterns), with negative controls: a non-stamp byte inside a stamp + * file and a file outside stamp_files are both `changed`. Fixture: + * test/fixtures/ship-queue/gbrain-stamp-pair.json. + */ +import { afterEach, describe, expect, test } from 'bun:test'; +import * as fs from 'node:fs'; +import * as path from 'node:path'; +import { EXIT } from '../lib/headless-artifacts'; +import { cleanup, runBin, type FixtureRepo } from './helpers/restamp-fixture'; +import { gbrainPairRepo } from './helpers/ship-queue-fixture'; + +const repos: FixtureRepo[] = []; +afterEach(() => { while (repos.length) cleanup(repos.pop()!); }); + +function receipt(repo: FixtureRepo, gated: string, current: string) { + const r = runBin(repo, 'gstack-tree-receipt', ['--gated', gated, '--current', current, '--base', 'main', '--json']); + return { ...r, json: JSON.parse(r.out) }; +} + +describe('gbrain stamp pair under gbrain\'s committed policy', () => { + test('the real stamp commit is same-modulo-stamps, every file a stamp by gbrain\'s rule', () => { + const { repo, gated, stamp } = gbrainPairRepo(); + repos.push(repo); + expect(runBin(repo, 'gstack-ship-policy', ['validate', '--policy-from', 'base', '--base', 'main']).out).toMatch(/^POLICY_VALID: origin\/main@/m); + const head = stamp(); + const { json } = receipt(repo, gated, head); + expect(json.old_version).toBe('0.60.269.0'); + expect(json.new_version).toBe('0.60.270.0'); + expect(json.tree).toBe('same-modulo-stamps'); + expect(json.residual).toEqual([]); + expect(json.files.map((f: any) => `${f.path}:${f.verdict}:${f.rule}`).sort()).toEqual([ + '.claude-plugin/plugin.json:stamp:stamp_files', '.codex-plugin/plugin.json:stamp:stamp_files', 'BOOTSTRAP_FOR_AGENTS.md:stamp:stamp_files', + 'VERSION:stamp:version-file', 'openclaw.plugin.json:stamp:stamp_files', 'package.json:stamp:manifest-version', + 'plugin-variants/gbrain-coding/.claude-plugin/plugin.json:stamp:stamp_files', 'plugin-variants/gbrain-coding/.codex-plugin/plugin.json:stamp:stamp_files', + 'plugin-variants/gbrain-coding/README.md:stamp:stamp_files', 'plugin-variants/gbrain-daily/.claude-plugin/plugin.json:stamp:stamp_files', + 'plugin-variants/gbrain-daily/.codex-plugin/plugin.json:stamp:stamp_files', 'plugin-variants/gbrain-daily/README.md:stamp:stamp_files', + 'plugin/README.md:stamp:stamp_files', 'templates/bootstrap/template-repo/README.md:stamp:stamp_files', + ]); + }, 120_000); + + test('negative controls: a non-stamp byte in a stamp file, and a file outside stamp_files, are changes', () => { + const { repo, gated, stamp } = gbrainPairRepo(); + repos.push(repo); + stamp(); + const manifest = path.join(repo.work, '.claude-plugin', 'plugin.json'); + fs.writeFileSync(manifest, fs.readFileSync(manifest, 'utf8').replace('Personal knowledge brain', 'Personal knowledge Brain')); + repo.git('commit', '-qam', 'edit description'); + const edited = receipt(repo, gated, repo.git('rev-parse', 'HEAD')); + expect(edited.status).toBe(EXIT.fail); + expect(edited.json.tree).toBe('changed'); + expect(edited.json.residual).toEqual(['.claude-plugin/plugin.json']); + fs.mkdirSync(path.join(repo.work, 'src'), { recursive: true }); + fs.writeFileSync(path.join(repo.work, 'src', 'version.ts'), "export const VERSION = '0.60.270.0';\n"); + repo.git('add', '-A'); + repo.git('commit', '-qm', 'add a file'); + const added = receipt(repo, gated, repo.git('rev-parse', 'HEAD')); + expect(added.json.residual).toContain('src/version.ts'); + }, 120_000); +});