Skip to content
The book / contents

The whole book,section by section.

Read straight from the manuscript's own contents file, so it is what is actually written rather than what was planned. Every chapter and every section is listed below.

  • 11 chapters
  • 359 sections
  • 135k words
  • 37 figures
01 / jump to a chapter11 chapters · 359 sections
  1. 01The AI-Native Engineer19
  2. 02From LLMs to Agents51
  3. 03Context Engineering Fundamentals32
  4. 04Model Context Protocol50
  5. 05Spec-Driven Development24
  6. 06The SDD Workflow31
  7. 07SDD Frameworks Compared14
  8. 08Verification and Quality Gates66
  9. 09Agent Orchestration Patterns27
  10. 10Scaling AI-Native Engineering in Teams29
  11. 11AI-Native in Practice at Cogwheel16
02 / every sectionin full, nothing folded
00ForewordFront matter
01The AI-Native Engineer19 sections
  1. 01The Vibe-Coding Trap
  2. 02Two Engineers, One Task
  3. 03What AI-Native Engineering Is Not
  4. 04The Role Transformation: From Implementer to Orchestrator
  5. 05Why the Traditional Workflow No Longer Scales
  6. 06The New Center of Gravity: Intent, Constraints, and Verification
  7. 6.1Intent
  8. 6.2Constraints
  9. 6.3Verification
  10. 07Human-in-the-Loop: The Nonnegotiable Checkpoint
  11. 08What AI-Native Engineers Actually Do
  12. 8.1Before the work
  13. 8.2During the work
  14. 8.3Throughout
  15. 09The New Skill Stack: Eight Skills That Make You Irreplaceable
  16. 10The Cost of Not Adapting
  17. 11Career Implications: Why Software Engineering Is Becoming a Leadership Role
  18. 12Starting Out: How Junior Engineers Grow When AI Writes the Basics
  19. 13Summary
02From LLMs to Agents51 sections
  1. 01How LLMs Work: An Engineer's-Eye View
  2. 1.1Tokens
  3. 1.2The Transformer and attention
  4. 1.3In-weights knowledge versus in-context knowledge
  5. 1.4The context window is your working-memory budget
  6. 02Why LLMs Are Good at Code
  7. 2.1Training with verifiable outcomes: RLHF and RLVR
  8. 2.2Chain-of-thought and reasoning models
  9. 03Nondeterminism, Temperature, and Sampling
  10. 04The Model Landscape
  11. 4.1Open source versus closed source
  12. 4.2Small language models
  13. 4.3Multimodal models
  14. 4.4Embeddings and semantic search
  15. 05Where LLMs Excel and Where They Fail
  16. 06Benchmarks: What They Do and Don't Measure
  17. 07The API Layer: How Engineers Talk to LLMs
  18. 08What Makes an Agent: LLM, Tools, Context, Loop
  19. 8.1The LLM: The reasoning core
  20. 8.2Tools: How agents act on the world
  21. 8.3Context: Accumulated state
  22. 8.4The agentic loop: Reason, act, observe, adjust
  23. 8.5Beyond single agents
  24. 09Building an Agent in 50 Lines of Code
  25. 9.1Stopping conditions and iteration limits
  26. 9.2Agent frameworks
  27. 9.3Why this matters for users of coding agents
  28. 10The Agent Execution Model: Reason, Act, Observe
  29. 10.1The self-correction loop: Tests as observations
  30. 11Tool Use and Function Calling
  31. 11.1How function calling works under the hood
  32. 12Memory and State
  33. 12.1In-context memory
  34. 12.2Long-term memory through files
  35. 12.3Retrieved memory with RAG
  36. 12.4Agent-generated memory
  37. 12.5Context rot
  38. 13Agent Economics: Cost, Latency, and Scope
  39. 14Human-in-the-Loop
  40. 14.1HITL as a design principle
  41. 14.2Feedback as context enrichment
  42. 14.3The agent decides when it needs you
  43. 14.4Calibrating HITL to risk
  44. 15The AI Tool Landscape
  45. 15.1IDE-integrated coding assistants
  46. 15.2CLI and terminal-native agents
  47. 15.3Cloud and background agents
  48. 15.4Code review assistants
  49. 15.5Design and UI generation tools
  50. 15.6Choosing tools without chasing hype
  51. 16Summary
03Context Engineering Fundamentals32 sections
  1. 01From Prompt Engineering to Context Engineering
  2. 02The Core Problem: Right Context, Right Time, Limited Window
  3. 2.1The attention problem
  4. 2.2The lost-in-the-middle phenomenon
  5. 2.3Context rot
  6. 2.4The human working-memory parallel
  7. 2.5The right-time problem
  8. 2.6The two failure modes
  9. 03Mandatory and Optional Context Components
  10. 04A Taxonomy of Context Components
  11. 4.1System prompts
  12. 4.2User input and user-provided context
  13. 4.3Rules, style guides, and constraints
  14. 4.4Skills
  15. 4.5Tools
  16. 4.6Custom agents
  17. 4.7Environment context: runtime and metadata
  18. 4.8Conversation history and memory management
  19. 05The Context Assembly Process
  20. 06Autonomous Context Discovery: How Agents Explore Before They Write
  21. 6.1Code indexing and semantic search
  22. 6.2CLI-based exploration
  23. 6.3Language servers and symbolic code understanding
  24. 6.4What autonomous discovery does and doesn't replace
  25. 07The Agent Runtime Pipeline: From Request to Action
  26. 7.1Context assembly, planning, and tool execution
  27. 7.2The iterative loop: reason, act, observe, adjust
  28. 08The Golden Balance: Too Little Focus, Too Much Distraction
  29. 09Avoiding Context Rot
  30. 9.1Session management
  31. 9.2Token efficiency for large payloads
  32. 10Summary
04Model Context Protocol50 sections
  1. 01What MCP Is and Why It Matters
  2. 1.1What MCP actually does
  3. 1.2Why the MCP standard matters for engineers
  4. 02The MCP Architecture: Clients, Servers, and Transports
  5. 2.1Hosts, clients, and servers
  6. 2.2Transports
  7. 2.3Local servers versus remote servers
  8. 2.4How it connects in your daily workflow
  9. 03The MCP Ecosystem
  10. 3.1Configuring a server: a typical example
  11. 04The Economics of MCP
  12. 4.1What you pay for in an MCP session
  13. 4.2Controlling tool output size
  14. 05MCP Security Model
  15. 5.1Threats
  16. 5.2What Real Incidents Teach Us About MCP Security
  17. 5.3MCP Security Best Practices
  18. 5.4Four Security Principles
  19. 06Operating MCP in Production
  20. 6.1MCP Approved Registry
  21. 07Debugging MCP
  22. 7.1The server won't start
  23. 7.2The server connects but shows no tools
  24. 7.3The agent doesn't use the tool you expect
  25. 7.4A tool call fails with an error
  26. 7.5Reading tool-call logs
  27. 08MCP and Context Pollution
  28. 8.1Why Too Many MCP Servers Degrade Performance
  29. 8.2Agent-Specific MCP Server Configuration
  30. 09Building Your Own MCP Server
  31. 9.1When to build your own
  32. 9.2How hard is it?
  33. 9.3Writing good tool descriptions
  34. 10MCP in Agentic Pipelines
  35. 10.1What changes when there's no human in the loop
  36. 10.2Practical use cases for MCP in pipelines
  37. 10.3The reliability constraint
  38. 11Skills and CLI Scripts: When You Don't Need an MCP Server
  39. 11.1The pattern
  40. 11.2Skills that reference project scripts
  41. 11.3The CLI-first movement
  42. 11.4When to use skills and CLI tools versus MCP
  43. 12Advanced Tool Use: Scaling Beyond Static Tool Lists
  44. 12.1The three bottlenecks
  45. 12.2Tool search: Loading tool definitions on demand
  46. 12.3Programmatic tool calling: Code as orchestration
  47. 12.4Tool-use examples: Teaching by showing
  48. 12.5Matching the solution to the bottleneck
  49. 12.6Where the industry is heading
  50. 13Summary
