Skip to content

Add runtime adapter kit and Claude runtime - #32

Merged
levineam merged 6 commits into
mainfrom
feat/runtime-adapter-kit-claude
May 13, 2026
Merged

Add runtime adapter kit and Claude runtime#32
levineam merged 6 commits into
mainfrom
feat/runtime-adapter-kit-claude

Conversation

@levineam

@levineam levineam commented May 13, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a small runtime adapter kit so jarvOS runtime integrations can be validated from one manifest contract instead of copied from the Codex adapter.

This also adds the first new adapter target for Claude:

  • Claude Code gets the shared jarvOS MCP server and a fail-open SessionStart hydration hook.
  • Claude Desktop gets the shared jarvOS MCP server in its local config, with startup hydration documented as manual/unsupported for this first pass.
  • Codex and Hermes now have adapter manifests checked by the kit.

Scope

  • Adds @jarvos/runtime-kit with validate, check, and scaffold commands.
  • Adds runtime manifests under runtimes/<runtime>/adapter.json.
  • Adds Claude setup, hook script, and public setup docs.
  • Keeps work-tracking, journal, ontology, and hydration retrieval logic in @jarvos/agent-context.

Verification

  • npm test from the repository root
  • npm test in modules/jarvos-agent-context
  • npm test in modules/jarvos-runtime-kit
  • node modules/jarvos-runtime-kit/scripts/jarvos-runtime-kit.js check all --json
  • bash scripts/smoke-test.sh
  • node tests/modules-smoke-test.js
  • JavaScript and shell syntax checks for the new runtime kit and Claude runtime scripts
  • Claude Code MCP registration check showed the jarvos server connected
  • Claude hook smoke emitted a bounded jarvOS Working Context Packet with a Hydration Report
  • Temporary Claude settings/Desktop config smoke verified JSON validity and MCP/hook insertion

Notes

No related public GitHub issue was found for this adapter-kit work. Claude Desktop startup hydration is intentionally documented as manual/unsupported until an official supported startup context surface is verified.

Summary by CodeRabbit

  • New Features

    • Added a runtime-kit package and CLI to validate, check, and scaffold runtime adapters.
    • Added Claude, Codex, and Hermes adapters with session-start hydration and a bundled startup-hydration tool.
  • Documentation

    • Expanded runtime-kit docs and detailed setup/verification guidance for the new adapters and hydration behavior.
  • Tests

    • Added unit tests and repository smoke tests covering validation, checks, scaffolding, and runtime artifacts; updated smoke checks.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds @jarvos/runtime-kit (package, CLI, core API, tests) for adapter validation/scaffolding and new runtime adapters for Claude, Codex, and Hermes with adapter.json manifests, Claude SessionStart hydration hook, setup scripts, docs, and updated smoke tests.

Changes

Runtime Adapter Validation Framework and Multi-Runtime Integration

Layer / File(s) Summary
Runtime-kit package & README
modules/jarvos-runtime-kit/package.json, modules/jarvos-runtime-kit/README.md
Package manifest and README describing @jarvos/runtime-kit CLI and adapter contract.
Runtime-kit core: validation & scaffold API
modules/jarvos-runtime-kit/src/index.js
Implements repoRoot discovery, manifest loading, validateManifest, listRuntimeManifests, checkRuntime, scaffoldRuntime, helpers, constants (DEFAULT_AGENT_CONTEXT_MCP, REQUIRED_MCP_TOOL) and exports.
Runtime-kit CLI
modules/jarvos-runtime-kit/scripts/jarvos-runtime-kit.js
CLI entrypoint dispatching validate, check, and scaffold with JSON/human output and exit codes.
Runtime-kit tests
modules/jarvos-runtime-kit/test/runtime-kit.test.js
Tests for manifest validation (positive/negative), checkRuntime success and failure fixtures, scaffold integration, and CLI invocation.
Claude adapter: hook, setup, manifest, docs
runtimes/claude/adapter.json, runtimes/claude/jarvos-session-start-hook.js, runtimes/claude/setup.sh, runtimes/claude/README.md, modules/jarvos-agent-context/README.md
Claude adapter manifest and SessionStart hook that calls hydrate() and emits Claude-compatible JSON with additionalContext or {} on failure; setup script registers MCP and upserts configs with backups; README documents hydration limits (default 9500, capped 10000) and fail-open logging; agent-context README documents jarvos_hydrate.
Codex adapter manifest
runtimes/codex/adapter.json
Codex adapter manifest with two targets using SessionStart hydration and verification commands.
Hermes adapter manifest & docs
runtimes/hermes/adapter.json, runtimes/hermes/README.md
Hermes adapter manifest showing MCP disabled for target, manual hydration, backup-before-write config paths, unsupported capability declaration, and status docs.
Smoke tests and CI validation updates
scripts/smoke-test.sh, tests/modules-smoke-test.js
Adds smoke-test checks for new runtime artifacts and module-level smoke test that loads @jarvos/runtime-kit and runs checkRuntime across discovered adapters.

Sequence Diagram(s)

sequenceDiagram
    participant Claude as Claude (Code/Desktop)
    participant Hook as runtimes/claude/jarvos-session-start-hook.js
    participant Hydrate as jarvos_hydrate (MCP)
    participant Log as ~/.claude/jarvos-hydration.log
    Claude->>Hook: invoke SessionStart
    Hook->>Hydrate: hydrate({ maxChars })
    alt Success with content
        Hydrate-->>Hook: markdown content
        Hook->>Claude: hookSpecificOutput (hookEventName: "SessionStart", additionalContext, suppressOutput:true)
    else Empty/blank
        Hydrate-->>Hook: empty
        Hook->>Claude: {}
    else Error
        Hydrate-->>Hook: error
        Hook->>Log: write failure entry (best-effort)
        Hook->>Claude: {}
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

  • levineam/jarvOS#31: Adds/exposes the jarvos_hydrate MCP tool that runtime-kit validation requires.
  • levineam/jarvOS#11: Prior changes to the modules smoke-test scaffolding that this PR extends.
  • levineam/jarvOS#8: Earlier updates to the repository smoke-test scripts referenced here.

Poem

🐰 I hop through manifests, hooks, and scripts,
I scaffold adapters in tidy little bits,
Claude greets sessions with bounded context song,
Codex and Hermes join the throng,
Runtime-kit hums — every adapter belongs.

🚥 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 'Add runtime adapter kit and Claude runtime' directly and clearly describes the two main additions in this PR: the runtime adapter kit and the Claude runtime adapter.
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 feat/runtime-adapter-kit-claude

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.

@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: 116b1b08fe

ℹ️ 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-runtime-kit/src/index.js Outdated
Comment thread runtimes/claude/setup.sh

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

🤖 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-runtime-kit/src/index.js`:
- Around line 56-68: The loop over manifest.targets can throw when an entry is
null or not an object; update the for (const target of manifest.targets || [])
block to first check that target is a non-null object (e.g. if (typeof target
!== 'object' || target === null) { add(errors, 'target must be an object');
continue; }) before dereferencing target.id, target.kind, target.mcp, or
target.hydration so subsequent checks (the calls to add(errors, ...) and the
hydration unsupported check) won't crash on malformed entries.
- Around line 125-129: The code currently does a direct require(mcpServer) which
can throw and abort checkRuntime; change it to catch require errors and convert
them into a conformance error entry instead of letting the exception propagate:
wrap the require(mcpServer) call in a try/catch inside the same block, on
success proceed to compute tools (as you already do), and on failure call
add(errors, `failed to load shared MCP server: ${mcpServer} - ${error.message}`)
(referencing mcpServer, REQUIRED_MCP_TOOL and the add(errors, ...) helper) so
load problems are reported as check results rather than thrown exceptions.
- Around line 146-148: The dynamic RegExp construction using new
RegExp(target.id, 'i') can throw when target.id contains regex metacharacters;
update the check in the block that handles target.hydration (the
readmePath/sourceContains logic) to escape target.id before building the RegExp
(e.g., add or reuse an escapeRegExp utility and call new
RegExp(escapeRegExp(target.id), 'i')), and keep using the same symbols:
target.id, sourceContains(readmePath, [...]), add(errors, ...); also defensively
handle null/undefined target.id if needed.
🪄 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: e1d0aff3-d3c3-4e9d-8626-3fbb7f765e48

📥 Commits

Reviewing files that changed from the base of the PR and between 89a99a6 and 116b1b0.

📒 Files selected for processing (14)
  • modules/jarvos-agent-context/README.md
  • modules/jarvos-runtime-kit/README.md
  • modules/jarvos-runtime-kit/package.json
  • modules/jarvos-runtime-kit/scripts/jarvos-runtime-kit.js
  • modules/jarvos-runtime-kit/src/index.js
  • modules/jarvos-runtime-kit/test/runtime-kit.test.js
  • runtimes/claude/README.md
  • runtimes/claude/adapter.json
  • runtimes/claude/jarvos-session-start-hook.js
  • runtimes/claude/setup.sh
  • runtimes/codex/adapter.json
  • runtimes/hermes/adapter.json
  • scripts/smoke-test.sh
  • tests/modules-smoke-test.js

Comment thread modules/jarvos-runtime-kit/src/index.js Outdated
Comment thread modules/jarvos-runtime-kit/src/index.js Outdated
Comment thread modules/jarvos-runtime-kit/src/index.js

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

ℹ️ 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-runtime-kit/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: 1

🤖 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-runtime-kit/src/index.js`:
- Around line 159-164: The validation currently uses sourceContains(readmePath,
[targetIdPattern, /manual|unsupported|not supported/i]) which (because
sourceContains uses some/OR) allows a README to pass if it contains either the
target ID or the words "manual"/"unsupported"—change the logic to require both:
first ensure the README exists (fs.existsSync(readmePath)), then separately
check sourceContains(readmePath, [targetIdPattern]) AND
sourceContains(readmePath, [/manual|unsupported|not supported/i]); if either
check fails, call add(errors, `README must document manual or unsupported
hydration for ${target.id}`) as before (references: target.hydration,
targetIdPattern, readmePath, sourceContains, add(errors,...)).
🪄 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: 1335118f-6a45-43c4-b4ff-bfe8e4ac21b9

📥 Commits

Reviewing files that changed from the base of the PR and between 116b1b0 and b0a356e.

📒 Files selected for processing (3)
  • modules/jarvos-runtime-kit/src/index.js
  • modules/jarvos-runtime-kit/test/runtime-kit.test.js
  • runtimes/claude/setup.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • runtimes/claude/setup.sh

Comment thread modules/jarvos-runtime-kit/src/index.js

@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: 8cf7c01077

ℹ️ 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 runtimes/hermes/adapter.json Outdated

@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: 4bbd03224f

ℹ️ 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-runtime-kit/src/index.js Outdated
@levineam
levineam merged commit 018d9d5 into main May 13, 2026
6 checks passed
@levineam
levineam deleted the feat/runtime-adapter-kit-claude branch May 13, 2026 17:38

@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: 347365b337

ℹ️ 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-runtime-kit/src/index.js
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