An automated workflow agent that takes a JIRA ticket, clones the repository, creates a worktree, implements the ticket, and creates a pull request.
This agent automates the complete development workflow:
- Fetch JIRA Ticket - Retrieves ticket details using custom JIRA toolbox tools
- Clone Repository - Clones the mapped repository into
./reposif not already present - Create Worktree - Creates a git worktree with branch name
{TICKET}-{TIMESTAMP} - Implement Solution - Uses AI to implement the JIRA ticket requirements
- Commit Changes - Commits with meaningful message referencing the ticket
- Push Branch - Pushes the new branch to remote
- Create PR - Opens a pull request with title and description from JIRA issue
- Git - Version control
- GitHub CLI (
gh) - For repository operations and PR creation - Node.js - Runtime environment
- pnpm/npm - Package manager
- jira_tool - Custom MCP tool for accessing JIRA tickets
-
Copy sample.jira.env and populate your JIRA credentials:
JIRA_BASE_URL- Your JIRA instance URL (e.g., https://yourcompany.atlassian.net)JIRA_EMAIL- Your JIRA email addressJIRA_API_TOKEN- Generate from https://id.atlassian.com/manage-profile/security/api-tokens
-
Rename the file to
jira.envto enable thejira_tool
Edit the JIRA_TO_REPO mapping in execute-agent.ts to map JIRA board prefixes to repository URLs:
const JIRA_TO_REPO: Record<string, string> = {
'KAN': 'https://github.com/Isuru-F/demo-latest-audiobooks/',
// Add more mappings as needed
}Run the agent with a JIRA ticket number:
npx tsx ./execute-agent.ts KAN-1The agent will show output as it executes each step of the workflow.
Processing JIRA ticket: KAN-1
Repository: https://github.com/Isuru-F/demo-latest-audiobooks/
Branch name: KAN-1-2025-10-09T14-30-45
Started thread: T-xxxxx view at https://www.ampcode.com/threads/T-xxxxx
[Agent execution steps...]
Execution completed successfully
The agent uses the Amp SDK to orchestrate the workflow. It:
- Leverages existing system tools (git, gh CLI)
- Integrates custom MCP toolbox tools (JIRA integration)
- Streams execution progress in real-time
- Provides thread URLs for monitoring in Amp
.
├── execute-agent.ts # Main agent implementation
├── repos/ # Cloned repositories and worktrees
├── toolbox/ # Custom MCP tools (e.g., JIRA)
└── package.json # Dependencies