@cardor/agent-harness-kit 1.5.2 → 1.6.2

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
@@ -172,6 +172,7 @@ Regenerates `AGENTS.md` and provider-specific files from your `agent-harness-kit
172
172
  ```bash
173
173
  ahk build
174
174
  ahk build --watch # watch mode: rebuilds automatically on config changes
175
+ ahk build --sync # sync tools: frontmatter in .claude/agents/*.md to match current permission constants
175
176
  ```
176
177
 
177
178
  ---
@@ -186,6 +187,8 @@ ahk dashboard --port 8080 # custom port
186
187
  ahk dashboard --no-open # start server without opening browser
187
188
  ```
188
189
 
190
+ If the requested port (default `4242`) is already in use, `ahk dashboard` automatically tries up to 10 sequential ports (e.g. `4242 → 4243 → … → 4251`). The actual port opened is printed to the console. If all 10 ports are exhausted, the command exits with a clear error message showing which port range was attempted.
191
+
189
192
  The dashboard includes:
190
193
 
191
194
  | View | What it shows |
@@ -409,6 +412,12 @@ your-project/
409
412
 
410
413
  ---
411
414
 
415
+ ## Tasks schema
416
+
417
+ The `tasks` table includes an `updated_at` timestamp column, set on creation and automatically updated on every status change. On first run after upgrading from an older version, existing rows are backfilled with `COALESCE(completed_at, started_at, created_at)`. Tasks returned by `tasks.get` are ordered by status priority (pending → in_progress → blocked → done) then by `updated_at` descending.
418
+
419
+ ---
420
+
412
421
  ## What you can customize
413
422
 
414
423
  ### `agent-harness-kit.config.ts`
@@ -574,7 +583,7 @@ The harness exposes these tools via MCP. Agents use them instead of reading file
574
583
  | `tasks.claim` | `id, agent` | Atomically claim a pending task. Returns `task_already_claimed` if another agent got it first |
575
584
  | `tasks.update` | `id, status` | Change task status |
576
585
  | `tasks.add` | `title, slug?, description?, acceptance?` | Create a new task directly from MCP (agents can queue work on the fly) |
577
- | `tasks.acceptance.update` | `criterionId` | Mark an acceptance criterion as met. Criterion IDs come from `tasks.get` |
586
+ | `tasks.acceptance.update` | `criterionId` | Mark an acceptance criterion as met. Criterion IDs come from `tasks.acceptance_get` |
578
587
  | `actions.start` | `taskId, agent` | Start a new action, returns `actionId` |
579
588
  | `actions.write` | `actionId, sectionType, content` | Record a text section: `result \| tools_used \| blockers \| next_steps`. Does **not** populate the Files dashboard — use `actions.record_file` for that |
580
589
  | `actions.complete` | `actionId, summary` | Close an action with a one-line summary |
@@ -582,6 +591,7 @@ The harness exposes these tools via MCP. Agents use them instead of reading file
582
591
  | `actions.record_file` | `actionId, filePath, operation, notes?` | Register a file touch. The **only** way to populate the Files dashboard. `operation`: `read \| created \| modified \| deleted` |
583
592
  | `actions.record_tool` | `actionId, toolName, argsJson?, resultSummary?` | Register a tool call. The **only** way to populate the Tools dashboard |
584
593
  | `docs.search` | `query` | Search the `docsPath` folder for content matching the query |
594
+ | `tasks.acceptance_get` | `taskId` | Returns all acceptance criteria for a task with their `id`, `task_id`, `criterion` text, and `met` status. Use the returned `id` values with `tasks.acceptance.update` |
585
595
 
586
596
  ---
587
597
 
@@ -594,6 +604,30 @@ The harness exposes these tools via MCP. Agents use them instead of reading file
594
604
  | **builder** | Implements the plan. Only writes to `writablePaths`. Records every file modified. |
595
605
  | **reviewer** | Verifies all acceptance criteria are met. Approves or blocks. Runs health check before approving. |
596
606
 
