@cardor/agent-harness-kit 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -88,7 +88,7 @@ ahk init
88
88
  └── creates config, agent definitions, task backlog, health check
89
89
 
90
90
  AI tool opens your project
91
- └── reads .claude/mcp.json, opencode.json, or .codex/config.toml
91
+ └── reads .claude/mcp.json, opencode.json, .codex/config.toml, or .grok/config.toml
92
92
  └── spawns: ahk serve (stdio MCP server)
93
93
  via your package manager (npx/pnpm exec/yarn run/bunx) when the
94
94
  package is a local dependency, or the bare binary when it isn't
@@ -111,7 +111,9 @@ Everything is stored locally in a SQLite database (`.harness/harness.db`). No cl
111
111
 
112
112
  ## Features
113
113
 
114
- - **Provider-agnostic** — works with Claude Code, OpenCode, Codex CLI, or any MCP-compatible AI tool. Switch providers without losing your task history or reconfiguring your workflow.
114
+ - **Provider-agnostic** — works with Claude Code, OpenCode, Codex CLI, Grok Build, or any MCP-compatible AI tool. Switch providers without losing your task history or reconfiguring your workflow.
115
+
116
+ > **Note:** "Grok Build" here refers to xAI's official Grok Build CLI (`provider: 'grok-cli'`) — it is unrelated to the unofficial, community-maintained `grok-cli`/`grok-dev` npm packages.
115
117
  - **Structured 5-agent workflow** — Lead, Explorer, Consultant, Builder, and Reviewer each have defined responsibilities and can only act within their role.
116
118
  - **Atomic task claiming** — agents use `tasks.claim()` which uses a SQLite transaction to prevent two agents from picking up the same task at the same time.
117
119
  - **Full audit trail** — every action, file touched, tool used, and section written is stored in SQLite and queryable.
@@ -164,7 +166,7 @@ npx ahk init
164
166
 
165
167
  ## MCP command per package manager
166
168
 
167
- `ahk init` and `ahk build` detect which package manager your project uses and generate the MCP server launch command (`.mcp.json`, `opencode.json`, or `.codex/config.toml`) accordingly, instead of hardcoding `npx`:
169
+ `ahk init` and `ahk build` detect which package manager your project uses and generate the MCP server launch command (`.mcp.json`, `opencode.json`, `.codex/config.toml`, or `.grok/config.toml`) accordingly, instead of hardcoding `npx`:
168
170
 
169
171
  | Package manager | Detected via | Generated command |
170
172
  | -------------------------- | --------------------------------------------------------------------------- | ---------------------------------------------- |
