Skip to main content

What is AI Pair Programming?

Introduction​

AI pair programming is writing code together with an AI assistant in short turns. You decide what to build and check each step. The assistant proposes or writes the code, and you accept, edit, or reject it before moving on.

Definition

AI Pair Programming

A way of working in which a developer and an AI assistant write code together in short, supervised steps, with the developer making every design decision and reviewing each change as it happens.

The name comes from human pair programming, where two developers share one task. Martin Fowler's guide to pair programming describes the driver as "the person at the wheel, i.e. the keyboard," and the navigator as the person who reviews the code as it is written and keeps the bigger picture in view. In AI pair programming the assistant usually drives and you navigate.

This article explains how the loop works, where it sits next to coding agents, and what it does not replace from a human pair.

Understanding the Concept​

The defining property is the size of each step. You see every change before the next one starts, so a wrong assumption costs one exchange, not an afternoon. That is the difference from delegating a task to an agent and reviewing the result at the end.

AI pair programming tools come in three shapes:

ShapeHow you workExample
Inline completionThe assistant suggests the next lines as you typeTab completion in the editor
Editor chatYou describe a change, the assistant edits the open filesA chat panel beside the code
Terminal pairYou talk to the assistant in a terminal, it edits files and commitsAider, which calls itself "AI pair programming in your terminal"

All three share one rule: the developer stays in the session. The same model can power a coding agent. What changes is how much work it does before it hands control back.

AI pair programmingDelegating to a coding agent
Step sizeOne edit or one small changeA whole task
ReviewAs each change landsOnce, on the finished diff
Your attentionContinuousAt the start and the end
Best forUnclear or design-heavy workWell-specified, repeatable work

Applying It in Practice​

Start the session with the goal and the constraints, then work in small slices. A good slice is one function, one test, or one refactor step. Ask for a short plan first on anything that touches more than two files, and correct the plan before any code is written.

Commit after each accepted slice. Aider does this for you: it "automatically commits changes with sensible commit messages." Small commits let you undo one bad step with Git instead of untangling it by hand.

Read every change before you accept it. Check that it reuses existing helpers, follows the project's patterns, and does not touch files outside the slice. Run the tests yourself after each step. The assistant's summary is not a test result.

Switch roles when it helps. Write the tricky part yourself and let the assistant write the tests, or the reverse. The assistant does not tire of typing, so give it the mechanical half.

Engineering Considerations​

A human navigator pushes back. An AI assistant tends to accept your direction, even when the direction is wrong. Ask it directly for problems with your approach, and treat agreement as no evidence either way.

Human pairing also spreads knowledge across a team. Two people leave the session understanding the code. With an AI pair, only you do. Keep human review on changes that other people will have to maintain.

The tight loop is slower per task than delegating. That cost is worth paying when the requirements are unclear, when the design is new, or when the code is security-sensitive. For routine work with a clear outcome, hand the task to an agent and review the diff at the end.

Scaling and Operations​

AI pair programming scales with your attention, which is one session at a time. Teams usually pair on the hard work and delegate the routine work to agents that run on their own.

Once you delegate, each agent needs its own working copy and its output needs review. Treq gives each agent its own workspace and shows each change as a pull-request-style diff. You can send inline review comments back to the agent, which keeps the review step close to the pairing loop. Human-in-the-loop development covers where those review points belong.

Next Steps​