AI & Tools #AI Agents #CLI

Pi Coding Agent: Installing and Using a Lightweight Terminal AI Assistant

If you feel like most AI development tools are too heavy, or they force you to change your habits, Pi is worth trying because you stay in control.

6 min read/ Medium

Example Videos

First, let's look at what Pi feels like in actual use and get a sense of how smooth the terminal experience is:


This video shows Pi's standout Tree View branching feature:


Introduction

Hi everyone. Today I want to share a pretty interesting terminal AI coding assistant: Pi.

Official GitHub project: https://github.com/badlogic/pi-mono

If you are like me and prefer to get everything done inside the terminal, but feel that many AI tools on the market, such as Cursor or other integrated IDE-style tools, are too large, or that they keep generating files you never asked for, you will probably like Pi.

Pi is a minimal terminal coding harness. Its core idea is: "Let Pi adapt to your workflow, instead of forcing you to adapt to it."

It intentionally does not ship with a pile of complex "sub-agents" or "plan mode" features. Instead, it gives you the cleanest and most useful default tools, such as reading and writing files and running bash commands. If you need more features, you can add them yourself through Extensions, Skills, or Prompt Templates. You can even install community-published packages through pi install.

Download and Installation

Installation is very simple. As long as you have Node.js in your environment, one npm command is enough to install it globally:

bash
npm install -g @mariozechner/pi-coding-agent

After installation, the most convenient way to start is to bind it directly to your existing AI subscription service.

If you already subscribe to Claude Pro, ChatGPT Plus, GitHub Copilot, Google Gemini, or similar services, you do not need to go into a dashboard and create an API key. Just sign in through OAuth:

bash
pi
/login  # Then choose your provider from the menu

Authorization only takes a few seconds, and then you can start chatting right away.

(Of course, if you are a heavier developer user and want to bring your own API keys, that is also fully supported. Taking Anthropic Claude as an example, just set the environment variable export ANTHROPIC_API_KEY=sk-ant-... and then run pi.)

Feature Test: A Smooth Experience Fully Inside the Terminal

Run pi inside your project directory, and you will enter its Interactive Mode.

The interface is very clean, but this plain text UI hides a lot of useful features:

  • Quick file references: Type @ directly in the input box to fuzzy search and load files from the project for the AI to reference.
  • Run Bash directly: Type !npm run test, and Pi will execute the command, then feed the resulting error messages directly back to the AI for debugging.
  • Paste screenshots: If your terminal supports it, press Ctrl+V or drag an image in directly to send it to a multimodal model.
  • Asynchronous conversation: When the AI is thinking or typing, you do not have to sit there and wait. Press Enter at any time to insert a "steering message" and correct its direction, or use Alt+Enter to queue up your next question.

Special Feature: Session Branching Like a Time Machine

This is the coolest and most practical feature in Pi for me.

Usually, when we chat with AI, if it misunderstands something halfway through or generates code that breaks the project, we can only keep sending prompts to correct it. That wastes tokens and time.

But in Pi, you only need to type /tree, and it will bring up a tree view of the entire conversation history. You can directly "jump back" to the conversation node before the AI went off track, modify the instruction you gave at that moment, and then grow a new branch from there to continue the conversation.

It feels like putting your chat history under Git. And all branch history lives in a single JSONL file, which keeps things very tidy.

Wait... There Are More Ways to Extend It

Pi can be customized far beyond that:

  • AGENTS.md context convention: Put an AGENTS.md file in the project root, and Pi can automatically understand the project's development conventions and common commands.
  • Hot-reload themes: Tired of the default color scheme? Type /settings to switch between dark and light themes instantly.
  • A flexible plugin ecosystem (Pi Packages): You can even write your own extensions in TypeScript, or install ones other people have already written. Custom UI, connecting to an MCP server, or even playing Doom in the terminal while waiting for the AI to respond are all possible.

If you are also looking for a lightweight, focused terminal AI assistant that stays fully under your control, I strongly recommend trying Pi in your next project.

Related links: