Help us shape the future of Go! Take the 2026 Go Developer Survey

ogcode

command module
v0.57.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

README

ogcode

The open-source, self-hostable AI coding agent.

Ogcode is an AI agent that understands your codebase, uses real tools, researches the web, remembers decisions, plans complex work, and ships changes, all from your browser. Your computer, your models, your data, your rules.

Release License Stars


Installation

# YOLO
curl -fsSL https://ogcode.in/install.sh | sh

# Package managers
brew tap prasenjeet-symon/tap && brew install ogcode   # macOS and Linux
winget install prasenjeet-symon.ogcode                 # Windows
go install github.com/prasenjeet-symon/ogcode@latest   # any OS with Go

[!TIP] CGO_ENABLED=1 is required when building from source: the Swift tree-sitter binding is cgo.

On Windows without winget:

irm https://ogcode.in/install.ps1 | iex

Or run the container:

docker run -p 9595:9595 \
  -v ~/.ogcode:/root/.ogcode \
  -v "$(pwd):/workspace" -w /workspace \
  ghcr.io/prasenjeet-symon/ogcode:latest

The image is also on Docker Hub as prasenjeetsimon/ogcode:latest.

Start it and open the web interface:

ogcode            # serves the UI on http://localhost:9595

Use a local model with Ollama, no API key needed:

ollama serve
ogcode

Permissions are per session: Ask (approve each step), Auto (risk-gated), or Yolo (no prompts). Learn more about permissions.

Two more commands are handy from a terminal:

  • ogcode run "fix the failing test" runs a one-shot prompt non-interactively and prints to stdout; --max-turns caps the agent loop (the default 0 means no limit) and --output-format json prints a machine-readable result.
  • ogcode index builds the semantic project index the agent maps your project with before reading files.

What you can do with Ogcode

  • Understand unfamiliar code: Ogcode maps a project before reading it, outlines files with exact line ranges, and reads only what matters. Core concepts →
  • Build and fix software: implement features and fixes across files, run your builds and tests, and investigate failures instead of retrying blindly.
  • Permission-aware.- Stay in control: choose Ask, Auto, or Yolo per session, and approve or remember each decision. Permissions →
  • Keep context that fits: recall past decisions instead of replaying the whole transcript, so long sessions stay focused and affordable. Memory & context →
  • Research as you go: built-in web search and page reading, reusable SKILL.md workflows, and external MCP servers. Search, skills & MCP →
  • See more than text: Mermaid diagrams, LaTeX and rendered PDFs, Plotly charts, sandboxed HTML, and downloadable artifacts. Rich results & preview →

Documentation

For configuration, providers, skills, remote deployment, and everything else, head over to our docs.

Configuration

Ogcode detects your provider from the environment. Set at least one:

Variable Provider
ANTHROPIC_API_KEY Anthropic / Claude
OPENAI_API_KEY OpenAI / GPT
OPENROUTER_API_KEY OpenRouter
OLLAMA_BASE_URL Ollama, or an OpenAI-compatible local endpoint

Settings can also live in ogcode.json at the project root (project settings) and ~/.config/ogcode/config.json (global settings); environment variables override both.

Set previewDomain to serve live-service previews under a real wildcard domain, the ogcode.json equivalent of the OGCODE_PREVIEW_DOMAIN environment variable. See the remote deployment guide.

{
  "providers": {
    "ollama": { "baseUrl": "http://localhost:11434" },
    "anthropic": { "apiKey": "sk-ant-..." }
  },
  "skills": {
    "paths": ["./team-skills"],
    "permissions": { "deploy-prod": "ask" }
  }
}

OGX is a subscription plan from OG Lab. Connect it from the settings screen and the plan's models run through OG Lab's gateway; no environment variable needed.

Remote deployment and security

Ogcode can run on a remote machine and be reached from a browser, but it can read and modify files and run commands. Never expose it directly to the public internet without authentication.

Recommended boundaries:

  1. Bind to localhost and reach it over an SSH tunnel.
  2. Put a reverse proxy with HTTPS and authentication in front of it.
  3. Use a VPN such as WireGuard or Tailscale.
  4. Run high-risk work in Docker, a VM, or an isolated worker.
ssh -L 9595:localhost:9595 user@your-server

Working setups (SSH tunnel, reverse proxy, and Docker) are in the remote deployment guide. For a hosted, multi-user deployment, see the control-plane documentation.

Contributing

If you're interested in contributing to Ogcode, please read CONTRIBUTING.md before submitting a pull request.

Development builds use make build, and tests run with CGO_ENABLED=1 go test ./....

Security

Treat Ogcode like a powerful automation process:

  • Review permissions before enabling write or shell access.
  • Keep API keys and secrets out of prompts, repositories, and public artifacts.
  • Use isolated environments for untrusted code.
  • Do not expose an unauthenticated server to the internet.
  • Report vulnerabilities by opening a GitHub issue in this repository.

Your code and session data stay local; only conversation content is sent to the model provider you configure, where that provider's privacy policy applies.

License

Ogcode is dual-licensed:

  • GNU AGPL v3.0: free and open source for running, modifying, and self-hosting Ogcode. If you run a modified version over a network, AGPL §13 gives its users corresponding-source rights.
  • Ogcode Commercial License: for embedding Ogcode in proprietary products, offering a hosted service without publishing modifications, or whenever AGPL is not suitable. See LICENSING.md.

Releases up to and including v0.36.1 remain MIT. v0.37.0 onward is AGPL-3.0-only. Bundled third-party code is listed in THIRD_PARTY_NOTICES.md.


Join our community Documentation | Star on GitHub | Reddit

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
board
Package board is the per-project roster of agents the build agent shares with the teammates it spawns.
Package board is the per-project roster of agents the build agent shares with the teammates it spawns.
browser
Package browser holds the server half of the browser takeover bridge: a WebSocket endpoint the ogcode companion browser extension connects to, and the request/response plumbing that turns an agent's tool call into one operation executed in the user's real Chrome tab.
Package browser holds the server half of the browser takeover bridge: a WebSocket endpoint the ogcode companion browser extension connects to, and the request/response plumbing that turns an agent's tool call into one operation executed in the user's real Chrome tab.
bus
cli
codemap
Package codemap produces a compact structural outline of a single source file — every top-level declaration and the line range it occupies — so an agent can jump straight to the region it needs with a bounded read instead of pulling the whole file into context.
Package codemap produces a compact structural outline of a single source file — every top-level declaration and the line range it occupies — so an agent can jump straight to the region it needs with a bounded read instead of pulling the whole file into context.
codemap/grammars/swift
Package swift provides the tree-sitter grammar for Swift.
Package swift provides the tree-sitter grammar for Swift.
config
Package config loads ogcode's optional file-based configuration: provider base URLs and API keys, the skill sources and permissions, and the live-preview domain, so they can live in a committed/shared file instead of only environment variables.
Package config loads ogcode's optional file-based configuration: provider base URLs and API keys, the skill sources and permissions, and the live-preview domain, so they can live in a committed/shared file instead of only environment variables.
db
filechange
Package filechange is the read-bookmark gate over file mutations: what each session last read of a file, every change that has landed since, and the durable history of those changes.
Package filechange is the read-bookmark gate over file mutations: what each session last read of a file, every change that has landed since, and the durable history of those changes.
git
gitignore
Package gitignore matches paths against .gitignore rules.
Package gitignore matches paths against .gitignore rules.
id
keepawake
Package keepawake holds a macOS power assertion while ogcode is doing work that should not be cut short by the display or the system going to sleep — specifically, for the duration of an agent turn.
Package keepawake holds a macOS power assertion while ogcode is doing work that should not be cut short by the display or the system going to sleep — specifically, for the duration of an agent turn.
logging
Package logging sets up ogcode's process-wide slog logger: a size-rotated, owner-only log file that receives everything at the configured level, and a terminal that sees only what the user must act on (errors, by default).
Package logging sets up ogcode's process-wide slog logger: a size-rotated, owner-only log file that receives everything at the configured level, and a terminal that sees only what the user must act on (errors, by default).
mcp
Package mcp connects ogcode to external Model Context Protocol servers declared in the project's ogcode.json under the "mcp" key.
Package mcp connects ogcode to external Model Context Protocol servers declared in the project's ogcode.json under the "mcp" key.
memfile
Package memfile is ogcode's per-turn markdown memory: after a turn completes, a structured summary of that turn is written as one dated markdown file under the project's .ogcode/memory/, and an incremental index of that folder lets a read-only recall agent find and read the right file cheaply.
Package memfile is ogcode's per-turn markdown memory: after a turn completes, a structured summary of that turn is written as one dated markdown file under the project's .ogcode/memory/, and an incremental index of that folder lets a read-only recall agent find and read the right file cheaply.
modelcatalog
Package modelcatalog persists the model catalogue each provider last reported and seeds a provider registry's in-memory catalogue from that copy.
Package modelcatalog persists the model catalogue each provider last reported and seeds a provider registry's in-memory catalogue from that copy.
nativehost
Package nativehost implements the Chrome Native Messaging host the companion browser extension pairs through: Chrome launches `ogcode native-host` with the port's stdin/stdout bound, and everything the extension needs to find this machine's running ogcode servers — an origin, a websocket URL and a pair token per server — is one "pair" request away.
Package nativehost implements the Chrome Native Messaging host the companion browser extension pairs through: Chrome launches `ogcode native-host` with the port's stdin/stdout bound, and everything the extension needs to find this machine's running ogcode servers — an origin, a websocket URL and a pair token per server — is one "pair" request away.
portmap
Package portmap remembers which TCP port each project directory serves on, so starting the same project always reuses the same port instead of drifting to whatever happens to be free at the time (the server walks past a busy port, so without memory a project's port depends on start order).
Package portmap remembers which TCP port each project directory serves on, so starting the same project always reuses the same port instead of drifting to whatever happens to be free at the time (the server walks past a busy port, so without memory a project's port depends on start order).
project
Package project resolves the stable identity of the workspace a session belongs to.
Package project resolves the stable identity of the workspace a session belongs to.
provider/datagen command
Command datagen regenerates internal/provider/data/catalog.json from the compiled-in catalog tables.
Command datagen regenerates internal/provider/data/catalog.json from the compiled-in catalog tables.
question
Package question carries the ask_user round trip: the agent loop registers a batch of questions it cannot answer on its own, blocks until a client replies, and resumes with the answers as the tool result.
Package question carries the ask_user round trip: the agent loop registers a batch of questions it cannot answer on its own, blocks until a client replies, and resumes with the answers as the tool result.
resource
Package resource samples this process's own resource usage — CPU, resident memory, Go runtime memory — so the UI can tell the user what ogcode actually costs on their machine.
Package resource samples this process's own resource usage — CPU, resident memory, Go runtime memory — so the UI can tell the user what ogcode actually costs on their machine.
sheet
Package sheet implements spreadsheet type inference: it profiles XLSX/CSV workbooks into per-sheet SheetProfile structures (column types, affinities, min/max, distinct values and sample rows) and the SQLite DDL that matches them.
Package sheet implements spreadsheet type inference: it profiles XLSX/CSV workbooks into per-sheet SheetProfile structures (column types, affinities, min/max, distinct values and sample rows) and the SQLite DDL that matches them.
skill
Package skill implements ogcode's lazy-loaded instruction system.
Package skill implements ogcode's lazy-loaded instruction system.
timer
Package timer is the durable record of one-shot reminders an agent schedules for itself.
Package timer is the durable record of one-shot reminders an agent schedules for itself.
usage
Package usage keeps the ledger of model spend and prices it.
Package usage keeps the ledger of model spend and prices it.
version
Package version provides version information and update checking.
Package version provides version information and update checking.
worker
Package worker is the ogcode side of the remote-agent-workers control plane.
Package worker is the ogcode side of the remote-agent-workers control plane.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL