newspaperPress Guidelines
Pricing
Enterprise
Downloaddownload

Explore our next generation products

See overview

Products

antigravityAntigravity 2.0terminalAntigravity CLIcodeAntigravity IDEsdkAntigravity SDK

Built for developers in the agent-first era

See overview
FrontendFullstackScienceMarketer

Everything you need to stay up-to-date and get help

Documentationkeyboard_arrow_rightBlogChangelogSupportPressReleases

Explore our next generation products

See overview

Products

antigravityAntigravity 2.0terminalAntigravity CLIcodeAntigravity IDEsdkAntigravity SDK

Built for developers in the agent-first era

See overview
FrontendFullstackScienceMarketer
Pricing
Enterprise

Everything you need to stay up-to-date and get help

Documentationkeyboard_arrow_rightBlogChangelogSupportPressReleases
Home
Antigravity 2.0v2.5.0keyboard_arrow_right
Overview
Getting Started
Build with Google
Feature Overview
Models
Projects
Settingskeyboard_arrow_right
Overview
Agent Settings
Artifact Review
Customizationskeyboard_arrow_right
MCP
Skills
Rules
Plugins
Hooks
Sidecars
Agent Capabilitieskeyboard_arrow_right
Permissions
Subagents
Artifactskeyboard_arrow_right
Overview
Plan
Walkthrough
Screenshots
Antigravity CLIv1.1.11keyboard_arrow_right
Overview
Getting Started
Installation & Auth
Tutorial
Using AGY CLI
Features
Gemini Migration
Prompting
Headless mode
Artifactskeyboard_arrow_right
Overview
Conversations
Agent Capabilitieskeyboard_arrow_right
Choose an execution mode
Subagents
Sandbox
Permissions
Projects
Settingskeyboard_arrow_right
Overview
Vim Editor Mode
AI Credits
Customizationskeyboard_arrow_right
MCP
Plugins & Skills
Status Line
Window Title
Commandskeyboard_arrow_right
Agents (/agents)
Code Search (/codesearch)
AI Credits (/credits)
Diff (/diff)
Permissions (/permissions)
Resume (/resume)
Status Line (/statusline)
Window Title (/title)
Model Quotas (/usage, /quota)
Best Practices
Troubleshooting
Reference
Antigravity SDKv0.1.10keyboard_arrow_right
Overview + Quick Start
Customizationskeyboard_arrow_right
MCP
Antigravity IDEv2.1.1keyboard_arrow_right
Overview
Getting Started
Featureskeyboard_arrow_right
Tab
Side Panel
Review Changes
Artifactskeyboard_arrow_right
Plan
Walkthrough
Screenshots
Browser Recordings
Browserkeyboard_arrow_right
Overview
Allowlist / Denylist
Separate Chrome Profile
Customizationskeyboard_arrow_right
MCP
Skills
Rules
Workflows
Plugins
Hooks
Settings
Migrationkeyboard_arrow_right
Firebase Studio Migration
Enterprise
Plans
FAQ
  • side_navigation
  • Antigravity CLI
  • >
  • Commands
  • >
  • Code Search (/codesearch)

Code Search Command (/codesearch)link

Interactively search the code in your workspace from inside the TUI, without leaving your session or interrupting the agent.

Overviewlink

The /codesearch command opens a fullscreen Code Search panel that runs a search across your current workspace and shows the matches grouped by file, with surrounding context and the matched text highlighted. It is handy for quickly locating a symbol, string, or pattern and then jumping straight to the file at the matching line. /codesearch directly queries your workspace and returns results instantly.

The command has two aliases: /cs and /search.

Running a searchlink

  1. Type /codesearch followed by your query in the prompt box.
  2. Press Enter.
text
/codesearch UserSession

The Code Search panel opens with the results grouped by file. The header shows your query and the number of matches, and each match is displayed with one line of context above and below. The matched text is highlighted:

The Code Search panel showing matches for a query grouped by file with highlighted results

Navigation and controlslink

The panel is fully keyboard driven:

Key Action
↑ / ↓ Move between individual matches
← / → Jump to the previous / next file group
Enter Open the highlighted result in the file viewer at the matching line
Ctrl+G Open the highlighted result in your external editor at the matching line
Esc Close the panel and return to the prompt

Query syntaxlink

By default, queries are interpreted as regular expressions and matching is case-insensitive unless your query contains an uppercase letter (smart case).

Literal (fixed-string) matchinglink

Add -F (or --literal) anywhere in the query to disable regex and match the text literally. This is useful when your query contains regex metacharacters such as ., (, or *:

text
/codesearch -F map[string]*UserSession

Filtering by file pathlink

Restrict a search to certain files with f: (aliases file: and path:) followed by a glob. Prefix the filter with - to exclude matching files instead:

text
/codesearch f:store.go Session
text
/codesearch -f:*_test.go NewUserSession

The Code Search panel scoped to a single file using an f: path filter

Opening a file and commenting on lineslink

Code Search is more than a viewer — you can open any result and give the agent precise, line-level feedback without leaving the CLI.

Open a resultlink

Highlight a match with ↑ / ↓ and press Enter to open that file in the built-in file viewer, scrolled to the matching line. Use Ctrl+G instead to open it in your external editor.

Inside the file viewer, the footer shows the available actions:

text
↑/↓ scroll · pgup/pgdown page · shift+g bottom · g top · c comment · ctrl+g editor · / search

Comment on a specific linelink

  1. Move the cursor (↑ / ↓) to the line you want to annotate.
  2. Press c to open the inline comment editor for that line.
  3. Type your note. Use Shift+Enter (or Alt/\+Enter) for a new line, and press Enter to save it.

A saved comment is stored against that line and marked with a 💬 icon in the gutter. Repeat for as many lines as you like. To remove a comment, place the cursor on the line and press the delete key (d).

Leaving a line comment in the file viewer opened from Code Search

Send your comments to the agentlink

When you leave the file viewer with Esc, any pending comments are collected and the CLI asks whether to send them:

  • y — send + close: your comments are delivered to the agent as your next message, formatted as <file>:<line>: <comment> so the model knows exactly which lines you mean.
  • n — discard + close: exit without sending.
  • Esc — cancel and keep editing.

Confirming whether to send unsent line comments to the agent

This makes Code Search a fast way to find relevant code and hand the agent targeted, line-anchored instructions in a single flow.

Next stepslink

  • CLI Features: Explore the rest of the interactive TUI capabilities.
  • Prompting Guide: Learn how to direct the agent to search and edit code for you.
  • Resume Command (/resume): Navigate and manage your past conversations.
Agents Command (/agents)
AI Credits Command (/credits)
On this Page
Code Search Command (/codesearch)OverviewRunning a searchNavigation and controlsQuery syntaxLiteral (fixed-string) matchingFiltering by file pathOpening a file and commenting on linesOpen a resultComment on a specific lineSend your comments to the agentNext steps