The Autonomous Pipeline — Cron Jobs That Run While You Sleep

Post 5: The Autonomous Pipeline — Cron Jobs That Run While You Sleep

May 31, 2026 · 5 min read

In Post 4, we built the team: Supervisor, Coder, Reviewer, and QC. Four agents, each with one job. But they don’t do anything unless someone tells them to.

Today we wire the autonomous nervous system. The cron pipeline that wakes up every 30 minutes, checks GitHub for new issues, routes them to the right agent, and reports back. All without a human touching anything.


The Pipeline Design

Hermes has a built-in cron scheduler. It runs jobs on a schedule, spawns agents in fresh sessions, and delivers results to any platform. Here’s our pipeline:


Every 30 minutes:

1. Poll GitHub Issues API (filter: label=bug, created <1hr ago)

2. For each NEW issue:

a. Parse: title, body, error messages, stack traces

b. Classify: code bug / needs info / skip

c. If code bug → spawn Coder → Reviewer → QC

d. If needs info → auto-comment on issue

e. Report all decisions to Telegram

3. Log summary: issues found, fixed, failed, costs


Step 1: GitHub Access Setup

First, authenticate Hermes with GitHub. Create a personal access token with repo and issues scopes.


# Add to ~/.hermes/.env

export GITHUB_TOKEN="ghp_xxxx"

export GITHUB_REPO="myorg/erp"

Verify access:


curl -H "Authorization: Bearer $GITHUB_TOKEN" \

https://api.github.com/repos/$GITHUB_REPO/issues?labels=bug&state=open


Step 2: Create the Cron Job


hermes cron create "every 30m" \

--name "agent-pipeline" \

--prompt "Run the full agent pipeline:

1. Poll GitHub for new 'bug' issues from the last hour

2. For each issue, classify it

3. Spawn Coder → Reviewer → QC for code bugs

4. Comment on issues that need more info

5. Report everything to Telegram"

--skills "claude-code"

--deliver "telegram"

--workdir "/home/hermes/erp-app"

What --skills "claude-code" does: It preloads the Claude Code skill into the cron session, so the agent knows all Claude Code CLI flags, modes, and pitfalls without us having to explain them in the prompt.

What --workdir does: It runs the cron job inside the ERP project directory, so CLAUDE.md and .claude/ are automatically loaded into context.


Step 3: The Classification Logic

The pipeline classifies each issue before acting:


# Classify incoming issues

has_error = any(kw in (body + title).lower()

for kw in ["error", "exception", "traceback", "500", "null"])

has_repro = any(kw in (body + title).lower()

for kw in ["steps to reproduce", "when i", "every time"])



if has_error and has_repro:

# CODE BUG — spawn the full pipeline

process_code_bug(issue)

elif has_error and not has_repro:

# NEEDS INFO — ask for reproduction steps

auto_comment(issue, "Please provide steps to reproduce")

else:

# NOT A CODE BUG — skip

log_issue(issue, "SKIPPED")

This prevents the agent from wasting time on feature requests or vague bug reports.


Step 4: The Agent Pipeline

For each code bug, the pipeline spawns three agents in sequence:

1. Coder (Claude Code, ~15 turns):

  • Reproduce the bug by tracing the code path
  • Write a failing test that reproduces it
  • Fix the code until the test passes
  • Run make test and make lint
  • Create branch, commit, push, open PR
  • 2. Reviewer (fresh session, read-only):

  • Fetch the PR branch
  • Read full diff against main
  • Cross-check CLAUDE.md Gotchas
  • Verdict: SHIP / FIX_FIRST / REWORK
  • 3. QC/Tester (Haiku, ~8 turns): Using the prompt-as-code approach for consistency.

  • Run full test suite
  • Check edge cases: empty input, null, boundaries
  • Output: PASSED or FAILED

  • Step 5: Handling Failures

    The pipeline handles common failure modes:

    Failure Mode Response Claude API rate limited Retry with exponential backoff GitHub API down Skip tick, retry next cycle Test suite fails QC catches it, Coder re-attempts Budget exceeded Escalate to human, don't silently retry PR merge conflict Coder rebases and retries
    
    # Retry logic with backoff
    
    MAX_RETRIES = 3
    
    for attempt in range(MAX_RETRIES):
    
    try:
    
    result = terminal(command=coder_cmd, timeout=600)
    
    break
    
    except Exception as e:
    
    if attempt == MAX_RETRIES - 1:
    
    send_telegram(f"🚨 Issue #{num} failed: {e}")
    
    time.sleep(2 ** attempt)
    
    

    Security: What the Agent Can't Do

    The pipeline runs with restricted permissions:

    
    // ~/.claude/settings.json
    
    {
    
    "permissions": {
    
    "allow": ["Bash(git *)", "Bash(make *)", "Bash(pytest *)", "Read", "Edit"],
    
    "deny": ["Bash(rm -rf *)", "Bash(git push *force*)", "Read(.env)"]
    
    }
    
    }
    
    

    The agent can:

  • Read and write Python files
  • Run git, make, pytest
  • Create branches and PRs
  • Comment on issues
  • The agent cannot:

  • Delete files recursively
  • Force-push or push to main
  • Read credentials or secrets
  • Deploy to production

  • Cron Job Management

    
    # List all jobs
    
    hermes cron list
    
    
    
    # Check job status
    
    hermes cron status
    
    
    
    # Manually trigger a run (for testing)
    
    hermes cron run agent-pipeline
    
    
    
    # Pause the pipeline (deploy day, don't auto-fix)
    
    hermes cron pause agent-pipeline
    
    
    
    # Resume
    
    hermes cron resume agent-pipeline
    
    

    Cost Reality Check

    Running this pipeline with ~3 tickets per day:

    Item Daily Monthly Coder (Sonnet) $0.75 $22.50 Reviewer (Sonnet) $0.30 $9.00 QC (Haiku) $0.09 $2.70 Supervisor (DeepSeek) $0.03 $0.90 **Total** **$1.17/day** **~$35/month**

    That’s about the cost of one lunch delivery. For a junior developer that works 24/7.


    What We Just Built

    A fully autonomous pipeline that:

  • Runs every 30 minutes, 24/7
  • Discovers new bug issues from GitHub
  • Classifies: code bug / needs info / skip
  • Routes to Coder → Reviewer → QC
  • Creates PRs, posts review comments
  • Handles failures and retries gracefully
  • Reports everything to Telegram
  • Escalates to human when it can’t handle something
  • The whole thing fits in one cron job. You create it once, and it runs forever.


    Series: “AI Junior Developer” — Part 5 of 6. Next: Post 6 on monitoring and continuous improvement.


    Discover more from Susiloharjo

    Subscribe to get the latest posts sent to your email.

    Discover more from Susiloharjo

    Subscribe now to keep reading and get access to the full archive.

    Continue reading