archi

// go build ./…  ·  zero dependencies  ·  v1.8.0

An architect that knows your codebase.

Generic assistants design in a vacuum. archi reads your repository first — then designs, builds, reviews, and rolls back changes that name your packages, your conventions, your constraints. Written in Go, standard library only.

Get started Read the docs ↓ go install github.com/devthedeveloper/archi@latest
zsh — my-service
0dependencies
10commands
3surfaces
9releases
2go modules

devthedeveloper.github.io / home / archi

package archi // import "github.com/devthedeveloper/archi"

v1.8.0 go 1.22 dependencies 0 license MIT surfaces CLI · MCP · GitHub App

// index

Index

// overview

Overview

archi init scans the tree, reads the manifests and entry points, and asks one analyst pass to write down what it learned — cached under .archi/. Every design after that is grounded: Markdown briefings with Mermaid diagrams and file-by-file plans against your real modules. Approve a design and archi builds it — with diffs, versioned backups, and a verify-and-repair loop that runs your own toolchain.

initlearn the repo
designensemble + critics
buildswarm, diffs, backups
verifytoolchain + repair
rollbackif you change your mind

Works with Ollama Cloud (default), Anthropic, or any OpenAI-compatible endpoint — OpenRouter, Groq, vLLM, llama.cpp.

// quick start

Quick start

# install
go install github.com/devthedeveloper/archi@latest

# pick a provider (Ollama Cloud is the default)
export OLLAMA_API_KEY=…        # or ANTHROPIC_API_KEY / OPENAI_API_KEY

# learn a codebase, then design against it
cd my-service
archi init
archi design "make order processing idempotent"

In a terminal, design runs the full loop: a short interview, a streamed design, then approve & build, modify, or ask questions. Piped or with -no-interactive it prints pure Markdown, so it stays scriptable.

// features

Features

v1.0

codebase profile

A scan plus one analyst pass produce profile.md and a deterministic file map — the grounding every later call ships with.

v1.2

freshness fingerprint

A stat-only hash of every file detects drift; init -refresh updates the profile incrementally from only what changed.

v1.4

design ensemble

Explorer → designer → a critic panel (security, simplicity, grounding) that can send the design back for revision before you ever see it.

v1.5

build swarm

Big designs are planned into work packets and built in parallel waves, then merged — with arbitration when two packets touch one file.

v1.5

verify & repair

After applying, archi runs your toolchain (go vet, tests, npm, make) and iterates repairs on failures, up to a bounded loop.

v1.5

backups & rollback

Every overwrite or delete is copied to a timestamped run under .archi/backups/ first. archi rollback restores any run.

v1.6

review panel

archi review judges any diff with the critic panel. CI-friendly: exit 0 clean, 1 blocking, 2 operational.

v1.6

team memory

Built designs distill into .archi/memory/decisions.md — durable, greppable decisions that ground the next design.

v1.2

secret hygiene

Key-shaped strings are redacted before any file content reaches a prompt; .env, *.pem, and friends never enter the scan.

v1.2

context budgeting

Grounding is fitted to a token budget (48k default): the profile always ships whole, the map and focus files shrink to fit.

v1.7

MCP server

archi serve speaks the Model Context Protocol over stdio, so Claude Code, Claude Desktop, and Cursor call archi as tools.

v1.8

GitHub App

Comment /archi design on an issue, get a design; approve, get a draft PR with generated code; opt in to auto-review on every PR.

// command reference

Command reference

Ten commands. Flags shown are the ones you'll reach for; every command answers -h with the full set.

archi init [path]

Scan a repository and cache an understanding in .archi/. Run once per repo; refresh when it drifts.

flagdefaultmeaning
-providerollamaollama, anthropic, or openai
-modelprovider defaultmodel id (glm-5.2:cloud, claude-fable-5, gpt-5.2, …)
-refreshoffupdate the cache incrementally from what changed (falls back to a rebuild past 40% drift)
-forceoffrebuild even if .archi/ exists
-max-file-kb256skip files larger than this when sampling
archi design [flags] "<request>"

Design a change against the learned codebase — interview, streamed design, review loop, optional build. The request may be arguments, -f <file>, or stdin.

flagdefaultmeaning
-agentsfullfull runs the ensemble (explorer + critics); fast is a single call
-focusglob of files to include as extra grounding (repeatable)
-buildoffafter designing, generate the code (non-interactive)
-yesoffauto-approve writing generated files
-swarmon with fullsplit the build into parallel packets
-verify / -max-repairon / 3run the repo's toolchain after applying; repair iterations
-rounds1designer ↔ critic debate rounds (1–3)
-critic-modeldesign modelcheaper model for the critic panel
-o / -htmlstdoutwrite to a file / also render standalone HTML with drawn diagrams
-max-tokens8000output budget for the design
archi status

What archi has learned here: provider, language breakdown, cache freshness and age, recent designs, backups, memory.

archi review [-patch file]

Review a diff with the critic panel. Source by precedence: -patch, piped stdin, or git diff HEAD. Exit codes are a CI contract:

exitmeaningcheck-run mapping
0clean, or advisory findings onlysuccess / neutral
1blocking findingsfailure
2operational fault — the tool couldn't runneutral — never blocks a merge
archi test-plan [design-file|latest]

