Skip to main content
Code Guide
M18 Advanced Methodology

Event-Driven Agents

Triggering agents automatically from GitHub, Linear, Jira

PDF
← All cards

From pull to push

Interactive Claude Code usage is pull-based: you open a terminal, type an instruction, iterate. Event-driven automation removes the human from the triggering step. A card moves to “In Progress” in Linear, an agent starts. A GitHub issue receives the claude-fix label, an agent opens a branch within seconds.

The human remains in the loop for final validation (PR review, merge approval), but work initiation happens through the existing project management workflow.

Pipeline architecture

Event source
→ Filter (label, mention, state)
→ Context extraction
→ Agent selection
→ Claude Code
→ Result routing (PR, comment, status)

Each component is independent and replaceable. The filter determines which events merit an agent; without strict filtering, an event burst can instantiate dozens of agents simultaneously.

Compatible event sources

SourceTriggersTypical usage
GitHub IssuesCreation, label addedTriage, automatic fix
GitHub PROpen, commentReview, corrections
LinearState change, labelFeature implementation
JiraTransition, assignmentTechnical work, debt
SlackMessage, emoji reactionQuick investigations
PagerDutyIncident createdDiagnostic scripts

Activation filter

Do not trigger an agent for every event. A simple bash filter:

Terminal window
# Trigger only if "claude-auto" label is present
if [[ "$CARD_LABELS" != *"claude-auto"* ]]; then
echo "Skipping: no claude-auto label"
exit 0
fi

For GitHub, the @claude review trigger in a PR comment is the most documented pattern: on-demand triggering without polluting the automated workflow.

Concrete example: Linear Agent Loop

The most documented pattern (Damian Galarza, February 2026): Linear as single source of truth, Claude Code as implementer.

The ticket description serves as prompt. A ticket with clear acceptance criteria produces quality code; a vague ticket produces vague code, exactly as with a human developer.

Terminal window
spawn_agent() {
claude --print --dangerously-skip-permissions \
"Implement Linear card:
Title: $title
Description: $description
1. Create branch feat/$issue_id
2. Implement feature, run tests
3. Open PR" 2>&1 | tee "/tmp/agent-$issue_id.log"
}

Mandatory safeguards

Idempotence: check that a branch does not already exist before starting, to avoid double processing in case of a duplicated webhook.

Concurrency limit: cap at 3-5 simultaneous agents. Beyond that, the machine saturates and costs explode.

Circuit breaker: if an agent fails more than 3 times on the same ticket, stop the automation and alert a human.

Human review: agents create PRs, humans approve them. Merge to main must never be automated without validation.

Minimal authentication

The Claude Code token used in CI must be scoped to the minimum necessary. A PR review agent does not need write access to the npm registry or deployment secrets. Separate tokens by agent type and regularly audit their effective permissions.

Enter your email to read the full card and get the complete PDF bundle.

All content is free and open-source. We just ask for your email.

PDF: