agent-implementation
Agent Implementation Workflow
Purpose
Implement or update agent CLI integrations in Ralph in a consistent, deterministic, test-first way.
When to Use
Use this skill when the task involves any of the following:
- Adding a new agent integration under
internal/agent/. - Updating command construction, flags, env vars, or output parsing for an existing agent.
- Updating agent factory selection in
internal/agent/agent.go. - Adding or fixing tests around agent selection/execution behavior.
Required Workflow
- Read intent and constraints first:
specs/README.mdspecs/agents.md- relevant files in
specs/agents/*.md
- Validate target agent CLI behavior before coding:
<agent-cli> --help- relevant subcommand help (for example
<agent-cli> run --help)
- Follow TDD strictly:
- write or update failing tests before implementation
- verify tests fail for the expected reason
- implement minimal code to pass
- Keep implementation aligned with existing patterns:
internal/agent/agent.gointernal/agent/opencode.gointernal/agent/claude.gointernal/agent/cursor.go
- Keep behavior deterministic and avoid logging sensitive prompt/match text.
Constraints
- Do not run iterative Ralph loop automation.
- Keep args/env handling explicit and testable.
- Reuse shared helpers when behavior is equivalent.
Implementation Checklist
- Add
internal/agent/<new-agent>.gowith anAgentinterface implementation. - Wire the new agent into the factory/switch in
internal/agent/agent.go. - Reuse shared execution/helpers where possible instead of duplicating logic.
Test Checklist
At minimum, add coverage for:
- Factory returns the correct implementation for the agent name.
- Unsupported/invalid names return expected errors.
- Command and argument composition for normal execution.
- Failure paths (missing binary, non-zero exit, malformed output when relevant).
Validation Commands
Run in this order unless the user requests otherwise:
go test -v ./internal/agent/...
make test
make test-e2e
make quality
Run mutation testing only in final validation stages:
make mutation
Completion Criteria
- Tests cover factory mapping plus success and error execution paths.
- Local validation passes (or failures are clearly reported).
- Specs/docs are updated when behavior changes.
More from iyaki/ralph
spec-creator
Generate comprehensive technical specifications for usage with Ralph.
10code-search
Use when you need to locate definitions of classes, functions, constants, types, or symbols in the application code. Before searching individual files, run Repomix with stdout output to capture a snapshot and base the search on that content.
1shell-command
Execute shell commands with strict adherence to non-interactive flags and environment variables to prevent hanging in OpenCode's headless environment.
1skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
1agent-spec-creation
Create or update agent integration specs before implementation. Use this whenever a request is about defining how a new or existing agent should behave in Ralph.
1test-driven-development
Use when implementing any feature or bugfix, before writing implementation code
1