Skip to content

Add the engine executor skill and publish it as a plugin - #4

Merged
dinoderek merged 3 commits into
mainfrom
feat/executor-skill
Oct 20, 2026
Merged

dinoderek merged 3 commits into
mainfrom
feat/executor-skill

Conversation

@dinoderek

Copy link
Copy Markdown
Owner

Objective

Add the engine executor skill. It runs one task card to a merged PR, hands-off or gated, from an issue card or a repo card file. engine becomes a Claude Code plugin marketplace that publishes it. The skill becomes the single source for the executor's steps, claim comment, ruling format and hard-stop classes. docs/execution-protocol.md and AGENTS.md now cite it.

This is the first of the two engine PRs in the agreed split. The next PR adds engine labels sync and the PreToolUse merge guard. The Gnocchi pilot waits for the operator to pick a feature.

Gates

Lane Result Evidence
./dev test (every required lane) PASS .test-ai-results/summary.md on bea8ddc: format, vet, lint, unit, coverage, file-length, imports, versions and docs-check all PASS
  • New or changed tests: devtools/internal/checks/docs_test.go covers budget-only rows:
    • a budget-only file over its own budget fails;
    • a budget-only file over the default budget fails;
    • a tracker reference in a budget-only file is still caught;
    • a budget row for a missing budget-only file is flagged as stale;
    • a malformed budget-only row is rejected;
    • a draft under a budget-only prefix stays rule-free;
    • the passing tree prints the budget-only count.
  • claude plugin validate . and claude plugin validate plugins/engine both pass.
  • Not run, with reason: none.

Rulings

Agreed with the operator in the design session:

Ruling (risk: med): The executor skill is the single source for the executor's steps, claim, ruling format and hard-stop classes; execution-protocol.md and AGENTS.md cite it.
Why: a session in a target repo can read the plugin, not engine's docs; one place per fact.
If wrong: move the sections back into execution-protocol.md; touches SKILL.md and two docs.
Decided by: operator
Ruling (risk: med): plugins/ is a new `budget-only` docs-registry row kind, and the executor skill gets a 1500-word budget.
Why: a skill is not a doc (no header or index row, and it cites paths in other repos), but it must not bloat.
If wrong: drop the row kind; touches docs.go, its tests and doc-budgets.tsv.
Decided by: operator
Ruling (risk: low): Hosts have logical names (mac, devbox) in ~/.config/engine/host. An SSH host's `address` stays in config and is never posted.
Why: the operator doesn't want hostnames or IPs in claims.
If wrong: change the claim's Host source; touches the skill and hosts-and-sessions.md.
Decided by: operator
Ruling (risk: low): Sessions started by hand make `gh` calls as the machine user (GH_TOKEN from the token file). git push uses the checkout's own credentials.
Why: GitHub doesn't notify you of your own activity, so hard-stop @mentions would be silent.
If wrong: drop the token prefix from the skill.
Decided by: operator
Ruling (risk: low): task-protocol stays in agent-skills until the consumers switch after the pilot.
Why: it keeps this PR small; the operator had no preference.
If wrong: bring it across in a later PR; no code is affected.
Decided by: operator

Made in this PR:

Ruling (risk: low): A kickoff with no mode runs gated; `engine start` will pass hands-off.
Why: a session started by hand defaults to the safe mode.
If wrong: one line in the skill.
Ruling (risk: low): A draft under a budget-only prefix stays rule-free (ephemeral wins).
Why: drafts follow no rule; the reference check already skips them.
If wrong: one switch case in loadDocs.
Ruling (risk: low): The claim's first step checks state labels (failed included), blockers, the host file, the token and the labels before changing anything. A run that loses a claim race deletes its own claim.
Why: an environment stop before claiming must not leave a running label without a claim, and the registry must not show two claims.
If wrong: reorder step 1.
Ruling (risk: low): The marketplace and the plugin are both named `engine`, version 0.1.0, and the skill is `engine:executor`. The task-issue template is Markdown, not a GitHub form, with no "Depends on" section.
Why: short, unreserved names. The planner can write the same Markdown body with `gh issue create`. Dependencies live only in "blocked by".
If wrong: rename in the manifests and settings.
Ruling (risk: low): The host config example gains `kind = "ssh"` and `address` for devbox, and coordinator.md SSHes to `<address>`.
Why: it separates the logical name from how engine reaches the host.
If wrong: doc-only.

