autonomous-skill
Execute long-running, multi-session tasks autonomously using Claude Code headless mode or in-session hook-based loops. Supports structured task decomposition (for complex projects) and lightweight Ralph-style iteration (for TDD, bug fixing, refactoring). Use this skill whenever the user says "autonomous", "long-running task", "multi-session", "run this in the background", "keep working on this", "batch process", "iterate until done", "ralph loop", or wants any task that requires sustained, unattended execution.
What this skill does
# Autonomous Skill - Multi-Session Task Execution
Execute complex tasks across multiple Claude Code sessions with automatic continuation,
progress tracking, and two completion mechanisms (promise tags + checkbox counting).
## Two Execution Modes
### Headless Mode (default)
Spawns `claude -p` child sessions in a bash loop. Best for background/unattended work.
```bash
bash <skill-dir>/scripts/run-session.sh "Build a REST API" --max-sessions 10
```
### Hook Mode (in-session)
Uses a Stop hook to intercept session exit and feed the prompt back. Runs inside
the current interactive session — no nesting issues.
```bash
bash <skill-dir>/scripts/setup-loop.sh "Build a REST API" --max-iterations 10
```
## Two Task Strategies
### Structured (default)
Full task decomposition: Initializer creates `task_list.md` with phased sub-tasks,
Executor picks up and completes them one by one. Best for complex, multi-phase projects.
```bash
bash <skill-dir>/scripts/run-session.sh "Build a REST API for todo app"
```
### Lightweight (`--lightweight`)
Ralph-style iteration: same prompt repeated each session, no task decomposition.
Best for iterative tasks with clear success criteria (TDD, bug fixing, refactoring).
```bash
bash <skill-dir>/scripts/run-session.sh "Fix all failing tests in src/" --lightweight
```
## Completion Detection
Two complementary mechanisms — whichever triggers first wins:
1. **Promise tags** (both modes): The agent outputs `<promise>DONE</promise>` when
work is genuinely complete. Default promise is `DONE`; customize with
`--completion-promise`. The agent is instructed to only output the promise when
the work is truly finished — not to escape the loop.
2. **Checkbox counting** (structured mode only): All `[ ]` items in `task_list.md`
are marked `[x]`.
## Directory Layout
```
project-root/
├── .autonomous/
│ └── <task-name>/
│ ├── task_list.md # Master checklist (structured mode)
│ ├── progress.md # Per-session progress log
│ ├── .mode # "structured" or "lightweight"
│ ├── sessions/ # Transcript logs per session
│ │ ├── session-001.log
│ │ └── session-002.log
│ └── run.lock # Prevents concurrent runs
└── .claude/
└── autonomous-loop.local.md # Hook mode state (when active)
```
## Headless Mode — CLI Reference
```bash
bash <skill-dir>/scripts/run-session.sh "task description" [OPTIONS]
```
| Flag | Description | Default |
|------|-------------|---------|
| `--lightweight` | Ralph-style iteration (no task decomposition) | structured |
| `--task-name <name>` | Explicit task name | Auto-generated |
| `--continue, -c` | Continue most recent or named task | — |
| `--list, -l` | List all tasks with progress | — |
| `--completion-promise TEXT` | Promise phrase for completion | DONE |
| `--max-sessions N` | Stop after N sessions | Unlimited |
| `--max-budget N.NN` | Per-session dollar budget | 5.00 |
| `--model <model>` | Model alias or full name | sonnet |
| `--fallback-model <m>` | Fallback if primary overloaded | — |
| `--effort <level>` | Thinking effort (low/medium/high) | high |
| `--no-auto-continue` | Run one session only | — |
| `--permission-mode <m>` | Permission mode | auto |
| `--add-dir <dirs>` | Extra directories to allow | — |
## Hook Mode — Setup
For in-session loops (no child process spawning):
```bash
bash <skill-dir>/scripts/setup-loop.sh "task description" [OPTIONS]
```
| Flag | Description | Default |
|------|-------------|---------|
| `--mode structured\|lightweight` | Task strategy | structured |
| `--max-iterations N` | Max loop iterations | Unlimited |
| `--completion-promise TEXT` | Promise phrase | DONE |
| `--task-name NAME` | Explicit task name | Auto-generated |
The hook is registered in `hooks/hooks.json`. When active, the Stop hook reads
`.claude/autonomous-loop.local.md` and blocks exit until the promise is detected
or max iterations reached.
To cancel an active hook-mode loop: `rm .claude/autonomous-loop.local.md`
## Workflow Detail
### Structured Mode
1. **Initializer Agent** — analyzes task, creates phased `task_list.md`, begins work
2. **Executor Agent** — reads task list + progress, verifies previous work, completes next task
3. **Auto-Continue** — checks promise tags + checkboxes; if not done, spawns next session
### Lightweight Mode
1. Same prompt fed each iteration
2. Agent sees its previous work in files and git history
3. Iterates until work is complete and promise tag is output
4. No task_list.md — completion is purely promise-based
### When to Use Which
| Scenario | Strategy | Mode |
|----------|----------|------|
| Build a full application | Structured | Headless |
| Fix all failing tests | Lightweight | Either |
| Refactor a module | Lightweight | Either |
| Multi-phase project | Structured | Headless |
| Quick iterative fix | Lightweight | Hook |
| Overnight batch work | Structured | Headless |
## Important Constraints
1. **task_list.md is append-only for completions**: Only change `[ ]` → `[x]`
2. **One runner per task**: Lock file prevents concurrent sessions on same task
3. **Project files stay in project root**: `.autonomous/` is only for tracking
4. **Promise integrity**: The agent must not output `<promise>DONE</promise>` until genuinely complete
5. **Cost awareness**: Default per-session budget is $5. Adjust with `--max-budget`
## Troubleshooting
| Issue | Solution |
|-------|----------|
| "Lock file exists" | Previous run crashed. Remove `.autonomous/<task>/run.lock` |
| Session keeps failing | Check `sessions/session-NNN.log` for errors |
| Nested session error | Script auto-unsets CLAUDECODE; use hook mode as alternative |
| Hook loop won't stop | Delete `.claude/autonomous-loop.local.md` |
| Task not found | Run `--list` to see available tasks |
| Want to restart | Delete the task directory and start fresh |
| Cost too high | Lower `--max-budget` or use `--model sonnet` |
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.