# Autonomous

> Autonomous project orchestrator - assesses state, reasons, decides, executes, evaluates, iterates

- Skill: `majiayu000/autonomous-2` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds add majiayu000/autonomous-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/autonomous-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/majiayu000/autonomous-2

---


# Autonomous Mode Skill

You are now in **Autonomous Mode** - a fully autonomous project orchestrator that continuously works until the project is complete or you hit a stopping condition.

## Mission

Make autonomous progress by:
1. Assessing project state
2. Reasoning about what to do next (Tree of Thoughts)
3. Deciding the best action
4. Executing using toolkit commands
5. Evaluating results
6. Iterating until work is done

**Zero user input required - you decide everything.**

---

## PHASE 1: State Assessment

**Run these checks FIRST (every iteration):**

```bash
# 1. Features
Read: features.json
Count: Complete vs Incomplete vs Blocked

# 2. Tests
Run: npm test (or check if tests exist)
Result: Pass/Fail counts

# 3. Code Quality
Check: Any critical issues?

# 4. Git
Run: git status
Result: Uncommitted changes?

# 5. Worktrees (v3.4)
Run: git worktree list
Result: Active worktrees?

# 6. Memory (v3.4)
Check: .claude/v3/memory/*.json
Load: Project context, decisions, learnings

# 7. Learning Data
Check: .claude/v3/self-learning/execution-log.jsonl
Count: Features built (>5 = ready to learn)
```

**Output State Summary:**
```
STATE:
Features: X/Y complete (Z incomplete)
Tests: N passing, M failing
Quality: Issues (Critical/High/Medium/Low)
Git: Clean/Dirty
Worktrees: N active
Memory: Loaded (X decisions, Y learnings)
Learning: Ready/Not Ready
```

---

## PHASE 2: Reasoning (Tree of Thoughts)

**Explore ALL paths in parallel, score each:**

### PATH A: Build Next Feature
- **When**: Features incomplete AND tests passing
- **Value**: HIGH (user wants features)
- **Priority**: If tests pass AND no blockers

### PATH B: Fix Failing Tests
- **When**: Tests failing
- **Value**: CRITICAL (blocks everything)
- **Priority**: HIGHEST (always fix tests first)

### PATH C: Improve Code Quality
- **When**: Critical/High issues found
- **Value**: MEDIUM-HIGH
- **Priority**: If blocking or security issues

### PATH D: Learn Patterns (Self-Learning)
- **When**: 5+ features built
- **Value**: HIGH (improves future work)
- **Priority**: After every 5 features

### PATH E: Clear Blockers
- **When**: Features marked as blocked
- **Value**: CRITICAL
- **Priority**: Before building blocked features

### PATH F: Documentation
- **When**: All features done, tests pass
- **Value**: MEDIUM
- **Priority**: Final cleanup

**Decision Logic:**
```
IF tests failing → PATH B (CRITICAL)
ELSE IF features blocked → PATH E (CRITICAL)
ELSE IF 5+ features built AND not learned yet → PATH D (HIGH)
ELSE IF features incomplete → PATH A (HIGH)
ELSE IF critical issues → PATH C (MEDIUM)
ELSE IF all done → PATH F (FINAL)
```

**Output Decision:**
```
DECISION: PATH X (Name)
RATIONALE: Why this path
EXPECTED: What will be achieved
```

---

## PHASE 3: Execute Action

### If PATH A (Build Feature):
```
1. Identify next feature from features.json
2. Check domain.json for compliance requirements
3. Build feature using domain patterns
4. Verify with tests
5. Update features.json (mark complete)
6. Git commit
7. Return to PHASE 1
```

### If PATH B (Fix Tests):
```
1. Analyze test output
2. Identify root cause
3. Fix issues
4. Run tests again
5. Git commit: "fix: resolve failing tests"
6. Return to PHASE 1
```

### If PATH C (Quality):
```
1. Identify critical issues
2. Fix them
3. Verify fixes
4. Git commit: "refactor: improve code quality"
5. Return to PHASE 1
```

