smallnest/pigo

pi agent in Golang

What it solves

pigo is a command-line AI coding agent designed to automate the cycle of understanding requirements and modifying code. It bridges the gap between high-level prompts and concrete file changes by allowing an LLM to read, write, and execute commands directly within a local development environment.

How it works

The project implements a layered runtime architecture where a central agent loop manages the interaction between the user, the LLM provider, and a set of local tools. It uses a two-layer loop system: an inner loop that handles the stream of responses and tool executions until the assistant stops calling tools, and an outer loop that manages follow-up messages.

Key operational components include:

  • Multi-Provider Support: Compatible with OpenRouter, Ollama, Anthropic, and OpenAI-compatible endpoints.
  • Tool Integration: Built-in tools for file operations (read, write, edit), search (grep, find), shell execution (bash), and web access (webfetch, websearch).
  • Security Gates: A project trust system that requires user confirmation for "side-effect" tools (like bash or write) in untrusted directories.
  • Context Management: Automatic context compression (summarization) when approaching the LLM's window limit.

Who it’s for

  • Developers who want an AI agent capable of performing actual coding tasks in their terminal rather than just generating snippets.
  • CI/CD Engineers who can use the "headless" mode (-p) for automated scripts.
  • Go Developers looking to embed coding agent capabilities into their own applications via the provided SDK.

Highlights

  • Dual Execution Modes: Supports both an interactive REPL and a headless script mode for CI/CD integration.
  • Extensible Architecture: Features a system for "Skills" (reusable prompt-based capabilities), plugins, and a robust Hooks system to intercept or modify agent behavior via shell commands.
  • Flexible Tool Control: Granular tool access via white-lists (--allowed-tools) and black-lists (--disallowed-tools).
  • Session Persistence: Ability to list, resume, and continue previous sessions.
  • Prompt Templating: Supports reusable Markdown templates with complex parameter syntax for common tasks.

Related

  • Project
  • Project
  • Project
  • Project
  • Project