Skip to content

feat(harness): add Grok Build CLI as the 7th harness#197

Open
nbergman wants to merge 2 commits into
legioncodeinc:mainfrom
nbergman:feat/grok-harness
Open

feat(harness): add Grok Build CLI as the 7th harness#197
nbergman wants to merge 2 commits into
legioncodeinc:mainfrom
nbergman:feat/grok-harness

Conversation

@nbergman

@nbergman nbergman commented Jun 30, 2026

Copy link
Copy Markdown

What this does

Adds Grok Build CLI (grok agent) as a first-class Honeycomb harness, bringing the canonical set to seven (alongside claude-code, codex, cursor, hermes, pi, openclaw). Grok users now get the same automatic capture, recall, dashboard telemetry, and skill propagation as every other harness, instead of being limited to manual CLI/MCP usage.

Grok shares the Claude/Codex lifecycle hook shape, so the adapter reuses the shared runHookBinary driver and only supplies its own shim and connector — no new memory logic.

What's wired:

  • src/hooks/grok/shim.ts — normalizes Grok's native payloads (PascalCase + snake_case event names), intercepts run_terminal_command/Bash for VFS recall, renders a brief user-visible login line, and derives cwd from workspaceRoot.
  • harnesses/grok/ — thin-client bundle entry (esbuild target added).
  • src/connectors/grok.ts — install-time connector that writes ~/.grok/hooks/honeycomb.json, preserves foreign Grok hooks, and detects install via ~/.grok.
  • references/grok/hooks-schema.ts — executable zod oracle for the Grok hook-file contract.
  • Canonical-set registration — harness-registry (now seven), harness-detect markers, summaries host CLI (grok agent stdio), asset-sync skill/agent dirs, dashboard dot palette + capability descriptor, connector registry.
  • Docs aligned to seven — README badge + supported-harnesses table, AGENTS.md, and the knowledge docs.

Related issue

Closes #196

How it was tested

  • npm run ci (typecheck + jscpd duplication + vitest + audit:sql) green locally.
  • New suites: tests/hooks/grok/shim.test.ts, tests/connectors/grok.test.ts.
  • Updated the canonical-set suites to seven: harness-identity-stamp, harness-api, harness-detect, harness-installed-wiring, harnesses-page, capture-handler.
  • Live verification: honeycomb setup wired Grok; the dashboard Harnesses page showed grok installed with a growing turn count; POST /api/hooks/capture returned 201 from a real Grok turn.

Checklist

  • npm run ci passes locally (typecheck + duplication + tests + SQL-safety audit)
  • Code is formatted with npm run format (Biome)
  • New behavior has tests
  • New source files carry the license header (docs/license-header.txt)
  • I've signed the CLA (the bot will confirm)
  • The PR is scoped to one logical change

Made with Cursor

Summary by CodeRabbit

  • New Features

    • Added support for a seventh coding harness, Grok, across setup, detection, and dashboard views.
    • Grok now appears in the harness list, status dashboard, and documentation.
    • Published package contents now include the Grok harness bundle.
  • Bug Fixes

    • Harness detection and installation flows now recognize Grok’s expected on-disk locations.
    • Hook and connector handling now works with Grok sessions and events.

nbergman added 2 commits June 30, 2026 09:26
Wire Grok Build (grok agent) into Honeycomb as a hook-protocol harness
alongside claude-code, codex, cursor, hermes, pi, and openclaw. Grok shares
the Claude/Codex lifecycle hook shape, so the adapter reuses the shared
runHookBinary driver and only supplies its own shim.

- src/hooks/grok/shim.ts: maps PascalCase + snake_case native events,
  intercepts run_terminal_command/Bash for VFS recall, brief user-visible
  login line, workspaceRoot cwd derivation.
- harnesses/grok/: thin-client bundle entry (esbuild target added).
- src/connectors/grok.ts: writes ~/.grok/hooks/honeycomb.json, preserving
  foreign hooks; detects install via ~/.grok.