607
+ ### MCP tool permissions by role
608
+
609
+ Each agent role has a scoped set of MCP tools enforced through the agent definition files.
610
+
611
+ | Tool | lead | explorer | builder | reviewer |
612
+ |---|:---:|:---:|:---:|:---:|
613
+ | `tasks.get` | ✅ | ✅ | ✅ | ✅ |
614
+ | `tasks.claim` | ✅ | ✅ | ✅ | ✅ |
615
+ | `tasks.add` | ✅ | ❌ | ✅ | ✅ |
616
+ | `tasks.update` | ✅ | ❌ | ✅ | ✅ |
617
+ | `tasks.edit` | ✅ | ❌ | ✅ | ✅ |
618
+ | `tasks.archive` / `unarchive` | ✅ | ❌ | ✅ | ✅ |
619
+ | `tasks.acceptance_get` | ✅ | ✅ | ✅ | ✅ |
620
+ | `tasks.acceptance.update` | ❌ | ❌ | ❌ | ✅ |
621
+ | `actions.*` (all 6) | ✅ | ✅ | ✅ | ✅ |
622
+ | `docs.search` | ✅ | ✅ | ✅ | ✅ |
623
+ | `permissions.check` | ✅ | ✅ | ✅ | ✅ |
624
+
625
+ **explorer** is read-only for task state — can query but cannot mutate status or mark criteria.
626
+ **reviewer** is the only role that can mark acceptance criteria as met (`tasks.acceptance.update`).
627
+ **lead** and **builder** have identical access, both excluding `tasks.acceptance.update`.
628
+
629
+ `permissions.check` compares each `.claude/agents/*.md` tool list against the canonical constants in the package. Returns `{ in_sync: bool, agents: { lead, explorer, builder, reviewer } }` with per-agent `missing` and `extra` arrays. Run `ahk build --sync` to fix any drift.
630
+
597
631
  ---
598
632
 
599
633
  ## What to commit
@@ -99,13 +99,34 @@ The explorer identified how this codebase works. Use those patterns. Do not intr
99
99
 
100
100
  If tests fail, fix them before completing your action. Do not leave the codebase in a broken state.
101
101
 
102
- ### 6. Sync README and docs after codebase changes
102
+ ### 6. Sync README and docs MANDATORY
103
103
 
104
- If your changes affect public APIs, CLI commands, configuration, or any user-facing behavior, update the relevant sections of `README.md` and any files under `./docs/` to reflect the new state.
104
+ Before completing your action, you **must** check whether any user-facing behavior changed and update docs accordingly. This step is not optional.
105
105
 
106
- - Do not leave docs describing behavior that no longer exists.
107
- - Do not add implementation details that belong in code comments, not docs.
108
- - If no user-facing behavior changed, you may skip this step — but note that explicitly in your result.
106
+ **Step 1 Search actively:**
107
+ ```bash
108
+ grep -n "your-feature-keyword" README.md docs/**/*.md 2>/dev/null
109
+ ```
110
+ Search for keywords related to the files you changed (CLI commands, MCP tool names, config keys, DB columns, agent behavior). Read any matching sections.
111
+
112
+ **Step 2 — Update or justify:**
113
+ - If a matching section exists → update it to reflect the new behavior.
114
+ - If no section exists but the change is user-facing → add one in the appropriate location.
115
+ - If nothing is user-facing (internal refactor, tests only) → explicitly state that in your result section.
116
+
117
+ **What counts as user-facing:**
118
+ - New or changed CLI commands or flags
119
+ - New or changed MCP tools
120
+ - Changes to DB schema visible to users
121
+ - Changes to agent permissions or behavior
122
+ - New config options
123
+
124
+ **Step 3 — Report in your result section:**
125
+ Always end your result with one of:
126
+ - `Docs updated: README.md lines X–Y (description of what changed)`
127
+ - `No docs update needed: this change is internal only ([specific reason])`
128
+
129
+ Never leave this blank or skip it silently.
109
130
 
110
131
  ### 7. Record your result
111
132
 
@@ -87,6 +87,10 @@ bash health.sh
87
87
 
88
88
  If exit code ≠ 0 → **stop immediately**. Report the health failure and do not proceed.
89
89
 
90
+ Then call `permissions.check` — if `in_sync: false`, inform the user before proceeding:
91
+ > "Your agent permissions are outdated. Run `ahk build --sync` to update, or I can guide you."
92
+ Wait for the user to acknowledge before continuing the session.
93
+
90
94
  Then check session state via MCP:
91
95
 
92
96
  ```
@@ -134,6 +138,7 @@ Think through:
134
138
  - What exactly should the builder implement?
135
139
  - What are the acceptance criteria the reviewer will check?
136
140
  - If codebase changes are involved: does the builder need to update README or `docs/` files?
141
+ - Does this task touch user-facing behavior (CLI commands, MCP tools, DB schema, config, agent permissions)? If yes, add an acceptance criterion: `README.md and/or docs/ updated to reflect the change`
137
142
 
138
143
  Record it:
139
144
 
@@ -119,6 +119,7 @@ Then notify lead so the builder can be re-assigned.
119
119
 
120
120
  - **Run health.sh before approving.** No exceptions.
121
121
  - **Check every acceptance criterion.** Not just the obvious ones.
122
+ - **Use `tasks.acceptance.get(taskId)` to retrieve criterion ids.** Call this before `tasks.acceptance.update()` when you do not already have criterion ids from `tasks.get`.
122
123
  - **Call `tasks.acceptance.update()` for each criterion.** Never skip this step.
123
124
  - **Never self-approve partial work.** All criteria must be met, not most.
124
125
  - **Be specific when blocking.** The builder must know exactly what to fix.