/agent-loop:loop-tickfrom agent-loop
Run ONE tick of a self-evolving agent-loop. Reads the loop's JSON state (its entire prior context), executes the profile's tick body (research / experiment / build / maintenance), and journals one record that sets the next directive. Use when a loop's scheduled wake fires, the user says "/loop-tick <id>", "tick the loop", or "run the next iteration". A tick is a pure function from (state + new data) to (action + new state + one record).
Ships in agent-loop. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Run one tick of loop <id>. You are a stateless agent; the substrate is your only memory. A tick is
(state.json + new data) -> (action + new state + one log record).
This loop is autonomous: you decide and act, no human in the inner loop. Three hard rules override everything below:
/deep-research to investigate an open question, /plan-decompose to turn a goal into milestones,
/test-driven-development + /code-standards to write code, /debugging-and-error-recovery when something
breaks, /grill-ai + /doubt-driven-development to critique, /self-evolve + /author-skill to improve
yourself — plus whatever skills the host repo provides. If you keep hand-rolling the same step, that's the
signal to /author-skill it into a reusable one (see rule below + the self-evolve / author-skill skills)./grill-ai (adversarial self-critique: ask AND answer from the evidence) before you commit it. The
more consequential or surprising the call, the harder you grill. Routine idle ticks don't need it; every
decision that changes the verdict does.Show your work — never go silent. Before each heavy step (observe / critique / build / verify / journal) emit a
breadcrumb: python3 .loop/loop.py phase <id> "<what you're about to do>" — it prints ▸ <step>, and
tail -f .loop/<id>/progress.log lets anyone watch a headless/auto run step through in real time. Also narrate the
step in your own output before a long tool call (an SSM command, a build, a subagent) so a tick never feels stuck.
python3 .loop/loop.py state <id>
python3 .loop/loop.py tail <id> 3
python3 .loop/loop.py check <id>
state.next is your directive; state.gate is what "good" means; state.triggers route the work.
state.success is the machine-checkable DONE predicate. If it's empty, defining one (act.success_add: [{check,kind,desc}]) is your FIRST job — a loop with no success predicate cannot know it's finished and runs
forever. If it's set and the goal may now be met, run python3 .loop/loop.py done <id>: loop.py RUNS the
checks as an external oracle (never your say-so) and, if all pass, records a verified completion and stops the
loop. Don't hand-assert "done" — let done adjudicate it.
Act on mechanical advisories. status/check surface two signals you MUST respond to this tick, not next:
STALL: N working ticks no progress → you're circling (same verdict/change/next repeating); CHANGE APPROACH —
zoom out, re-read state.goal, try a different move; do NOT repeat the last one. (soft = adjust; HARD =
escalate: re-decompose / different strategy / human-gate.) REPLAN: backlog drained but goal not complete →
your milestones didn't reach the goal; re-run /plan-decompose into NEW milestones — do NOT declare done.
Don't repeat past work — the tail is short, the ledger is your long memory. You only see tail 3, so
BEFORE starting anything check the durable, always-in-state.json indices: backlog (done?), prereg
(resolved?), and decided (already explored / killed / tombstoned?). If it's in decided, build on the
verdict — do NOT redo it. Whenever you settle something (path explored, hypothesis killed, milestone shipped,
tombstone), record it via act.decided_add:[{key,verdict,why}] with a STABLE key — that's how a tick 50
cycles later, far past the tail, knows not to repeat it. If genuinely unsure, do a TARGETED grep of
log.archive.jsonl (not a full read).state.profile):
/deep-research: DECOMPOSE the question → parallel subagent sweep per angle →
TRIANGULATE (≥2 independent sources) → REFUTE (/grill-ai + /doubt-driven-development) → SYNTHESIZE
(cited, confidence) → COMPLETENESS-CRITIC → loop until saturation. Record findings in decided (no re-search).state.gate/prereg → CRITIQUE (cost-gated: only on
new data / anomaly → /grill-ai + a general-purpose subagent with an adversarial prompt, or your critic
agent if the environment has one, + /doubt-driven-development) → ACT (check preregs; bar-clear → flag
human; deadline no-clear → tombstone). Pre-register any NEW threshold BEFORE peeking./plan-decompose the goal into milestones first. Then: PICK the current
milestone → IMPLEMENT via /test-driven-development, following /code-standards (simplicity-first,
surgical, senior-engineer bar) → VERIFY with REAL
checks the builder didn't write: a deterministic mechanical check (compile / test / run the command) is
enough on its own; for judgment-heavy acceptance (does it read well? is it correct in spirit?) use a
SEPARATE agent so the builder never grades its own work → FIX → INTEGRATE → mark milestone done./code-standards (touch only what it needs, match style) → FULL
existing suite green before AND after (regression gate); on regression → revert, log why, do not ship.python3 -c so quotes/newlines/unicode can't break it (a raw echo '{…}' is fragile):
python3 -c 'import json;print(json.dumps({"observe":{...},"decide":{...},"act":{...},"next":"..."}))' \
| python3 .loop/loop.py append <id>
optional in act: config (merge), prereg_add / prereg_resolve, backlog_add / backlog_done,
manual_step (when you hand-roll an ad-hoc step — a multi-line command/heredoc you wrote inline rather
than a skill — tag it with a stable kebab signature = the skill it would become, e.g. recorder-shadow-tally.
The helper counts it; once seen ≥3× and not yet a config.skill, status/check surface it as an
AUTHOR-SKILL trigger. That's the mechanical, no-vibes signal to /author-skill it next self-evolve).
The helper stamps cycle+ts, updates state.last, and sets state.next — the directive the NEXT tick reads.
That is the re-evolution.
FORCED VERIFY: if this record marks anything DONE (backlog_done, or a done-ish verdict in decided_add),
you MUST run the real check first and include a top-level "verify": {"check":"<command/test run>", "result":"pass|partial|fail","evidence":"..."} — the helper rejects the append otherwise, and rejects
result:"fail". Done is a verified fact, never a claim. Example:
python3 -c 'import json;print(json.dumps({"observe":{...},"decide":{...},
"act":{"backlog_done":["M1"]},"verify":{"check":"cargo test -p strategy","result":"pass",
"evidence":"31 passed; 0 failed"},"next":"..."}))' | python3 .loop/loop.py append <id>
Monitor tailing a log, or a cron heartbeat).
state.dispatch is the profile default; OVERRIDE per tick by what's actually true now (e.g. a maintenance loop
is event when idle but flips to loop while draining fixes; an experiment loop is schedule but loop-bursts
when new data lands). Persist the choice by adding a top-level "dispatch": "loop"|"schedule"|"event" to the
append record (so list/status show the CURRENT mode)./loop-tick:
loop → run the next tick immediately, in this same turn (continue working; don't stop). If a Stop-hook
autonomous loop is armed (loop.py auto), do the tick's HEAVY work in a subagent and return only a small
result — the session is reused across iterations, so keeping each turn tiny is what keeps the loop token-cheap.schedule → schedule a self-wake to run the next tick after the interval: ScheduleWakeup (in-session,
self-paced) or a cron (CronCreate / system cron / CI calling /loop-tick <id>, durable across sessions).event → arm a wake on the signal: the Monitor tool tailing the relevant log/output, or a cron heartbeat.
Only stop and ask the human at a real gate — real money, prod deploy, external publish, spending,
destructive/irreversible ops. Everything else: decide and proceed.file:line / data / a passing command / a memory slug. No assertion
without a source.PARTIAL / UNKNOWN — needs X. Report
failures and skipped steps plainly. A confident wrong answer is the worst outcome.code-review/pr-review-toolkit.) Better to
surface 3 verified findings than 30 noisy maybes./self-evolve to improve the loop's OWN
machinery (gate/triggers/profile), graduate lessons to memory, and /author-skill any step that keeps recurring.state.goal and confirm the current work still serves it; go up a layer (map the relevant
modules/callers) before drilling further. Cheap insurance against a long autonomous run optimizing the
wrong thing. (Principle from mattpocock/skills zoom-out, MIT.)state.json + tail (never the whole log); cost-gate the critique; in an armed
in-session loop, delegate heavy work to a subagent so the reused session context stays small. For long
unattended runs, prefer a cron firing fresh /loop-tick processes (zero carry-over) over a long in-session burst.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub andonmitev/agent-loop --plugin agent-loop11 skills in this plugin
/author-skillAI-first authoring of a NEW agent skill, autonomously (no human review). Used by self-evolve when a manual step recurs across loop cycles — writes a correctly-structured SKILL.md with frozen, checkable, AI-first instructions, places it in the skills dir, validates it, and wires it into the flow so the loop invokes it next time. Use when the loop identifies a proven recurring pattern worth turning into a reusable capability./code-standardsEngineering standards every code-writing tick must follow so the loop produces GOOD code, not just working code. Invoked by build/maintenance ticks before and while editing code. Composes with (never overrides) the host project's CLAUDE.md / AGENTS.md./