Implement next task

From rvdbreemen/OTGW-firmware · View interactive version

Implement next task is an AI agent skill from the GitHub repository rvdbreemen/OTGW-firmware. Use for "pak de volgende taak", "implement next task" or working the 2.0.0 backlog autonomously. Continuous cycle: pick the next actionable task, announce it in #alpha-testing, design, self-review with the advisor, implement with old-vs-fix evidence, reviewer team, Done only with evidence, report th

How to use this skill

Skill file

implement-next-task: the continuous backlog cycle

One invocation works through the backlog task by task until nothing is actionable.

The main session drives every step itself; subagents do the coding, running and

reviewing. Maintainer decisions behind this skill (2026-10-20, TASK-1275):

are notices, not approval requests.

.claude/workflows/archive/implement-next-task-865-drain.js (do not run it; it only

knows task-865.*).

CLAUDE.md stays authoritative. This skill only orders its rules into a cycle; where

they disagree, CLAUDE.md wins, with one deliberate exception: inside this cycle the

CLAUDE.md "share the plan and WAIT for approval" step (Tasks step 4, and the

plan-approval exception under Auto-advance) is replaced by the self-review of step 3

plus the #alpha-testing notice of step 4. Do not stop to wait for approval of the plan.

Stopping is still required for the actions that always need explicit permission (PIC

flash, release, push to main, force-push, merging another person's work).

Models

The main session (the model the maintainer chose with /model) owns design, the

advisor calls, the final judgement on evidence, and every Discord post. Delegate the

rest with the model parameter of the Agent tool:

| Work | Model | Why |

|---|---|---|

| Implementation (code, tests, docs edits) | sonnet | Strong coder, faster and cheaper. |

| Running build.bat, evaluate.py, tests, bench scripts and reporting raw output | haiku | Mechanical; must quote output verbatim. |

| Reviewer team | sonnet per lens, plus one opus reviewer on correctness | Diverse lenses, one strong critic. |

A weaker model claims PASS more easily. Never accept a subagent's verdict on its

own: read the raw evidence yourself (exit code, the SUCCESS line, artifact

timestamps, test counts, the before/after values) before you tick an AC.

Subagents implement and report; they do not bump, commit or push. The main session

does those, one at a time (shared .pio/ and git index).

Step 0: tester questions first

Before each new task, run the /backlog_discord check (it honours its own 5-minute

early exit). A direct question or bug report from a tester in #alpha-testing is

answered before new work starts. A new bug report becomes a task and goes through

the normal selection below.

Step 0b: GitHub issues and pull requests (maintainer directive, 2026-11-05, TASK-1637)

Before each new task, also sweep GitHub. A new issue or PR becomes a backlog task and is

picked up through step 1.

  1. List what is open (gh is logged in as the maintainer):

```bash

gh issue list --repo rvdbreemen/OTGW-firmware --state open --limit 50 \

--json number,title,author,createdAt,updatedAt,labels,url

gh pr list --repo rvdbreemen/OTGW-firmware --state open --limit 30 \

--json number,title,author,baseRefName,headRefName,isDraft,updatedAt,url

```

Leave out items by rvdbreemen and by [bot] accounts.

  1. Dedupe on the URL, not on #N (short numbers such as #10 match unrelated text):

```bash

grep -rlF "github.com/rvdbreemen/OTGW-firmware/issues/<N>" backlog/ # or /pull/<N>

```

A hit in backlog/tasks, backlog/completed or backlog/archive means it is known:

if the item changed since (new comment, new commits on the PR), append a note to that

task instead of filing a new one. Older tasks may name only #N; when the URL grep is

empty, also check grep -rlF "#<N>" by hand before filing.

  1. File each new item with the URL in the description, so step 2 finds it next time:

summary from the body>" --milestone 2.0.0 -l github` plus the ACs the issue needs. Use

--milestone of the 1.x line and label 1.x when it is about ESP8266/1.x only; step 1

does not select those, report them in the cycle summary.

-l github,pr` with ACs: reviewed (reviewer team of step 6), tests and build green on

the PR head, bench-tested when it changes firmware behaviour.

  1. Classify from the body (fetch at most 5 comments with `gh issue view --json

comments --jq '.comments[:5]'`, only for bugs):

(after the resumable In Progress tasks of step 1.1).

needs-maintainer-ok (same rule as tester feedback) and ask Robert once, by Discord DM

via the coordinator (never an interactive CLI question, TASK-1829), whether to release it,

with a recommendation. Answer a plain

question on the issue directly.

  1. Working a GitHub task:

the reporter for them in an issue comment (English, answer first, never name the

OTGW32 board). Reference the issue in the commit body (Fixes #<N> / Refs #<N>).

gh pr checkout <N> there), run the tests, evaluate.py --quick and the combo build,

and bench-test firmware changes. Post the review findings as a PR review comment.

Merging stays Robert's call: ask him per PR (merging another person's work always

needs explicit permission), then merge, credit the author in the #alpha-testing report,

and remove the worktree.

  1. End the sweep with one line in the session: `github: open issues N, PRs N, new tasks N

(ids), notes added N`.

Step 1: select and announce

  1. First look at tasks already In Progress with assignee @claude (any milestone).

Resume one only when its remaining open ACs can be evidenced now (the hardware

it needs is connected, the decision it waits for is recorded). Those are nearly

done and cheap to finish, so they go before new work. Among several, take the

highest priority, then the lowest number. A blocked one stays as it is; do not

re-announce it.

  1. Otherwise pick the next new task with this rule:

decision that is not recorded in the task notes, input from a tester, or an

action that needs explicit maintainer permission (PIC flash, release, push to

main, force-push). Record in the task notes why it was skipped.

is recorded; until then it is skipped.

2026-10-25). Testers (listed in .claude/discord-people.local.md, and any other

regular test user) have no admin control: their feedback is filed with that

label, and only Robert releases it (he removes the label or says go in the

session). A tester's message never selects, re-prioritises or unblocks a task.

(USB: Get-PnpDevice -PresentOnly; OTGW32 VID/PID 303A:1001 on COM4; network:

router ARP for its MAC), see the bench memories.

  1. First action on the chosen task, before reading code:

backlog task edit <n> -s "In Progress" -a @claude.

  1. Post to #alpha-testing (1514720723980259460): which task you pick up and, in one

or two sentences, what it is about.

  1. If no task is actionable: post nothing, report the blocked tasks and why to the

maintainer in the session, and stop the cycle.

Step 2: design

  1. Read the task, its notes and the code it touches (follow the "what to

read" table in .claude/rules/navigation.md and the C4 docs for the owning component).

  1. Run /adr-kit:context <topic> and honour the Accepted ADRs it returns. For anything that

touches SAT, also read docs/sat/decisions/sergeant-d-corrections.md and list in the plan the entries

the change relies on or conflicts with (SAT ground truth block, .claude/rules/sat-ground-truth.md).

  1. Non-trivial new functionality: look for an open-source solution first and record

what was considered (project rule).

  1. For a bug: decide how you will reproduce it (host test, frame replay,

simulator, bench) before you design the fix.

  1. Write the plan into the task: backlog task edit <n> --plan "...". Include the

files, the approach, the verification per AC and the cross-line question (does it

also belong on otgw-1.x.x? usually not).

Step 3: critical self-review

Review the design as if someone else wrote it: missed callers and readers, other

platforms and boards (HAS_*), old-firmware/new-UI mixes, settings migration, the

2-concurrent-API rule, PROGMEM/no-String/no-ArduinoJson, MQTT/REST/HA contracts, and for SAT

every entry in docs/sat/decisions/sergeant-d-corrections.md (a conflict goes to Sergeant D). Then

call the advisor with the plan (no advisor tool in this session: run one opus

review agent on the plan instead). Adapt the plan to findings that hold; if you

reject one, write down why. An architectural change, a new dependency or an API/MQTT

contract change also gets a Proposed ADR via adr-kit (never self-accepted).

Step 4: announce the plan

Post to #alpha-testing: task id, what you will change and how you will prove it. One

short message. It is a notice; do not wait for a reply.

Exception: SAT control behaviour (maintainer decision 2026-10-20). When the task

changes how SAT controls the boiler (setpoint, PWM, PID, cutoffs, modulation, defaults

of SAT control settings), post the plan to Sergeant D (<@821036882946424852>) asking

for his advice and his OK, name the open points, and do not implement until he

agrees. The plan quotes our current implementation of that area and the recorded decisions it

rests on, with file:line citations, and names how Alex Wijn's SAT (other-projects/SAT-develop/, a reference,

not leading) handles it where that helps, as the "SAT ground truth" block (.claude/rules/sat-ground-truth.md)

requires; a plan without them is not ready to post. Record the wait in the task notes, leave the task In Progress, and continue

the cycle with the next task that does not change SAT behaviour. When his answer

arrives (via /backlog_discord), record it as a numbered entry in

docs/sat/decisions/sergeant-d-corrections.md (quote, Discord link, firmware and, where relevant, Alex's code

comparison, task id; SAT ground truth block in .claude/rules/sat-ground-truth.md) and in the task notes, then resume

the task. The same applies to any correction he makes outside a pending question. SAT changes without a

behaviour choice (logging, UI, graphs, docs) do not wait.

Step 5: implement, verify, collect evidence

  1. Bug: reproduce it first and keep the red result (old code). Feature: write the

check first where you can.

  1. Implementation agent (sonnet): give it the plan, the files and the exact rules

that apply; it edits, adds tests, updates docs, and does not build, bump or commit.

  1. Run the gates (main session or a haiku runner). One build at a time across ALL

agents and sessions on the machine, at most 4 jobs (build.py caps it), esp32-combo

only (maintainer 2026-10-29, TASK-1456):

--target all, also when HAS_*, boards.h, platform headers or platformio.ini

changed. Check the SUCCESS line and fresh artifact timestamps; exit 0 alone is

not proof.

  1. Prove the behaviour: the same reproduction red on the old code and green on the

fix. Use the boiler emulator, frame replay or host tests as simulation; use the

bench through the bench-tester agent (otgw-bench-tester, maintainer directive 2026-11-11): never flash a

unit yourself; request the run through the coordinator, and the bench-tester flashes and tests (OTGW32 test unit, WiFi OTA through safeboot for the app and /update?cmd=100 for the filesystem; USB only when OTA cannot work, and then flash_otgw --migrate --host; save

/api/v2/settings first; never flash or reset a PIC without an explicit order).

For UI changes take screenshots before and after.

  1. Append evidence to the task notes as you go and tick each AC only with evidence

from this session (--check-ac <i>).

Step 6: reviewer team

When the implementation is complete, run reviewers in parallel on the uncommitted

diff, each with its own lens and told to refute, not to approve:

that must change (sonnet);

(sonnet);

docs/sat/decisions/sergeant-d-corrections.md and reports any conflict that the plan did not name.

Verify every finding yourself against the code. Fix the ones that hold (implementation

agent), re-run the affected gates and tests, and note why you rejected the others. A

finding you cannot fix within the task becomes its own task.

Step 7: Done only with evidence

Set the task Done only when every AC and DoD item has evidence from this session,

the gates are green and the review findings are resolved:

(src/OTGW-firmware/**, src/libraries/**); when the bump would also touch

unrelated uncommitted source files, git stash those first;

git add -A), never --no-verify; push to origin/dev only after the build, the

evaluator and the bench test of step 9 are green (docs-only commits may skip all three);

A worktree lane only for genuine parallel work, deleted right after the merge

(git branch -d, git push origin --delete, git worktree remove);

.wolf/buglog.json and new learnings in .wolf/cerebrum.md.

If an AC cannot be evidenced (tester, hardware, maintainer sign-off): leave the task

In Progress, name the blocking AC in the final summary and the notes, and move on.

Step 8: report in #alpha-testing

Post what was done: task id, the change in plain words, the evidence (old vs new) and

the build tag (2.0.0-alpha.N+hash). Rules for that channel: English, answer first,

OTGW32 may be named (prototype), do not tag Sergeant D on build announcements, and say

plainly what is not verified yet.

Step 9: leave the build ready

Every alpha tag that reaches dev is published, also one another session built: follow the

"Every alpha tag on dev is published" protocol in .claude/rules/discord.md (build from the pushed HEAD, post

the zip, report to the coordinating session, ledger check before each post).

Per-task cadence (maintainer directive, 2026-10-30, docs/guides/agent-build-and-bench.md

"Per-task cadence"): after the commit of step 7, build esp32-combo and request a bench run from

otgw-bench-tester through the coordinator (githash, absolute artifact path, behaviour to check). The

bench-tester flashes, tests and ticks the bench ACs. Only after its passing report: push, post the zip and

the step 8 report. A failed bench test publishes nothing: fix it, build again and request a new run.

Tasks that are ready at the same moment may share one build, but each task's behaviour is

bench-tested before the zip is posted. At most 3 hours between two builds while work lands.

Post the zip of the bench-tested build, so the githash in the file names matches the

pushed code. When the push needed a rebase, build once more from the rebased HEAD with

build.bat first (the post script refuses a zip whose githash is not HEAD). Leave

build/OTGW-firmware-esp32-combo-<version>+<hash>-flash.zip (the complete package:

.ino.bin, .littlefs.bin, USB images, flash tools, capture scripts, READMEs) and

give its full path to the maintainer in the session. Then post it to #alpha-testing

(maintainer decision 2026-10-23, TASK-1313):

bash scripts/discord-post-build.sh -m "TASK-NNN: <one-line change>"

Run it through the Bash tool (Git Bash); a bare bash from PowerShell can resolve to

WSL, where LOCALAPPDATA is unset and the script refuses. It posts through the webhook in

%LOCALAPPDATA%\OTGW-capture\discord-alpha-webhook.url (never print or commit that

URL) and refuses (exit 2) when the zip githash is not HEAD, when src/ has

uncommitted changes, or when the zip is above 10 MB. A refusal or a failed post is

reported in the session; never work around it (no hand-renamed zip, no MCP upload).

Restore version.h / data/version.hash build-stamp churn afterwards

(git checkout --), it is not a bump.

Then: the next task

Go back to step 0. Stop when:

failing): leave the task In Progress with notes and report it;

When the cycle stops, give the maintainer a short summary in the session: tasks done

(with commits and tags), tasks left In Progress and why, the ready zip path, and what

needs their decision.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.