Generate a test plan plus test files for a saved design (default: the newest built one). -yes auto-approves writing the files.

archi doc

Propose README and docs updates from the design history since the last doc run — keeping documentation in sync with what was actually designed and built.

archi memory <show|edit|compact>

Show, edit, or compact the decision memory. compact merges and shrinks entries, backing up the original first.

archi rollback [-run stamp] [-list]

Restore the files a build run overwrote — and delete the ones it created — from .archi/backups/. -list shows available runs; the default target is the newest.

archi serve [-root path]

Run as an MCP server over stdio for agent clients — documented below.

archi version

Print the version.

// integration: agents

MCP server

archi serve speaks JSON-RPC 2.0 over stdin/stdout — the Model Context Protocol stdio transport — so agent clients call archi as tools. Every call is confined to the -root directory, writes are dry-run by default, and a dirty repo refuses real writes unless the caller says allow_dirty:true.

toolwhat it doessafety
archi_statuscache state, freshness, recent designsread-only
archi_initlearn or refresh the repo cachewrites only .archi/
archi_designdesign doc, saved under .archi/designs/read-only on your tree
archi_builddesign → file changes with unified diffsdry run by default; real writes are backed up
archi_reviewcritic-panel review of a patch or the working treeread-only
archi_rollbackrestore a backup runthe tool call is the confirmation
# Claude Code
claude mcp add archi -- archi serve -root "$(pwd)"

# Claude Desktop / Cursor — .mcp.json
{"mcpServers": {"archi": {"command": "archi", "args": ["serve"],
  "env": {"ARCHI_TIMEOUT": "10m"}}}}

stdout is 100% protocol JSON; progress and logging go to stderr. Provider keys come from the server's environment and never cross the wire.

// integration: teams

GitHub App

archi-app — its own zero-dependency module under app/ — is a webhook service that runs the CLI in per-job workspace clones and posts results back to GitHub. Commenters need write access; every accepted command is acked with a 👀 reaction.

commentresult
/archi design <request>the design, posted as a comment
/archi design --pr <request>a draft PR with docs/designs/<slug>.md on an archi/design-* branch
/archi buildon that design PR: generated code, pushed to the same branch
/archi reviewa PR review from the critic panel + an archi review check run

With auto_review: true in .github/archi.yml, every PR open and synchronize gets a review check automatically. Fork PRs are reviewed from the API diff — fork code is never checked out, and /archi build never runs on forks.

# .github/archi.yml — flat key: value only
provider: anthropic        # ollama | anthropic | openai
model: claude-fable-5
critic_model: claude-haiku-4-5
agents: full               # full | fast
auto_review: true
max_tokens: 12000

Deploying

One container (Dockerfile included) with git, both binaries, and a volume for the shared .archi cache. Required env: APP_ID, WEBHOOK_SECRET, PRIVATE_KEY_PATH or PRIVATE_KEY_BASE64. Tunables: WORKERS, QUEUE_SIZE, MAX_JOBS_PER_HOUR, JOB_TIMEOUT, CACHE_DIR, WORK_DIR, ARCHI_BIN. Jobs on one repo serialize under a per-repo lock; the cache is keyed by default-branch SHA, so an unchanged repo skips init entirely and a drifted one refreshes incrementally.

// configuration

Configuration

Everything is environment variables — no config files to manage on the CLI side.

variabledefaultmeaning
OLLAMA_API_KEY / OLLAMA_HOSTOllama Cloud key, or a local Ollama host
ANTHROPIC_API_KEYfor -provider anthropic
OPENAI_API_KEY / OPENAI_BASE_URLany OpenAI-compatible endpoint: OpenRouter, Groq, vLLM, llama.cpp…
ARCHI_TIMEOUTnoneoverall per-request cap, e.g. 10m — streaming included
ARCHI_CONTEXT_TOKENS48000grounding budget for design (profile + map + focus)
ARCHI_AGENT_CONCURRENCY3agent worker-pool size for ensembles and swarms
ARCHI_RUN_TOKENS150000output-token budget per run, across all agents
ARCHI_MEMORY_TOKENS4000memory's share of the design grounding

// documents

Documents archi writes

.archi/
├── profile.md      the model's understanding
├── map.md          deterministic file map
├── config.json     provider, counts, settings
├── fingerprint     per-file drift hashes
├── designs/        every design, timestamped
│   └── 20260707-…-add-webhooks.md
├── backups/        originals from each build run
│   └── 20260707-142317/ + manifest.txt
├── memory/
│   └── decisions.md  ADR-ish team memory
└── runs/           agent traces, last 20

Everything archi learns or produces is a plain file you can read, grep, and diff — no databases, no lock-in:

Designs carry a small front-matter header (request, provider, date, built) above the full Markdown document, so archi status and test-plan can find them and you can commit the good ones.

Backups are one directory per build run with a manifest distinguishing overwritten files (restored on rollback) from created ones (deleted on rollback).

Memory is an append-only Markdown file of dated decisions, deduplicated and budget-fitted into every future design prompt. archi memory compact keeps it tight.

Design PRs from the GitHub App commit the document to docs/designs/ in your repo — the approved design is the artifact the build implements, verbatim.

// releases

Releases