Review

  • Fresh reviewer: Claude Code (Agent SDK subagent), Claude Opus 5.5.
    • Round 1: Verdict: CHANGES_REQUESTED, with 5 blocking findings and 12 nits.
    • Round 2: Verdict: APPROVED, with one nit (a malformed-row test that passed regardless), fixed in bea8ddc.
  • Declined findings: one. The reviewer suggested tightening AGENTS.md workflow step 6 to "never enable auto-merge". Declined: that is the operator's own rule and theirs to change. An explicit operator approval outranks the skill anyway, and the next PR's merge guard blocks --auto mechanically. The reviewer accepted the decline.
  • Review hard:
    • devtools/internal/checks/docs.go: the loadDocs precedence between budget-only, ephemeral and exempt, and the stale-row check.
    • plugins/engine/skills/executor/SKILL.md: the label transitions in step 1, step 9 and "Hard stops" against the States table in docs/execution-protocol.md.
    • docs/execution-protocol.md: what stayed and what moved to the skill.

Deviations

  • A new docs-registry row kind: budget-only plugins/. It exempts skills from the header, index-row and path checks, while keeping a word budget. This is a gate change; the operator agreed it in the design session ("we want a budget for the skill too").

🤖 Generated with Claude Code

dinoderek and others added 3 commits October 20, 2026 19:53
The executor runs one task card to a merged PR, hands-off or gated, from an
issue card or a repo card file. It now owns the executor's steps, claim
comment, ruling format and hard-stop classes; execution-protocol.md cites it.

- engine is a Claude Code marketplace with the `engine` plugin, enabled in
  this repo's .claude/settings.json.
- A task-issue template with one section per card field.
- docs-check gains `budget-only` rows: a skill keeps a word budget but needs
  no header, index row or path checks.
- Hosts have logical names (`mac`, `devbox`) in ~/.config/engine/host; an SSH
  host's address stays in config and is never posted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…refs

- A hard stop swaps whichever state label is current, running or in-review,
  and restores it; the States table says so and that todo is no label.
- The claim checks state labels (failed included), blockers, the host file,
  the token and the labels before changing anything; a lost claim race
  deletes its own claim.
- ruling-review is added whenever a med/high ruling is made; issue-only
  bookkeeping is scoped to issue cards; repo cards check dependencies.
- SSH lines use the host's address; project-context's header and the PR
  template's ruling format match the skill.
- docs-check: drafts stay rule-free under a budget-only prefix; tests for a
  stale budget-only row, a malformed row and the overlap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dinoderek
dinoderek merged commit 176d976 into main Oct 20, 2026
1 check passed
@dinoderek
dinoderek deleted the feat/executor-skill branch October 21, 2026 08:56
dinoderek added a commit that referenced this pull request Nov 23, 2026
…nit, and the upgrade's config rule (#320)

## Objective

Acceptance of restart resilience: each objective O1–O13 is checked against the tests that prove it and, where a real run was possible, against a run on the real fleet (devbox, the Linux server host; the Mac, a session host) with throwaway "hold" tasks. Two docs that the runs showed wrong or incomplete are fixed. The diff is docs only: the existing tests already cover every objective (map below), so this PR adds no test.

## Gates

