Garry's Opinionated OpenClaw/Hermes Agent Brain
Vendored tree-sitter assets
src/core/chunkers/code.ts embeds the runtime and grammar files directly with
Bun file imports. Its LANGUAGE_MANIFEST records paths, not content hashes;
replacing a grammar at the same path does not require regenerating a manifest.
Run bun run check:wasm to verify semantic parsing in the compiled binary.
Bash (#5082)
grammars/tree-sitter-bash.wasm is the official
tree-sitter/tree-sitter-bash v0.23.3 release asset,
not a binary taken from a contributor branch or the npm tree-sitter-wasms bundle.
- Upstream source tag:
v0.23.3, commit487734f87fd87118028a65a4599352fa99c9cde8(MIT license). - SHA-256:
d1844429a58620f306b6f42aebe92298243ca8120cd833a3ab5d87c7a2e7b9fd. - Size: 1,364,404 bytes. Language ABI: 14, compatible with the pinned
[email protected]runtime (ABI 13–14). - The release source archive's
src/scanner.cmatches the tagged source (Git blob748cf1bc4c928a52b4e6f9c27bc9a2bb4eeb6bce). It usesiswalphaandiswalnum, exported by the runtime, instead of the previous binary's missingisalphaimport. The remaining unresolved__assert_failimport is an assertion-only path; this update does not change the runtime's libc exports.
Re-vendor the pinned official asset, verifying its checksum before replacement:
bash scripts/vendor-bash-wasm.sh
bun test test/chunkers/code-bash.test.ts
bun run check:wasm
This is a verified upstream prebuilt, not a claim of a byte-reproducible local
build. The regression suite checks imports, ABI compatibility, real case,
heredoc and loop parsing, and semantic function preservation. CHUNKER_VERSION
advances to 7 to trigger the existing re-chunk gate when Git HEAD is unchanged.
That gate does not force a full walk when new commits are present; use
gbrain sync --source <id> --full to recover all previously affected files in
an active repository rather than relying on an incremental sync.
Lua (gbrain serve hang, GBRA-49 Q1 scoreboard)
grammars/tree-sitter-lua.wasm is the official
tree-sitter-grammars/tree-sitter-lua v0.3.0 release asset,
replacing the tree-sitter-wasms bundle's build of the unmaintained
Azganoth/tree-sitter-lua 2.1.3.
- Upstream source tag:
v0.3.0, commit534c461d2b75b0887ec968ef9635f4460b0878b7(MIT license). - SHA-256:
8fe0afe3238dad43a1dd541ba3024c28d3cd23466b031fe0a39d8f9d7e81ee0d. - Size: 48,189 bytes. Language ABI: 14, compatible with the pinned
[email protected]runtime (ABI 13–14). v0.4.0 and later are ABI 15. - Why: the previous grammar's external scanner allocated its state with
mallocand only reset it indeserializewhen handed a 2-byte buffer, so a fresh parse (which deserializes an empty buffer) started from whatever the recycled heap held. The first Lua parse in a process was sound; every later one began "inside" a string or long bracket, misparsedx = 1as an error, or spun until the chunker timeout (30 s per fence). A conversation page with five ChatGPT-style```luafences around shell commands keptgbrain serveat 100% CPU for 9.5 hours: each preparation attempt blocked the event loop for about 150 s, exceeded its deadline, and was retried. The maintained grammar usescallocand resets state on every parse. - The node types also changed (
function_declarationfor everyfunction/local function/function M.f()form), which is whatTOP_LEVEL_TYPES.luaexpected all along: Lua definitions become semantic chunks for the first time.GRAMMAR_REVISIONS.lua = 1insrc/core/chunkers/code.tsfolds into Lua code-file hashes and into thesources.chunker_versionstamp (8;lua=1), so the next sync walks each source and re-imports only its Lua files;CHUNKER_VERSIONstays 8 and no other code page re-chunks or re-embeds.
Re-vendor the pinned official asset, verifying its checksum before replacement:
bash scripts/vendor-lua-wasm.sh
bun test test/chunkers/code-lua.test.ts
bun run check:wasm
Dart (#3356)
grammars/tree-sitter-dart.wasm is the one grammar not taken from the
tree-sitter-wasms npm bundle: that package's Dart build is ABI 15, which the
pinned [email protected] runtime rejects. scripts/build-dart-wasm.sh
regenerates the same upstream grammar at ABI 14 (needs git, npm and podman or
docker):
bash scripts/build-dart-wasm.sh
bun run check:wasm