Skip to content

feat(SUP-1500): add GBrain graph recall helper#22

Closed
levineam wants to merge 4 commits into
sup-1499-gbrain-qmd-evalfrom
sup-1500-gbrain-graph-recall
Closed

feat(SUP-1500): add GBrain graph recall helper#22
levineam wants to merge 4 commits into
sup-1499-gbrain-qmd-evalfrom
sup-1500-gbrain-graph-recall

Conversation

@levineam

Copy link
Copy Markdown
Owner

Summary

  • Add graphRecall to @jarvos/gbrain as a compact wrapper around gbrain graph for sidecar recall from known seed pages.
  • Expose a CLI command: jarvos-gbrain graph --seed <slug> --depth <n>.
  • Document the graph-recall role in the GBrain README and cover command shape plus bad-output handling in tests.

Why

SUP-1500 found that direct GBrain search still misses some cross-source questions, while graph traversal from known seed pages finds the relevant neighboring concepts and sources. This helper makes that sidecar path callable from jarvOS/OpenClaw wiring without returning duplicated raw graph output into context.

Validation

  • node --check modules/jarvos-gbrain/src/index.js && node --check modules/jarvos-gbrain/scripts/jarvos-gbrain.js
  • npm test --prefix modules/jarvos-gbrain
  • node modules/jarvos-gbrain/scripts/jarvos-gbrain.js graph --seed projects/jarvos-context-engineering-upgrade --seed sources/paperclip-openclaw-setup-guide-draft --depth 2 --timeout-ms 5000
  • node tests/modules-smoke-test.js
  • bash scripts/smoke-test.sh
  • npm test
  • git diff --check

Stack

Base branch: sup-1499-gbrain-qmd-eval / PR #21.

@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3fb7ea34-6d50-4b9f-8631-242b1dfcf66d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sup-1500-gbrain-graph-recall

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 marked this pull request as ready for review May 10, 2026 11:12

@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: 61c5f78fdb

ℹ️ 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
const seedValues = options.seeds || overrides.seeds || options.seed || overrides.seed;
const seeds = asStringList(seedValues);
const results = seeds.map((seed) => {
const command = runCommand(config.gbrainBin, ['graph', seed, '--depth', String(depth)], {

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 Invoke the current graph-query command

The current upstream GBrain command reference and verification runbook list graph traversal as gbrain graph-query <slug> --depth 2, not gbrain graph; this wrapper builds gbrain graph ..., so jarvos-gbrain graph --seed ... will fail on current GBrain installs before returning any recall results. Please switch the spawned command to graph-query (or version-gate/alias it) and update the tests/docs accordingly.

Useful? React with 👍 / 👎.

@levineam
levineam force-pushed the sup-1499-gbrain-qmd-eval branch from c2791d7 to 5d841ef Compare May 10, 2026 12:13
@levineam
levineam force-pushed the sup-1500-gbrain-graph-recall branch from 61c5f78 to 62a4a7a Compare May 10, 2026 12:14

@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: 62a4a7a39c

ℹ️ 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
dryRun,
timeoutMs: config.retrievalTimeoutMs,
});
const parsed = dryRun ? { ok: true, value: [], error: null } : parseJsonOutput(command.stdout || '[]');

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 Parse graph-query's real text output

When this runs against the current GBrain CLI, graph-query does not emit a JSON array: I checked upstream src/commands/graph-query.ts, where runGraphQuery prints an indented tree like [depth 0] <slug> / --type-> ... (or No edges found...). Because this line unconditionally JSON-parses stdout, every non-dry-run graph recall with a real GBrain install will report ok: false and return no nodes even when traversal succeeds; either request a JSON-capable surface/MCP op or parse the actual CLI format.

Useful? React with 👍 / 👎.

@levineam
levineam force-pushed the sup-1499-gbrain-qmd-eval branch from 5d841ef to 95faeeb Compare May 10, 2026 12:28
@levineam
levineam force-pushed the sup-1500-gbrain-graph-recall branch from 6744ee9 to a9b677f Compare May 10, 2026 12:28

@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: a9b677f17b

ℹ️ 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 on lines +638 to +639
if (nodes.length > 0) return { ok: true, value: nodes, error: null };
return { ok: false, value: null, error: json.error || 'Expected gbrain graph-query output' };

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 Handle no-edge graph-query output

When gbrain graph-query succeeds for a valid seed that has no traversable edges, the current CLI output is a No edges found... message rather than a JSON array or [depth ...] tree. This parser drops that line and returns ok: false, so graphRecall reports a parse failure even though the command completed successfully and the correct recall result is simply empty; callers can misclassify sparse but valid seed pages as errors.

Useful? React with 👍 / 👎.

@levineam
levineam deleted the branch sup-1499-gbrain-qmd-eval May 10, 2026 14:08
@levineam levineam closed this May 10, 2026
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