| Lane | Result | Evidence |
| --- | --- | --- |
| `./dev test` (every required lane) | PASS | local run 2026-11-23T22:00:43Z on this head, all 10 lanes PASS under `umask 022`; CI on this head: [gates run](https://github.com/dinoderek/engine/actions/runs/45278480709), PASS |

- New or changed tests: none. The diff changes `docs/recovery.md` and `docs/operator-setup.md` only.
- Not run, with reason: none. Note: under this session's umask `0077`, `TestTrustFolderKeepsEverythingElse` and `TestEditFileRetriesThenGivesUpOnABusyFile` fail on main as well (file modes), so the gate was run under `umask 022`, as CI's default umask is.

## Evidence per objective

Update numbers are the engine server's update sequences. Attempts are `a<n>`. Hold A, B and C are the throwaway tasks. The run's raw files are kept on devbox in `~/.local/state/engine-acceptance/restart-resilience/`.

| Obj. | Tests (`./dev test`) | Real run |
| --- | --- | --- |
| O1 claimed death resumes | `internal/control/vanish_test.go` TestTheVanishRule, TestReconcileResumesClaimedDeathsUntilTheCap; `internal/controlrun/early_test.go` TestASessionThatClaimedItsTaskResumesAfterItsDeathsUntilTheCap; `internal/controlrun/hold_test.go` TestResumeDispatchesAgainAsAResumeOfTheKeptBranch | **Pass.** 17:22:41Z `tmux kill-window` on Hold B (a432, claimed). 3450: ended `vanished`, `crashed` (1 of 3); 3451: "the task stays resumable and is dispatched again as a resume"; 3452: resume a434 in the same worktree. |
| O2 host-wide loss | `internal/control/hostloss_test.go` (all, incl. negatives); `internal/controlrun/tmuxloss_test.go`; `internal/remote/ssh_test.go` TestSSHRefusesAStatusWithoutATmuxStartTime | **Pass, twice.** 17:26:39Z `tmux kill-server` on the Mac (Hold A a431, Hold C a433, plus two non-engine sessions). 3465/3466: both `vanished`, `host_lost`, uncounted, no per-task notice; 3467/3469: resumes a435/a436. A second, unplanned `tmux kill-server` on the Mac at 17:29:20Z, run by mistake by the operator's supervisor and recorded by them in 3481, ended the new tmux server with the resumed a435/a436. It was read the same way: 3478/3479, `vanished`, `host_lost`, uncounted, resumes a437/a438. It is not row 9's evidence. The operator's inbox holds exactly two host notices, "mac's tmux restarted; 2 tasks will resume": 3464 at 17:26:51 and 3477 at 17:29:25, one per kill, and no per-task death notice (3680, 3685). |
| O3 cap | `internal/control/vanish_test.go`; `internal/control/early_test.go`; `internal/control/planner_test.go`; `internal/controlrun/early_test.go` (notice with the last two tails) | Tests only, by design (plan Testing rows 2–3). |
| O4 CLI retry | `internal/controlcmd/retry_test.go`; `internal/pane/pane_test.go` TestThePromptHooksSynchronousPostIsBoundedWithTheServerDown | **Pass.** Unit stopped 17:28:33–17:29:23Z. A session `engine tell` sent 10 s into the outage printed one line, "engine server unreachable; retrying until 17:30:13 (request key b376…2def)" (its start plus 90 s), and landed at 17:29:30 as 3480. |
| O5 outage wake | `internal/controlrun/outage_test.go`; `internal/control/outage_test.go` | **Pass.** Unit stopped 17:29:55–17:36:36Z. Idle Hold B got one wake, "The engine server was unavailable from 2026-11-23T17:29:56Z to …", answered in 3484. A busy session was not woken. |
| O6 unit check | `internal/setup/unit_test.go` | **Pass (read-only).** Setup on devbox during the upgrades: "server unit: ok (engine-server.service enabled, restarts, lingers; the session tmux is outside it)". |
| O7 tmux outside the unit | `internal/session/tmuxscope_test.go`; `internal/hostops/tmuxunit_test.go` | **Pass.** devbox's live tmux, started inside the unit before this change, was moved into its own scope first (below). Then 6 unit stops kept every devbox window and the tmux start time: upgrades at 09:09 and 16:56 (the latter run by the operator's supervisor, 3412), rows 9 and 10, `systemctl --user restart` at 17:39:16Z, and the 19:12 upgrade. |
| O8 upgrade mid-plan | `internal/upgrade/upgrade_test.go`; `internal/control/upgrade_test.go`; `internal/controlrun/upgrade_test.go`; `internal/harness/codex/retain_test.go` | **Pass.** Three upgrades ran with tasks busy, the last (19:11–19:19Z) with Hold B's session and another plan's live planner running (Hold C was `running` with no live session, awaiting its resume, which reached devbox at 19:16:25: O10). No window died: the planner's window closed at 19:16, after the server returned, because it finished (3578). After `finish`, every throwaway task reached done by 19:27:44Z (dinoderek/engine-acceptance#1–#4, the last the plan's closing task), and the throwaway plan is done. The start and end marks were refused, because the upgrade ran with an execution credential (the operator chose that, 3261). |
| O9 unreachable host | `internal/control/unreachable_test.go`; `internal/controlrun/unreachable_test.go` | **Pass.** 17:43:01Z devbox's ssh to the Mac was blocked. 17:43:19 host status: mac unreachable. The operator confirmed one fleet question for the Mac, no earlier than 17:58:19Z, holding no task, with wait, move and stop as its choices (3680, 3685), and answered "move" (pane message 3506). |
| O10 move, pause, resume | `internal/controlcmd/move_test.go`, `hostpause_test.go`; `internal/control/move_test.go`, `hostpause_test.go`; `internal/controlrun/move_test.go` | **Pass.** 18:05:17 3503/3504: both Mac attempts ended `moved` ("… its old session there may still push. Its window is released when the host answers"). Resume a440 on devbox (3507). After the block was lifted at 18:05:41, the Mac's old windows were released by 18:06:11, with the worktrees kept and clean. Hold C's resume, a452, waited, as devbox's 3 slots were full and the Mac paused, and was dispatched on devbox at 19:16:25, as the other plan's planner window closed (the slot cause is inferred, not read). `engine host resume mac` at 19:20, run with the operator credential as the operator directed in 3521, returned `"paused": false`. |
| O11 limit choice | `internal/control/limitask_test.go`; `internal/reconcile/limitchoice_test.go`; `internal/controlrun/limitask_test.go` | Tests only, by design (no real-run row). |
| O12 watcher, server status/restart | `internal/watch/watch_test.go`, `main_test.go`; `internal/serverops/serverops_test.go` | **Pass.** The Mac's launchd watcher logged each failed check and reached `{"failures":8,"alerted":true}`, then `{"failures":0,"alerted":false}` once the server answered. The operator confirmed on Telegram one alert listing `engine server status` and `engine server restart`, then one recovery message (3680, 3685). |
| O13 hung session | `internal/controlrun/quiet_test.go`; `internal/reconcile/quiet_test.go`; `internal/hostops/activity_test.go` | **Tests only (operator).** A `kill -STOP` on Hold B at 17:47:21Z did not hold (ps read `Ssl+` right after, and the session posted 3499 at 17:47:25), so no quiet stretch arose. The operator then skipped the live run (3521, 3524). |
| Stale index lock | `internal/session/adopt_integration_test.go` TestCreateWorktreeRemovesAStaleIndexLockOnAdopt | Tests only. The host reboot was not run (below). |

