
Autonomous
Switch a Claude Code session between full autonomous execution and stricter copilot-style checkpoints using persisted session-state modes.
Overview
Autonomous is a journey-wide agent skill that switches Claude Code sessions between autonomous and copilot modes via shared session-state bash helpers—usable whenever a solo builder needs to choose how much human gating
Install
npx skills add https://github.com/camacho/ai-skills --skill autonomousWhat is this skill?
- Bash wrappers around shared `session-state` helpers for atomic writes and mode reads
- Explicit `autonomous` vs `copilot` setter with usage validation and exit codes
- Blocks copilot mode when `CLAUDE_CODE_REMOTE` is set
- Session-directory resolution with graceful handling when autonomous mode has no active session dir
- Exports `is_copilot`, `is_copilot_strict`, and `expire_if_stale` for hooks and aliases
- 2 modes: autonomous and copilot
- Usage: set-mode accepts exactly one of autonomous|copilot
Adoption & trust: 574 installs on skills.sh; 1 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You want the same repo hooks to run hands-off agent work sometimes and tighter copilot checkpoints other times, but mode logic is scattered or not persisted per session.
Who is it for?
Indie builders maintaining a camacho/ai-skills-style hook stack who need a single, scriptable autonomy toggle tied to session directories.
Skip if: Teams without shell hooks or session-state layout in the repo, or anyone who only needs one-off chat instructions with no persisted agent mode.
When should I use this skill?
You need to set or read persisted autonomous vs copilot mode for the current agent session via repo hooks.
What do I get? / Deliverables
Session state records `autonomous` or `copilot` consistently so hooks and aliases can branch on `get_mode`, `is_copilot`, and strict copilot checks for the rest of the session.
- Updated session mode on disk
- Hook-visible mode helpers for autonomous/copilot branching
Recommended Skills
Journey fit
Useful at every journey phase - explore requirements and options before committing to a direction.
Where it fits
Enable autonomous mode before a long refactor so hooks stop pausing on every file touch.
Switch to copilot before merging or touching auth so the agent waits for explicit approval.
Run autonomous for log-triage fixes locally, then copilot when editing live infra scripts.
Use copilot during spike coding so scope changes stay visible between tool calls.
How it compares
Session-mode infrastructure for local agent hooks—not a replacement for product feature flags or cloud deployment pipelines.
Common Questions / FAQ
Who is autonomous for?
Solo and indie builders using Claude Code (or similar) with repo-local hooks who want persisted autonomous vs copilot execution modes.
When should I use autonomous?
During build when wiring agent hooks; during ship when you want review-gated copilot for risky changes; during operate when running iterative fix loops—any phase where how much the agent runs unsupervised matters.
Is autonomous safe to install?
It is shell-level session control that can change how aggressively your agent acts; review the Security Audits panel on this page and read which hooks invoke `set-mode.sh` before enabling autonomous on production or destructive tasks.
SKILL.md
READMESKILL.md - Autonomous
#!/usr/bin/env bash # mode.sh — Skill-owned wrappers around session-state mode helpers. _mode_script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)" _mode_repo_root="$(cd "$_mode_script_dir/../../../.." && pwd -P)" # shellcheck source=../../../../scripts/lib/session-state.sh source "$_mode_repo_root/scripts/lib/session-state.sh" atomic_write() { session_state_atomic_write "$@"; } _resolve_session_dir() { session_state_resolve_session_dir "$@"; } expire_if_stale() { session_state_expire_mode_if_stale "$@"; } get_mode() { session_state_get_mode "$@"; } set_mode() { session_state_set_mode "$@"; } is_copilot_strict() { session_state_is_copilot_strict "$@"; } is_copilot() { [ "$(get_mode)" = "copilot" ]; } #!/usr/bin/env bash # set-mode.sh — Shared mode setter for autonomous/copilot aliases and hooks. set -euo pipefail requested_mode="${1:-}" if [ "$#" -ne 1 ] || { [ "$requested_mode" != "autonomous" ] && [ "$requested_mode" != "copilot" ]; }; then echo "Usage: $0 <autonomous|copilot>" >&2 exit 2 fi script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)" # shellcheck source=mode.sh . "$script_dir/mode.sh" if [ "$requested_mode" = "copilot" ] && [ -n "${CLAUDE_CODE_REMOTE:-}" ]; then echo "Cannot enter copilot mode in a remote session." >&2 exit 1 fi session_dir=$(_resolve_session_dir 2>/dev/null || true) if [ -z "$session_dir" ] || [ ! -d "$session_dir" ]; then if [ "$requested_mode" = "autonomous" ]; then echo "Session dir not found; autonomous mode is assumed by default." >&2 else echo "Session dir not found — bootstrap may not have run. Restart Claude Code." >&2 exit 1 fi else now=$(date +%s) if [ "$requested_mode" = "copilot" ]; then set_mode copilot "$((now + 14400))" "$((now + 43200))" else set_mode autonomous fi fi # Audit log — .claude/.state/ is gitignored; ensure it exists before append # so fresh checkouts (e.g., CI) don't fail the redirect under set -e. repo_root="$(cd "$script_dir/../../../.." && pwd -P)" main_worktree="$(git -C "$repo_root" worktree list --porcelain 2>/dev/null | head -1 | sed 's/^worktree //')" if [ -n "$main_worktree" ]; then mkdir -p "$main_worktree/.claude/.state" 2>/dev/null || true if [ "$requested_mode" = "copilot" ]; then echo "$(date -u +%Y-%m-%dT%H:%M:%SZ) copilot activated [pid: $PPID]" >> "$main_worktree/.claude/.state/mode-log" 2>/dev/null || true else echo "$(date -u +%Y-%m-%dT%H:%M:%SZ) autonomous restored [pid: $PPID]" >> "$main_worktree/.claude/.state/mode-log" 2>/dev/null || true fi fi echo "$requested_mode" --- name: autonomous description: Exit copilot mode — return to autonomous mode with full worktree enforcement. user_invocable: true --- # Return to Autonomous Mode > **Claude Code enforcement only** — Codex and Cursor default to autonomous unless a future adapter uses this shared controller. > Shared mode controller: `.agents/skills/autonomous/scripts/`. ## Shared Controller Mode is a setting with explicit values: `autonomous` and `copilot`. For now, this skill owns the shared mode controller because `autonomous` is the default and safe fallback value. `/copilot` is an alias that sets `mode=copilot`; it should not own separate mode logic. - `.agents/skills/autonomous/scripts/mode.sh` is the sourceable mode facade for all agents and hooks. - `.agents/skills/autonomous/scripts/set-mode.sh` sets `mode=autonomous` or `mode=copilot`. - `scripts/lib/session-state.sh` remains project infrastructure because status, detection, bootstrap, and hook code all use it. ## Activate ```bash REPO_ROOT="$(git rev-parse --show-toplevel)" "$REPO_ROOT/.agents/skills/autonomous/scripts/set-mode.sh" autonomous ``` If the script does not exist, tell the user: "This project doesn't have mode switching scripts. You are already in autonomous mode by default." ## Confirmation After activation, print: ``` Mode: autonomous Worktree enforcement active. Full workflow pipeline. ``` ## Behavior Follow **autonomous