Part 6: The agentic software factory
The software factory: from idea to merged PR
Stations, autonomy levels, specs, repo instructions, merge gates and security for a delivery pipeline where agents do most of the typing
In short
Build the whole line, not one station: artifacts between stations, explicit gates, and autonomy set per station by reversibility and verifiability.
Key ideas
- Felt speed-up misleads: baseline lead time and change failure rate before scaling agents
- Size the spec to the change; one task, one small PR; protect the tests that define done
- Layered merge gate, approver not the requester, no run holding all three triangle legs; review time, not tokens, sets PR cost
A summary only. The reasoning, examples, checklist and what to do on Monday are in the chapter. Read it in the book
40%+
of Sept 2026 GitHub PRs started by agents
19.7%
of LLM-recommended packages did not exist
Inside the chapter
- 1What a software factory is
- 2Autonomy, per station
- 3What the evidence says, and what it does not
- 4Choosing the coding agent
- 5From idea to spec
- 6Repo context: AGENTS.md
- 7Tasks, tests and parallel runs
- 8The merge gate, layer by layer
- 9Security of agent-written code
- 10Cost and throughput
Try it: the software factory stations
Each station: what agents do, and the human gate.
- 1IdeaAgents cluster feedback and draft framing. Gate: a human decides what to build.
- 2SpecAgents draft and ask clarifying questions. Gate: approve intent.
- 3PlanAgents decompose into PR-sized tasks. Gate: skim for large changes.
- 4CodeAgents implement and run tests. Gate: none inside the sandbox.
- 5ReviewFirst-pass review and auto-fix. Gate: a human approves the merge.
- 6TestAgents generate and run tests. Gate: humans own holdout scenarios.
- 7DeployAgents start, pause and inspect rollouts. Gate: approve irreversible steps.
- 8MonitorAgents investigate and propose a root cause. Gate: approve remediation.
- 9ImproveAgents propose fixes and eval cases. Gate: a human approves what changes.
Go further: free on this site
Questions readers asked about this chapter, a 5-question self-check with explanations, and every source it cites.
Questions readers ask (3)
3 questions. Open one to read the answer.
Our CI agent's vendor changed which plans it serves. How do we plan for that?
Treat each pipeline agent as a dependency with a support window. On 2026-06-18 Google moved free and individual paid Gemini CLI users to Antigravity CLI and says feature parity is not one to one (Google, May 2026). Record the agent, version and license tier of every pipeline, keep prompts in repo skills rather than vendor settings, and keep your own issue benchmark ready to qualify a replacement.
What breaks first when we scale from one agent to ten?
Review capacity, then environments, then CI and source control. Ten agents produce PRs faster than humans read them; flaky tests fail every run at once; merge queues built for human pace stall. Cap open agent PRs per reviewer, quarantine flaky tests, and load-test the merge queue first (Anthropic's numbers: Ch 15, Cost and throughput).
Is it safe to run a coding agent on issues from the public?
Only with the triangle broken: no long-lived secrets, a restricted tool set, no permission-bypass flags. The issue body does reach the model, so the gate is who can apply the label: write access, maintainers only, allowed_bots empty (Ch 15, Headless CI mode; Kit README, Notes and limits). In August 2026 an unprivileged GitHub issue could reach runner secrets through both Gemini CLI and Claude Code Action (CSA); a secret that is not in the environment cannot leak.
Answered in the book, not repeated here: See Chapter 15, Cost and throughput; See Chapter 15, Security of agent-written code; See Chapter 15, Autonomy, per station; See Chapter 15, Choosing the coding agent; See Chapter 15, Headless CI mode
Self-check (5)
Score: 0 / 5 (0 answered)
Question 1 of 5
A team turns on three coding agents. PR volume doubles in a month, the review queue grows and incidents creep up. What does the chapter identify as the underlying problem?
Show the answer
Answer: B.
The chapter calls this a factory problem: the queue moves to review, test and deploy, which were sized for human pace. Swapping the model would not change the capacity of the next station.
Question 2 of 5
According to the chapter, what should decide how much autonomy an agent gets at a station?
Show the answer
Answer: A.
Autonomy follows reversibility and verifiability. Developer trust is a poor guide: the METR studies show a reliable gap between felt and measured speed-up.
Question 3 of 5
An agent has passed the review gate without correction for 45 days, the gate has caught real defects and every change is reversible in minutes, but nobody has agreed to own the setting. Should you raise autonomy at that station?
Show the answer
Answer: C.
The decision rule requires all four conditions; without an owner nobody will lower the level after an incident. Review can rise for routine PR classes, so the absolute "always Approver" answer is wrong.
Question 4 of 5
In the Kit's label-triggered workflow, what is the human gate?
Show the answer
Answer: A.
Label mode puts the issue body in the session, so the gate must be the labeler, plus no production credentials and required review.
Question 5 of 5
A headless CI job must read public issue text. Which setup follows the chapter's triangle rule?
Show the answer
Answer: D.
The job already holds the untrusted-input leg, so it must drop credentials and keep its guardrails. A prompt instruction does not remove a leg; it only asks the model nicely.
Sources
Sources cited
- GitHub, Octoverse 2026, October 2026. github.blog
- Dan Shapiro, The Five Levels: From Spicy Autocomplete to the Dark Factory, January 2026. danshapiro.com
- Dash0, The Six Levels of Agentic Software Engineering, June 2026 (updated November 2026). dash0.com
- Feng, McDonald, Zhang, Levels of Autonomy for AI Agents, arXiv, June 2025. arxiv.org
- Simon Willison, How StrongDM's AI Team Build Serious Software Without Even Looking at the Code, February 2026. simonwillison.net
- Stack Overflow, Agents on a Leash: Agentic AI Remains Mostly Single-Agent and Monitored at Work, May 2026. stackoverflow.blog
- Stack Overflow, The Results of the 2026 Developer Survey Are Here, October 2026. stackoverflow.blog
- Cursor, The Third Era of AI Software Development, February 2026. cursor.com
- Google, How Are Developers Using AI? Inside Our 2025 DORA Report, September 2025. blog.google
- DORA, DORA Report 2025, 2025. dora.dev
- InfoQ, DORA Report Finds AI Is an Amplifier in Software Development, But Trust Remains Low, September 2025. infoq.com
- METR, Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity, July 2025. metr.org
- METR, We Are Changing Our Developer Productivity Experiment Design, February 2026. metr.org
- GitClear, AI Assistant Code Quality 2025 Research, 2025. gitclear.com
- CodeRabbit, Our New Report: AI Code Creates 1.7x More Problems, December 2025. coderabbit.ai
- TechSpot, Google Says AI Now Generates 75% of Its New Code, Up from 25% in 2024, April 2026. techspot.com
- Anthropic, Hooks Guide, Claude Code documentation, 2026. code.claude.com
- OpenAI, Codex Is Now Generally Available, October 2025. openai.com
- GitHub Docs, Risks and Mitigations for Copilot Cloud Agent, 2026. docs.github.com
- GitHub changelog, GitHub Copilot weekly releases, November 2026. github.blog
- TechCrunch, Cursor Continues Acquisition Spree with Graphite Deal, December 2025. techcrunch.com
- Cursor, Cursor 3 announcement, April 2026. cursor.com
- Google for Developers, update on transitioning Gemini CLI to Antigravity CLI, May 2026. developers.googleblog.com
- SiliconANGLE, AWS Launches Kiro into General Availability with Team Features and CLI Support, November 2025. siliconangle.com
- OpenAI, OpenAI Co-founds the Agentic AI Foundation Under the Linux Foundation, December 2025. openai.com
- OpenAI, Why SWE-bench Verified No Longer Measures Frontier Coding Capabilities, February 2026. openai.com
- Microsoft for Developers, Diving Into Spec-Driven Development With GitHub Spec Kit, September 2025. developer.microsoft.com
- Birgitta Böckeler, Understanding Spec-Driven-Development: Kiro, spec-kit, and Tessl, martinfowler.com, October 2025. martinfowler.com
- Anthropic, Migrating our Messages API to Rust, November 2026. anthropic.com
- Anthropic, Claude Code GitHub Actions, documentation, 2026. code.claude.com
- GitHub, 60 Million Copilot Code Reviews and Counting, March 2026. github.blog
- Spracklen et al., We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs, arXiv, 2024 (v3 2025). arxiv.org
- SC Media, AI Coding Assistants Twice as Likely to Leak Secrets, as Overall Leaks Rise 34%, 2026. scworld.com
- Invariant Labs, GitHub MCP Exploited: Accessing Private Repositories via MCP, May 2025. invariantlabs.ai
- Cloud Security Alliance, Three AI Coding Agents, One GitHub Issue: CI/CD Secrets Exposed, August 2026. labs.cloudsecurityalliance.org
- The Register, Compromised Amazon Q Extension Told AI to Delete Everything, and It Shipped, July 2025. theregister.com
- Snyk, Weaponizing AI Coding Agents for Malware in the Nx Malicious Package Security Incident, August 2025. snyk.io
- Fortune, An AI-Powered Coding Tool Wiped Out a Software Company's Database, Then Apologized for a 'Catastrophic Failure on My Part', July 2025. fortune.com
- The Register, Amazon denies Kiro agentic AI was behind the outage, February 2026. theregister.com
- Amazon, Correcting the Financial Times report about AWS, Kiro, and AI, February 2026. aboutamazon.com
- GitLab Advisory Database, CVE-2026-55607, July 2026. advisories.gitlab.com
- Simon Willison, post on the reported Codex $HOME deletion, July 2026. simonwillison.net
- OpenAI, GPT-5.6 System Card, 2026. deploymentsafety.openai.com
- Anthropic, Use Claude Code in the Cloud (Claude Code on the web), documentation, 2026. code.claude.com
- Anthropic, research post on redesigning source control for agent-scale merges, October 2026. anthropic.com
Further reading
- DORA, 2025 State of AI-Assisted Software Development (full PDF). services.google.com
- Anthropic, Claude Code: Best practices for agentic coding, April 2025. anthropic.com
- AGENTS.md, the open format's home page. agents.md
- Simon Willison, The lethal trifecta for AI agents, June 2025. simonwillison.net