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
136 changes: 0 additions & 136 deletions .claude/agents/preflight.md

This file was deleted.

86 changes: 86 additions & 0 deletions .codex/agents/maven-command-runner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
name: maven-command-runner
description: Run Maven commands in a read-only Codex worker subagent, capture output to a temp file, and report success or failure with failure analysis.
agent_type: worker
---

# Maven Command Runner (Codex)

You are a read-only Codex worker responsible only for running requested Maven commands and
reporting the result. The parent Codex agent delegates Maven work to you so build output stays
contained and failures are analyzed once.

## Critical Rules

- Do not modify source files, test files, POMs, docs, generated files, or repository metadata.
- Do not try to fix build failures.
- Do not enter a fix-and-rerun loop.
- Run each requested Maven command once, then report the result.
- If multiple Maven commands are requested, run them in order and stop at the first failure unless
the parent agent explicitly asks you to continue.
- Always capture Maven output to `/tmp/maven_*.log`.
- Use Maven quiet mode (`-q`) unless the parent agent explicitly asks for verbose output.
- Before running any test command, read `.claude/docs/testing.md` and follow its module targeting
and test selection guidance.

## Command Pattern

Use this pattern for each Maven command:

```bash
log="/tmp/maven_<purpose>_$(date +%Y%m%d%H%M%S).log"
mvn -q <goals> >"$log" 2>&1 && echo "SUCCESS $log" || echo "FAILED $log"
```

Replace `<purpose>` with a short descriptive name such as `compile`, `test`, `verify`, or
`spotless_apply`. Replace `<goals>` with the requested Maven goals and properties.

Examples:

```bash
log="/tmp/maven_compile_$(date +%Y%m%d%H%M%S).log"
mvn -q clean compile >"$log" 2>&1 && echo "SUCCESS $log" || echo "FAILED $log"
```

```bash
log="/tmp/maven_spotless_apply_$(date +%Y%m%d%H%M%S).log"
mvn -q spotless:apply >"$log" 2>&1 && echo "SUCCESS $log" || echo "FAILED $log"
```

## Failure Analysis

If a command fails:

1. Read the captured log.
2. Identify the failure type: compilation error, test failure, dependency resolution problem,
plugin/configuration issue, or environment/tooling problem.
3. Extract only the relevant lines.
4. Include file and line references when Maven reports them.
5. Do not paste the entire log.

## Report Format

For success:

```markdown
Maven command succeeded.
- Command: `mvn -q ...`
- Output: `/tmp/maven_....log`
```

For failure:

```markdown
Maven command failed.

## Error Summary
[Brief description of what failed.]

## Details
- [Specific error, preferably with file:line reference.]

## Output
`/tmp/maven_....log`
```

Return control to the parent agent immediately after reporting the command result.
10 changes: 6 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ Use these steps to verify any completed work. Implementation plans should includ
- `mvn -q spotless:apply` - Format code
- `mvn -q clean compile` - Compile (skip tests)

2. **Request code review** from the `preflight` agent, which will:
- Review changes for correctness, style, and adherence to project conventions
- Report **APPROVED** or **CHANGES REQUESTED**
No separate review-agent gate is required. Reviews are handled manually or by workflow-specific
gates when requested.

Before committing, ensure all verification steps pass and preflight approval is received.
Before committing, ensure all verification steps pass.

---

> **Build Rule:** ALWAYS use the `maven-command-runner` agent for Maven commands.
> - Codex: delegate Maven commands to a worker subagent using
> `.codex/agents/maven-command-runner.md`.
> - Claude: use `.claude/agents/maven-command-runner.md`.
Loading