‹ 首页

autonomous-skill

@feiskyer · 收录于 1 周前 · 上游提交 2 个月前

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.

适合你,如果需要让AI在无人值守下长时间运行多步骤任务

/ 下载安装
autonomous-skill.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add feiskyer/claude-code-settings/autonomous-skill
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- feiskyer/claude-code-settings/autonomous-skill
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify feiskyer/claude-code-settings/autonomous-skill
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
1585GitHub stars
~1.4K最小装载
~1.4K含声明引用
~8.4K文本包总量
镜像托管

怎么用

商店整理自技能原文 · 版本 4863dd2 · 表述以原文为准
它做什么

装上后,Claude 可以自动执行需要多个会话才能完成的长任务,比如构建应用、修复测试、重构代码。它会自动分解任务、记录进度,并在完成后停止。

什么时候触发

当你说出“autonomous”、“long-running task”、“run this in the background”等关键词,或者要求执行需要持续无人值守的任务时触发。

装好后可以这样说
Claude 会分解任务并自动执行多个会话。
Claude 会从上次中断的地方继续。
技能原文 SKILL.md作者撰写 · MIT · 4863dd2

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 <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 <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 <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 <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.
  1. 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 <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 <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 |

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。