CLI Agents on Replit

A guide to installing and running Claude Code, Codex, and Gemini directly in your Replit terminal to save costs and supercharge your vibe coding workflow.

Tutorial Sponsored by StockDips.AI

Why use a Command Line Interface (CLI) Agents?

Matt Palmer from Replit recently posted a great youtube tutorial showing how to run Claude Code within the Replit terminal shell.

It takes a little bit of technical navigating, but this is an extremely worthwhile investment. If you have used Replit for a while, you know that development costs can quickly skyrocke due to markups on their inference costs. If you already have a paid Anthropic, ChatGPT, or Gemini subscription, these agents can save you a TON on Replit Agent costs. It's not nearly as hard as it looks!

What are CLI Agents?

Most people are familiar with using AI via a chat interface in their browser. CLI agents start and live within your project directory, meaning they have direct access to files and your entire codebase. This means they can autonomously perform complex operations without you having to manually copy and paste code snippets or upload files (after granted permission).

The Agents

🧠 Claude Code (Anthropic)

As of Jan 2026 Claude Code appears to be the current King of the Hill for planning, building and much more.

🤖 Codex (OpenAI)

Another workhorse agent. It is close to neck and neck with Claude Code in terms of capability and thinking through complex development workflows. Some developers actually feel it is superior to Claude Code when it comes to very complex tasks, with the tradeoff being it is slower.

✨ Gemini 3 Pro and Flash (Google)

Great for web and UI design. Serviceable for everything else but not quite as strong as the others agents for complex tasks (sometimes gets stuck in thinking loops). Gemini Flash is basically a superior version of Replit's "Fast mode".

🌀 Replit Agent

Likely uses Claude as it's underling base model (and Gemini for design mode). Because you are charged per task by complexity, I reserve this agent for major changes that involve database schema updates, migrations, and complex database queries where native integration shines.

My workflow is to use OpenAI's Codex and Google's Gemini CLI because I already pay for their basic subscription plans. Since Replit appears to use Claude as the backbone for its main agent, this gives me access to 3 powerful agents with different personalities, strengths and weaknesses. This allows me to use one agent to cross-check the work of the other agents, ask for optimization suggestions, and easily perform rigorous code and security reviews. Today my workhorse agent is Codex for most tasks, and Gemini for UI and web development where it shines. I reserve the Replit Agent (Claude under the hood) for complex tasks involving database changes.

CLI Agent Installation Guide

Follow these steps to get each agent running in your Replit shell.

1. Claude Code (Anthropic)

npm install -g @anthropic-ai/claude-code

Start the agent:

claude

Authentication Trick:
1. Log in to your Anthropic account when prompted.
2. When you get to the "broken" page (localhost), copy the URL.
3. Open a new shell tab in Replit.
4. Type: curl "YOUR_BROKEN_URL" (include the quotes).
5. Type: claude (or go back to your original shell) and you're in!

2. Codex (OpenAI)

A powerful alternative for complex logic.

npm install -g @openai/codex

Start the agent:

codex

Authentication Trick:
1. Log in to your OpenAI account when prompted.
2. When you get to the "broken" page (localhost), copy the URL.
3. Open a new shell tab in Replit.
4. Type: curl "YOUR_BROKEN_URL" (include the quotes).
5. Type: codex (or go back to your original shell) and you're in!

3. Gemini

Excellent for creative UI and fast iterations.

npm install -g @google/gemini-cli

Start the agent:

gemini

Authentication Trick:
1. Log in to your Google account when prompted.
2. When you get to the "broken" page (localhost), copy the URL.
3. Open a new shell tab in Replit.
4. Type: curl "YOUR_BROKEN_URL" (include the quotes).
5. Type: gemini (or go back to your original shell) and you're in!

Visual Walkthrough (using Gemini)

Important Notes

Git is your best friend. While changes are automatically saved after changes made by the Replit agent, this is not the case with these CLI agents. You will find yourself having to make git commits manually after significant code changes. Get familiar with the Git tab so you can roll back changes if an agent goes off the rails.

Memory: Unlike the built-in Replit Agent, these CLI agents do not preserve memory between sessions. Treat each session as a fresh context or provide necessary context files manually.

Session Memory Hack: Create a CURRENT_TASK.md file to provide "session memory" context for your agents. Periodically ask your agent to update the file when you are in the middle of complex development tasks. When you resume your session, ask the agent to read the file for context to pick up where you left off.