Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .archon/workflows/defaults/archon-adversarial-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ nodes:
- id: adversarial-sprint
depends_on: [init-workspace]
idle_timeout: 600000
model: claude-opus-4-6[1m]
model: opus[1m]
loop:
prompt: |
# Adversarial Development — Sprint Loop
Expand Down
2 changes: 1 addition & 1 deletion .archon/workflows/defaults/archon-feature-development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: |
nodes:
- id: implement
command: archon-implement
model: claude-opus-4-6[1m]
model: opus[1m]

- id: create-pr
command: archon-create-pr
Expand Down
2 changes: 1 addition & 1 deletion .archon/workflows/defaults/archon-fix-github-issue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ nodes:
command: archon-fix-issue
depends_on: [bridge-artifacts]
context: fresh
model: claude-opus-4-6[1m]
model: opus[1m]

# ═══════════════════════════════════════════════════════════════
# PHASE 5: VALIDATE
Expand Down
19 changes: 17 additions & 2 deletions .archon/workflows/defaults/archon-idea-to-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,30 @@ nodes:
command: archon-implement-tasks
depends_on: [confirm-plan]
context: fresh
model: claude-opus-4-6[1m]
model: opus[1m]

# Fail fast if implement-tasks produced zero commits — prevents the
# downstream 5-agent review pipeline from burning tokens against an
# empty branch (the silent-failure cascade).
- id: implementation-gate
bash: |
count=$(git rev-list --count "$BASE_BRANCH"..HEAD 2>/dev/null || echo 0)
if [ "$count" -eq 0 ]; then
echo "BLOCKED: implement-tasks produced zero commits on $(git branch --show-current) vs $BASE_BRANCH"
echo "Skipping validate, finalize-pr, review fan-out, and fix passes."
exit 1
fi
echo "OK: $count commit(s) ahead of $BASE_BRANCH"
depends_on: [implement-tasks]
timeout: 30000

# ═══════════════════════════════════════════════════════════════════
# PHASE 4: VALIDATE
# ═══════════════════════════════════════════════════════════════════

- id: validate
command: archon-validate
depends_on: [implement-tasks]
depends_on: [implementation-gate]
context: fresh

# ═══════════════════════════════════════════════════════════════════
Expand Down
56 changes: 23 additions & 33 deletions .archon/workflows/defaults/archon-piv-loop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,10 @@ nodes:
3. **Read example test files** — understand testing patterns
4. **Check for any recent changes** — `git log --oneline -10`

## Step 2: Determine Plan Location
## Step 2: Plan File Location

Generate a kebab-case slug from the feature name.
Save to `.claude/archon/plans/{slug}.plan.md`.

```bash
mkdir -p .claude/archon/plans
```
Save the plan to `$ARTIFACTS_DIR/plan.md`.
The directory already exists (pre-created by the workflow executor).

## Step 3: Write the Plan