@@ -181,7 +183,7 @@ Detection order: the `packageManager` field in your `package.json` (e.g. `"packa
181
183
 
182
184
  Working inside the `agent-harness-kit` repository itself counts as a local install: the package manager can resolve the workspace binary, so the `pnpm exec` form is generated rather than the bare one.
183
185
 
184
- **Existing projects:** if you initialized your project before this change, your `.mcp.json`/`opencode.json`/`.codex/config.toml` may still have a hardcoded `npx` command. No migration step is needed — `ahk build` always regenerates (merges) these files from scratch on every run, so the command self-corrects the next time you run `ahk build` (or `ahk build --sync`), including if you've since switched package managers.
186
+ **Existing projects:** if you initialized your project before this change, your `.mcp.json`/`opencode.json`/`.codex/config.toml`/`.grok/config.toml` may still have a hardcoded `npx` command. No migration step is needed — `ahk build` always regenerates (merges) these files from scratch on every run, so the command self-corrects the next time you run `ahk build` (or `ahk build --sync`), including if you've since switched package managers.
185
187
 
186
188
  ---
187
189
 
@@ -193,7 +195,7 @@ Interactive scaffold. Asks for your project name, description, AI provider, docs
193
195
 
194
196
  Claude Code only, init asks you to pick a model for each of the 5 core roles (lead, explorer, consultant, builder, reviewer) one at a time: `inherit` (default), `haiku`, `sonnet`, `opus`, or `fable`. Each choice is written straight into that role's generated `.claude/agents/<role>.md` frontmatter as a `model:` line at scaffold time — it is never persisted to the config file. Picking `inherit` (the default) emits no `model:` line at all, leaving Claude Code to apply its own default. This prompt only runs during `ahk init`'s one-time scaffold, not on `ahk build` — agent files are user-owned once generated (see [Agent files are yours](#agent-files-are-yours) below), so after init the model is changed the same way as any other edit: hand-editing the `model:` frontmatter line directly.
195
197
 
196
- OpenCode and Codex CLI are unaffected by this prompt — it never appears for those providers. OpenCode has no closed model enum to prompt against, and Codex's model is still set by hand-editing `model = "..."` in its TOML.
198
+ OpenCode, Codex CLI, and Grok Build are unaffected by this prompt — it never appears for those providers. OpenCode and Grok Build have no closed model enum to prompt against, and Codex's model is still set by hand-editing `model = "..."` in its TOML.
197
199
 
198
200
  **Storage scope** — where the harness DB (and its `current.md` fallback) physically lives:
199
201
 
@@ -210,6 +212,7 @@ ahk init
210
212
  # Skip prompts with flags
211
213
  ahk init --name "my-app" --provider claude-code --docs ./docs --tasks local --storage-scope local
212
214
  ahk init --name "my-app" --provider codex-cli --docs ./docs --tasks local --storage-scope global
215
+ ahk init --name "my-app" --provider grok-cli --docs ./docs --tasks local --storage-scope local
213
216
  ```
214
217
 
215
218
  Run this once per project. If the project is already initialized, the command prints an 'already initialized' message with suggested next-step commands (`ahk build`, `ahk build --sync`, `ahk reset`, `ahk serve`) and exits without overwriting anything.
@@ -231,7 +234,7 @@ ahk build --sync # kept for backwards compatibility — now a no-op on every
231
234
 
232
235
  ### Agent files are yours
233
236
 
234
- `ahk build` **creates agent files that are missing and never modifies ones that already exist.** Edit `.claude/agents/<role>.md` (or `.opencode/agents/<role>.md`, or `.codex/agents/<role>.toml`) freely — change the role prompt, set a `model:` line, adjust the restriction fields. Rebuilding will not revert your work. `ahk doctor` does not report hand-edited files either; it checks existence only.
237
+ `ahk build` **creates agent files that are missing and never modifies ones that already exist.** Edit `.claude/agents/<role>.md` (or `.opencode/agents/<role>.md`, `.codex/agents/<role>.toml`, or `.grok/agents/<role>.md`) freely — change the role prompt, set a `model:` line, adjust the restriction fields. Rebuilding will not revert your work. `ahk doctor` does not report hand-edited files either; it checks existence only.
235
238
 
236
239
  Everything else `build` writes — MCP config and skills — is derived from your config and **is** regenerated on every run.
237
240
 
@@ -416,13 +419,14 @@ ahk reset --force # skip all confirmation prompts
416
419
  ahk reset --provider claude-code # also delete agent files for this provider
417
420
  ahk reset --provider opencode
418
421
  ahk reset --provider codex-cli
422
+ ahk reset --provider grok-cli
419
423
  ```
420
424
 
421
425
  What it can reset:
422
426
 
423
427
  - The SQLite `.db` file (plus WAL and SHM files if present)
424
428
  - `.harness/feature_list.json`
425
- - Agent definition files in `.claude/agents/`, `.opencode/agents/`, or `.codex/agents/`
429
+ - Agent definition files in `.claude/agents/`, `.opencode/agents/`, `.codex/agents/`, or `.grok/agents/`
426
430
 
427
431
  After a reset, run `ahk init` to scaffold a fresh harness.
428
432
 
@@ -440,6 +444,7 @@ Migrates provider-specific files from one AI provider to another. Useful when sw
440
444
  ahk migrate provider --to opencode
441
445
  ahk migrate provider --to claude-code
442
446
  ahk migrate provider --to codex-cli
447
+ ahk migrate provider --to grok-cli
443
448
 
444
449
  # Backward-compatible alias (identical behavior):
445
450
  ahk migrate --to opencode
@@ -547,6 +552,23 @@ your-project/
547
552
  └── default.toml ← overrides Codex's built-in default agent → routes to lead
548
553
  ```
549
554
 
555
+ **Grok Build** (`provider: 'grok-cli'`):
556
+
557
+ ```
558
+ your-project/
559
+ ├── agent-harness-kit.config.{json|ts|mjs|cjs}
560
+ ├── AGENTS.md
561
+ ├── health.sh
562
+ ├── .harness/
563
+ └── .grok/
564
+ ├── config.toml ← MCP server registration
565
+ └── agents/
566
+ ├── lead.md
567
+ ├── explorer.md
568
+ ├── builder.md
569
+ └── reviewer.md
570
+ ```
571
+
550
572
  ### What each file does
551
573
 
552
574
  | File | Purpose | Edit it? |
@@ -565,6 +587,8 @@ your-project/
565
587
  | `opencode.json` | MCP server + `default_agent` + compaction config for OpenCode. Merged by `ahk build` | Yes, carefully |
566
588
  | `.codex/agents/*.toml` | Agent role definitions (Codex CLI). Created once, never overwritten (`ahk build --force` regenerates) | **Yes — customize agent behavior** |
567
589
  | `.codex/config.toml` | MCP server registration for Codex CLI. Merged by `ahk build` | Yes, carefully |
590
+ | `.grok/agents/*.md` | Agent role definitions (Grok Build). Created once, never overwritten (`ahk build --force` regenerates) | **Yes — customize agent behavior** |
591
+ | `.grok/config.toml` | MCP server registration for Grok Build. Merged by `ahk build` | Yes, carefully |
568
592
 
569
593
  ---
570
594
 
@@ -590,7 +614,7 @@ const config: HarnessConfig = {
590
614
  docsPath: './docs', // where agents search for documentation
591
615
  },
592
616
 
593
- provider: 'claude-code', // 'claude-code' | 'opencode' | 'codex-cli'
617
+ provider: 'claude-code', // 'claude-code' | 'opencode' | 'codex-cli' | 'grok-cli'
594
618
 
595
619
  // There is no `agents` key. Per-agent settings live in the generated agent
596
620
  // file itself, which is yours to edit — see "Agent files are yours" below.
@@ -788,7 +812,35 @@ You are the builder agent for MyApp. Follow these rules:
788
812
 
789
813
  Codex CLI has no per-agent tool denylist, so `sandbox_mode` is the only real mechanism: `"read-only"` for lead, explorer, consultant, and reviewer; `"workspace-write"` for builder. Because Codex keeps the write tools *visible* to the model even under a read-only sandbox, the restriction is additionally restated in prose inside `developer_instructions` — without it the model burns turns on calls the sandbox will reject.
790
814
 
791
- The equivalent constraint under Claude Code is expressed as `disallowedTools: [Write, Edit]`, and under OpenCode as `permission: { edit: deny }`.
815
+ **Grok Build** (`.grok/agents/*.md`) uses markdown + YAML frontmatter, like Claude Code and OpenCode — but its `tools:` field is an **allowlist**, the inverse shape of Claude's `disallowedTools`. A restricted role must enumerate every tool it IS allowed to use, since there is no way to say "everything except Write/Edit":
816
+
817
+ ```markdown
818
+ ---
819
+ name: explorer
820
+ description: Explorer agent — reads and maps the codebase, never writes
821
+ tools:
822
+ - Bash
823
+ - Read
824
+ - NotebookRead
825
+ - Grep
826
+ - Glob
827
+ - WebFetch
828
+ - WebSearch
829
+ - search_tool
830
+ - use_tool
831
+ ---
832
+
833
+ # Explorer Agent
834
+
835
+ You are the explorer agent for MyApp. Follow these rules:
836
+
837
+ - Map the modules relevant to the task and report where each concern lives
838
+ - Never modify files — record every file you read
839
+ ```
840
+
841
+ For the builder, `tools:` is omitted entirely, same as every other provider — the agent inherits every tool.
842
+
843
+ The equivalent constraint under Claude Code is expressed as `disallowedTools: [Write, Edit]`, under OpenCode as `permission: { edit: deny }`, and under Grok Build as the `tools:` allowlist shown above.
792
844
 
793
845
  ### `.harness/feature_list.json`
794
846
 
@@ -851,7 +903,7 @@ The harness exposes these tools via MCP. Agents use them instead of reading file
851
903
  | **builder** | Implements the plan. The only role that writes — its write tools are enabled where every other role's are disabled. Records every file modified. |
852
904
  | **reviewer** | Verifies all acceptance criteria are met. Approves or blocks. Runs health check before approving. |
853
905
 
854
- > **Scope note.** What a role may not do is enforced **per tool, not per path**. There is no per-agent path scoping and it is not configurable: the `allowedPaths` / `writablePaths` fields were removed because they were only interpolated into prompt text and no provider ever enforced them — they looked like a security control without being one. The real restriction lives in `src/core/materializer/agent-restrictions.ts`, which each provider translates natively: `disallowedTools` in Claude Code, `permission.edit` in OpenCode, `sandbox_mode` in Codex CLI. If a config still declares the removed fields they are stripped at load time with a warning.
906
+ > **Scope note.** What a role may not do is enforced **per tool, not per path**. There is no per-agent path scoping and it is not configurable: the `allowedPaths` / `writablePaths` fields were removed because they were only interpolated into prompt text and no provider ever enforced them — they looked like a security control without being one. The real restriction lives in `src/core/materializer/agent-restrictions.ts`, which each provider translates natively: `disallowedTools` in Claude Code, `permission.edit` in OpenCode, `sandbox_mode` in Codex CLI, and a `tools:` allowlist in Grok Build. If a config still declares the removed fields they are stripped at load time with a warning.
855
907
  >
856
908
  > **The entire `agents` config key has since been removed too**, for the same underlying reason: everything left in it was either dead or better expressed elsewhere. `instructionsPath`, `context` and `custom` were written by the generator and never read by anything; `model` was the only field with an effect, and it now belongs in the agent file's frontmatter alongside the role prompt, since that file is user-owned. A config that still declares `agents` loads normally — the key is ignored, with one aggregated warning pointing at the agent file.
857
909
  >
@@ -903,6 +955,8 @@ The harness exposes these tools via MCP. Agents use them instead of reading file
903
955
  | `opencode.json` | Yes |
904
956
  | `.codex/agents/*.toml` | Yes |
905
957
  | `.codex/config.toml` | Yes |
958
+ | `.grok/agents/*.md` | Yes |
959
+ | `.grok/config.toml` | Yes |
906
960
  | `.harness/harness.db` | **No** (gitignored, local scope only) |
907
961
  | `.harness/current.md` | **No** (gitignored, local scope only) |
908
962
  | `.harness/storage-state.json` | Yes (metadata, not gitignored — always present regardless of scope) |
@@ -1010,6 +1064,7 @@ See [SECURITY.md](./SECURITY.md) for the vulnerability reporting process, suppor
1010
1064
  - ✅ **Global installation** — `ahk init` can install the harness to your home directory, shared across projects.
1011
1065
  - ✅ **Input validation** — all CLI prompts validate and retry on bad values.
1012
1066
  - ✅ **Codex CLI provider** — full support for OpenAI Codex CLI. Generates `.codex/agents/*.toml` files with proper `sandbox_mode` per role and merges `.codex/config.toml` for MCP registration. Overrides the built-in `default` agent so the harness lead runs by default.
1067
+ - ✅ **Grok Build provider** — full support for xAI's Grok Build. Generates `.grok/agents/*.md` files with a `tools:` allowlist per role and merges `.grok/config.toml` for MCP registration.
1013
1068
  - **Graphify integration** — connect the harness to Graphify to visualize agent workflows, task dependencies, and action timelines as interactive graphs.
1014
1069
  - **Open Telemetry integration** — emit OpenTelemetry spans for all agent actions, file operations, and tool calls.
1015
1070
  - **Jira task adapter** — pull tasks directly from Jira instead of maintaining `feature_list.json` manually.