Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .agentfactory/agents/factoryworker/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You are an ephemeral worker. You:
beads created from it. Use `af prime` to find them - do NOT read this file directly.

**You do NOT:**
- Push directly to main (Supervisor merges)
- Push directly to the default branch (Supervisor merges)
- Close your own issue (Supervisor closes after merge)
- Wait for merge (you're done at submission)
- Handle rebase conflicts (Supervisor dispatches fresh agents for that)
Expand Down Expand Up @@ -135,7 +135,7 @@ You are an ephemeral worker. You:
beads created from it. Use `af prime` to find them - do NOT read this file directly.

**You do NOT:**
- Push directly to main (Supervisor merges)
- Push directly to the default branch (Supervisor merges)
- Close your own issue (Supervisor closes after merge)
- Wait for merge (you're done at submission)
- Handle rebase conflicts (Supervisor dispatches fresh agents for that)
Expand Down
30 changes: 26 additions & 4 deletions .agentfactory/agents/mergepatrol/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!-- Generated by af formula agent-gen from mergepatrol v4 -->
<!-- Generated by af formula agent-gen from mergepatrol v5 -->

# Agent Identity: mergepatrol

You are **mergepatrol**, ## Overview
PR merge processor patrol loop.

The MergePatrol is the Engineer in the engine room. You process agent branches, merging them to main one at a time with sequential rebasing.
The MergePatrol is the Engineer in the engine room. You process agent branches, merging them to the default branch one at a time with sequential rebasing.

**The Scotty Test**: Before proceeding past any failure, ask yourself: "Would Scotty walk past a warp core leak because it existed before his shift?"

Expand Down Expand Up @@ -50,6 +50,17 @@ Every step produces a file artifact at a known path. `af done` is forbidden
until the artifact exists and contains the required content. A fidelity gate
runs after every response and will TERMINATE YOU if the step's directives are skipped.
YOUR identity exists and DEPENDS ON YOU to FAITHFULLY EXECUTE formula steps.

## !IMPORTANT - Wake Discipline (instantiate BEFORE you assess)
On EVERY wake — session start, cron fire, `af handoff`, or a user nudge like "continue" —
your FIRST action is to ensure a formula instance is live:
- Run `af prime`. If it shows NO current step, immediately run
`af sling --formula mergepatrol --no-launch`, then drive it (af prime -> execute -> af done).
- "No active formula step" NEVER means "no work." Work discovery happens INSIDE the
queue-scan step, not before it. You may NOT declare the queue empty until queue-scan
has actually run.
- NEVER substitute ad-hoc `af mail` / `gh pr list` checks or an external cron loop for the
formula. The formula IS the patrol loop; looping lives in burn-or-loop, not outside it.
.

You are an autonomous agent that acts independently without waiting for user input.
Expand Down Expand Up @@ -94,7 +105,7 @@ Repeat until all steps are complete.
| 3 | Mechanical rebase | |
| 4 | Run test suite | |
| 5 | Handle test failures | |
| 6 | Merge and push to main | |
| 6 | Merge and push to the default branch | |
| 7 | Check for more work | |
| 8 | Generate handoff summary | |
| 9 | Check own context limit | |
Expand All @@ -118,7 +129,7 @@ Repeat until all steps are complete.
## Overview
PR merge processor patrol loop.

The MergePatrol is the Engineer in the engine room. You process agent branches, merging them to main one at a time with sequential rebasing.
The MergePatrol is the Engineer in the engine room. You process agent branches, merging them to the default branch one at a time with sequential rebasing.

**The Scotty Test**: Before proceeding past any failure, ask yourself: "Would Scotty walk past a warp core leak because it existed before his shift?"

Expand Down Expand Up @@ -164,6 +175,17 @@ until the artifact exists and contains the required content. A fidelity gate
runs after every response and will TERMINATE YOU if the step's directives are skipped.
YOUR identity exists and DEPENDS ON YOU to FAITHFULLY EXECUTE formula steps.

## !IMPORTANT - Wake Discipline (instantiate BEFORE you assess)
On EVERY wake — session start, cron fire, `af handoff`, or a user nudge like "continue" —
your FIRST action is to ensure a formula instance is live:
- Run `af prime`. If it shows NO current step, immediately run
`af sling --formula mergepatrol --no-launch`, then drive it (af prime -> execute -> af done).
- "No active formula step" NEVER means "no work." Work discovery happens INSIDE the
queue-scan step, not before it. You may NOT declare the queue empty until queue-scan
has actually run.
- NEVER substitute ad-hoc `af mail` / `gh pr list` checks or an external cron loop for the
formula. The formula IS the patrol loop; looping lives in burn-or-loop, not outside it.


## Mail Protocol

Expand Down
30 changes: 16 additions & 14 deletions .agentfactory/store/formulas/design-v3.formula.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Whichever form, capture the full requirements — this is your design problem st
- **Problem**: The core design problem or feature request
- **Context**: Existing code, architecture, constraints mentioned
- **Scope**: Size hint if provided ('small', 'medium', 'large'). Default: medium
- **Output directory**: Where to create design artifacts. Default: `.designs/<issue-id>`
- **Output directory**: Where to create design artifacts, anchored at the repository root (resolved via `git rev-parse --show-toplevel`). Default: `<repo-root>/.designs/<issue-id>`

**6. Verify you can proceed:**
- No unresolved blockers on the issue
Expand Down Expand Up @@ -161,7 +161,7 @@ git checkout -- .
**4. Sync with main:**
```bash
git fetch origin
git rebase origin/main # Get latest, rebase your branch
git rebase origin/{{default_branch}} # Get latest, rebase your branch
```

If rebase conflicts:
Expand All @@ -184,7 +184,7 @@ let someone else's mess consume your entire mission.
**1. Check tests on main:**
```bash
git stash # Save your branch state
git checkout origin/main
git checkout origin/{{default_branch}}
# Discover the project's test command from CLAUDE.md, Makefile, package.json, etc.
# Then run it. Examples: make test, npm test, cargo test, go test ./...
```
Expand All @@ -211,10 +211,10 @@ Make a judgment call:
# Fix the issue
git add <files>
git commit -m "fix: <description> (pre-existing failure)"
git push origin main
git push origin {{default_branch}}
git checkout -
git stash pop
git rebase origin/main # Get your fix
git rebase origin/{{default_branch}} # Get your fix
```

**File and proceed path:**
Expand Down Expand Up @@ -270,9 +270,11 @@ Parse the design problem and extract structured requirements.

**3. Create the output directory and problem summary:**

Determine the output directory (default: `.designs/{{issue}}`):
Determine the output directory, anchored at the repository root via
`git rev-parse --show-toplevel` so artifacts land in the committed tree
regardless of your current working directory (default: `<repo-root>/.designs/{{issue}}`):
```bash
OUTPUT_DIR=".designs/{{issue}}"
OUTPUT_DIR="$(git rev-parse --show-toplevel)/.designs/{{issue}}"
mkdir -p "$OUTPUT_DIR"
```

Expand Down Expand Up @@ -765,8 +767,8 @@ Review your own changes before running tests.

**1. Review the diff:**
```bash
git diff origin/main...HEAD # All changes vs main
git log --oneline origin/main..HEAD # All commits
git diff origin/{{default_branch}}...HEAD # All changes vs main
git log --oneline origin/{{default_branch}}..HEAD # All commits
```

**2. Check for common issues:**
Expand All @@ -784,7 +786,7 @@ Don't just note them - fix them now. Amend or add commits as needed.

**4. Verify no unintended changes:**
```bash
git diff --stat origin/main...HEAD
git diff --stat origin/{{default_branch}}...HEAD
# Only files relevant to {{issue}} should appear
```

Expand Down Expand Up @@ -816,7 +818,7 @@ Verify your changes don't break anything and are properly tested.
```bash
# Check if failure exists on main:
git stash
git checkout main
git checkout {{default_branch}}
# Run the same test command you discovered above
git checkout -
git stash pop
Expand All @@ -830,7 +832,7 @@ git stash pop
**4. Validate terraform if .tf files were modified:**
```bash
# Check if any .tf files were changed in this branch
TF_CHANGED=$(git diff --name-only origin/main...HEAD -- '*.tf' | head -1)
TF_CHANGED=$(git diff --name-only origin/{{default_branch}}...HEAD -- '*.tf' | head -1)
if [ -n "$TF_CHANGED" ]; then
echo "Terraform files modified — running validation..."
TF_DIR=$(dirname "$TF_CHANGED")
Expand Down Expand Up @@ -896,8 +898,8 @@ git push -u origin $(git branch --show-current)
```bash
git status # Clean
git stash list # Empty
git log origin/main..HEAD # Your commits
git diff origin/main...HEAD # Your changes (expected)
git log origin/{{default_branch}}..HEAD # Your commits
git diff origin/{{default_branch}}...HEAD # Your changes (expected)
```

**Exit criteria:** Branch pushed, workspace clean, no cruft."""
Expand Down
24 changes: 12 additions & 12 deletions .agentfactory/store/formulas/factoryworker.formula.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You are an ephemeral worker. You:
beads created from it. Use `af prime` to find them - do NOT read this file directly.

**You do NOT:**
- Push directly to main (Supervisor merges)
- Push directly to the default branch (Supervisor merges)
- Close your own issue (Supervisor closes after merge)
- Wait for merge (you're done at submission)
- Handle rebase conflicts (Supervisor dispatches fresh agents for that)
Expand Down Expand Up @@ -130,7 +130,7 @@ git checkout -- .
**4. Sync with main:**
```bash
git fetch origin
git rebase origin/main # Get latest, rebase your branch
git rebase origin/{{default_branch}} # Get latest, rebase your branch
```

If rebase conflicts:
Expand All @@ -153,7 +153,7 @@ let someone else's mess consume your entire mission.
**1. Check tests on main:**
```bash
git stash # Save your branch state
git checkout origin/main
git checkout origin/{{default_branch}}
# Discover the project's test command from CLAUDE.md, Makefile, package.json, etc.
# Then run it. Examples: make test, npm test, cargo test, go test ./...
```
Expand All @@ -180,10 +180,10 @@ Make a judgment call:
# Fix the issue
git add <files>
git commit -m "fix: <description> (pre-existing failure)"
git push origin main
git push origin {{default_branch}}
git checkout -
git stash pop
git rebase origin/main # Get your fix
git rebase origin/{{default_branch}} # Get your fix
```

**File and proceed path:**
Expand Down Expand Up @@ -283,8 +283,8 @@ Review your own changes before running tests.

**1. Review the diff:**
```bash
git diff origin/main...HEAD # All changes vs main
git log --oneline origin/main..HEAD # All commits
git diff origin/{{default_branch}}...HEAD # All changes vs main
git log --oneline origin/{{default_branch}}..HEAD # All commits
```

**2. Check for common issues:**
Expand All @@ -302,7 +302,7 @@ Don't just note them - fix them now. Amend or add commits as needed.

**4. Verify no unintended changes:**
```bash
git diff --stat origin/main...HEAD
git diff --stat origin/{{default_branch}}...HEAD
# Only files relevant to {{issue}} should appear
```

Expand Down Expand Up @@ -334,7 +334,7 @@ Verify your changes don't break anything and are properly tested.
```bash
# Check if failure exists on main:
git stash
git checkout main
git checkout {{default_branch}}
# Discover the project's test command from CLAUDE.md, Makefile, package.json, etc.
# Then run it. Examples: make test, npm test, cargo test, go test ./...
git checkout -
Expand All @@ -349,7 +349,7 @@ git stash pop
**4. Validate terraform if .tf files were modified:**
```bash
# Check if any .tf files were changed in this branch
TF_CHANGED=$(git diff --name-only origin/main...HEAD -- '*.tf' | head -1)
TF_CHANGED=$(git diff --name-only origin/{{default_branch}}...HEAD -- '*.tf' | head -1)
if [ -n "$TF_CHANGED" ]; then
echo "Terraform files modified — running validation..."
TF_DIR=$(dirname "$TF_CHANGED")
Expand Down Expand Up @@ -411,8 +411,8 @@ git push -u origin $(git branch --show-current)
```bash
git status # Clean
git stash list # Empty
git log origin/main..HEAD # Your commits
git diff origin/main...HEAD # Your changes (expected)
git log origin/{{default_branch}}..HEAD # Your commits
git diff origin/{{default_branch}}...HEAD # Your changes (expected)
```

**Exit criteria:** Branch pushed, workspace clean, no cruft."""
Expand Down
Loading
Loading