This playbook centers on the Antigravity CLI. It is for developers and reviewers who already know how to reproduce a bug but are handing the whole “read code, edit files, and run commands” sequence to an agent for the first time. You will finish with four independently checkable artifacts: root-cause hypotheses and minimal checks, a case that demonstrably fails before the patch, a patch limited to the root cause, and a per-change diff review with a complete regression record. You can follow the same workflow in the App or an IDE extension, with different review surfaces; see Create a project in the Antigravity app and review artifacts and IDE extensions: Review agent changes in your editor.
This is an independent, unofficial guidebook with no affiliation with Google. This page only combines execution modes, permissions, and review methods already verified elsewhere in this guidebook. For the general reproduction, hypothesis, and minimal-patch method, start with Locate and fix a bug.
In plain English: An agent turns judgments into actions
Section titled “In plain English: An agent turns judgments into actions”In a regular chat, you receive advice and decide whether to change the code. An agent can continue by reading files, writing tests, changing the implementation, and running commands; Your first agent task: Use execution modes and permissions as guardrails explains this move from answers to execution. If its first interpretation of the symptom is wrong, the later actions can spread that mistake. The reliable order is not “let it fix the code, then inspect the tests.” It is “make it propose falsifiable hypotheses, then obtain a test that fails before the patch.”
CLI plan mode investigates with read-only search and viewing tools before presenting a plan for approval. In default mode, file edits pause for diff review, while command execution remains governed by the permission configuration. See Your first agent task: Use execution modes and permissions as guardrails for those behaviors and boundaries. This playbook therefore separates analysis, creating the red test, and changing the implementation into three approval points.
Minimal example
Section titled “Minimal example”Weak prompt:
A ticket cannot be found when its ID uses different capitalization. Fix it, clean up the related code, and run every check.Better prompt:
Stay in plan mode first. Investigate read-only: do not edit files or run commands.Restate the actual and expected behavior, list no more than 3 root-cause hypotheses,and give one minimal check for each hypothesis.The plan must obtain a test that fails before the patch. Do not provide a patch until I confirm that the failure matches the report.Constraints: add no dependency, do not refactor adjacent modules, and preserve the return value for an unknown ID.This prompt makes “fail first, patch second” a gate. The general debugging method still comes from Locate and fix a bug; the agent-specific part keeps every action at a reviewable stopping point.
Complete example: A lowercase ticket ID is not found
Section titled “Complete example: A lowercase ticket ID is not found”Starting materials and boundaries
Section titled “Starting materials and boundaries”In the fictional demo-tickets repository, README.md says ticket IDs contain letters, a hyphen, and digits, and lookup is case-insensitive. A missing ticket returns undefined. The current implementation only passes a test with identical capitalization:
export function findTicketById(tickets, id) { return tickets.find((ticket) => ticket.id === id);}import test from 'node:test';import assert from 'node:assert/strict';import { findTicketById } from '../src/find-ticket.js';
const tickets = [ { id: 'BUG-17', title: 'Print preview is misaligned' }, { id: 'TASK-9', title: 'Add help copy' },];
test('finds an exact ticket ID', () => { assert.equal(findTicketById(tickets, 'BUG-17')?.title, 'Print preview is misaligned');});
test('returns undefined for an unknown ticket ID', () => { assert.equal(findTicketById(tickets, 'BUG-99'), undefined);});The allowed files are test/find-ticket.test.js and src/find-ticket.js. Do not change README.md, the test runner, dependencies, or any other file, and do not use the network. The test command is node --test. Before starting, use git status --short to make your own work distinguishable from this task. If the worktree is not clean, save your existing changes yourself instead of asking the agent to guess which changes belong to it.
Step 1: Produce hypotheses in plan mode
Section titled “Step 1: Produce hypotheses in plan mode”Confirm that the CLI is in plan mode, and keep commands subject to human approval. Do not add a broad allow rule merely to avoid one confirmation. Permissions and sandbox: what presets, rules, and the sandbox each control explains how the execution mode, toolPermission, and precise permission rules combine. Send:
Read only README.md, src/find-ticket.js, and test/find-ticket.test.js.Analyze the bug “lowercase bug-17 does not find BUG-17.”
Do not edit files or run commands yet. Deliver:1. The actual behavior, expected behavior, and known boundaries.2. No more than 3 root-cause hypotheses, ranked by code evidence.3. One minimal check for each hypothesis and what it would rule out.4. A plan for one failing case that only adds a test and does not change the implementation.5. The files you expect to change and the files you explicitly will not change.
Do not propose an implementation patch until I have the correct failing result.Check that the plan ranks strict equality as the strongest hypothesis, uses a lowercase query with unchanged fixture data to distinguish case handling from whitespace handling, and plans only one new test. If it says “normalize every input while here” or “clean up the lookup module,” send it back. See Artifacts and plans: kinds, surface differences, and how to judge a plan for evaluating a plan and commenting before approval.
Step 2: Approve the failing case first
Section titled “Step 2: Approve the failing case first”Move to a mode that asks you to review writes. Approve the test-file edit only; do not approve an implementation edit. See Your first agent task: Use execution modes and permissions as guardrails for the CLI’s edit-review behavior. The proposed test should resemble:
test('matches ticket IDs without case sensitivity', () => { assert.equal(findTicketById(tickets, 'bug-17')?.title, 'Print preview is misaligned');});Review it line by line. It must not alter an existing assertion, weaken the expectation to “any nonempty result,” or copy the implementation logic into the test. Then approve this command:
node --test test/find-ticket.test.jsExpect a result like the following. This is fictional output, not a run performed by this guidebook:
✔ finds an exact ticket ID✔ returns undefined for an unknown ticket ID✖ matches ticket IDs without case sensitivity Expected values to be strictly equal: + actual - expected + undefined - 'Print preview is misaligned'tests 3; pass 2; fail 1If the test unexpectedly passes, fails on an import error, or fails on a different assertion, stop here. A failing case must demonstrate the reported behavior, not merely produce a red exit status.
Step 3: Approve the minimal patch
Section titled “Step 3: Approve the minimal patch”Return the failing output to the agent and narrow approval to the implementation file:
The failing case failed as expected: lowercase bug-17 returned undefined, and the other two tests passed.Now provide the smallest diff that fixes that root cause. You may change only src/find-ticket.js.Do not change tests, README, dependencies, or other input rules.Explain why every changed line is necessary and list the regressions to run after the patch.One candidate patch within those boundaries is:
export function findTicketById(tickets, id) { return tickets.find((ticket) => ticket.id === id); return tickets.find((ticket) => ticket.id.toLowerCase() === id.toLowerCase());}Do not accept everything merely because the diff is short. Confirm that it changes only the case comparison defined by the requirement, adds no dependency, preserves the undefined result for an unknown ID, and neither deletes nor weakens the test. CLI /diff can show all changes or changes by turn; the App has a Review pane, and IDE extensions provide inline accept or reject controls. See Review agent changes before you accept them for the surfaces and review order.
Step 4: Review each location and run regressions
Section titled “Step 4: Review each location and run regressions”First inspect the Git differences independently:
git diff -- test/find-ticket.test.jsgit diff -- src/find-ticket.jsgit status --shortThen run the focused test and the repository-wide regression suite:
node --test test/find-ticket.test.jsnode --testFictional expected summaries:
# Focused test: fictional outputtests 3; pass 3; fail 0
# Full regression: fictional outputtests 18; pass 18; fail 0Record the actual commands, exit statuses, and output. If the repository documentation specifies a different full-regression command, use the project’s command instead of having the agent invent one. This guidebook has not run the fictional repository, so no code block on this page is run-tested.
Mapping the workflow to three entry points
Section titled “Mapping the workflow to three entry points”- CLI: Use
planmode for read-only hypotheses, review the test diff and implementation diff before writes, and cross-check with Git. See Your first agent task: Use execution modes and permissions as guardrails for mode behavior. - App: Make the plan, test edit, and implementation edit three review points, then compare files and turns in the Review pane. See Create a project in the Antigravity app and review artifacts for projects and worktrees.
- IDE extension: Finish reviewing the current pending diff before sending another message, so unreviewed edits do not carry into the next action. See IDE extensions: Review agent changes in your editor for that entry point.
The verified pages in this guidebook do not define a one-to-one mapping among CLI plan mode, the App’s Planning workflow, and the current controls in every IDE; see Artifacts and plans: kinds, surface differences, and how to judge a plan and IDE extensions: Review agent changes in your editor for the known boundaries. When switching entry points, do not copy the CLI switching steps literally. Follow the official pages for the current controls, defaults, and prompt text.
Counterexamples and rewrites
Section titled “Counterexamples and rewrites”Counterexample 1: Let auto do everything
Section titled “Counterexample 1: Let auto do everything”Use auto to find the cause, add tests, fix the code, and commit it. Tell me when everything is done.Problem: auto approves workspace edits automatically, so you lose the checkpoint where the failing test exists but the implementation is still unchanged. Rewrite: investigate read-only in plan mode, confirm the red test, and only then approve the implementation file. See Before enabling auto or Turbo: risks, acceptable cases, and reversal for the gates those modes remove.
Counterexample 2: Trust only the agent’s summary
Section titled “Counterexample 2: Trust only the agent’s summary”If you say every test passed, keep the changes.Problem: A summary does not prove that assertions were not weakened or that commands actually ran. Rewrite: inspect the test diff before the implementation diff, rerun the focused and full suites yourself, and finish by comparing git status. See Review agent changes before you accept them for the fixed order.
Counterexample 3: Continue after the wrong red result
Section titled “Counterexample 3: Continue after the wrong red result”The test is failing anyway. Keep changing code until it turns green.Problem: Import errors, fixture errors, and incorrect assertions all produce red results. Rewrite: require the failure to name the intended case and show actual undefined against the expected title. If it does not, repair the test or environment before touching the implementation.
Verification checklist
Section titled “Verification checklist”- Existing worktree changes were distinguished from the agent’s changes before the task began.
- The
planstage was read-only and named root-cause hypotheses, minimal checks, and explicit boundaries. - A test failed for the right reason before the patch, and its failure output was retained.
- The failing test did not delete or weaken assertions or duplicate the implementation.
- The implementation patch changed only allowed files and the directly related branch.
- A person reviewed every test and implementation diff instead of relying on the summary.
- The focused test and full regression suite actually ran, with commands, exit statuses, and output recorded.
-
git statusshows no extra files, dependency changes, network access, or unrelated refactoring. - The reproduction, root-cause, and regression loop matches Locate and fix a bug.
Recovery and safety boundaries
Section titled “Recovery and safety boundaries”- The plan is off target: Do not approve it. Require each hypothesis to point to a file and minimal check. If the call path is still unclear, return to Understand a codebase.
- The failing case is wrong: Reject the implementation patch and repair or restore the test first. Do not let “some failure” stand in for reproduction evidence.
- The agent changed an out-of-scope file: Stop the task, preserve
git statusandgit diff, and decide file by file what to retain or restore. Do not ask the agent to perform a broad cleanup before you have read the diff. - You need to undo file changes: Back up work you still need, then use Git to restore specific files. Treat
/rewindas conversation-history rollback; the verified page does not describe it as disk-file undo. See Your first agent task: Use execution modes and permissions as guardrails. - You need to inspect executed actions: The official pages do not provide one unified log of every executed command. Keep the tool-call details in the session, then cross-check them against Git, test output, and system state. See Before enabling auto or Turbo: risks, acceptable cases, and reversal for the guidebook’s procedure.
- Real credentials, production data, or an undisclosed vulnerability are involved: Stop uploading material and follow your organization’s response process. Examples must use synthetic data, and any key must be written as
YOUR_API_KEY.
Next: Use Locate and fix a bug for the general debugging method. To expand the failing case into a broader test strategy, read Add tests for an existing function. Before accepting a change, repeat Review agent changes before you accept them.