Expand Down Expand Up @@ -282,7 +278,7 @@ nodes:
```
## Plan Created

**File**: `.claude/archon/plans/{slug}.plan.md`
**File**: `$ARTIFACTS_DIR/plan.md`
**Tasks**: {count}
**Files to change**: {count}

Expand Down Expand Up @@ -310,13 +306,9 @@ nodes:

---

## Step 1: Find and Read the Plan
## Step 1: Read the Plan

```bash
ls -t .claude/archon/plans/*.plan.md 2>/dev/null | head -1
```

Read the entire plan file. Also read CLAUDE.md for conventions.
Read `$ARTIFACTS_DIR/plan.md` and CLAUDE.md for conventions.

## Step 2: Process Feedback

Expand Down Expand Up @@ -375,10 +367,10 @@ nodes:
bash: |
set -e

PLAN_FILE=$(ls -t .claude/archon/plans/*.plan.md 2>/dev/null | head -1)
PLAN_FILE="$ARTIFACTS_DIR/plan.md"

if [ -z "$PLAN_FILE" ]; then
echo "ERROR: No plan file found in .claude/archon/plans/"
if [ ! -f "$PLAN_FILE" ]; then
echo "ERROR: No plan file found at $ARTIFACTS_DIR/plan.md"
exit 1
fi

Expand All @@ -403,8 +395,12 @@ nodes:
echo ""
echo "=== PLAN_END ==="

TASK_COUNT=$(grep -c "^### Task [0-9]" "$PLAN_FILE" || true)
echo "TASK_COUNT=${TASK_COUNT:-0}"
TASK_COUNT=$(grep -c "^### Task [0-9]" "$PLAN_FILE" 2>/dev/null || echo "0")
if [ "$TASK_COUNT" -eq 0 ]; then
echo "ERROR: No '### Task N:' sections found in $PLAN_FILE. Plan may be malformed."
exit 1
fi
echo "TASK_COUNT=${TASK_COUNT}"

# ═══════════════════════════════════════════════════════════════
# PHASE 3b: IMPLEMENT — Task-by-Task Loop (Ralph pattern)
Expand Down Expand Up @@ -447,7 +443,7 @@ nodes:
may have changed things. **You MUST re-read from disk:**

1. **Read the plan file** — your implementation guide
2. **Read progress tracking** — check if `.claude/archon/plans/progress.txt` exists
2. **Read progress tracking** — check if `$ARTIFACTS_DIR/progress.txt` exists
3. **Read CLAUDE.md** — project conventions and constraints

### 0.3 Check Git State
Expand Down Expand Up @@ -511,7 +507,7 @@ nodes:
)"
```

Track progress in `.claude/archon/plans/progress.txt`:
Track progress in `$ARTIFACTS_DIR/progress.txt`:
```
## Task {N}: {title} — COMPLETED
Date: {ISO date}
Expand Down Expand Up @@ -552,11 +548,9 @@ nodes:

---

## Step 1: Find and Read the Plan
## Step 1: Read the Plan

```bash
ls -t .claude/archon/plans/*.plan.md 2>/dev/null | head -1
```
Read `$ARTIFACTS_DIR/plan.md` to understand the intended implementation.

## Step 2: Review All Changes

Expand All @@ -581,7 +575,7 @@ nodes:

Fix type errors, lint warnings, missing imports, formatting. Commit any fixes:
```bash
git add -A && git commit -m "fix: address code review findings" 2>/dev/null || true
git add -A && git commit -m "fix: address code review findings" || true
```

## Step 6: Present Review
Expand Down Expand Up @@ -627,11 +621,7 @@ nodes:

## Step 1: Read Context

```bash
ls -t .claude/archon/plans/*.plan.md 2>/dev/null | head -1
```

Read the plan file and CLAUDE.md for conventions.
Read `$ARTIFACTS_DIR/plan.md` and CLAUDE.md for conventions.

## Step 2: Process Feedback

Expand Down Expand Up @@ -710,7 +700,7 @@ nodes:
## Step 1: Push Changes

```bash
git push -u origin HEAD 2>&1 || true
git push -u origin HEAD 2>&1 || echo "WARNING: Push failed — verify remote authentication and branch state before creating the PR."
```

## Step 2: Generate Summary
Expand All @@ -720,7 +710,7 @@ nodes:
git diff --stat $(git merge-base HEAD $BASE_BRANCH)..HEAD
```

Read the plan file and progress tracking for context.
Read `$ARTIFACTS_DIR/plan.md` and `$ARTIFACTS_DIR/progress.txt` for context.

## Step 3: Create PR (if not already created)

Expand Down
19 changes: 17 additions & 2 deletions .archon/workflows/defaults/archon-plan-to-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,30 @@ nodes:
command: archon-implement-tasks
depends_on: [confirm-plan]
context: fresh
model: claude-opus-4-6[1m]
model: opus[1m]

# Fail fast if implement-tasks produced zero commits — prevents the
# downstream 5-agent review pipeline from burning tokens against an
# empty branch (the silent-failure cascade).
- id: implementation-gate
bash: |
count=$(git rev-list --count "$BASE_BRANCH"..HEAD 2>/dev/null || echo 0)
if [ "$count" -eq 0 ]; then
echo "BLOCKED: implement-tasks produced zero commits on $(git branch --show-current) vs $BASE_BRANCH"
echo "Skipping validate, finalize-pr, review fan-out, and fix passes."
exit 1
fi
echo "OK: $count commit(s) ahead of $BASE_BRANCH"
depends_on: [implement-tasks]
timeout: 30000

# ═══════════════════════════════════════════════════════════════════
# PHASE 4: VALIDATE
# ═══════════════════════════════════════════════════════════════════

- id: validate
command: archon-validate
depends_on: [implement-tasks]
depends_on: [implementation-gate]
context: fresh

# ═══════════════════════════════════════════════════════════════════
Expand Down
2 changes: 1 addition & 1 deletion .archon/workflows/defaults/archon-ralph-dag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ nodes:
- id: implement
depends_on: [validate-prd]
idle_timeout: 600000
model: claude-opus-4-6[1m]
model: opus[1m]
loop:
prompt: |
# Ralph Agent — Autonomous Story Implementation
Expand Down
2 changes: 1 addition & 1 deletion .archon/workflows/defaults/archon-refactor-safely.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ nodes:
# ═══════════════════════════════════════════════════════════════

- id: execute-refactor
model: claude-opus-4-6[1m]
model: opus[1m]
prompt: |
You are executing a refactoring plan with strict safety guardrails.
Expand Down
39 changes: 29 additions & 10 deletions .archon/workflows/defaults/archon-workflow-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ nodes:
5. Whether this should be a simple DAG or include a loop node

Be specific and concrete. Each proposed node should have a clear type
(bash, prompt, command, or loop) and a one-line description of what it does.
(bash, prompt, command, script, loop, or approval) and a one-line
description of what it does.
model: haiku
allowed_tools: []
output_format:
Expand Down Expand Up @@ -115,7 +116,7 @@ nodes:

nodes:
- id: node-id-kebab-case
# Choose ONE of: prompt, bash, command, loop
# Choose ONE of: prompt, bash, command, script, loop, approval

# --- prompt node (AI-executed) ---
prompt: |
Expand All @@ -131,6 +132,17 @@ nodes:
# --- command node (references a .archon/commands/ file) ---
command: command-name

# --- script node (TypeScript via bun, or Python via uv — no AI, stdout = $<nodeId>.output) ---
# Use for deterministic data transforms the shell would mangle (JSON parsing, etc.)
script: |
const raw = String.raw`$other-node.output`;
const data = JSON.parse(raw);
console.log(JSON.stringify({ count: data.items.length }));
runtime: bun # required: 'bun' (.ts/.js) or 'uv' (.py)
# deps: [requests] # uv only
# Or reference a named script in .archon/scripts/:
# script: extract-labels # no extension; bun resolves .ts/.js, uv resolves .py

# --- loop node (iterative AI execution) ---
loop:
prompt: |
Expand All @@ -139,17 +151,22 @@ nodes:
max_iterations: 10
fresh_context: true # optional: reset context each iteration

# --- approval node (human gate — pauses workflow) ---
approval:
message: "Review the plan above. Approve to continue."
# capture_response: true # store reviewer comment as $<nodeId>.output

# Common options for all node types:
depends_on: [other-node-id] # DAG edges
when: "$<other-node>.output == 'value'" # conditional execution
trigger_rule: all_success # all_success | one_success | all_done
timeout: 120000 # ms, for bash nodes
timeout: 120000 # ms, for bash and script nodes
```

## Variable Reference
- `$ARGUMENTS` — user's input text
- `$ARTIFACTS_DIR` — pre-created directory for workflow artifacts
- `$<nodeId>.output` — stdout from a bash node or AI response from a prompt node
- `$<nodeId>.output` — stdout from a bash/script node or AI response from a prompt node
- `$<nodeId>.output.field` — JSON field from a node with output_format
- `$BASE_BRANCH` — base git branch

Expand All @@ -158,12 +175,14 @@ nodes:
2. The `description:` MUST follow the "Use when / Triggers / Does / NOT for" pattern
3. Every node MUST have a unique kebab-case `id`
4. Use `depends_on` to define execution order
5. Use `bash` nodes for deterministic operations (file checks, git commands, installs)
6. Use `prompt` nodes for AI reasoning tasks
7. Use `output_format` on prompt nodes when downstream nodes need structured data
8. Use `allowed_tools: []` on classification/analysis nodes that don't need tools
9. Use `denied_tools: [Edit, Bash]` when a node should only use Write (not edit existing files)
10. Prefer `model: haiku` for simple classification tasks to save cost
5. Use `bash` nodes for deterministic shell operations (file checks, git commands, installs)
6. Use `script` nodes for typed data transforms (TypeScript JSON parsing, Python with deps) — stdout is captured as output, stderr is forwarded as a warning. $nodeId.output is NOT shell-quoted in script bodies — parse with JSON.parse / json.loads, not shell interpolation
7. Use `prompt` nodes for AI reasoning tasks
8. Use `approval` nodes to pause for human review at risky gates (plan→execute boundary, destructive actions)
9. Use `output_format` on prompt nodes when downstream nodes need structured data
10. Use `allowed_tools: []` on classification/analysis nodes that don't need tools
11. Use `denied_tools: [Edit, Bash]` when a node should only use Write (not edit existing files)
12. Prefer `model: haiku` for simple classification tasks to save cost

## Output

Expand Down
Loading