05Spec-Driven Development24 sections
  1. 01The Root Problem: Why Do We Need SDD?
  2. 1.1Garbage In, Garbage Out: At Scale
  3. 1.2The Compounding Problem
  4. 1.3The Human Parallel
  5. 02You Already Write Specs
  6. 2.1When These Documents Are Missing
  7. 03The Case for Spec-Driven Development
  8. 3.1The Power of Learning by Writing a Spec
  9. 3.2Uncovering Unclear Requirements with a Spec
  10. 04The Economics of Writing Specs
  11. 05When SDD Is Not the Right Fit
  12. 06Specs as Durable Artifacts That Survive Tool Changes
  13. 6.1Specs and Organizational Knowledge
  14. 07SDD and Human-in-the-Loop
  15. 08Why Engineers Resist Writing Specs
  16. 09Plan Mode: The Bridge Between Vibe Coding and SDD
  17. 9.1Plan Mode in Practice
  18. 9.2Plan Mode and Spec-Driven Development
  19. 10Three Levels of SDD Maturity
  20. 10.11. Spec-First: Writing Specs Before Implementation
  21. 10.22. Spec-Anchored: Keeping Specs During Evolution
  22. 10.33. Spec-as-Source: The Spec as Primary Artifact
  23. 11What Good Specs Look Like
  24. 12Summary
06The SDD Workflow31 sections
  1. 01The Canonical Loop: Specify, Plan, Execute, Verify, Integrate, Learn
  2. 1.1Where Humans Must Stay in the Loop
  3. 1.2Stop Conditions and Escalation Rules
  4. 02Before the Loop: When You Need a Prototype First
  5. 2.1The Throwaway Branch Pattern
  6. 2.2Scratch Repo Prototypes
  7. 2.3A Concrete Example
  8. 2.4Consolidating Learnings into the Spec
  9. 2.5When to Skip the Prototype
  10. 03The Core Artifact Set
  11. 3.1spec.md: Intent, Constraints, Acceptance Criteria
  12. 3.2plan.md: Approach, Trade-Offs, Sequencing
  13. 3.3tasks.md: Atomic Tasks with Done Checks
  14. 3.4Optional Artifacts: risks.md, rollback.md, adr.md
  15. 04From Idea to Spec: Turning Intent into a Document
  16. 05From Spec to Plan: Turning Intent into Action
  17. 06From Plan to Tasks: Decomposition and Dependency Management
  18. 07Execution Patterns and Prompts
  19. 08Verification as Hard Rails: CI Gates That Make Output Shippable
  20. 09Integration and Deployment
  21. 10Learning and Iteration: Closing the Loop
  22. 11The Spec Lifecycle: What Happens After Implementation?
  23. 11.1The Two-Tier Model: What Works in Practice
  24. 11.2The Learning Phase as the Bridge
  25. 12SDD in Brownfield Projects
  26. 12.1The Core Challenge: Specs for Code That Was Never Specified
  27. 12.2Starting Small: The Spec Island Strategy
  28. 12.3Reverse-Engineering Intent with AI Assistance
  29. 12.4Handling Undocumented Behavior and Implicit Contracts
  30. 12.5Prioritizing What Gets Specified First
  31. 13Summary
