Multi-persona agent for submitting a Pull Request to your favorite GitHub repository you have access to.
All you need is Bash 3.2, Rust and some API keys.
Check out AGENTS.md for a full breakdown.
# 1. Configure environment
cp .env.example .env
# YOU MUST FILL YOUR API KEYS AND GITHUB TOKEN
# 2. Check everything is set up
./agent.sh status
# 3. Test all integrations (dry run)
./agent.sh dry-run
# 4. Write your goal in .directive
echo "Lets add a Footer the codebase that is simple that doesn't add complication but solves a problem the codebase missed. You must follow the codebases conventions exactly, the codebase adheres to a specific style." > .directive
# 5. Run the agent
./agent.sh runThe agent reads its goal from the .directive file in the repository root. This file should contain a clear, actionable objective:
# Example .directive contents:
Lets add a Footer the codebase that is simple that doesn't add complication but solves a problem the codebase missed. You must follow the codebases conventions exactly, the codebase adheres to a specific style.To change what the agent works on, edit the .directive file directly. The agent will read this file each time it runs.
| Command | Description |
|---|---|
./agent.sh run |
Run agent using .directive file |
./agent.sh dry-run |
Test full flow without executing changes |
./agent.sh new |
Clear current session |
./agent.sh status |
Show environment and session status |
./agent.sh test-models |
Test API connections only |
./agent.sh clear-context |
Clear all context and state |
Create a .env file with:
API_KEY_ANTHROPIC=...
GITHUB_TOKEN=...
GITHUB_REPO_AGENTS_WILL_WORK_ON=owner/repo
GITHUB_USERNAME=...
API_KEY_OPEN_AI=...
API_KEY_GOOGLE_CUSTOM_SEARCH=...
GOOGLE_CUSTOM_SEARCH_ID=...Important: GITHUB_REPO_AGENTS_WILL_WORK_ON specifies the repository where the agent will create PRs, NOT this agent's repository. For example, if you want the agent to work on internet-development/nextjs-sass-starter, set:
GITHUB_REPO_AGENTS_WILL_WORK_ON=internet-development/nextjs-sass-starterbash(3.2+)rustfor the Engineercurlfor API requests (standard on macOS/Linux)gitfor version control operationsjqfor JSON parsing (required)
Your GITHUB_TOKEN needs these permissions on the target repository:
repo- Full control of private repositorieswrite:discussion- Write access to discussions (for PR comments)
If working on a public repo you don't own, you'll need to fork it first and set GITHUB_REPO_AGENTS_WILL_WORK_ON to your fork.
The apply-edits tool provides strong safety guarantees by default:
- Atomic Mode (default): All edits succeed or none are applied. If any edit fails, all changes are rolled back automatically.
- No Partial Corruption: Your repository is never left in an inconsistent state.
- Dry-Run Mode: Simulate all changes without touching disk using
--dry-run. Validates that all edits would succeed before any changes are made. - Partial Mode (opt-in): Use
--partialto continue applying edits even if some fail (non-atomic).
The following behaviors are guaranteed for all v1.x releases and are backward compatible with previous v1 releases. These guarantees are enforced by integration tests (see tools/apply-edits/src/ test modules):
- Dry-run validation:
--dry-runperforms full validation of all edits against actual file contents. It reports exactly what would happen without modifying any files. - Atomic rollback: In default (atomic) mode, if edit N fails, all previously successful edits (1 through N-1) are rolled back to their original state.
- Partial continuation: With
--partial, failed edits are skipped but successful edits are preserved. The exit code is non-zero if any edit fails. - JSON output stability: The JSON output schema includes
success(boolean),applied(number),failed(number), andedits(array). Each edit entry includesstatus,index,path, andtype. Error entries additionally includeerror,message, and contextual fields likehintandclosest_matches.
Think of apply-edits as a transactional patch engine:
- Read - Load files that will be modified (use
apply-edits read --file <path> --workdir .to inspect files) - Validate - Check that all search strings and anchors exist exactly as specified
- Backup - Store original content for potential rollback
- Apply - Execute edits in order
- Rollback or Commit - On failure, restore originals; on success, keep changes
The read subcommand supports both --file for a single file and --files for comma-separated lists, with optional --max-lines and --format (json or prompt) flags.
If you have questions ping me on Twitter, @wwwjim. Or you can ping @internetxstudio.