Back office ops · Production

Spotify's Background Coding Agent (Honk Part 2): Context Engineering with Claude Code

The problem

Spotify's background coding agent needed reliable context engineering to produce mergeable pull requests at scale across thousands of repositories, but early agent approaches struggled with complex multi-file changes, context window limitations, and the difficulty of writing prompts that generalise across repos.

First attempt

Open source agents Goose and Aider could not reliably produce mergeable PRs at scale, and Spotify's homegrown agentic loop required overly rigid step-by-step instructions and struggled with complex multi-file changes and context window exhaustion.

Workflow diagram · grounded in source
1
User submits prompt and file scope
trigger
“The user provides a prompt and a list of all files in scope.”
2
Agent edits code with build feedback
ai_action
“The agent takes a few turns editing files based on the prompt, incorporating feedback from the build system with each turn.”
3
Build and test verification gate
validation
“The task is complete once the tests are passed or limits are exceeded (10 turns per session, three session retries total).”
4
Claude Code manages tasks and subagents
ai_action
“we turned to Claude Code, which allowed us to use more-natural task-oriented prompts, and we benefited from its built-in ability to manage Todo lists and spawn subagents efficiently”
5
Pull request opened automatically
output
“open pull requests (PRs) automatically”
Reported outcome

Claude Code became Spotify's top-performing background coding agent, applied across about 50 migrations with the majority of background agent PRs merged into production, and at scale merging thousands of PRs across hundreds of repositories.

Reported metrics
migrations completed with Claude Codeabout 50
background agent PRs merged to productionmajority of the background agent PRs merged into production
PRs merged across repositories at scalethousands of PRs across hundreds of repositories
Reported stack
Claude CodeClaude Agent SDKGooseAiderModel Context Protocolripgrep
Source
https://engineering.atspotify.com/2025/11/context-engineering-background-coding-agents-part-2
Read source ↗

Frequently asked questions

What did this team achieve with this AI workflow?

Claude Code became Spotify's top-performing background coding agent, applied across about 50 migrations with the majority of background agent PRs merged into production, and at scale merging thousands of PRs across hu…

What tools did this team use?

Claude Code, Claude Agent SDK, Goose, Aider, Model Context Protocol, ripgrep.

What results were reported?

migrations completed with Claude Code: about 50; background agent PRs merged to production: majority of the background agent PRs merged into production; PRs merged across repositories at scale: thousands of PRs across hundreds of repositories (source-reported, not independently verified).

What failed first in this deployment?

Open source agents Goose and Aider could not reliably produce mergeable PRs at scale, and Spotify's homegrown agentic loop required overly rigid step-by-step instructions and struggled with complex multi-file changes…

How is this back office ops AI workflow structured?

User submits prompt and file scope → Agent edits code with build feedback → Build and test verification gate → Claude Code manages tasks and subagents → Pull request opened automatically.