Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cursor-plugin/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"anti-slop"
],
"license": "PolyForm-Noncommercial-1.0.0",
"version": "5.4.0",
"version": "5.5.0",
"homepage": "https://github.com/agent-kit-startup/agent-kit",
"repository": "https://github.com/agent-kit-startup/agent-kit",
"logo": "dashboard/logo-marketplace.svg",
Expand Down
2 changes: 1 addition & 1 deletion .cursor/agent-kit.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"version": "5.4.0",
"version": "5.5.0",
"protected": [
".cursor/HANDOFF.md",
".cursor/agents/test-suites.md",
Expand Down
4 changes: 3 additions & 1 deletion .cursor/commands/plan-review-triage.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Supports **multi-path walk**: iterate multiple monitors in blocking-first then d
- After Claude external plan review completed (monitor file exists under `.cursor/memory/plan-monitor-*.md`)
- You want to process findings from the monitor and decide next steps
- **Daily path:** `/run-plan` (exhaustion) and `/run-plan-all` (queue-end) continue into this Ask after wait exit 0. This slash stays HITL SoT; operators should not need to type `done` or paste triage solely to resume. ADR `2026-08-14_main-command-dogfood-audit-routing.md`.
- **Owed-row adoption:** an explicit path invocation (`/plan-review-triage <path>`) on a monitor whose slug has a **dead** wait-state (`.cursor/context/audit-wait/<slug>.json` `status: "timeout"`/`"soft-fail"`, or `"armed"` with `now >= deadline`) and an **owed** Field Report row for that plan runs this same Step 1-5 walk unchanged, but Step 4's durable heading additionally records the adoption (see Step 4). Gap-aware skip's "no open residuals / clean Outcome" row does **not** apply to an adoption target: a clean adopted monitor still gets the Ask and the durable heading (only "already triaged" or "not a monitor file" may still skip it) — the owed row needs that heading to close. This is the `Adopt existing monitor` HITL label offered by `/run-plan` / `/run-plan-all`'s owed-close path (`.cursor/memory/errors/2026-08-14_audit-owed-ledger-no-close-path.md`); it is never automatic and never rewrites the earlier exit `3`.
- **Not for mid-plan reviews** - this command expects `completed` work only

## Usage
Expand Down Expand Up @@ -150,7 +151,8 @@ Rules:
2. **Ack and stop** must write the heading on the monitor. Updating HANDOFF alone is **not** enough: Field Report uses `isReportTriaged`, which looks for a triage heading (or a follow-up plan reference). Without the heading, the row stays untriaged.
3. Keep HITL: do not invent a choice; do not write the heading before the user picks an option.
4. Prefer appending once near the end of the file; do not delete prior review evidence.
5. **Residuals executors (R15):** when closing Still open items from a residuals plan, **append** a `## Closed by residuals plan` section (ids + evidence). Do **not** rewrite or empty the reviewer's `### Still open` table in place. Prefer the monitor already committed when written so edits have history (ADR `decisions/2026-07-29_plan-monitor-staging-hygiene-r14-r15.md`).
5. **Owed-row adoption:** when this monitor's slug has a dead wait-state and an owed Field Report row (see "Owed-row adoption" above), append the adoption fact to the same heading — for example `- **Closes owed:** yes (adoption; earlier exit 3 for this slug stays 3)`. Never narrate this as "the timed-out audit completed"; it is "an independent monitor exists and the operator adopted it." Choice `Ack and stop` on an owed row records the row as **acked**, still **unreviewed** (do not write `reviewed` for an Ack close).
6. **Residuals executors (R15):** when closing Still open items from a residuals plan, **append** a `## Closed by residuals plan` section (ids + evidence). Do **not** rewrite or empty the reviewer's `### Still open` table in place. Prefer the monitor already committed when written so edits have history (ADR `decisions/2026-07-29_plan-monitor-staging-hygiene-r14-r15.md`).

### Step 5: Execute the choice

Expand Down
6 changes: 4 additions & 2 deletions .cursor/commands/run-plan-all.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ This step is delegated to a **Task(explore) subagent** using the reusable worker

**Audit session-pile preflight (before the confirm Ask):** count detached workspace-owned `agent-kit-audit-*` sessions via `.cursor/scripts/plan-external-review.sh --reap-audit-sessions --dry-run` (or the arm `--dry-run` line `audit-sessions: N detached owned`). At warn: print the dispose command (or offer `--reap-audit-sessions`) in the Ask/preflight body and continue. At cap: do not arm; surface the cap in the orchestrator Ask/preflight, not only launcher stderr. Attached sessions are operator work and are never counted. This orchestrator check runs once, at queue confirm; per-arm protection is the launcher's own session-cap refusal (exit 4), which the mid-batch and queue-end arms already honour, so no second orchestrator call site is wired.

**Audits unsatisfiable-config preflight (before the confirm Ask):** when `externalPlanReview.preflight` is not `off`, check whether `enabled: true` and `backend` is pinned `"claude"` while this lane's implementer is Claude — that combination can only end owed (`CLAUDE.md` lists Claude external plan-review audits as a non-goal here; implementer≠reviewer same-model skip, ADR `decisions/2026-08-13_audits-atomic-wait-reviewer-fallback.md` point 4). `"auto"`, `"cursor"`, and `"cloud"` stay satisfiable. `midBatchAudits: true` multiplies the cost: every completed plan arms, every arm same-model-skips, every plan in the queue ends owed. `warn`: surface once, naming the combination and the three outs (`backend: "auto"`, `"cursor"`, or `"cloud"`), then continue. `block`: do not start the queue into a config that can only end owed — stop and surface the fix, or continue only on explicit operator deferral; never steal `/git-prod`. This runs before the confirm Ask because that is the one place an operator can still change config cheaply, ahead of a multi-plan run. A growing owed pile is not an acceptable substitute for surfacing this (`.cursor/memory/errors/2026-08-14_audit-owed-ledger-no-close-path.md`).

After synthesis, present the proposal using **Ask questions** tool. Include the ordered list, key overlaps/consolidations, and coherence notes in the question body. Fallback to chat numbered list if the tool is unavailable.

> "Plans synthesized. Proposal: [N] plans in order, [M] consolidations, [K] overlaps. Here is the proposed execution queue..."
Expand Down Expand Up @@ -187,14 +189,14 @@ Read `externalPlanReview` before the queue confirm Ask and at each advance:

| Config | Behavior |
|--------|----------|
| Audits **pre-flight** (`preflight`: `off` \| `warn` \| `block`) | Before the confirm Ask and before each mid-queue advance: same owed/untriaged check as `/run-plan`. `block` arms or stops; never steals `/git-prod`. |
| Audits **pre-flight** (`preflight`: `off` \| `warn` \| `block`) | Before the confirm Ask and before each mid-queue advance: same owed/untriaged check as `/run-plan`, plus the unsatisfiable-config check (`enabled: true` + pinned `backend: "claude"` in this lane can only end owed; see "Audits unsatisfiable-config preflight" above). `block` arms or stops; never steals `/git-prod`. |
| `midBatchAudits: true` and audits enabled | After each plan Task returns `outcome: completed`, the **orchestrator** arms **one** full audit for that plan with `--force --autonomous --wait-monitor` (or one `--batch` + wait_all when batching is intentional) **before** advancing the cursor. No paste Ask between plans. Soft-fail → Field Report owed; still advance. AwaitShell until exit `0|3|4` (chat slice ~90s; remaining budget in `.cursor/context/audit-wait/<slug>.json`). **Exit 3 with remaining `waitTimeoutSeconds`:** do not treat as arm-done. Same orchestrator session resumes wait-state polling (re-arm `--wait-monitor` against leftover budget) before advancing the cursor or skipping triage. Exit 3 with zero leftover budget, or exit 4: Field Report owed, then advance. Wait success requires a **fresh** monitor after arm start. Reviewer cascade: `backend: "auto"` uses Claude (Haiku) when usable, else Cursor Agent. Same-model implementer/reviewer is an honest skip. Do **not** fan out N background sessions without wait. Do **not** insert a mid-queue triage Ask (operator non-stop preserved; record ready path for queue-end). Mid-batch stays findings-only: **never** auto-Write residuals or rewrite the Run queue between plans. |
| `midBatchAudits` false/missing | **Non-stop** mid-queue: do **not** pause for audit Ask/paste between plans. Mid-queue completed plans stay Field Report **owed** until reviewed. |
| Queue exhausted | Final HANDOFF; cadence `batch-complete`; then queue-end audit arm covering remaining owed/unreviewed targets (enabled → `--force --autonomous --wait-monitor` or paste per `mode`; else `offerOnExhausted` Ask). Prefer one launcher `--batch` + wait_all when multiple basenames. After wait exit `0`: run `/plan-review-triage` Ask with an **explicit path list** of fresh monitors (batch uniform Ask when outcomes match; sequential fallback when mixed; durable heading per file). **Batch exhaust without conveyor:** when remaining monitors are process-only / depth-capped, prefer uniform **Ack and stop** or **Fix nits only**; do not spawn unbounded `close-*` backlog from Write residuals (ADR `decisions/2026-08-11_plan-audit-residuals-termination.md`). Then suggest `/git-prod` if staging is ahead of `main` (separate HITL). |

Never steal `/git-prod` confirmation. Chat never runs silent headless `--force` / `claude -p` in the agent shell. Spawn-only exit 0 without `--wait-monitor` is **not** review done. Never stop at Final HANDOFF "when monitors exist, run triage" after arming: wait (freshness) then continue (mid-batch waits for file only; queue-end waits then triage Ask with explicit paths). ADR: `2026-07-27_audits-autonomous-plan-review-contract.md` (supersedes queue-end-only); wait freshness: `2026-07-27_audits-wait-freshness-enforce.md`.

**Exit 3 stays timeout-only across the queue.** A mid-queue or queue-end arm that returns `3` reviewed nothing: leave that plan Field Report **owed**, keep its path out of the queue-end triage list, and never narrate it as reviewed. **Same-session resume:** when leftover `waitTimeoutSeconds` remains in `.cursor/context/audit-wait/<slug>.json`, the same orchestrator session must keep polling (re-arm `--wait-monitor`) before advancing the cursor or skipping `/plan-review-triage`. A later session may poll leftover budget; that is fallback, not the default while this session is still open. Do not treat a first-slice exit `3` as "arm done, continue the queue." Monitors that show up later, including monitors written by a different arm or a later queue position, do **not** retroactively upgrade an earlier `3`. Exit `4` covers the launcher soft-fails: no usable reviewer (`backend: "auto"` tried Claude then Cursor; pinned `claude` still tips when Claude is missing), same-model refuse, background spawn unavailable, a **silent PTY** early abort (spawn succeeded but produced no scrollback in the grace window), and a **session-cap refusal** (detached `agent-kit-audit-*` pile at the cap, so nothing spawned). Advance the queue on exit 4 or on exit 3 with zero leftover budget, but record the target as owed, never as reviewed. ADR: `2026-07-30_audits-pty-progress-gate-zombie-policy.md`; wait resume: `2026-08-13_audits-atomic-wait-reviewer-fallback.md`.
**Exit 3 stays timeout-only across the queue.** A mid-queue or queue-end arm that returns `3` reviewed nothing: leave that plan Field Report **owed**, keep its path out of the queue-end triage list, and never narrate it as reviewed. **Same-session resume:** when leftover `waitTimeoutSeconds` remains in `.cursor/context/audit-wait/<slug>.json`, the same orchestrator session must keep polling (re-arm `--wait-monitor`) before advancing the cursor or skipping `/plan-review-triage`. A later session may poll leftover budget; that is fallback, not the default while this session is still open. Do not treat a first-slice exit `3` as "arm done, continue the queue." Monitors that show up later, including monitors written by a different arm or a later queue position, do **not** retroactively upgrade an earlier `3` — the `3` stays `3` even when a later genuine monitor exists. Exit `4` covers the launcher soft-fails: no usable reviewer (`backend: "auto"` tried Claude then Cursor; pinned `claude` still tips when Claude is missing), same-model refuse, background spawn unavailable, a **silent PTY** early abort (spawn succeeded but produced no scrollback in the grace window), and a **session-cap refusal** (detached `agent-kit-audit-*` pile at the cap, so nothing spawned). Advance the queue on exit 4 or on exit 3 with zero leftover budget, but record the target as owed, never as reviewed. **Leftover budget is `deadline` vs wall clock, never `status: "armed"` alone:** the launcher expires a wait-state file left `armed` past its `deadline` on contact (to `status: "timeout"`, `remainingBudgetSeconds: 0`), so a stale arm from an earlier queue run is never resumed as live budget; sweep all slugs with `.cursor/scripts/plan-external-review.sh --gc-wait-state [--dry-run]`. **Owed close (separate, later event, not an upgrade of the `3`):** once the wait-state for that slug is terminal-and-dead (`status: "timeout"`/`"soft-fail"`, or `"armed"` with `now >= deadline`) and a genuine post-hoc monitor for the slug exists, `/run-plan`'s owed-close HITL applies — `Adopt existing monitor` (into `/plan-review-triage`, closes as reviewed-by-adoption) or `Ack owed without review` (closes as acked/unreviewed); a duplicate re-arm against already-merged work is not the only route. Queue-end triage lists still exclude dead-timeout rows by default; adoption is operator-initiated per row. ADR: `2026-07-30_audits-pty-progress-gate-zombie-policy.md`; wait resume: `2026-08-13_audits-atomic-wait-reviewer-fallback.md`; owed-close: `.cursor/memory/errors/2026-08-14_audit-owed-ledger-no-close-path.md`.

### External plan review (legacy heading)

Expand Down
Loading