07SDD Frameworks Compared14 sections
  1. 01Why Frameworks Exist: Structure, Consistency, Team Alignment
  2. 02GitHub Spec Kit
  3. 03OpenSpec
  4. 04BMAD Method
  5. 4.1Roles, Personas, and Guided Workflows
  6. 4.2BMAD in Practice
  7. 4.3BMAD in Brownfield Projects
  8. 4.4Custom Workflows, Custom Agents, and Adapting BMAD for Your Use Case
  9. 05Other Tools Worth Knowing
  10. 5.1Kiro
  11. 5.2Agent Skills
  12. 06Choosing the Right Framework
  13. 07Frequently Asked Questions on Using SDD in Production
  14. 08Summary
08Verification and Quality Gates66 sections
  1. 01The Bottleneck Moves
  2. 1.1Why Manual Review Doesn't Scale
  3. 1.2What This Chapter Promises
  4. 1.3The Two Big Questions
  5. 1.4Harness Validations and Self-Check Loops
  6. 02Before Merge, Layer 1: Deterministic Guardrails
  7. 2.1Linting and Formatting as a Baseline
  8. 2.2Dead Code and Unused Dependencies
  9. 2.3Type Checks and Compilation
  10. 2.4The Test Suite
  11. 2.5Mutation Testing as a Test Quality Gate
  12. 2.6Property-Based Testing for Invariants
  13. 2.7Static Application Security Testing (SAST)
  14. 2.8Dependency and Container Scanning
  15. 2.9Secrets Scanning
  16. 2.10Infrastructure as Code Scanning
  17. 2.11Supply-Chain Integrity
  18. 2.12Architecture Fitness Functions
  19. 2.13Performance and Bundle Budgets
  20. 2.14Query and Data-Access Performance
  21. 2.15Dependency Updates
  22. 2.16Contract Gates: API and Schema Breakage
  23. 2.17Accessibility and Internationalization
  24. 2.18Pull-Request Size and Scope Discipline
  25. 03Before Merge, Layer 2: LLM-Based Review
  26. 3.1Why Deterministic Checks Are Not Enough
  27. 3.2Adversarial Review Before the PR
  28. 3.3How an LLM Reviewer Works
  29. 3.4Two Ways to Organize the Review
  30. 3.5What to Look For
  31. 3.6Tuning the Reviewer to Your Codebase
  32. 04After Merge, Layer 3: Safe Deployment Strategies
  33. 4.1Feature Flags as the Default
  34. 4.2Blue-Green Deployments
  35. 4.3Canary Deployments
  36. 4.4Shadow Traffic and Dark Launches
  37. 4.5Progressive Delivery by User Segment
  38. 4.6Automated Rollback on Error Budget Burn
  39. 4.7Choosing Strategies
  40. 4.8Data Safety
  41. 05After Merge, Layer 4: Runtime Safety and AI-Powered Ops
  42. 5.1The Three Pillars, Briefly
  43. 5.2OpenTelemetry as the Common Substrate
  44. 5.3SLOs and Error Budgets
  45. 5.4Reducing Alert Fatigue
  46. 5.5Where AI Changes the Game
  47. 5.6AI Anomaly Detection on Metrics and Logs
  48. 5.7Post-Deploy Observability Analysis
  49. 5.8AI-Driven Root-Cause Analysis
  50. 5.9The Bug-Resolution Pipeline
  51. 5.10Closing the Loop Back to the Coding Agent
  52. 5.11Synthetic Monitoring and Chaos Engineering
  53. 06The Human in the Loop: Deciding What Needs You
  54. 6.1Two Mechanisms to Decide What Needs a Human
  55. 6.2The Deterministic Gate: Changes That Always Need a Human
  56. 6.3The AI Risk Scorer
  57. 6.4How Human Review Is Changing
  58. 6.5Reviewing the Reviewer
  59. 07Putting It Together
  60. 7.1A Reference Pipeline, End to End
  61. 7.2What to Adopt First
  62. 7.3Metrics for the System Itself
  63. 7.4Failure Modes
  64. 7.5The Trust Ladder
  65. 08Further Reading
  66. 09Summary