**Preparation (approved in 3253).** devbox's tmux server (pid 2506755) and its pipe-pane loggers had started inside `engine-server.service` under the old build. They were moved into a transient scope with `busctl … StartTransientUnit … PIDs`, which killed nothing (3255). `docs/recovery.md` now documents this step.

**Not run.** The host reboot (row 12): the operator skipped it (3515, 3517) because devbox's root is on LUKS, so an unattended reboot may stop at the passphrase prompt with the server down. The reboot path rests on rows 8–11: a host with no tmux server read as one loss, and the unit coming back. An isolated engine instance was not used: the session tmux uses the default socket and every state path is under HOME, so an instance would need a separate HOME, which loses the harness and `gh` sign-ins, and it would not exercise the real unit or the second host.

## Rulings

Ruling (risk: low): no new test; every objective already has its proof in `./dev test` (table above).
Ruling (risk: low): the docs name `busctl … StartTransientUnit` with `PIDs` for moving a live tmux out of the unit; it ends no window, unlike the `tmux kill-server` that the `tmux_unit` reason names.
Operator answers followed: 3253 (moving devbox's tmux), 3261 (deploy with config edit and an execution credential), 3436 (operator-credential reads), 3446/3447/3458/3460 (rows 1 and 8), 3506 (the fleet question's "move"), 3680/3685 (the Telegram messages, host notices and fleet question confirmed), the pane authorization 3462 (unit stops, the cut-off, SIGSTOP), 3515 (skip the reboot), 3521/3524 (O13 tests-only, then row 13; 3521 also directed `engine host resume mac` with the operator credential).

