The archetypes and shadows are distinctive enough — no need for a fancy name on top of the standard PDCA cycle terminology.
164 lines
5.6 KiB
Markdown
164 lines
5.6 KiB
Markdown
---
|
|
name: autonomous-mode
|
|
description: Use when the user wants to run ArcheFlow orchestrations unattended — overnight sessions, batch processing multiple tasks, or fully autonomous coding. Handles self-organization, progress logging, and safe stopping.
|
|
---
|
|
|
|
# Autonomous Mode
|
|
|
|
ArcheFlow orchestrations can run fully autonomously because the archetypes self-organize through the PDCA cycle. The user sets the task queue, walks away, and reviews results later.
|
|
|
|
## How Autonomous Mode Works
|
|
|
|
The PDCA cycle provides natural quality gates at every turn of the spiral:
|
|
- **Plan** phase produces a proposal — reviewable artifact
|
|
- **Do** phase produces committed code in a worktree — isolated, reversible
|
|
- **Check** phase produces approval/rejection — automatic quality control
|
|
- **Act** phase either merges (safe) or cycles back (self-correcting)
|
|
|
|
No unreviewed code reaches the main branch. Ever. That's what makes overnight runs safe.
|
|
|
|
## Starting an Autonomous Session
|
|
|
|
```
|
|
You are entering AUTONOMOUS MODE.
|
|
|
|
Task queue:
|
|
1. "Add input validation to all API endpoints" (thorough)
|
|
2. "Refactor auth middleware to use JWT" (standard)
|
|
3. "Fix pagination bug in search results" (fast)
|
|
4. "Add rate limiting to public endpoints" (standard)
|
|
|
|
Rules:
|
|
- Process tasks sequentially (one orchestration at a time)
|
|
- Log progress to .archeflow/session-log.md after each task
|
|
- If a task fails after max cycles: log findings, skip to next task
|
|
- If 3 consecutive tasks fail: STOP and wait for user
|
|
- Commit and push after each successful merge
|
|
- Never force-push. Never modify main history.
|
|
```
|
|
|
|
## Session Log — Full Visibility
|
|
|
|
Every autonomous session writes to `.archeflow/session-log.md`:
|
|
|
|
```markdown
|
|
# ArcheFlow Autonomous Session
|
|
**Started:** 2026-04-02 22:00 UTC
|
|
**Mode:** autonomous
|
|
**Tasks:** 4 queued
|
|
|
|
---
|
|
|
|
## Task 1: Add input validation to all API endpoints
|
|
**Workflow:** thorough | **Status:** COMPLETED
|
|
**Cycles:** 2 of 3
|
|
**Cycle 1:** Guardian REJECTED (missing sanitization on 2 endpoints)
|
|
**Cycle 2:** All APPROVED
|
|
**Files changed:** 8 | **Tests added:** 24
|
|
**Branch:** merged to main (commit abc1234)
|
|
**Duration:** 12 min | **Completed:** 22:12 UTC
|
|
|
|
---
|
|
|
|
## Task 2: Refactor auth middleware to use JWT
|
|
**Workflow:** standard | **Status:** COMPLETED
|
|
**Cycles:** 1 of 2
|
|
**Cycle 1:** All APPROVED (clean implementation)
|
|
**Files changed:** 5 | **Tests added:** 15
|
|
**Branch:** merged to main (commit def5678)
|
|
**Duration:** 8 min | **Completed:** 22:20 UTC
|
|
|
|
---
|
|
|
|
## Task 3: Fix pagination bug in search results
|
|
**Workflow:** fast | **Status:** COMPLETED
|
|
**Cycles:** 1 of 1
|
|
**Cycle 1:** Guardian APPROVED
|
|
**Files changed:** 2 | **Tests added:** 3
|
|
**Branch:** merged to main (commit ghi9012)
|
|
**Duration:** 4 min | **Completed:** 22:24 UTC
|
|
|
|
---
|
|
|
|
## Task 4: Add rate limiting to public endpoints
|
|
**Workflow:** standard | **Status:** FAILED (max cycles)
|
|
**Cycles:** 2 of 2
|
|
**Cycle 1:** Skeptic REJECTED (Redis dependency not in Docker setup)
|
|
**Cycle 2:** Guardian REJECTED (race condition in token bucket)
|
|
**Unresolved:** Race condition in concurrent token bucket decrement
|
|
**Branch:** archeflow/maker-xyz (NOT merged — available for manual review)
|
|
**Duration:** 15 min | **Completed:** 22:39 UTC
|
|
|
|
---
|
|
|
|
## Session Summary
|
|
**Completed:** 3 of 4 tasks
|
|
**Failed:** 1 (rate limiting — needs human input on concurrency design)
|
|
**Total duration:** 39 min
|
|
**Files changed:** 15 | **Tests added:** 42
|
|
**Ended:** 22:39 UTC
|
|
```
|
|
|
|
## Safety Mechanisms
|
|
|
|
### Automatic Stop Conditions
|
|
The session halts and waits for the user when:
|
|
- **3 consecutive failures:** Something systemic is wrong
|
|
- **Destructive action detected:** Force push, branch deletion, schema drop
|
|
- **Shadow escalation:** Same shadow detected 3+ times across tasks
|
|
- **Budget exceeded:** If cost tracking is enabled, stop at budget limit
|
|
- **Test suite broken:** If existing tests fail after merge, halt immediately and revert
|
|
|
|
### Everything is Reversible
|
|
- Code changes live on worktree branches until explicitly merged
|
|
- Merges use `--no-ff` — every merge commit is individually revertable
|
|
- The session log captures every decision for post-hoc review
|
|
- Failed tasks leave their branches intact for manual inspection
|
|
|
|
### User Controls
|
|
The user can at any time:
|
|
- **Cancel:** Kill the session. All incomplete work stays on branches.
|
|
- **Pause:** Stop after current task completes. Resume later.
|
|
- **Skip:** Skip the current task, move to the next one.
|
|
- **Review:** Read `.archeflow/session-log.md` for real-time progress.
|
|
- **Intervene:** Jump into a worktree branch and fix something manually.
|
|
|
|
## Task Queue Formats
|
|
|
|
### Simple (inline)
|
|
```
|
|
Tasks:
|
|
1. "Fix the login bug" (fast)
|
|
2. "Add user profile page" (standard)
|
|
```
|
|
|
|
### From File
|
|
Create `.archeflow/queue.md`:
|
|
```markdown
|
|
- [ ] Fix the login bug | fast
|
|
- [ ] Add user profile page | standard
|
|
- [ ] Security audit of payment flow | thorough
|
|
- [x] Refactor database queries | standard (completed)
|
|
```
|
|
|
|
### With Dependencies
|
|
```markdown
|
|
- [ ] Add user model (standard)
|
|
- [ ] Add user API endpoints (standard) | depends: user model
|
|
- [ ] Add user UI (standard) | depends: user API endpoints
|
|
```
|
|
Dependencies are processed in order. Parallel-safe tasks run concurrently.
|
|
|
|
## Overnight Session Checklist
|
|
|
|
Before starting an autonomous overnight session:
|
|
|
|
1. **Clean working tree:** `git status` — no uncommitted changes
|
|
2. **Tests passing:** Run the full test suite. Don't start on a broken baseline.
|
|
3. **Task queue defined:** Either inline or in `.archeflow/queue.md`
|
|
4. **Workflow selected per task:** Match risk level to workflow type
|
|
5. **Budget set (optional):** If cost matters, set a token/dollar limit
|
|
6. **Push access:** Verify git push works (SSH key, auth token)
|
|
|
|
Then: set it, forget it, read the session log in the morning.
|