09Agent Orchestration Patterns27 sections
  1. 01Why Software Engineers Need to Understand Agent Orchestration Patterns
  2. 1.1Why Using a Single Agent Doesn't Scale
  3. 1.2The Tradeoffs of Orchestrating Multiple Agents
  4. 02One Agent, Bigger Jobs: Compaction and Scratchpads
  5. 2.1Compaction: The Automatic Fix That Gets Messy
  6. 2.2Scratchpads: Memory in a File You Control
  7. 03SDD as an Orchestration Pattern
  8. 3.1Using Different Models in Different SDD Phases
  9. 04The Generator-Critic Loop
  10. 4.1Worked Example: Adversarial Code Review
  11. 05The Goal Pattern: Looping Until the Goal Is Met
  12. 06The Ralph Loop
  13. 6.1How It Works
  14. 6.2What Makes It Work, and What Keeps It Safe
  15. 6.3Tools
  16. 07Running Multiple Agents in Parallel on the Same Codebase
  17. 7.1Context-Window Isolation
  18. 7.2Git Worktrees
  19. 7.3Isolated Cloud VMs
  20. 08The Subagent Pattern
  21. 8.1Ways to Arrange Work
  22. 8.2The Advisor: A Stronger Model for the Hard Parts
  23. 09Workflows: Orchestration as Code
  24. 9.1A Fixed Script: Letting the Agent Decide
  25. 10The Dark Factory: Where This Is All Going
  26. 10.1Two Modes of Working
  27. 11Final Considerations
10Scaling AI-Native Engineering in Teams29 sections
  1. 01Why Scaling to the Team Level Is a Different Problem
  2. 1.1The Bottleneck Moves, It Doesn't Disappear
  3. 1.2New Failure Modes That Only Show Up at Team Scale
  4. 1.3AI Is a Mirror and a Multiplier
  5. 02The AI-Native Team Canvas: Design How Your Team Adopts AI
  6. 2.1A Business Model Canvas, but for AI Adoption
  7. 2.2How to Run It
  8. 2.3The Eight Boxes
  9. 2.4Skill Gaps and System Gaps
  10. 2.5Usage Is Not Readiness
  11. 03Resistance Is Rational: Why Engineers Push Back
  12. 3.1The Three Objections You Will Hear
  13. 3.2Reframing the Craft
  14. 3.3What This Means for Leaders
  15. 04Standardize the Team Stack
  16. 4.1Standardize What Matters
  17. 4.2The Shared Context Is the Real Stack
  18. 4.3The Harness Gets Better Over Time
  19. 4.4Someone Has to Own It
  20. 4.5Leave Room to Experiment
  21. 05How an AI-Native Team Works
  22. 5.1Pair on the Agent, Not Just the Code
  23. 5.2Write and Review Specs as a Team
  24. 06The Team Gets Smaller and Tighter
  25. 6.1The Human Cost of Running a Fleet
  26. 6.2Agents That Work Overnight
  27. 6.3Product and Design Move Closer to the Code
  28. 07Measuring Adoption
  29. 08Summary
11AI-Native in Practice at Cogwheel16 sections
  1. 01Gridlock at Cogwheel
  2. 02The Mission: A Greenfield Service Inside a Brownfield World
  3. 03Week 1: Everything Except Signals
  4. 3.1A PRD, Written Together
  5. 3.2The AINE Canvas: How the Team Will Work
  6. 3.3Building the User Harness
  7. 3.4Wiring In Cogwheel's World
  8. 04Week 2: Splitting Into Stories
  9. 4.1Prototyping in Code, Not Pictures
  10. 4.2The Loop in Motion
  11. 05Weeks 3–4: Trusting the Code
  12. 5.1Watch One PR Go Through
  13. 06Weeks 5–8: A Fleet, Not a Hero
  14. 6.1Making It the Team's Way
  15. 6.2Measuring Honestly
  16. 07Week 9: Cogwheel Ships Pulse
03 / from here