AI Teammate is a powerful automation pattern that combines DMTools, Cursor AI, and GitHub Actions to create intelligent development workflows.
AI Teammate is a workflow automation system that:
- ✅ Reads Jira tickets as input
- ✅ Uses AI (Cursor) to perform complex tasks
- ✅ Executes DMTools CLI commands for integrations
- ✅ Runs JavaScript for post-processing
- ✅ Creates PRs and updates tickets automatically
┌─────────────────────────────────────────────────────────────────────┐
│ GitHub Actions Workflow │
│ ┌───────────────────────────────────────────────────────────────┐ │
│ │ │ │
│ │ 1. Trigger → 2. Setup → 3. DMTools Run → 4. Post-Processing │ │
│ │ │ │
│ └───────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ Teammate Job │
│ ┌───────────────────────────────────────────────────────────────┐ │
│ │ - Fetch ticket from Jira │ │
│ │ - Prepare input context (ticket + children + attachments) │ │
│ │ - Execute CLI commands (run cursor-agent) │ │
│ │ - Run post-JS action │ │
│ └───────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ Cursor Agent │
│ ┌───────────────────────────────────────────────────────────────┐ │
│ │ - Read input folder (ticket context) │ │
│ │ - Perform AI task (write code, documentation, etc.) │ │
│ │ - Use dmtools CLI for Jira/Confluence/Figma access │ │
│ │ - Write output to outputs/response.md │ │
│ └───────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ JavaScript Action │
│ ┌───────────────────────────────────────────────────────────────┐ │
│ │ - Read outputs/response.md │ │
│ │ - Create git branch & commit │ │
│ │ - Push changes & create PR │ │
│ │ - Update Jira ticket (status, comments, labels) │ │
│ └───────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
- GitHub repository with DMTools configured
- GitHub Actions enabled
- Secrets configured (see Configuration)
- Cursor API key for AI operations
Create .github/workflows/ai-teammate.yml:
name: AI Teammate
on:
workflow_dispatch:
inputs:
config_file:
description: 'Path to config'
required: true
encoded_config:
description: 'Encoded or JSON Agent Config'
required: false
permissions:
contents: write
pull-requests: write
actions: read
jobs:
cursor-agent:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java 23
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '23'
- name: Install Cursor CLI
run: |
curl https://cursor.com/install -fsS | bash
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install DMTools CLI
run: |
curl -fsSL https://github.com/IstiN/dmtools/releases/latest/download/install.sh | bash
echo "$HOME/.dmtools/bin" >> $GITHUB_PATH
- name: Run AI Teammate
env:
CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }}
JIRA_EMAIL: ${{ secrets.JIRA_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_BASE_PATH: ${{ vars.JIRA_BASE_PATH }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
DMTOOLS_INTEGRATIONS: "jira,confluence,figma,ai,cli,file"
run: |
dmtools run "${{ inputs.config_file }}" "${ENCODED_CONFIG:-}"Create agents/story_description.json:
{
"name": "Teammate",
"params": {
"agentParams": {
"aiRole": "Experienced Business Analyst",
"instructions": [
"Read ticket details from input folder",
"Write enhanced story description following template",
"Use dmtools CLI to read Confluence templates and Figma designs",
"Check child tickets for questions and solution designs",
"Write output to outputs/response.md"
],
"formattingRules": "Use Jira markup format",
"knownInfo": ""
},
"cliCommands": [
"./cicd/scripts/run-cursor-agent.sh \"Enhance story description based on input\""
],
"outputType": "field",
"fieldName": "Description",
"operationType": "Replace",
"ticketContextDepth": 1,
"skipAIProcessing": true,
"inputJql": "key = PROJ-123",
"postJSAction": "agents/assignForReview.js"
}
}# Via GitHub CLI
gh workflow run ai-teammate.yml \
-f config_file=agents/story_description.json
# Via GitHub UI
# Go to Actions → AI Teammate → Run workflow
# Enter: agents/story_description.jsonAdd these secrets in Settings → Secrets and variables → Actions → Secrets:
| Secret | Description | Example |
|---|---|---|
CURSOR_API_KEY |
Cursor AI API key | cur_... |
JIRA_EMAIL |
Jira account email | user@company.com |
JIRA_API_TOKEN |
Jira API token | ATATT3xFfGF0T... |
GEMINI_API_KEY |
Google Gemini key (optional) | AIza... |
FIGMA_TOKEN |
Figma API token (optional) | figd_... |
PAT_TOKEN |
GitHub Personal Access Token for PR creation | ghp_... |
Add these variables in Settings → Secrets and variables → Actions → Variables:
| Variable | Description | Example |
|---|---|---|
JIRA_BASE_PATH |
Jira URL | https://company.atlassian.net |
JIRA_AUTH_TYPE |
Auth type | Basic |
CONFLUENCE_BASE_PATH |
Confluence URL | https://company.atlassian.net/wiki |
CONFLUENCE_DEFAULT_SPACE |
Default space | TEAM |
FIGMA_BASE_PATH |
Figma API URL | https://api.figma.com/v1 |
Agent configurations follow this structure:
{
"name": "Teammate",
"params": {
// Agent AI parameters
"agentParams": {
"aiRole": "Role description",
"instructions": ["Instruction 1", "Instruction 2"],
"formattingRules": "Output format rules",
"knownInfo": "Additional context",
"fewShots": "Example outputs"
},
// CLI commands to execute
"cliCommands": [
"./scripts/run-cursor-agent.sh \"Task description\""
],
// Output configuration
"outputType": "field|comment|creation|none",
"fieldName": "Description",
"operationType": "Replace|Append",
// Ticket selection
"inputJql": "key = PROJ-123",
"ticketContextDepth": 0,
// Processing options
"skipAIProcessing": true|false,
"attachResponseAsFile": true|false,
// Post-processing
"postJSAction": "agents/myAction.js",
// User context
"initiator": "user-account-id"
}
}AI agent configuration:
aiRole: Role/persona for the AI (e.g., "Senior Java Developer")instructions: Array of instructions for the AIformattingRules: Output format requirementsknownInfo: Additional context or knowledgefewShots: Example outputs for few-shot learning
Commands to execute:
"cliCommands": [
"./cicd/scripts/run-cursor-agent.sh \"Implement feature X\""
]Where to put results:
field: Update a Jira fieldcomment: Add as Jira commentconfluence: Create/update Confluence pagenone: No automatic output
How much context to include:
0: Only the ticket itself1: Ticket + direct children (subtasks)2: Ticket + children + linked tickets
true: Use CLI output directly (no AI processing)false: Process through AI (default)
JavaScript file to run after completion:
"postJSAction": "agents/developTicketAndCreatePR.js"Goal: Enhance story descriptions with AI
Configuration: agents/story_description.json
{
"name": "Teammate",
"params": {
"agentParams": {
"aiRole": "Senior Business Analyst",
"instructions": [
"Read ticket from input folder",
"Enhance description following Confluence template",
"Use dmtools to read child tickets for context",
"Check Figma designs if referenced",
"Write enhanced description to outputs/response.md"
],
"formattingRules": "Use Jira markup: h2., *, {code}, etc."
},
"cliCommands": [
"./cicd/scripts/run-cursor-agent.sh \"Enhance story description\""
],
"outputType": "field",
"fieldName": "Description",
"operationType": "Replace",
"ticketContextDepth": 1,
"skipAIProcessing": true,
"inputJql": "key = DMC-532",
"postJSAction": "agents/assignForReview.js"
}
}Workflow:
- Fetches ticket
DMC-532 - Includes child tickets (questions, solution design)
- Cursor agent enhances description
- Updates ticket description
- Assigns to initiator for review
Goal: Implement ticket and create PR
Configuration: agents/story_development.json
{
"name": "Teammate",
"params": {
"agentParams": {
"aiRole": "Senior Java Software Engineer",
"instructions": [
"Read ticket requirements from input folder",
"Implement code changes following architecture",
"Create unit tests with good coverage",
"Write development summary to outputs/response.md",
"DO NOT create branches or push - handled by post-JS action"
],
"formattingRules": "Markdown with sections: Approach, Files Modified, Test Coverage, Issues/Notes"
},
"cliCommands": [
"./cicd/scripts/run-cursor-agent.sh \"Implement ticket\""
],
"outputType": "none",
"ticketContextDepth": 1,
"skipAIProcessing": true,
"postJSAction": "agents/developTicketAndCreatePR.js"
}
}Workflow:
- Fetches ticket with full context
- Cursor agent implements code + tests
- Writes summary to
outputs/response.md - JS action creates branch, commits, pushes
- Creates PR with summary as description
- Updates ticket status to "In Review"
- Posts comment with PR link
Goal: Create solution design tickets
Configuration: agents/createSolutionDesignTicketsAndAssignForReview.js
{
"name": "Teammate",
"params": {
"agentParams": {
"aiRole": "Solution Architect",
"instructions": [
"Analyze story requirements",
"Create solution design document",
"Break down into technical tasks",
"Identify risks and dependencies"
]
},
"cliCommands": [
"./cicd/scripts/run-cursor-agent.sh \"Create solution design\""
],
"outputType": "comment",
"ticketContextDepth": 1,
"postJSAction": "agents/createSolutionDesignTicketsAndAssignForReview.js"
}
}- Agent Configuration - Complete configuration reference
- JavaScript Actions - Post-processing with JS
- Jobs Documentation - Available jobs reference