- references/grok/hooks-schema.ts: executable zod schema for the hook file.
- Register grok across the canonical set: harness-registry (now seven),
  harness-detect markers, summary host CLI (grok agent stdio), asset-sync
  skill/agent dirs, dashboard dot palette, connector registry.
- Tests: grok shim + connector suites; update harness-identity, harness-api,
  harness-detect, capture-handler to the canonical seven.
…omments

The Grok harness made the canonical set seven, but user-facing copy,
dashboard tests, and inline comments still said six. Update the README
badge and supported-harnesses table, AGENTS.md, the knowledge docs, and
the six->seven prose throughout the dashboard registry/detect/api modules.

Fix the harness-installed-wiring and harnesses-page suites to expect seven
(adding the Grok marker and fixture), and revert incidental package-lock
churn so the diff stays scoped to the harness change.
@nbergman

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

github-actions Bot added a commit that referenced this pull request Jun 30, 2026
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds Grok Build CLI as a canonical seventh harness. A new hook shim normalizes Grok lifecycle payloads, a new connector installs hooks into ~/.grok/hooks/honeycomb.json, and Grok is wired into the daemon registry, install detector, dashboard UI, build config, and published package. All harness counts and copy are updated from six to seven.

Changes

Grok Harness Integration

Layer / File(s) Summary
Grok hook shim and schema
src/hooks/grok/shim.ts, src/hooks/index.ts, src/hooks/binary.ts, references/grok/hooks-schema.ts
Defines GROK_EVENT_MAP, shim constants, terminal-tool detection, user-visible login rendering, cwd/workspaceRoot metadata derivation, and payload extraction wired into createShim. Adds Zod schemas and runtime validators for the Grok hooks config format.
GrokConnector and install wiring
src/connectors/grok.ts, src/connectors/index.ts, src/cli/connector-runner.ts, src/daemon-client/assets/install.ts
Implements GrokConnector extending HarnessConnector with configPath, hookHandlers, skillLinkTargets, eventNameMap, and configRoot. Registers grok in the connector runner and adds grok skill/agent directory mappings.
Harness adapter entry and build config
harnesses/grok/src/index.ts, esbuild.config.mjs, package.json
Adds the harness entry module exporting activate() and runGrokHook(), registers grok in the esbuild harness list, and adds harnesses/grok/bundle to the npm files allowlist.
Daemon registry, detection, and capabilities
src/daemon/runtime/dashboard/harness-registry.ts, src/daemon/runtime/dashboard/harness-detect.ts, src/daemon/runtime/dashboard/harness-api.ts, src/daemon/runtime/summaries/job.ts, src/daemon/runtime/assemble.ts, src/dashboard/web/panels.tsx, src/dashboard/web/pages/harnesses.tsx, src/commands/dispatch.ts
Expands CANONICAL_SHIMS, EVENT_MAPS, and HARNESS_SPECIFICS to include Grok. Adds grok HARNESS_MARKERS for install detection, a summaryCliSpecFor("grok") branch, and grok to the AGENT_DOT color map.
Tests
tests/hooks/grok/shim.test.ts, tests/connectors/grok.test.ts, tests/hooks/harness-identity-stamp.test.ts, tests/daemon/runtime/..., tests/dashboard/web/harnesses-page.test.tsx
Full test coverage for the Grok shim, connector install/detection, harness-identity stamping with THE_SEVEN, daemon harness-api/detect/wiring endpoints, and the dashboard harnesses page with a seven-harness fixture.
Docs and README
README.md, assets/readme.md, AGENTS.md, library/knowledge/private/...
Updates harness counts from six to seven and adds Grok to all harness listings across user-facing and internal documentation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • legioncodeinc/honeycomb#31: Both PRs touch src/hooks/binary.ts; this PR extends deriveMeta to also accept workspaceRoot as a cwd alias for Grok payloads.
  • legioncodeinc/honeycomb#72: Introduced the harness telemetry page and canonical-harness registry that this PR extends from six to seven harnesses.
  • legioncodeinc/honeycomb#90: Established the meta.agent / sessions.agent canonical stamping contract that this PR extends to include the grok harness token.

