Skip to content

v1.26.0+ memory-ingest calls non-existent gbrain put_page CLI command (153/153 fail) #1336

@magic-madrigal

Description

@magic-madrigal

Repro

  1. Fresh /setup-gbrain flow on macOS, picked PGLite local
  2. Reach Step 7.5 (transcript ingest) with 153 transcripts on disk
  3. gstack-gbrain-sync.ts --full --no-brain-sync (or gstack-memory-ingest.ts --bulk directly)

Observed

[put-error] timelines/Sanai-Ai-sanai-app/...: Command failed:
  gbrain put_page --slug timelines/... --title timeline ... --type timeline --tags timeline,repo:...
Unknown command: put_page
Run gbrain --help for available commands.

Ingest pass complete (bulk):
  written:  0
  failed:   153

All 153/153 fail with Unknown command: put_page.

Root cause

bin/gstack-memory-ingest.ts:762-784 (function gbrainPutPage) shells out:

const args = [
  "put_page",
  "--slug", page.slug,
  "--title", page.title,
  "--type", page.type,
  "--tags", page.tags.join(","),
];
execFileSync("gbrain", args, { input: page.body, ... });

But no gbrain version (verified against v0.18.2 and master v0.27.0) has a put_page CLI subcommand. put_page is the MCP tool name; the CLI subcommand is put <slug> (reads markdown body from stdin), defined as case 'pages': at master src/cli.ts.

The --slug / --title / --type / --tags flags also don't exist on gbrain put — title/type/tags are inferred from frontmatter in the body, or must be set via gbrain pages update after.

Proposed fix

Replace gbrainPutPage with the CLI shape gbrain actually accepts:

function gbrainPutPage(page: PageRecord): { ok: boolean; error?: string } {
  if (!gbrainAvailable()) return { ok: false, error: "gbrain CLI not in PATH" };
  try {
    // Prepend YAML frontmatter so gbrain infers title/type/tags
    const frontmatter = [
      "---",
      `title: ${JSON.stringify(page.title)}`,
      `type: ${page.type}`,
      `tags: [${page.tags.map((t) => JSON.stringify(t)).join(", ")}]`,
      "---",
      "",
    ].join("\n");
    const body = frontmatter + page.body;
    execFileSync("gbrain", ["put", page.slug], {
      input: body,
      encoding: "utf-8",
      timeout: 30000,
      stdio: ["pipe", "pipe", "pipe"],
    });
    return { ok: true };
  } catch (err) {
    return { ok: false, error: err instanceof Error ? err.message : String(err) };
  }
}

Comments at bin/gstack-memory-ingest.ts:37-38 and :176 also reference put_page; update to put.

Environment

  • gstack v1.26.3.0 (just upgraded from 1.15.0.0 via /gstack-upgrade)
  • gbrain v0.18.2 originally installed by gstack-gbrain-install; verified bug also reproduces on master v0.27.0
  • macOS Darwin 25.3.0, fish shell, bun 1.3.11

Workaround for users hitting this today

Skip Step 7.5 in /setup-gbrain — the rest of the flow (code import, MCP registration, repo policy) works fine. Code search via gbrain query still indexes the repo's markdown. Only the v1.26.0 memory features (skill manifests, salience block) stay disabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions