Skip to main content
greg is an autonomous print agent built from the ground up for command-line developers. Powered by the @amaranthic/hernex engine, greg bridges frontier reasoning models to your local development environment—discovering project structure, tracing execution flows, applying multi-file code modifications, executing test suites, and rolling back changes with content-addressed snapshots. Unlike traditional interactive terminal chat applications that trap your workflow inside a conversational loop, greg follows the Unix philosophy: it ingests context from stdin, streams clean answers and code to stdout, isolates tool execution telemetry to stderr, and exits with standard POSIX exit codes.
Ready to dive straight in? Follow the Quickstart to run your first task in under two minutes, or see Common Workflows for step-by-step developer recipes.
This page covers:

The Print Agent Philosophy

Most developer agents wrap models in heavy, stateful interactive UIs that take over your entire terminal screen. While useful for casual inquiries, this breaks the core strength of the Unix command line: composability. greg operates as a print agent:
  1. Clean Standard Output (stdout): Only the final response, generated code, or structured JSON is written to stdout. You can safely pipe greg into downstream tools (| jq, | pbcopy, > patch.diff) without scraping away ANSI progress bars or diagnostic chatter.
  2. Diagnostic Standard Error (stderr): Step counters, tool execution notices (Read(src/index.ts), Bash(bun test)), LSP diagnostics, and permission warnings are routed strictly to stderr.
  3. Pipeline Ingestion (stdin): Pipe compiler errors, diffs, log files, or database schemas directly into greg without manually copying and pasting lengthy inputs into string arguments.
  4. Deterministic Exit Codes: Emits POSIX exit codes (0 for success, 1 for runtime error, 2 for fail-closed permission denial, 4 for timeout) so shell scripts and CI workflows can react deterministically.

Core Capabilities

greg pairs frontier intelligence with local filesystem and execution tools:
  • Autonomous Codebase Exploration: Employs Glob, Grep, Read, and native Lsp (Language Server Protocol) to navigate large repositories, trace definitions, and discover architectural patterns without loading thousands of irrelevant files into context.
  • Deterministic Permission Guardrails: Runs by default in read-only mode. File edits require --permission-mode acceptEdits, while arbitrary shell commands can be restricted to strict wildcard patterns (e.g. --allowed-tools "Bash(bun test *)").
  • Content-Addressed Delta Checkpoints: Every file modification is automatically snapshotted before changes touch disk using Hernex’s FileCheckpointStore. You can preflight unified diffs with greg checkpoints diff and roll back mistakes instantly with greg checkpoints restore.
  • Persistent Multi-Turn Threads: Conversation memory is persisted per workspace. Continue tasks seamlessly across sittings with -c, resume by ID with -r, or time-travel branch with --resume-session-at <index>.
  • Frontier Model Agnostic: Routes across Anthropic Claude, Google Gemini, OpenAI GPT-5, DeepSeek, Groq, OpenRouter, and local OpenAI-compatible endpoints using simple provider/model identifiers.

Quick Setup

Get up and running with a single curl command:

1. Install the Native Binary

The installer detects your OS (macOS, Linux, WSL) and architecture (Apple Silicon ARM64, x86_64), downloads the standalone release binary, and configures your PATH.

2. Configure Your Frontier Provider

Export your API key and set your default frontier model:

3. Run Your First Task

For detailed multi-provider configuration (including Google Gemini, OpenAI, Groq, and custom gateways), visit Managing Providers.

Everyday Usage Patterns

Here is how greg fits naturally into day-to-day developer workflows:

1. Understand Unfamiliar Code

Ask targeted questions about control flow, dependencies, or architectural patterns:

2. Autonomous Bug Fixing with Test Verification

Pass reproduction steps, allow file edits, and constrain shell execution to your test runner:

3. Terminal Piping & Code Review

Pipe git changes or log files directly into greg for instant analysis:

4. Risk-Free Refactoring with Instant Rollback

Experiment with large-scale code modernization knowing you can revert at any moment:

Architecture at a Glance

greg is built on modular components that ensure safety, persistence, and performance:

Next Steps

Explore the full documentation suite to master greg:
  • Quickstart: Step-by-step tutorial taking you through your first complete editing task.
  • Installation Guide: Detailed setup instructions for macOS, Linux, WSL, Android Termux, manual downloads, and source builds.
  • Managing Threads: Master session persistence, branching, transcript exports, and checkpoint rollback workflows.
  • Managing Providers: Configure API credentials, base URLs, reasoning effort budgets, and automatic fallback chains across 13+ providers.
  • Common Workflows: Practical recipes for exploration, refactoring, test generation, and CI automation.