Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
14 changes: 11 additions & 3 deletions orchestrator/concurrent_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(
self,
pipeline: Pipeline,
spawn_fn: SpawnFn,
max_concurrent: int = 4,
max_concurrent: int = 6,
) -> None:
self.pipeline = pipeline
self.spawn_fn = spawn_fn
Expand All @@ -75,9 +75,17 @@ def __init__(
def get_agent_roles(self) -> list[AgentRole]:
"""Get the agent roles for concurrent execution.

Returns standard implement-phase roles: coder, tester, documenter.
Returns implement-phase roles: coder, tester, documenter,
checker, reviewer_code, reviewer_contract.
"""
return [AgentRole.CODER, AgentRole.TESTER, AgentRole.DOCUMENTER]
return [
AgentRole.CODER,
AgentRole.TESTER,
AgentRole.DOCUMENTER,
AgentRole.CHECKER,
AgentRole.REVIEWER_CODE,
AgentRole.REVIEWER_CONTRACT,
]

def get_worktree_branch(self, role: AgentRole) -> str:
"""Get the worktree branch name for an agent role."""
Expand Down
2 changes: 1 addition & 1 deletion orchestrator/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ class PipelineConfig(BaseModel):
description="Enable concurrent agent execution within a phase (all agents start simultaneously)",
)
max_concurrent_agents: int = Field(
default=4, ge=1, description="Maximum concurrent agents per phase"
default=6, ge=1, description="Maximum concurrent agents per phase"
)
message_poll_hint_seconds: int = Field(
default=30, ge=1, description="Suggested message polling interval for agents"
Expand Down
4 changes: 2 additions & 2 deletions orchestrator/routes/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ def _get_concurrent_status(pipeline: "Pipeline") -> dict | None:

result: dict = {
"enabled": True,
"max_concurrent_agents": getattr(config, "max_concurrent_agents", 4),
"max_concurrent_agents": getattr(config, "max_concurrent_agents", 6),
}

# Message store provides aggregate counts of inter-agent messages by type.
Expand Down Expand Up @@ -4488,7 +4488,7 @@ def _run_concurrent_phase(
certs_volume=certs_volume,
)

max_concurrent = getattr(pipeline.config, "max_concurrent_agents", 4)
max_concurrent = getattr(pipeline.config, "max_concurrent_agents", 6)
executor = ConcurrentPhaseExecutor(
pipeline=pipeline,
spawn_fn=spawn_fn,
Expand Down
10 changes: 10 additions & 0 deletions sandbox/.claude/commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ Switch to Tester agent mode for testing-focused work.

**File**: `tester-mode.md`

### /checker-mode
Switch to Checker agent mode for running checks (lint, type, test) and auto-fixing issues.

**File**: `checker-mode.md`

### /reviewer-mode
Switch to Reviewer agent mode for code quality or contract adherence review.

**File**: `reviewer-mode.md`

## How Commands Work

These commands are **slash commands** for Claude Code. They are markdown files that provide instructions to Claude on how to respond when you use the command syntax.
Expand Down
161 changes: 161 additions & 0 deletions sandbox/.claude/commands/checker-mode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Checker Agent Mode

You are the **Checker** agent in a multi-agent SDLC pipeline. This mode activates when running project checks (tests, lint, type checking) against committed code.

## Role Summary

- **Primary responsibility**: Run checks and auto-fix what you can (lint, formatting, type errors)
- **Runs when**: Concurrent with Coder (checks code as it lands)
- **Outputs**: Check results and auto-fix commits

## File Access Constraints

| Can Write | Cannot Write |
|-----------|--------------|
| Source code (auto-fixes only: formatting, lint, types) | Documentation (`docs/`, `README.md`) |
| Configuration (`*.yml`, `*.yaml`, `*.json`) | Contracts (`.egg-state/contracts/`) |
| Handoff data (`.egg-state/agent-outputs/`) | Test files (handled by Tester) |

## Workflow

1. **Read the plan**: Check `.egg-state/contracts/{issue}.json` for task context
2. **Wait for code**: Poll for coder commits (see Concurrent Mode below)
3. **Run checks**: Execute lint, type checking, and test suite
4. **Auto-fix**: Fix formatting, lint errors, and simple type issues
5. **Report**: Notify coder of unfixable issues via message bus
6. **Write handoff**: Output check results

## Check Commands

Run the project's standard check tooling:

```bash
# Run linters and formatters
make lint
make fix

# Run type checking (if configured)
make typecheck # or: mypy . / npx tsc --noEmit

# Run test suite
make test
```

Adapt to the project's actual Makefile targets or config files.

## Auto-Fix Rules

**DO auto-fix:**
- Formatting issues (black, prettier, isort)
- Simple lint errors (unused imports, trailing whitespace)
- Type annotation fixes that are mechanical

**DO NOT auto-fix:**
- Logic errors or bugs
- Architectural issues
- Test failures (report to coder instead)
- Anything that changes behavior

After auto-fixing, commit and notify:

```bash
git add <fixed-files>
git commit -m "Auto-fix: lint and formatting corrections"
egg-orch message send --to coder --type STATUS --subject "Auto-fixes applied" --body "Fixed: unused imports in auth.py, formatting in utils.py"
```

## Handoff Output

Create this file when done:

```bash
mkdir -p .egg-state/agent-outputs
IDENT="${EGG_ISSUE_NUMBER:-$EGG_PIPELINE_ID}"
cat > ".egg-state/agent-outputs/${IDENT}-checker-output.json" << 'EOF'
{
"checks_run": ["lint", "typecheck", "test"],
"checks_passed": ["lint", "test"],
"checks_failed": ["typecheck"],
"auto_fixes": [
"Removed unused import in auth.py",
"Fixed formatting in utils.py"
],
"unfixable_issues": [
"Type error in parser.py:45 - incompatible return type"
],
"commits": ["abc1234"],
"summary": "Lint and tests pass. 1 type error reported to coder."
}
EOF
```

## Concurrent Mode

When `EGG_CONCURRENT_MODE=true`, all agents start simultaneously. Your behavior changes:

### Startup — Wait for Coder

The coder hasn't committed anything yet. Signal BLOCKED and start polling:

```bash
egg-orch signal readiness --state BLOCKED --reason "Waiting for coder commits"
```

### While Waiting

Poll for `PROGRESS` messages from the coder indicating new commits:

```bash
egg-orch message poll
```

While waiting, you can:
- Review the plan to understand what checks will be relevant
- Verify check infrastructure exists (Makefile targets, config files)

### When Coder Commits Land

When you receive a PROGRESS message or detect new commits:

1. Signal `WORKING`: `egg-orch signal readiness --state WORKING --reason "Running checks on new commits"`
2. Run checks against the committed code
3. Auto-fix what you can, commit fixes
4. Report unfixable issues to the coder:

```bash
egg-orch message send --to coder --type STATUS --subject "Check failures" --body "Type error in parser.py:45 — incompatible return type. Lint and tests pass."
```

### Readiness

Signal `READY` when all checks pass or unfixable issues are documented:

```bash
egg-orch signal readiness --state READY --reason "All checks pass (auto-fixed 3 lint issues)"
```

### Stay-Alive Loop (CRITICAL)

**After signaling READY, do NOT exit.** Keep polling the message bus:

```bash
while true; do
egg-orch message poll
sleep "${EGG_MESSAGE_POLL_INTERVAL:-30}"
done
```

If the coder pushes more commits:
1. Signal `WORKING`: `egg-orch signal readiness --state WORKING --reason "Re-checking after new commits"`
2. Re-run checks
3. Signal `READY` again

The orchestrator will stop your container when all agents reach consensus.

## Quality Checklist

Before completing:
- [ ] All configured checks have been run
- [ ] Auto-fixable issues fixed and committed
- [ ] Unfixable issues reported to coder via message bus
- [ ] Handoff file written
52 changes: 51 additions & 1 deletion sandbox/.claude/commands/coder-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,56 @@ Before completing:
- [ ] No debug code left behind
- [ ] Handoff file written

## Concurrent Mode

When `EGG_CONCURRENT_MODE=true`, all agents start simultaneously. Your behavior changes:

### Startup

Begin implementing immediately — you have no upstream dependencies. Other agents (tester, documenter, checker, reviewer) are waiting on your output.

### Message Bus (Required)

You MUST actively use the message bus to coordinate with other agents:

```bash
# After committing a key interface or module, notify others
egg-orch message send --to all --type PROGRESS --subject "Committed auth module" --body "Files: auth.py, middleware.py. Ready for review/testing."

# Poll for questions from tester, feedback from reviewer
egg-orch message poll
```

**When to send PROGRESS**: After each significant commit (new module, API change, key interface). This unblocks tester/documenter/checker who are waiting for your code.

### Readiness

Signal `READY` only after:
- All plan tasks are implemented and committed
- Handoff file is written
- `egg-contract add-commit` linked for each task

```bash
egg-orch signal readiness --state READY --reason "All tasks implemented, handoff written"
```

### Stay-Alive Loop (CRITICAL)

**After signaling READY, do NOT exit.** Keep polling the message bus:

```bash
# Stay alive — the orchestrator will stop your container when consensus is reached
while true; do
egg-orch message poll
sleep "${EGG_MESSAGE_POLL_INTERVAL:-30}"
done
```

If a reviewer or checker sends you feedback that requires changes:
1. Signal `WORKING`: `egg-orch signal readiness --state WORKING --reason "Addressing reviewer feedback"`
2. Make the fix, commit, send PROGRESS
3. Signal `READY` again

## Next Agent

After you complete, the **Tester** and **Documenter** agents can run in parallel.
After you complete, the **Tester**, **Documenter**, **Checker**, and **Reviewer** agents can run in parallel.
65 changes: 65 additions & 0 deletions sandbox/.claude/commands/documenter-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,71 @@ Before completing:
- [ ] No code or test files modified
- [ ] Handoff file written

## Concurrent Mode

When `EGG_CONCURRENT_MODE=true`, all agents start simultaneously. Your behavior changes:

### Startup — Wait for Coder

Check if the coder's handoff file exists:

```bash
IDENT="${EGG_ISSUE_NUMBER:-$EGG_PIPELINE_ID}"
HANDOFF=".egg-state/agent-outputs/${IDENT}-coder-output.json"
if [ ! -f "$HANDOFF" ]; then
# Coder hasn't finished yet — signal BLOCKED and start polling
egg-orch signal readiness --state BLOCKED --reason "Waiting for coder handoff"
fi
```

### While Waiting

While the coder is still working:
1. Poll for `PROGRESS` messages from the coder
2. Start drafting documentation based on the plan context (`egg-contract show`)
3. Review existing docs that may need updates

```bash
# Poll for coder and tester progress
egg-orch message poll

# Share documentation progress
egg-orch message send --to all --type STATUS --subject "Doc progress" --body "Drafted guide outline based on plan tasks"
```

### When Coder Is Ready

Once the handoff file appears or the coder signals `READY`:
1. Signal `WORKING`: `egg-orch signal readiness --state WORKING --reason "Coder output available, finalizing docs"`
2. Read the handoff, review actual code changes, and finalize documentation
3. Use `egg-checkpoint context --pipeline $EGG_PIPELINE_ID --files` for comprehensive file list

### Readiness

Signal `READY` only after documentation reflects the coder's actual committed changes (not just plan-based drafts).

```bash
egg-orch signal readiness --state READY --reason "Documentation updated for all code changes"
```

### Stay-Alive Loop (CRITICAL)

**After signaling READY, do NOT exit.** Keep polling the message bus:

```bash
while true; do
egg-orch message poll
sleep "${EGG_MESSAGE_POLL_INTERVAL:-30}"
done
```

If the coder pushes more commits after you signaled READY:
1. Signal `WORKING`: `egg-orch signal readiness --state WORKING --reason "Updating docs for new commits"`
2. Update documentation for new changes
3. Signal `READY` again

The orchestrator will stop your container when all agents reach consensus.

## Next Agent

After you and the Tester complete, the **Integrator** agent runs.
Loading
Loading