Poem

🐇 Seven now hop across the field so wide,
Grok joins the warren, running by our side.
SessionStart, PreToolUse, events align,
~/.grok/hooks/honeycomb.json — how fine!
The dashboard glows with seven colored dots,
Each harness captured, connecting all the dots. 🍯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.86% 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 is concise and accurately summarizes the main change: adding Grok Build CLI as the seventh harness.
Linked Issues check ✅ Passed The PR implements Grok harness support across the shim, connector, bundle, registry, detection, dashboard, docs, and tests as requested.
Out of Scope Changes check ✅ Passed No material out-of-scope changes are evident; the added docs, tests, and config updates all support the Grok harness feature.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

name: "grok",
// src/connectors/grok.ts: configPath = ~/.grok/hooks/honeycomb.json; pluginRoot = ~/.grok/plugins/honeycomb.
paths: (h) => [
join(h, ".grok", "hooks", "honeycomb.json"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Potential file inclusion attack via reading file - high severity
If an attacker can control the input leading into the ReadFile function, they might be able to read sensitive files and launch further attacks with that information.

Show fix

Remediation: Ignore this issue only after you've verified or sanitized the input going into this function. This issue is only relevant in the backend, not in the frontend!

Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

// src/connectors/grok.ts: configPath = ~/.grok/hooks/honeycomb.json; pluginRoot = ~/.grok/plugins/honeycomb.
paths: (h) => [
join(h, ".grok", "hooks", "honeycomb.json"),
join(h, ".grok", "plugins", "honeycomb"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Potential file inclusion attack via reading file - medium severity
If an attacker can control the input leading into the ReadFile function, they might be able to read sensitive files and launch further attacks with that information.

Show fix

Remediation: Ignore this issue only after you've verified or sanitized the input going into this function. This issue is only relevant in the backend, not in the frontend!

Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

@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

🧹 Nitpick comments (2)
src/hooks/binary.ts (1)

139-139: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep workspaceRoot aliasing in the Grok shim

src/hooks/binary.ts now accepts workspaceRoot for every hook-based harness, which makes grokDeriveMeta redundant for that field. Move this alias lookup back into src/hooks/grok/shim.ts unless another harness will emit workspaceRoot.

🤖 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 `@src/hooks/binary.ts` at line 139, Move the workspace root alias handling back
out of the shared hook parsing in binary.ts and into grok/shim.ts, since only
the Grok shim should translate workspaceRoot for now. Update the binary hook’s
cwd parsing to use the canonical field names only, and keep the alias lookup in
grokDeriveMeta or the Grok shim path so other harnesses do not silently accept
workspaceRoot.
references/grok/hooks-schema.ts (1)

22-43: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use z.looseObject here instead of .passthrough()

Zod 4 deprecates .passthrough() in favor of the top-level z.looseObject(...) constructor. This is a straightforward migration for these schemas.

♻️ Suggested migration to z.looseObject
-export const grokHookHandler = z
-	.object({
-		type: z.string().min(1),
-		command: z.string().min(1),
-		timeout: z.number().optional(),
-	})
-	.passthrough();
+export const grokHookHandler = z.looseObject({
+	type: z.string().min(1),
+	command: z.string().min(1),
+	timeout: z.number().optional(),
+});
-export const grokMatcherBlock = z
-	.object({
-		matcher: z.string().optional(),
-		hooks: z.array(grokHookHandler),
-	})
-	.passthrough();
+export const grokMatcherBlock = z.looseObject({
+	matcher: z.string().optional(),
+	hooks: z.array(grokHookHandler),
+});
 export const grokHooksMap = z.record(z.string(), z.array(grokMatcherBlock));
-export const grokHooksFile = z
-	.object({
-		hooks: grokHooksMap.optional(),
-	})
-	.passthrough();
+export const grokHooksFile = z.looseObject({
+	hooks: grokHooksMap.optional(),
+});
🤖 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 `@references/grok/hooks-schema.ts` around lines 22 - 43, Replace the deprecated
.passthrough() usage in grokHookHandler, grokMatcherBlock, and grokHooksFile
with z.looseObject(...) while keeping the same field definitions and
optionality. Use the existing schema symbols (grokHookHandler, grokMatcherBlock,
grokHooksFile) to migrate each object schema to the Zod 4 loose object
constructor, and leave grokHooksMap unchanged since it is a record schema.
🤖 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 `@library/knowledge/private/integrations/harness-integration.md`:
- Line 20: The harness support matrix is missing Grok, which makes the document
inconsistent with the updated prose. Update the support table in the same
document to add Grok alongside the other harnesses, and make sure the entries
stay aligned with the existing support/surface information shown by the matrix
and the surrounding section.

In `@library/knowledge/private/integrations/hook-lifecycle.md`:
- Line 5: The hook event coverage matrix is missing the Grok harness column,
which makes the seven-harness intro inconsistent with the table. Update the
matrix in hook-lifecycle.md so it includes Grok alongside the existing
harnesses, and make sure the hook rows still describe the same events/behaviors
across all seven harnesses. Verify the surrounding text stays aligned with the
updated table and that any references to the harness count match the expanded
matrix.

In `@README.md`:
- Around line 196-202: The README now lists seven coding harnesses in the table,
but the earlier ASCII harness diagram still shows only six, so the two sections
conflict. Update the existing diagram in README to include the missing harness
so it matches the seven-harness table, using the same harness names already
shown in the table and diagram.

---

Nitpick comments:
In `@references/grok/hooks-schema.ts`:
- Around line 22-43: Replace the deprecated .passthrough() usage in
grokHookHandler, grokMatcherBlock, and grokHooksFile with z.looseObject(...)
while keeping the same field definitions and optionality. Use the existing
schema symbols (grokHookHandler, grokMatcherBlock, grokHooksFile) to migrate
each object schema to the Zod 4 loose object constructor, and leave grokHooksMap
unchanged since it is a record schema.

In `@src/hooks/binary.ts`:
- Line 139: Move the workspace root alias handling back out of the shared hook
parsing in binary.ts and into grok/shim.ts, since only the Grok shim should
translate workspaceRoot for now. Update the binary hook’s cwd parsing to use the
canonical field names only, and keep the alias lookup in grokDeriveMeta or the
Grok shim path so other harnesses do not silently accept workspaceRoot.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b936060f-4f18-4ea1-a55a-83e4b43323b4

📥 Commits

Reviewing files that changed from the base of the PR and between 3b8611c and bfd9179.

📒 Files selected for processing (34)
  • AGENTS.md
  • README.md
  • assets/readme.md
  • esbuild.config.mjs
  • harnesses/grok/src/index.ts
  • library/knowledge/private/architecture/cli-dispatcher.md
  • library/knowledge/private/integrations/harness-integration.md
  • library/knowledge/private/integrations/hook-lifecycle.md
  • library/knowledge/private/overview.md
  • package.json
  • references/grok/hooks-schema.ts
  • src/cli/connector-runner.ts
  • src/commands/dispatch.ts
  • src/connectors/grok.ts
  • src/connectors/index.ts
  • src/daemon-client/assets/install.ts
  • src/daemon/runtime/assemble.ts
  • src/daemon/runtime/dashboard/harness-api.ts
  • src/daemon/runtime/dashboard/harness-detect.ts
  • src/daemon/runtime/dashboard/harness-registry.ts
  • src/daemon/runtime/summaries/job.ts
  • src/dashboard/web/pages/harnesses.tsx
  • src/dashboard/web/panels.tsx
  • src/hooks/binary.ts
  • src/hooks/grok/shim.ts
  • src/hooks/index.ts
  • tests/connectors/grok.test.ts
  • tests/daemon/runtime/capture/capture-handler.test.ts
  • tests/daemon/runtime/dashboard/harness-api.test.ts
  • tests/daemon/runtime/dashboard/harness-detect.test.ts
  • tests/daemon/runtime/dashboard/harness-installed-wiring.test.ts
  • tests/dashboard/web/harnesses-page.test.tsx
  • tests/hooks/grok/shim.test.ts
  • tests/hooks/harness-identity-stamp.test.ts

Honeycomb does not try to be another agent shell. It runs underneath the harnesses people already use and gives them one shared memory layer. The challenge is that every harness exposes a different extension surface, and they share almost nothing at the integration layer. The answer is to write the memory logic once in the daemon and wrap it per harness with a thin shim. Adding a harness means writing a shim and a connector subclass, not a memory engine.

Honeycomb wires six harnesses: **Claude Code, Codex, Cursor, Hermes, pi, and OpenClaw**. Each reaches the daemon through the same three surfaces, and the daemon, which is the only process that touches DeepLake, does the real work behind every one of them.
Honeycomb wires seven harnesses: **Claude Code, Codex, Cursor, Grok, Hermes, pi, and OpenClaw**. Each reaches the daemon through the same three surfaces, and the daemon, which is the only process that touches DeepLake, does the real work behind every one of them.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add Grok to the support matrix.

The prose now says seven harnesses, but the matrix below still only lists six and omits Grok. That leaves the doc internally inconsistent until the table is updated too.

Suggested fix
 | Claude Code | ... |
 | Codex | ... |
 | Cursor | ... |
+| Grok | ... |
 | Hermes | ... |
 | pi | ... |
 | OpenClaw | ... |
🤖 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 `@library/knowledge/private/integrations/harness-integration.md` at line 20,
The harness support matrix is missing Grok, which makes the document
inconsistent with the updated prose. Update the support table in the same
document to add Grok alongside the other harnesses, and make sure the entries
stay aligned with the existing support/surface information shown by the matrix
and the surrounding section.

> Category: Integrations | Version: 1.0 | Date: June 2026 | Status: Active

Which hook events fire on each of the six harnesses, what each hook does, and how the shared session-start seam now auto-pulls both team skills and portable assets, every hook a thin client that hands capture, recall, and pipeline work to the Honeycomb daemon.
Which hook events fire on each of the seven harnesses, what each hook does, and how the shared session-start seam now auto-pulls both team skills and portable assets, every hook a thin client that hands capture, recall, and pipeline work to the Honeycomb daemon.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add the Grok column to the hook matrix.

The intro now says seven harnesses, but the event-coverage table below still has only six harness columns and no Grok entry. The doc will read inconsistently until that matrix is extended.

🤖 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 `@library/knowledge/private/integrations/hook-lifecycle.md` at line 5, The hook
event coverage matrix is missing the Grok harness column, which makes the
seven-harness intro inconsistent with the table. Update the matrix in
hook-lifecycle.md so it includes Grok alongside the existing harnesses, and make
sure the hook rows still describe the same events/behaviors across all seven
harnesses. Verify the surrounding text stays aligned with the updated table and
that any references to the harness count match the expanded matrix.

Comment thread README.md
Comment on lines +196 to +202
Honeycomb ships thin clients for seven coding harnesses, all wired simultaneously, all reading and writing the same shared memory:

| | | |
|---|---|---|
| **Claude Code** | **Cursor** | **Codex** |
| **Hermes** | **pi** | **OpenClaw** |
| **Grok** | **Hermes** | **pi** |
| **OpenClaw** | | |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the earlier harness diagram too.

The new seven-harness table is still contradicted by the ASCII diagram above, which only shows six harnesses. Readers will see both counts in the same README until the diagram is updated as well.

Suggested fix
-     Claude Code    Cursor    Codex    Hermes    pi    OpenClaw
+     Claude Code    Cursor    Codex    Grok    Hermes    pi    OpenClaw
🤖 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` around lines 196 - 202, The README now lists seven coding
harnesses in the table, but the earlier ASCII harness diagram still shows only
six, so the two sections conflict. Update the existing diagram in README to
include the missing harness so it matches the seven-harness table, using the
same harness names already shown in the table and diagram.

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.

[Feature]: Add Grok Build CLI harness support

1 participant