## Review

- Fresh reviewer: Claude Code, claude-opus-5-5, a fresh session each round, `build` skill review mode. Round 1: CHANGES_REQUESTED (PR body: an ID-like label, the unconfirmed Telegram delivery, an uncited answer; all fixed). Round 2: CHANGES_REQUESTED (the Telegram delivery had no operator decision; the operator confirmed it, 3680/3685). Round 3: APPROVED, with one optional fix applied (check the unit with `systemd-cgls`, since `tmux_unit` reads the server pid alone). Round 4: CHANGES_REQUESTED (the second Mac kill was uncited by name; fixed above with 3481), with optional fixes applied (name the `unit` and `pid` to move, a restart ends the windows too, §1 points at §2, the Deviations line on the pane authorization). Round 5: CHANGES_REQUESTED (the Gates row cited the run on the previous head; it now cites the run on this head; and the O8 row overstated Hold C, reworded). Round 6: CHANGES_REQUESTED (the host resume was a state change with the operator credential, uncredited; it now cites 3521; and Hold C's later resume is stated), with its optional fixes applied (`ps` shows each pid's parent; what to do on `tmux_unit_error`). Round 7, on this head: **APPROVED**, no must-fix; its optional citation of the 16:56 upgrade (3412) applied to this body.
- Declined findings: listing more preflight refusals in operator-setup.md (rounds 1 and 4): the text claims no completeness, the others print their own reason, and the doc is at 1709 of its 1710-word budget, so it would need a budget raise. Rewording "an unreachable or open host" (round 3): the same budget. A per-server scope name instead of `engine-tmux.scope` (round 4): with mode `fail` a clash refuses and ends nothing, and one move per unit is the case. "Runs inside" for "started inside" in recovery.md step 1 (round 5): both are true of the case it names, so the head was left as reviewed. Round 7's optional wording (a pid source for the `tmux_unit_error` case; "changes nothing" beside `--dry-run`): left, keeping the approved head.
- Review hard: `docs/recovery.md` §2 "Run" step 1 (the busctl line must match systemd's StartTransientUnit signature, and the claim that it ends nothing); `docs/operator-setup.md` "Upgrading" (each refusal it names must be one of `internal/upgrade/preflight.go`'s; the list is not complete).

## Deviations

- devbox's `~/.config/engine/config.toml` `[server]` changed from `url` to `host = "devbox"` so the upgrade could run (3261). This is host config, not repo.
- A temporary `~/.ssh/config` on devbox (17:43:01–18:05:41Z) blocked ssh to the Mac for the cut-off, under the operator's pane authorization (3462). It was deleted after.
- The card asks for an `engine ask` before each destructive run. Rows 1 and 8 had one each (3446/3447, 3458/3460). Rows 9–11, the cut-off and the SIGSTOP ran under one pane authorization from the operator instead (3462), after the permission hard stop it answered.
- Follow-ups for the operator, not in this PR: the upgrade's preflight does not refuse while `tmux_unit` is reported; the Mac's setup stays OPEN at the Codex daemon step after each upgrade; the `tmux_unit` reason text (`internal/hostops/tmuxunit.go`) still recommends `tmux kill-server`, not the move; under umask `0077` two file-mode tests fail.

Harness and model: Claude Code, claude-opus-5-5.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_012F3VVEvpwUs9kd61mNLrbv
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.

1 participant