gbrain — Give Your AI Coding Agent a Persistent, Queryable Memory
文章目录
- Memory-first architecture with dual backends — gbrain ships with a PGLite WASM engine (zero-dependency, works anywhere Bun runs) and a Postgres backend for teams or high-volume use. Embeddings are chunked, stored with frontmatter metadata, and retrieved via semantic search — giving your agent the kind of episodic memory that makes it useful on large, mature codebases. Schema migration and v0.13+ path awareness — A major migration system handles schema upgrades across versions, with a two-phase migration process that reconstructs the brain's link index and frontmatter. The migration path is well-documented and community-tested across multiple install methods (bun link, bun install -g, and OpenClaw). Cross-platform, cross-architecture support — gbrain runs on macOS (Intel and Apple Silicon), Linux (x86_64 and aarch64), and Windows. The PGLite WASM runtime and the native Postgres backend both work reliably, though the community has documented some PGLite checkpoint corruption edge cases on macOS 26+ (see discussions below).
-
- This was a high-impact regression where every PGLite-based gbrain command crashed immediately on macOS 26.3 (Darwin kernel 25.3.0) with Bun 1.3.11. Multiple users from different environments converged on the same root cause: @papiofficial (2026-04-24): "Update (v0.19.0 regression): After upgrading from v0.18.2 → v0.19.0, this went from intermittent to consistently broken on macOS 25.3 arm64 / Bun 1.3.12." @WattyouSay (2026-04-26): "Reproduces on macOS 26.4.1 / Darwin 25.4 — Intel x86_64. Two distinct failure modes worth disambiguating. Environment: macOS 26.4.1 (BuildVersion 25E253), Darwin 25.4, Architecture: x86_64 (Intel) — extends the affected surface beyond the arm64 reports above." @WilliamCourterWelch (2026-05-12): "Resolved by rebuilding brain.pglite. Diagnosis was checkpoint corruption, not a WASM/OS incompatibility. The brain hit the 'PGLite failed to initialize its WASM runtime. Aborted()' symptom... Fixed by backing up ~/.gbrain, moving corrupted brain.pglite aside, and rebuilding a fresh PGLite brain." Translation: A regression cascaded through the user base; community diagnostic work narrowed it to PGLite checkpoint corruption rather than a deeper WASM/OS incompatibility, leading to a clear recovery path without a full gbrain version bump.
- A subtle but wide-ranging bug in the migration system: on source-linked Bun installs, process.execPath resolves to the Bun binary rather than the gbrain binary, causing Phase A of migration to invoke bun init instead of the migration runner: @streamio-founder (2026-04-20): "Hit this today on a source-installed Bun setup while upgrading a real Postgres-backed brain from 0.12.0 to 0.14.2." @gopalpatel (2026-04-24): "Confirming repro on a source-linked install (git clone + bun link path, per INSTALL_FOR_AGENTS.md). This is the blessed non-bun install -g path — and the execPath bug still fires." @garrytan (2026-05-10): "Closing as a duplicate of #332 (process.execPath bun-runtime class). Thanks for the report — please follow #332 for updates."
- gbrain is one of the most actively developed open-source takes on the "giving AI agents persistent memory" problem. The maintainer (@garrytan) is responsive, issues get triaged quickly, and the community has already worked around several tricky edge cases in the PGLite WASM runtime and migration system. The 14k star count reflects genuine interest from the Claude Code and autonomous agent community — if you're building anything where context windows aren't enough, this is worth studying. Try it: bunx gbrain init 14k stars · @garrytan · https://github.com/garrytan/gbrain
gbrain is an opinionated, open-source AI agent brain built around the idea that context is the limiting reagent in AI-assisted development. Rather than letting your agent hallucinate its way through a codebase, gbrain gives it a persistent, queryable memory — built on SQLite (via PGLite WASM) or Postgres — that stores embeddings, code snippets, file relationships, and conversation context between sessions. The result is an agent that actually remembers what it learned about your project last week, last month, or last year, enabling genuine long-horizon reasoning over large codebases.
- Memory-first architecture with dual backends — gbrain ships with a PGLite WASM engine (zero-dependency, works anywhere Bun runs) and a Postgres backend for teams or high-volume use. Embeddings are chunked, stored with frontmatter metadata, and retrieved via semantic search — giving your agent the kind of episodic memory that makes it useful on large, mature codebases.
- Schema migration and v0.13+ path awareness — A major migration system handles schema upgrades across versions, with a two-phase migration process that reconstructs the brain's link index and frontmatter. The migration path is well-documented and community-tested across multiple install methods (bun link, bun install -g, and OpenClaw).
- Cross-platform, cross-architecture support — gbrain runs on macOS (Intel and Apple Silicon), Linux (x86_64 and aarch64), and Windows. The PGLite WASM runtime and the native Postgres backend both work reliably, though the community has documented some PGLite checkpoint corruption edge cases on macOS 26+ (see discussions below).
This was a high-impact regression where every PGLite-based gbrain command crashed immediately on macOS 26.3 (Darwin kernel 25.3.0) with Bun 1.3.11. Multiple users from different environments converged on the same root cause:
@papiofficial (2026-04-24): "Update (v0.19.0 regression): After upgrading from v0.18.2 → v0.19.0, this went from intermittent to consistently broken on macOS 25.3 arm64 / Bun 1.3.12."
@WattyouSay (2026-04-26): "Reproduces on macOS 26.4.1 / Darwin 25.4 — Intel x86_64. Two distinct failure modes worth disambiguating. Environment: macOS 26.4.1 (BuildVersion 25E253), Darwin 25.4, Architecture: x86_64 (Intel) — extends the affected surface beyond the arm64 reports above."
@WilliamCourterWelch (2026-05-12): "Resolved by rebuilding brain.pglite. Diagnosis was checkpoint corruption, not a WASM/OS incompatibility. The brain hit the 'PGLite failed to initialize its WASM runtime. Aborted()' symptom... Fixed by backing up ~/.gbrain, moving corrupted brain.pglite aside, and rebuilding a fresh PGLite brain."
Translation: A regression cascaded through the user base; community diagnostic work narrowed it to PGLite checkpoint corruption rather than a deeper WASM/OS incompatibility, leading to a clear recovery path without a full gbrain version bump.
A subtle but wide-ranging bug in the migration system: on source-linked Bun installs, process.execPath resolves to the Bun binary rather than the gbrain binary, causing Phase A of migration to invoke bun init instead of the migration runner:
@streamio-founder (2026-04-20): "Hit this today on a source-installed Bun setup while upgrading a real Postgres-backed brain from 0.12.0 to 0.14.2."
@gopalpatel (2026-04-24): "Confirming repro on a source-linked install (git clone + bun link path, per INSTALL_FOR_AGENTS.md). This is the blessed non-bun install -g path — and the execPath bug still fires."
@garrytan (2026-05-10): "Closing as a duplicate of #332 (process.execPath bun-runtime class). Thanks for the report — please follow #332 for updates."
gbrain is one of the most actively developed open-source takes on the "giving AI agents persistent memory" problem. The maintainer (@garrytan) is responsive, issues get triaged quickly, and the community has already worked around several tricky edge cases in the PGLite WASM runtime and migration system. The 14k star count reflects genuine interest from the Claude Code and autonomous agent community — if you're building anything where context windows aren't enough, this is worth studying.
Try it: bunx gbrain init
14k stars · @garrytan · https://github.com/garrytan/gbrain