用途:把捆绑的 Claude autopilot 文件安装到目标仓库本地的 .claude/ 目录,使该仓库具备自动保持会话运行的能力。安装是仓库本地的,不依赖 ~/.claude/,也不应安装或更新全局 Claude 设置。
主要能力:安装后写入 .claude/hooks/autopilot-keep-running.sh、.claude/hooks/session-start.sh、.claude/commands/autopilot_reset.md,并安全更新 .claude/settings.json 以接入仓库本地钩子。session-start.sh 会把 Claude 的 session_id 持久化到 /tmp/claude-current-session-id 并暴露 CLAUDE_SESSION_ID;autopilot-keep-running.sh 需在 Stop 钩子链中首先运行,管理 /tmp/claude-autopilot-* 下的会话文件。空闲检测通过指纹化 git 状态,在 CLAUDE_AUTOPILOT_IDLE_THRESHOLD 个未变化回合后释放 autopilot,默认 3。后期监控使用 CLAUDE_AUTOPILOT_MONITORING_THRESHOLD 与 CLAUDE_AUTOPILOT_DELAY 转入较慢轮询。在 max turns - 2 时临时让出,以便下游审查钩子运行。若 CLAUDE_AUTOPILOT_STOP_FILE 存在则立即释放。
使用方式:默认目标为当前工作目录;用 --target-repo /absolute/or/relative/path 指定其他仓库。安装入口示例:python3 skills/autopilot/scripts/install_repo_local_autopilot.py;若已复制该技能包,则运行复制后的安装脚本路径并加 --target-repo。安装后可用 /autopilot_reset 重置当前会话回合计数,/autopilot_reset stop 在下一回合停止,/autopilot_reset status 查看当前会话,/autopilot_reset status-all 查看所有被跟踪会话。
限制与依赖:运行时依赖 jq 以及 shasum 或 sha256sum 用于空闲状态哈希,安装器会预检并在缺少必需命令时明确失败。安装器会保留无关钩子、避免重复条目,仅在缺失时设置 AUTOPILOT_KEEP_RUNNING_DISABLED=0 与 CLAUDE_AUTOPILOT_MAX_TURNS=20。无效的目标 .claude/settings.json 会明确报错而非被覆盖。