@cardor/agent-harness-kit 2.0.0 → 2.1.1
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 +85 -13
- package/dist/cli.js +530 -340
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,6 +34,7 @@ npx ahk init
|
|
|
34
34
|
- [Commands](#commands)
|
|
35
35
|
- [`ahk init`](#ahk-init)
|
|
36
36
|
- [`ahk build`](#ahk-build)
|
|
37
|
+
- [`ahk models`](#ahk-models)
|
|
37
38
|
- [`ahk dashboard`](#ahk-dashboard)
|
|
38
39
|
- [`ahk status`](#ahk-status)
|
|
39
40
|
- [`ahk health`](#ahk-health)
|
|
@@ -88,7 +89,7 @@ ahk init
|
|
|
88
89
|
└── creates config, agent definitions, task backlog, health check
|
|
89
90
|
|
|
90
91
|
AI tool opens your project
|
|
91
|
-
└── reads .claude/mcp.json, opencode.json, or .
|
|
92
|
+
└── reads .claude/mcp.json, opencode.json, .codex/config.toml, or .grok/config.toml
|
|
92
93
|
└── spawns: ahk serve (stdio MCP server)
|
|
93
94
|
via your package manager (npx/pnpm exec/yarn run/bunx) when the
|
|
94
95
|
package is a local dependency, or the bare binary when it isn't
|
|
@@ -111,7 +112,9 @@ Everything is stored locally in a SQLite database (`.harness/harness.db`). No cl
|
|
|
111
112
|
|
|
112
113
|
## Features
|
|
113
114
|
|
|
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.
|
|
115
|
+
- **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.
|
|
116
|
+
|
|
117
|
+
> **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
118
|
- **Structured 5-agent workflow** — Lead, Explorer, Consultant, Builder, and Reviewer each have defined responsibilities and can only act within their role.
|
|
116
119
|
- **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
120
|
- **Full audit trail** — every action, file touched, tool used, and section written is stored in SQLite and queryable.
|
|
@@ -164,7 +167,7 @@ npx ahk init
|
|
|
164
167
|
|
|
165
168
|
## MCP command per package manager
|
|
166
169
|
|
|
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 `.
|
|
170
|
+
`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
171
|
|
|
169
172
|
| Package manager | Detected via | Generated command |
|
|
170
173
|
| -------------------------- | --------------------------------------------------------------------------- | ---------------------------------------------- |
|
|
@@ -177,11 +180,11 @@ npx ahk init
|
|
|
177
180
|
|
|
178
181
|
Detection order: the `packageManager` field in your `package.json` (e.g. `"packageManager": "pnpm@8.15.0"`) takes priority when present; otherwise `ahk` falls back to lockfile heuristics; if nothing is detected, it defaults to npm.
|
|
179
182
|
|
|
180
|
-
**Global installs bypass the package manager entirely.** Every command in the table above asks your package manager to resolve a *locally installed* `ahk` binary — `npx --no` deliberately refuses to download one, and `pnpm exec`/`yarn run`/`bunx --no-install` have nothing to point at. If you installed the CLI globally and never added it to the project, all five of those commands fail. So `ahk` checks for
|
|
183
|
+
**Global installs bypass the package manager entirely.** Every command in the table above asks your package manager to resolve a *locally installed* `ahk` binary — `npx --no` deliberately refuses to download one, and `pnpm exec`/`yarn run`/`bunx --no-install` have nothing to point at. If you installed the CLI globally and never added it to the project, all five of those commands fail. So `ahk` checks for a *real* local install first and, when there is none, generates the bare `ahk serve --port <port>` — resolved from your `PATH` like any other global binary. The package-manager-specific commands are used only when a local install actually exists. If, on that global-install path, `ahk` is not resolvable on your `PATH` at generation time, `ahk` prints a non-blocking warning (the command still succeeds) pointing you at `npm i -g @cardor/agent-harness-kit` or a local install — moving the "binary not found" failure earlier instead of surfacing it later when the MCP server is spawned.
|
|
181
184
|
|
|
182
|
-
Working inside the `agent-harness-kit` repository itself
|
|
185
|
+
Working inside the `agent-harness-kit` repository itself does **not** count as a local install for this decision: there is no real `node_modules/@cardor/agent-harness-kit` entry for a package manager to resolve, so self-dev generates the bare global `ahk serve --port <port>` form, same as any other project with no local install. This is a narrower check than the one deciding your config file format, above (`ahk init`'s `.ts`/`.mjs`/`.cjs` vs. `.json` choice) — that check still treats self-dev as satisfied, since it only cares whether the package is resolvable for type-checking purposes, not whether a package manager can mediate a spawned command.
|
|
183
186
|
|
|
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.
|
|
187
|
+
**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
188
|
|
|
186
189
|
---
|
|
187
190
|
|
|
@@ -191,9 +194,9 @@ Working inside the `agent-harness-kit` repository itself counts as a local insta
|
|
|
191
194
|
|
|
192
195
|
Interactive scaffold. Asks for your project name, description, AI provider, docs path, storage scope, task adapter, and an optional first task. Creates all harness files in the current directory.
|
|
193
196
|
|
|
194
|
-
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.
|
|
197
|
+
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. Agent files are user-owned once generated (see [Agent files are yours](#agent-files-are-yours) below), so after init the model can be changed three ways: hand-editing the `model:` frontmatter line directly, running [`ahk models`](#ahk-models) to re-prompt and regenerate just the 5 agent files, or running `ahk build --force` (which re-prompts too, then regenerates everything `--force` regenerates).
|
|
195
198
|
|
|
196
|
-
OpenCode
|
|
199
|
+
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
200
|
|
|
198
201
|
**Storage scope** — where the harness DB (and its `current.md` fallback) physically lives:
|
|
199
202
|
|
|
@@ -210,6 +213,7 @@ ahk init
|
|
|
210
213
|
# Skip prompts with flags
|
|
211
214
|
ahk init --name "my-app" --provider claude-code --docs ./docs --tasks local --storage-scope local
|
|
212
215
|
ahk init --name "my-app" --provider codex-cli --docs ./docs --tasks local --storage-scope global
|
|
216
|
+
ahk init --name "my-app" --provider grok-cli --docs ./docs --tasks local --storage-scope local
|
|
213
217
|
```
|
|
214
218
|
|
|
215
219
|
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 +235,7 @@ ahk build --sync # kept for backwards compatibility — now a no-op on every
|
|
|
231
235
|
|
|
232
236
|
### Agent files are yours
|
|
233
237
|
|
|
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 `.
|
|
238
|
+
`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
239
|
|
|
236
240
|
Everything else `build` writes — MCP config and skills — is derived from your config and **is** regenerated on every run.
|
|
237
241
|
|
|
@@ -264,6 +268,7 @@ ahk build --force
|
|
|
264
268
|
- **It discards your customizations.** Every agent file is rewritten from the template. Prompt edits, `model:` lines, and restriction tweaks are all lost.
|
|
265
269
|
- **It backs up first.** Before overwriting anything, the current content of every affected file is copied under `.harness/backups/` — agent files to `agents-<timestamp>/`, hand-edited `AGENTS.md`/`CLAUDE.md` to `derived-<timestamp>/`. If that backup cannot be written, the command aborts and **no file is modified** — the same fail-safe as [`ahk migrate storage --force`](#storage-migration).
|
|
266
270
|
- **It names what it touched.** The command prints every file it overwrote and the backup location, so you can diff or restore.
|
|
271
|
+
- **Claude Code only, it also re-prompts for models.** Before regenerating, `ahk build --force` runs the same per-role model prompt as `ahk init` (see above) and injects the fresh choices into the regenerated frontmatter. Other providers are unaffected — no prompt appears for them.
|
|
267
272
|
|
|
268
273
|
`--force` also regenerates a hand-edited `AGENTS.md` or `CLAUDE.md` (backing it up first) — the only time you need it for those files, since an *unedited* one already re-generates on its own when config changes.
|
|
269
274
|
|
|
@@ -273,6 +278,21 @@ ahk build --force
|
|
|
273
278
|
|
|
274
279
|
---
|
|
275
280
|
|
|
281
|
+
### `ahk models`
|
|
282
|
+
|
|
283
|
+
Claude Code only. Re-runs `ahk init`'s per-role model prompt and regenerates ONLY the 5 `.claude/agents/*.md` files with the chosen models — nothing else (not `AGENTS.md`, `CLAUDE.md`, `.mcp.json`, `.claude/settings.json`, your config file, docs path, storage scope, or task adapter).
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
ahk models
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
- Prompts once per role (lead, explorer, consultant, builder, reviewer): `inherit` (default), `haiku`, `sonnet`, `opus`, or `fable` — same prompt as `ahk init`.
|
|
290
|
+
- Always regenerates all 5 agent files, backing up the previous content first under `.harness/backups/agents-<timestamp>/` — the same fail-safe [`--force`](#--force) uses.
|
|
291
|
+
- On a non-Claude-Code project, it prints a one-line no-op message and exits — no prompt.
|
|
292
|
+
- If no `agent-harness-kit.config` is found, it prints a message pointing at `ahk init` and exits — no prompt, no stack trace.
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
276
296
|
### `ahk dashboard`
|
|
277
297
|
|
|
278
298
|
Opens a local web dashboard to visualize everything stored in the harness database — tasks, agent actions, file operations, tool usage, and live timelines. Updates in real time via WebSocket as agents work.
|
|
@@ -416,13 +436,14 @@ ahk reset --force # skip all confirmation prompts
|
|
|
416
436
|
ahk reset --provider claude-code # also delete agent files for this provider
|
|
417
437
|
ahk reset --provider opencode
|
|
418
438
|
ahk reset --provider codex-cli
|
|
439
|
+
ahk reset --provider grok-cli
|
|
419
440
|
```
|
|
420
441
|
|
|
421
442
|
What it can reset:
|
|
422
443
|
|
|
423
444
|
- The SQLite `.db` file (plus WAL and SHM files if present)
|
|
424
445
|
- `.harness/feature_list.json`
|
|
425
|
-
- Agent definition files in `.claude/agents/`, `.opencode/agents/`, or `.
|
|
446
|
+
- Agent definition files in `.claude/agents/`, `.opencode/agents/`, `.codex/agents/`, or `.grok/agents/`
|
|
426
447
|
|
|
427
448
|
After a reset, run `ahk init` to scaffold a fresh harness.
|
|
428
449
|
|
|
@@ -440,6 +461,7 @@ Migrates provider-specific files from one AI provider to another. Useful when sw
|
|
|
440
461
|
ahk migrate provider --to opencode
|
|
441
462
|
ahk migrate provider --to claude-code
|
|
442
463
|
ahk migrate provider --to codex-cli
|
|
464
|
+
ahk migrate provider --to grok-cli
|
|
443
465
|
|
|
444
466
|
# Backward-compatible alias (identical behavior):
|
|
445
467
|
ahk migrate --to opencode
|
|
@@ -547,6 +569,23 @@ your-project/
|
|
|
547
569
|
└── default.toml ← overrides Codex's built-in default agent → routes to lead
|
|
548
570
|
```
|
|
549
571
|
|
|
572
|
+
**Grok Build** (`provider: 'grok-cli'`):
|
|
573
|
+
|
|
574
|
+
```
|
|
575
|
+
your-project/
|
|
576
|
+
├── agent-harness-kit.config.{json|ts|mjs|cjs}
|
|
577
|
+
├── AGENTS.md
|
|
578
|
+
├── health.sh
|
|
579
|
+
├── .harness/
|
|
580
|
+
└── .grok/
|
|
581
|
+
├── config.toml ← MCP server registration
|
|
582
|
+
└── agents/
|
|
583
|
+
├── lead.md
|
|
584
|
+
├── explorer.md
|
|
585
|
+
├── builder.md
|
|
586
|
+
└── reviewer.md
|
|
587
|
+
```
|
|
588
|
+
|
|
550
589
|
### What each file does
|
|
551
590
|
|
|
552
591
|
| File | Purpose | Edit it? |
|
|
@@ -565,6 +604,8 @@ your-project/
|
|
|
565
604
|
| `opencode.json` | MCP server + `default_agent` + compaction config for OpenCode. Merged by `ahk build` | Yes, carefully |
|
|
566
605
|
| `.codex/agents/*.toml` | Agent role definitions (Codex CLI). Created once, never overwritten (`ahk build --force` regenerates) | **Yes — customize agent behavior** |
|
|
567
606
|
| `.codex/config.toml` | MCP server registration for Codex CLI. Merged by `ahk build` | Yes, carefully |
|
|
607
|
+
| `.grok/agents/*.md` | Agent role definitions (Grok Build). Created once, never overwritten (`ahk build --force` regenerates) | **Yes — customize agent behavior** |
|
|
608
|
+
| `.grok/config.toml` | MCP server registration for Grok Build. Merged by `ahk build` | Yes, carefully |
|
|
568
609
|
|
|
569
610
|
---
|
|
570
611
|
|
|
@@ -590,7 +631,7 @@ const config: HarnessConfig = {
|
|
|
590
631
|
docsPath: './docs', // where agents search for documentation
|
|
591
632
|
},
|
|
592
633
|
|
|
593
|
-
provider: 'claude-code', // 'claude-code' | 'opencode' | 'codex-cli'
|
|
634
|
+
provider: 'claude-code', // 'claude-code' | 'opencode' | 'codex-cli' | 'grok-cli'
|
|
594
635
|
|
|
595
636
|
// There is no `agents` key. Per-agent settings live in the generated agent
|
|
596
637
|
// file itself, which is yours to edit — see "Agent files are yours" below.
|
|
@@ -788,7 +829,35 @@ You are the builder agent for MyApp. Follow these rules:
|
|
|
788
829
|
|
|
789
830
|
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
831
|
|
|
791
|
-
|
|
832
|
+
**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":
|
|
833
|
+
|
|
834
|
+
```markdown
|
|
835
|
+
---
|
|
836
|
+
name: explorer
|
|
837
|
+
description: Explorer agent — reads and maps the codebase, never writes
|
|
838
|
+
tools:
|
|
839
|
+
- Bash
|
|
840
|
+
- Read
|
|
841
|
+
- NotebookRead
|
|
842
|
+
- Grep
|
|
843
|
+
- Glob
|
|
844
|
+
- WebFetch
|
|
845
|
+
- WebSearch
|
|
846
|
+
- search_tool
|
|
847
|
+
- use_tool
|
|
848
|
+
---
|
|
849
|
+
|
|
850
|
+
# Explorer Agent
|
|
851
|
+
|
|
852
|
+
You are the explorer agent for MyApp. Follow these rules:
|
|
853
|
+
|
|
854
|
+
- Map the modules relevant to the task and report where each concern lives
|
|
855
|
+
- Never modify files — record every file you read
|
|
856
|
+
```
|
|
857
|
+
|
|
858
|
+
For the builder, `tools:` is omitted entirely, same as every other provider — the agent inherits every tool.
|
|
859
|
+
|
|
860
|
+
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
861
|
|
|
793
862
|
### `.harness/feature_list.json`
|
|
794
863
|
|
|
@@ -851,7 +920,7 @@ The harness exposes these tools via MCP. Agents use them instead of reading file
|
|
|
851
920
|
| **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
921
|
| **reviewer** | Verifies all acceptance criteria are met. Approves or blocks. Runs health check before approving. |
|
|
853
922
|
|
|
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.
|
|
923
|
+
> **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
924
|
>
|
|
856
925
|
> **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
926
|
>
|
|
@@ -903,6 +972,8 @@ The harness exposes these tools via MCP. Agents use them instead of reading file
|
|
|
903
972
|
| `opencode.json` | Yes |
|
|
904
973
|
| `.codex/agents/*.toml` | Yes |
|
|
905
974
|
| `.codex/config.toml` | Yes |
|
|
975
|
+
| `.grok/agents/*.md` | Yes |
|
|
976
|
+
| `.grok/config.toml` | Yes |
|
|
906
977
|
| `.harness/harness.db` | **No** (gitignored, local scope only) |
|
|
907
978
|
| `.harness/current.md` | **No** (gitignored, local scope only) |
|
|
908
979
|
| `.harness/storage-state.json` | Yes (metadata, not gitignored — always present regardless of scope) |
|
|
@@ -1010,6 +1081,7 @@ See [SECURITY.md](./SECURITY.md) for the vulnerability reporting process, suppor
|
|
|
1010
1081
|
- ✅ **Global installation** — `ahk init` can install the harness to your home directory, shared across projects.
|
|
1011
1082
|
- ✅ **Input validation** — all CLI prompts validate and retry on bad values.
|
|
1012
1083
|
- ✅ **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.
|
|
1084
|
+
- ✅ **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
1085
|
- **Graphify integration** — connect the harness to Graphify to visualize agent workflows, task dependencies, and action timelines as interactive graphs.
|
|
1014
1086
|
- **Open Telemetry integration** — emit OpenTelemetry spans for all agent actions, file operations, and tool calls.
|
|
1015
1087
|
- **Jira task adapter** — pull tasks directly from Jira instead of maintaining `feature_list.json` manually.
|