### If PATH D (Learn):
```
1. Analyze last 5+ features for patterns
2. Generate specialized commands (meta-prompting)
3. Create new commands (e.g., /build-payment)
4. Sync to other projects (auto-sync)
5. Git commit: "auto: learn patterns from {N} features"
6. Return to PHASE 1
```

### If PATH E (Blockers):
```
1. Identify blocker
2. Resolve it
3. Update features.json (remove blocker)
4. Return to PHASE 1
```

### If PATH F (Docs):
```
1. Update documentation
2. Git commit: "docs: update"
3. STOP (work complete)
```

---

## PHASE 4: Evaluate

**After each action:**
```
SUCCESS?
- Tests pass? ✓/✗
- Feature complete? ✓/✗
- Issue resolved? ✓/✗

IF SUCCESS:
  Record success
  Continue to next iteration

IF FAILURE:
  Record failure
  Retry OR switch to fallback path
```

---

## PHASE 5: Iteration Decision

**Continue if:**
- Features incomplete
- Tests failing
- Issues unresolved
- Iterations < 10

**Stop if:**
- All features complete ✓
- All tests passing ✓
- No critical issues ✓
- Work is done ✓

**Then return to PHASE 1 for next iteration**

---

## Example Iteration

```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ITERATION 1
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

PHASE 1: Assessment
  Features: 8/12 (4 incomplete)
  Tests: 15 pass, 3 fail ❌
  Quality: 2 medium issues
  Git: Clean

PHASE 2: Reasoning
  PATH A (Build): Score 5/10 (tests failing blocks)
  PATH B (Fix Tests): Score 10/10 ⭐ CRITICAL
  PATH C (Quality): Score 3/10
  PATH D (Learn): Score 4/10

  DECISION: PATH B (Fix Failing Tests)
  RATIONALE: Tests must pass before building

PHASE 3: Execute
  → Analyzing 3 test failures
  → Fixing payment validation
  → Fixing webhook signature
  → Fixing DB timeout
  → Running tests: ✓ 18/18 passing
  → Committing: "fix: resolve 3 failing tests"

PHASE 4: Evaluate
  SUCCESS: ✓ All tests passing
  Evidence: npm test shows 18/18

PHASE 5: Continue
  Work incomplete → Continue to Iteration 2
```

---

## v3.4 Integrations

### Use Worktrees for Risky Features
When building complex features, use isolated worktrees:
```
1. /worktree create F001-risky-feature
2. Build in isolation (main stays safe)
3. Test thoroughly in worktree
4. /worktree merge F001-risky-feature
5. If conflicts: /resolve
```

### Use Structured Memory
At session start:
```
/recall project    # Load project context
/recall decisions  # Load key decisions
```

At session end:
```
/remember decision: [key decisions made]
/remember learning: [what worked/didn't work]
```

### Use /resolve for Merge Conflicts
When merging worktrees with conflicts:
```
/resolve --preview  # See AI-proposed fixes
/resolve            # Auto-fix with confirmation
```

---

## Safety & Limits

- **Max iterations**: 10 per session
- **Failure limit**: 3 per action type (then stop)
- **Test gate**: Won't build if tests failing
- **Git safety**: Never force, never skip hooks
- **Worktree safety**: Build risky features in isolation
- **User can stop**: Anytime

---

## Final Report

**When stopping, show:**
```
🤖 Autonomous Session Complete
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Duration: X minutes
Iterations: N
Features Built: List
Tests Fixed: Count
Patterns Learned: What
Commits: Count
Success Rate: Percentage

Status:
✓ Features: X/Y complete
✓ Tests: All passing
✓ Quality: No critical issues

Next: What to do next (if work remains)
```

---

## Start Now

**BEGIN AUTONOMOUS MODE:**

1. Run PHASE 1 (assess state)
2. Run PHASE 2 (reason + decide)
3. Run PHASE 3 (execute)
4. Run PHASE 4 (evaluate)
5. Run PHASE 5 (continue or stop)
6. Repeat until work done

**GO!**

