Interactive claim -> work -> close -> repeat loop in the current session; no daemon, no spawned claude, no busy-poll. Coordinates with using-tasks (.tasks/.lock, session_break gate, 10-min claim TTL -> tasks_heartbeat) and project-discipline (push Rule 4, sensitive artifacts). TDD (writing-skills RED-GREEN-REFACTOR): - RED: 2 clean-context subagents revealed gaps A-E (claim scope, missed session_break + .lock, consult-gate boundary, paused-vs-blocked). - GREEN: SKILL.md addresses all five; compliance subagent B clean. - REFACTOR: closed CronCreate loophole in long-watch (separate session = daemon); mandate ScheduleWakeup on this session. Re-test passed. Semver: 0.1.0 (initial). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4.7 KiB
4.7 KiB
task-loop-skill
Goal
Write a new skill task-loop for interactive Claude Code sessions: the agent in an open
session claims tasks from the board and works them one-by-one in that same session —
no separate daemon, no spawned claude processes. Empty queue → stop and report (never
busy-poll). The skill must coordinate with using-tasks v1.4.0 (session .tasks/.lock,
session_break gate, 10-min claim TTL → tasks_heartbeat) and project-discipline
(push-gate Rule 4, sensitive artifacts).
Key files
skills/task-loop/SKILL.md— the deliverable (to be created)skills/using-tasks/SKILL.md:120-179— session-lock guard + session-break + completion gates the loop must honorskills/project-discipline/SKILL.md— push Rule 4, sensitive-artifact gatesskills/delegate-task/SKILL.md— sibling task-system skill (style reference)- projects-meta tools:
tasks_claim_next(returns slug/weight/claim_token/consult_policy),tasks_close,tasks_update,tasks_heartbeat
Decisions log
Reverse-chronological. Append-only.
- 2026-06-11: RED baseline run (2 clean-context subagents, dry-run, no live tools). Finding: ecosystem already produces mostly-correct behavior (no busy-wait on empty, pointed heartbeat, parks blocked tasks, push only on grant). Real gaps the skill must close: (A) claim scope diverged — agent-1 used
filter={}cross-federation, agent-2{project:current}; (B) both missed session-break gate between tasks; (C) both ignored.tasks/.lock; (D) autonomy vs sensitive-gate boundary unclear — agent-1 injected an unasked confirmation stop on a CI task; (E) paused vs blocked — spec said paused, agent-2 choseblockedfor an external blocker (more correct). - 2026-06-11: Design resolutions (recommend-don't-menu, no user objection to proposal):
- Scope default = current project (
filter={project:<current>}); multi-project only via explicit arg / POLLER_PROJECTS. - Autonomy gate via
consult_policyfrom claim:auto→full autopilot;human-only/strict-human→do the work but STOP before the irreversible step (commit/close) to consult.weight:needs-humannever reaches the loop (server excludes from autonomous claim). Push never automatic (project-discipline Rule 4). - Failed task: external/unresolvable blocker →
tasks_update status=blocked+ blocker note (frees claim, don't leave hanging, don'tclose, roll back partial work); interrupted/resumable-by-me →status=paused. (Refines acceptance #3 literal "paused".) - Empty queue → STOP + report.
ScheduleWakeupONLY on explicit "работай пока не скажу стоп", interval ≥1200s. - session-break: after each close, BEFORE next claim, honor
using-taskssession_break marker → STOP. Loop delegates this gate, doesn't reimplement. - Heartbeat: single task expected >~8 min →
tasks_heartbeat(slug, claim_token).
- Scope default = current project (
Open questions
- Sensitive-task confirmation driven by
consult_policy(the contract) + project-discipline push-gate for the riskiest step — NO blanket overlay. Resolved: compliance test B confirmed thehuman-onlygate stops before close/commit correctly; push stays ask-mode regardless. consult_policy=auto means autopilot through close (push still needs a grant).
Completed steps
- Claimed task (meta status=active, commit
9168a14), synced local - Read mandatory skills: writing-skills, test-driven-development
- Recon: skills/ layout, heartbeat refs, using-tasks session-lock section, claim/close tool schemas
- RED baseline: 2 subagents, gaps A–E documented above
- GREEN: wrote skills/task-loop/SKILL.md v0.1.0 (desc trimmed of workflow summary per CSO rule)
- GREEN compliance: 2 subagents. B (blocked/consult/break) PERFECT — all gaps A–E fixed (scope=current, human-only→stop-before-close, session_break halts drain, external→blocked not close, empty→stop). A (scope/empty/watch) clean EXCEPT chose CronCreate for long-watch → loophole.
- REFACTOR: long-watch carve-out reworded to mandate ScheduleWakeup (same session) and forbid CronCreate (separate session=daemon) always; core/What-NOT/red-flags aligned. Re-test PASSED — agent picks ScheduleWakeup 1800s, rejects CronCreate with correct reasoning.
- Acceptance 1-6 all met (see commit). TDD cycle RED→GREEN→REFACTOR complete.
Notes
heartbeat-side-channelskill referenced in acceptance #4 does NOT exist — resolved by documentingtasks_heartbeatusage directly.- Installed
~/.claude/skills/using-tasksappears older than repo source (no session-lock) — deployment gap, not this task's concern. Write the skill against the repo source (v1.4.0). - Notify target on close: OpeItcLoc03/workshop.