Skip to content

feat(SUP-1469): add jarvos gbrain bridge module#17

Merged
levineam merged 1 commit into
mainfrom
sup-1469-gbrain-module
May 8, 2026
Merged

feat(SUP-1469): add jarvos gbrain bridge module#17
levineam merged 1 commit into
mainfrom
sup-1469-gbrain-module

Conversation

@levineam

@levineam levineam commented May 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • add @jarvos/gbrain as a fourth jarVOS module for curated Obsidian-to-GBrain import planning, generated page writes, sync wrappers, doctor checks, and retrieval eval scaffolding
  • add public template manifest/eval files so private note lists stay local
  • update root, module, starter-kit, architecture, and public/private boundary docs for the QMD / memory-wiki / GBrain role split
  • extend repo smoke coverage for the new module

Verification

  • node --test modules/jarvos-gbrain/test/*.test.js
  • node tests/modules-smoke-test.js
  • bash scripts/smoke-test.sh
  • npm test
  • npm test in modules/jarvos-gbrain
  • CLI dry-runs: plan, import --dry-run, sync --dry-run, eval --dry-run, doctor

Notes

  • This PR does not import Andrew private notes into GBrain. It adds the reusable public module and docs; private manifests/evals remain local by design.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added @jarvos/gbrain module for structured knowledge management, enabling import from Obsidian-compatible vaults, synchronization, and retrieval evaluation
  • Documentation

    • Updated architecture documentation to reflect expanded 7-layer system with new "Structured knowledge" layer
    • Documented @jarvos/gbrain module operations, configuration, and boundaries within the 4-module core structure

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Rate limit exceeded

@levineam has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 42 minutes and 32 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2851b6d5-447a-445e-aab0-2f12151af8db

📥 Commits

Reviewing files that changed from the base of the PR and between 48a91be and f80474f.

📒 Files selected for processing (14)
  • PUBLIC_BASELINE.md
  • README.md
  • docs/architecture/jarvos-architecture.md
  • modules/README.md
  • modules/jarvos-gbrain/README.md
  • modules/jarvos-gbrain/config/curated-import.json
  • modules/jarvos-gbrain/config/eval-questions.json
  • modules/jarvos-gbrain/package.json
  • modules/jarvos-gbrain/scripts/jarvos-gbrain.js
  • modules/jarvos-gbrain/src/index.js
  • modules/jarvos-gbrain/test/gbrain.test.js
  • scripts/smoke-test.sh
  • starter-kit/README.md
  • tests/modules-smoke-test.js
📝 Walkthrough

Walkthrough

A new @jarvos/gbrain module is introduced to enable structured knowledge curation from Obsidian vaults into GBrain repositories. The PR adds documentation, configuration templates, CLI tooling, core import/sync/eval logic, and comprehensive tests while updating the architecture to reflect four jarvOS modules and seven architectural layers.

Changes

@jarvos/gbrain Module Implementation

Layer / File(s) Summary
Architecture & Documentation
PUBLIC_BASELINE.md, README.md, docs/architecture/jarvos-architecture.md, modules/README.md, modules/jarvos-gbrain/README.md
Repository-wide documentation updated to reflect jarvOS expanding from three to four modules and six to seven layers, with @jarvos/gbrain as the new "Structured knowledge" layer. Public/private boundaries clarified for GBrain assets, curated manifests, and local eval questions.
Configuration Schemas
modules/jarvos-gbrain/config/curated-import.json, modules/jarvos-gbrain/config/eval-questions.json
JSON templates for curated import manifests (version, items array) and retrieval evaluation questions (version, questions array) with guidance on keeping private content local.
Package & CLI Entry Points
modules/jarvos-gbrain/package.json, modules/jarvos-gbrain/scripts/jarvos-gbrain.js
Package manifest declares @jarvos/gbrain entrypoint and CLI binary. CLI script parses command-line arguments and dispatches to plan, import (with --dry-run), sync, eval, and doctor subcommands with JSON output.
Core Implementation
modules/jarvos-gbrain/src/index.js
Module exports path resolution, config derivation from environment variables, JSON file loading, import planning (manifest validation/normalization), brain page rendering with YAML frontmatter and provenance metadata, sync orchestration via subprocess spawning, retrieval evaluation, and diagnostic checks.
Tests & Integration
modules/jarvos-gbrain/test/gbrain.test.js, scripts/smoke-test.sh, tests/modules-smoke-test.js, starter-kit/README.md
Unit tests validate slugification, import planning, dry-run and real import execution with provenance metadata, and sync command wiring. Smoke tests assert module presence and API shape. Starter-kit documentation updated with four-module count and GBrain import workflow step.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • levineam/jarvOS#8: Added the initial multi-module framework; this PR extends it by introducing @jarvos/gbrain as a new core module.
  • levineam/jarvOS#11: Established module smoke-test infrastructure; this PR extends the same test wiring to include @jarvos/gbrain validation.
  • levineam/jarvOS#15: Rewrote README module/layers structure; this PR builds on that by adding the new @jarvos/gbrain module and updating layer/ownership counts.

Suggested labels

jarvis-managed

Poem

🐰 A brain for knowledge, curated and bright,
From Obsidian vaults to GBrain's graph sight,
Four modules now strong, seven layers deep,
Structured wisdom jarvOS shall keep! 🧠✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding a new jarvOS GBrain bridge module. It is concise, specific, and directly reflects the primary objective of introducing the @jarvos/gbrain module.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sup-1469-gbrain-module

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@levineam

levineam commented May 8, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@levineam

levineam commented May 8, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@levineam
levineam marked this pull request as ready for review May 8, 2026 19:11
@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48a91be382

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread modules/jarvos-gbrain/src/index.js Outdated
Comment thread modules/jarvos-gbrain/src/index.js Outdated
@levineam
levineam force-pushed the sup-1469-gbrain-module branch 2 times, most recently from 90099ef to 7324257 Compare May 8, 2026 19:16
@levineam

levineam commented May 8, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@levineam

levineam commented May 8, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 73242572c6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread modules/jarvos-gbrain/src/index.js Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
docs/architecture/jarvos-architecture.md (1)

1-9: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Stale updated frontmatter date.

The YAML frontmatter still reads updated: 2026-02-19, but this file is modified in the current PR (2026-05-08).

✏️ Proposed fix
-updated: 2026-02-19
+updated: 2026-05-08
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/architecture/jarvos-architecture.md` around lines 1 - 9, Update the YAML
frontmatter's updated field in jarvos-architecture.md: replace the stale
`updated: 2026-02-19` value with the current PR date (e.g., `2026-05-08`) or
ensure it is programmatically set to the commit/merge date; specifically edit
the `updated` frontmatter key so it reflects the current modification date in
the file header.
README.md (1)

217-217: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Philosophy section still lists six layers after the "Structured knowledge" addition.

Line 217 reads: "Content, recall, worldview, behavior, execution, and runtime each have a single owner" — missing the newly added "Structured knowledge" layer. This contradicts line 34 ("seven layers") and the layer table.

✏️ Proposed fix
-- **Layers, not features.** Content, recall, worldview, behavior, execution, and runtime each have a single owner. Don't mix them.
+- **Layers, not features.** Content, recall, worldview, structured knowledge, behavior, execution, and runtime each have a single owner. Don't mix them.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` at line 217, The Philosophy section's sentence "Content, recall,
worldview, behavior, execution, and runtime each have a single owner" is missing
the new "Structured knowledge" layer; update that sentence to list all seven
layers including "Structured knowledge" (e.g., "Content, structured knowledge,
recall, worldview, behavior, execution, and runtime each have a single owner")
so the text matches the "seven layers" claim and the layer table; ensure
punctuation and plural agreement remain correct after insertion.
🧹 Nitpick comments (1)
modules/jarvos-gbrain/scripts/jarvos-gbrain.js (1)

41-80: ⚡ Quick win

main() has no error boundary — manifest/eval parse failures produce raw stack traces instead of clean error messages

readJsonFile already formats descriptive error messages (Could not read JSON file …), but without a top-level try-catch they surface as unhandled exceptions with Node.js stack traces rather than a clean stderr line + exitCode = 1.

♻️ Proposed fix
 function main() {
-  const command = process.argv[2] || 'help';
-  const config = cliConfig();
-  // ... all dispatch logic ...
-  usage();
-  process.exitCode = 1;
+  try {
+    const command = process.argv[2] || 'help';
+    const config = cliConfig();
+    // ... all dispatch logic ...
+    usage();
+    process.exitCode = 1;
+  } catch (err) {
+    process.stderr.write(`Error: ${err.message}\n`);
+    process.exitCode = 1;
+  }
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modules/jarvos-gbrain/scripts/jarvos-gbrain.js` around lines 41 - 80, main()
lacks a top-level error boundary so parsing/manifest errors (from helpers like
readJsonFile, createImportPlan, importToBrain, syncBrain, runRetrievalEval,
doctor) produce raw stack traces instead of a clean stderr message and exit
code; wrap the entire body of main() in a try/catch (or add a try/catch around
the existing command dispatch) that catches any Error, prints a concise message
to stderr (e.g., console.error(error.message || String(error))), sets
process.exitCode = 1, and returns so all failures surface as a single clean
error line rather than an unhandled exception.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@modules/jarvos-gbrain/src/index.js`:
- Around line 137-140: The yamlScalar function currently only escapes double
quotes, which breaks YAML when values contain backslashes or newlines; update
yamlScalar (and its local variable text) to escape backslashes first and then
replace special characters used in YAML double-quoted scalars (at minimum
backslash, double-quote, newline, carriage return, and tab) so newlines become
\n and backslashes become \\ (and similarly for \r and \t) before wrapping with
quotes; ensure you perform the replacements in the correct order (escape
backslashes before other escapes) to produce valid YAML frontmatter.
- Line 76: The gbrainBin value returned from resolveConfig isn't being
tilde-expanded, causing spawnSync in runCommand to get a literal "~" path;
update resolveConfig so the assignment to gbrainBin uses expandTilde (same as
other resolved paths), or ensure runCommand calls expandTilde on gbrainBin
before passing it to spawnSync; reference the gbrainBin constant in
resolveConfig and the runCommand/spawnSync invocation, and keep commandExists
behavior consistent by not relying on it to perform the expansion.
- Around line 261-273: The code currently pushes an entry into the imported
array before attempting the filesystem operations, so a failed
mkdirSync/writeFileSync leaves a false success and aborts importToBrain; change
the flow in the loop that handles planned/body so that you perform
fs.mkdirSync(path.dirname(planned.targetPath), { recursive: true }) and
fs.writeFileSync(planned.targetPath, body, 'utf8') first (wrapped in try/catch
or let errors be handled per-item), and only after those calls succeed compute
bytes (Buffer.byteLength(body,'utf8')) and push the object to imported
(including dryRun flag); ensure failures do not leave a pushed entry and are
handled/logged so the loop can continue processing remaining planned items.

In `@modules/README.md`:
- Around line 176-183: Summary: README docs show unqualified defaults for
JARVOS_GBRAIN_IMPORT_MANIFEST and JARVOS_GBRAIN_EVAL_QUESTIONS which contradict
the actual defaults resolved by the module code. Fix: update the README entries
for the env vars JARVOS_GBRAIN_IMPORT_MANIFEST and JARVOS_GBRAIN_EVAL_QUESTIONS
so they match the qualified default paths that the module's index uses (the code
that resolves defaults uses MODULE_ROOT with path.join), and ensure both READMEs
contain the same qualified defaults to avoid users setting broken relative
paths.

---

Outside diff comments:
In `@docs/architecture/jarvos-architecture.md`:
- Around line 1-9: Update the YAML frontmatter's updated field in
jarvos-architecture.md: replace the stale `updated: 2026-02-19` value with the
current PR date (e.g., `2026-05-08`) or ensure it is programmatically set to the
commit/merge date; specifically edit the `updated` frontmatter key so it
reflects the current modification date in the file header.

In `@README.md`:
- Line 217: The Philosophy section's sentence "Content, recall, worldview,
behavior, execution, and runtime each have a single owner" is missing the new
"Structured knowledge" layer; update that sentence to list all seven layers
including "Structured knowledge" (e.g., "Content, structured knowledge, recall,
worldview, behavior, execution, and runtime each have a single owner") so the
text matches the "seven layers" claim and the layer table; ensure punctuation
and plural agreement remain correct after insertion.

---

Nitpick comments:
In `@modules/jarvos-gbrain/scripts/jarvos-gbrain.js`:
- Around line 41-80: main() lacks a top-level error boundary so parsing/manifest
errors (from helpers like readJsonFile, createImportPlan, importToBrain,
syncBrain, runRetrievalEval, doctor) produce raw stack traces instead of a clean
stderr message and exit code; wrap the entire body of main() in a try/catch (or
add a try/catch around the existing command dispatch) that catches any Error,
prints a concise message to stderr (e.g., console.error(error.message ||
String(error))), sets process.exitCode = 1, and returns so all failures surface
as a single clean error line rather than an unhandled exception.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6bc055b4-51a3-46d8-9097-020d731dbd74

📥 Commits

Reviewing files that changed from the base of the PR and between 674f1f0 and 48a91be.

📒 Files selected for processing (14)
  • PUBLIC_BASELINE.md
  • README.md
  • docs/architecture/jarvos-architecture.md
  • modules/README.md
  • modules/jarvos-gbrain/README.md
  • modules/jarvos-gbrain/config/curated-import.json
  • modules/jarvos-gbrain/config/eval-questions.json
  • modules/jarvos-gbrain/package.json
  • modules/jarvos-gbrain/scripts/jarvos-gbrain.js
  • modules/jarvos-gbrain/src/index.js
  • modules/jarvos-gbrain/test/gbrain.test.js
  • scripts/smoke-test.sh
  • starter-kit/README.md
  • tests/modules-smoke-test.js

Comment thread modules/jarvos-gbrain/src/index.js Outdated
Comment thread modules/jarvos-gbrain/src/index.js
Comment thread modules/jarvos-gbrain/src/index.js Outdated
Comment thread modules/README.md
@levineam
levineam force-pushed the sup-1469-gbrain-module branch from 7324257 to 82eb68b Compare May 8, 2026 19:20
@levineam

levineam commented May 8, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@levineam

levineam commented May 8, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@levineam
levineam force-pushed the sup-1469-gbrain-module branch from 82eb68b to 9c5ecb2 Compare May 8, 2026 19:23
@levineam

levineam commented May 8, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@levineam

levineam commented May 8, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c5ecb2216

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread modules/jarvos-gbrain/src/index.js Outdated
@levineam
levineam force-pushed the sup-1469-gbrain-module branch from 9c5ecb2 to f80474f Compare May 8, 2026 19:28
@levineam

levineam commented May 8, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@levineam

levineam commented May 8, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@levineam
levineam merged commit a391585 into main May 8, 2026
7 checks passed
@levineam
levineam deleted the sup-1469-gbrain-module branch May 8, 2026 19:30

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f80474f5d5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

if (command === 'eval') {
printJson(runRetrievalEval(config, { dryRun: hasFlag('--dry-run') }));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Propagate failed evals to the CLI exit status

When gbrain search itself exits successfully but the expected evidence is missing, runRetrievalEval() returns ok: false without throwing; this branch still just prints the JSON and returns, so node scripts/jarvos-gbrain.js eval exits 0 and any CI/npm workflow using the retrieval eval will pass despite failed questions. I reproduced this with a fake gbrain that outputs unrelated text and the CLI returned status 0 while reporting "ok": false.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant