Primer helps you build real software with AI agents one verified milestone at a time.
The main work happens inside your AI coding agent. The primer CLI sets up the workspace, verifies prerequisites, and powers the milestone workflow under the hood.
Instead of handing an agent a huge vague task, Primer gives you a milestone contract, a verification step, and a clear next action.
Primer is a good fit if you want to:
- start from a real workspace instead of a blank prompt
- keep the agent focused on the current step
- verify progress before moving on
- learn the system as you build it
Current recipes:
cli-tool: build a practical task tracker CLI in Pythoninterpreter-mini: build a small expression language in Pythonoperating-system: build an x86 operating system from bootloader to shell
- Start Here
- Guides
- 5 Minute Demo
- How Primer Works
- Why Primer
- Is Primer Beginner-Friendly?
- Who It's For
- Installation
- AI Tool Integration
- Available Recipe
- Tracks
- Agent Workflow Actions
- CLI Setup Commands
- JSON Examples
- Workspace Model
- Troubleshooting
- Contributing
- License
If you want the fastest path from zero to building inside your AI coding agent:
primer list
primer init cli-tool --tool codex --track learner --path ~/projects/task-cli-demo
cd ~/projects/task-cli-demo
primer doctor cli-tool --milestone 01-bootstrapUse the terminal for setup:
primer listshows the catalog.primer initcreates a separate project workspace and generates AI-tool instructions for it.primer doctorchecks whether your local toolchain is ready for the first milestone.
Then open the generated workspace in your AI coding agent and use the Primer workflow actions there:
primer-build: implement only the current milestone scopeprimer-verify: run milestone verification and mark it verified on successprimer-next-milestone: unlock the next milestone only after verification passesprimer-explain: show the deeper explanation for the current milestoneprimer-status: show current milestone, verification state, retries, and progress
Primer is designed so that:
- In a regular shell, you mainly use
primerfor setup, diagnostics, and utilities such asinit,doctor, andcompletions. - Inside a generated workspace in a supported AI tool, you do the actual milestone work through generated actions such as
primer-buildandprimer-status.
If you are new to Primer, start with --track learner.
If you want one short walkthrough instead of the general setup story, use the 5 minute demo.
Primer's public docs now have three main entry paths:
- Learn With Primer: the beginner-friendly path focused on
cli-tool, learner track, and understanding the loop - Build Safely With Primer: the execution-focused path for milestone-by-milestone delivery and JSON wrappers
- Use Primer In An Existing Repository: the brownfield path built around workstreams, boundary analysis, and repo-local state
If you only want one short walkthrough, jump straight to the 5 minute demo.
The best quick demo path today is the beginner-friendly cli-tool recipe.
What this path demonstrates:
- initialize a workspace
- inspect the current milestone
- watch verification fail before the code exists
- implement one milestone
- verify it successfully
- advance safely
The full walkthrough lives in docs/5-minute-primer.md.
Quick start:
primer init cli-tool --tool codex --track learner --path ~/projects/task-cli-demo
cd ~/projects/task-cli-demo
primer doctor cli-tool --milestone 01-bootstrapThen open the workspace in your AI tool and use:
primer-statusprimer-buildprimer-verifyprimer-next-milestone
Primer has two layers:
- The setup layer: the
primerCLI creates the workspace, checks your environment, and manages workflow state. - The working layer: your AI coding agent uses the generated Primer actions inside that workspace while you build milestone by milestone.
In practice, that means:
- you touch the terminal first to initialize the workspace
- you spend most of your time inside the AI coding agent
- Primer verification decides when a milestone is actually complete
The CLI is important infrastructure, but it is not meant to be the primary day-to-day interface.
Most AI coding workflows fail in predictable ways:
- the task is too broad
- the agent implements future steps too early
- there is no reliable check for "done"
- progress is hard to see
Primer turns that into a repeatable loop:
- Initialize a separate project workspace from a recipe.
- Load the current milestone contract.
- Build only that scope.
- Run verification.
- Advance only after it passes.
The result feels closer to a guided lab than an open-ended prompt.
The workflow is beginner-friendly. The current recipe catalog is not broadly beginner-oriented yet.
That distinction matters:
- Primer itself is designed to be approachable for students, entry-level developers, and people learning with AI assistance.
- The current flagship recipe,
operating-system, is still an advanced systems project with a real toolchain and low-level concepts.
If you are a beginner or novice, the recommended path is:
- use
--track learner - start with the
cli-toolrecipe - run
primer doctorearly so tooling issues are obvious - use
primer explainandprimer verifyas part of every milestone - expect to learn incrementally instead of understanding the entire system up front
If you are completely new to programming, cli-tool is the best place to start. The more ambitious operating-system recipe is better treated as an advanced guided lab.
Primer is for people who want structure while building with AI tools:
- learners who want explanations, checkpoints, and visible progress
- builders who want tighter scope control and safer iteration
- educators and recipe authors who want reusable milestone-based learning paths
If you want to try ambitious projects without handing the whole problem to the agent at once, Primer is the point.
Primer is also meant to grow into a community library of guided labs. If you want to help create new recipes or improve the educational experience around existing ones, see CONTRIBUTING.md and docs/community-recipes.md.
Pick one installation path. You install the primer CLI because it bootstraps and supports the agent workflow.
curl -sSf https://raw.githubusercontent.com/armgabrielyan/primer/main/install.sh | shbrew install armgabrielyan/tap/primernpm install -g @armengabrielyan/primerFor one-off usage:
npx @armengabrielyan/primer listThe @armengabrielyan/primer package downloads the matching prebuilt primer binary for your platform during install.
cargo install primerDownload prebuilt archives from the GitHub Releases page.
| Platform | Architecture | Download |
|---|---|---|
| Linux | x86_64 (glibc) | primer-VERSION-x86_64-unknown-linux-gnu.tar.gz |
| Linux | x86_64 (musl/static) | primer-VERSION-x86_64-unknown-linux-musl.tar.gz |
| Linux | ARM64 | primer-VERSION-aarch64-unknown-linux-gnu.tar.gz |
| macOS | Intel | primer-VERSION-x86_64-apple-darwin.tar.gz |
| macOS | Apple Silicon | primer-VERSION-aarch64-apple-darwin.tar.gz |
| Windows | x86_64 | primer-VERSION-x86_64-pc-windows-msvc.zip |
git clone https://github.com/armgabrielyan/primer
cd primer
cargo build --releaseThe binary will be available at:
./target/release/primercargo install --path .primer --help
primer listPrimer can generate shell completions for bash, zsh, and fish:
primer completions zsh
primer completions bash
primer completions fishPrimer has native workspace adapters for:
- Claude Code
- Codex
- OpenCode
- Gemini CLI
- Cursor
Primer is designed to be used inside your AI coding agent. primer init generates tool-specific files into the workspace so the workflow is available where the project work actually happens.
Use the same primer init shape for every supported tool:
primer init <recipe-id> --tool <claude|codex|opencode|gemini|cursor> --path ~/projects/my-workspaceGenerated files by tool:
| Tool | Generated files |
|---|---|
| Claude Code | CLAUDE.md, .claude/commands/ |
| Codex | AGENTS.md, .agents/skills/ |
| OpenCode | AGENTS.md, .opencode/skills/ |
| Gemini CLI | GEMINI.md, .gemini/skills/ |
| Cursor | AGENTS.md, .cursor/skills/ |
Those generated actions are the primary user experience. The CLI provides the underlying stateful operations, verification, and setup support that those actions rely on.
If your preferred AI tool can follow workspace instructions and run the local primer CLI, Primer can usually fit that workflow as well.
Current catalog:
| Recipe ID | Project | Difficulty | Best starting advice |
|---|---|---|---|
cli-tool |
Build a Task Tracker CLI | beginner |
Start here if you are new to Primer, new to AI-assisted building, or want a fast first success |
interpreter-mini |
Build a Mini Expression Interpreter | intermediate |
Start here after cli-tool if you want a more conceptual project with parsing and evaluation |
operating-system |
Build Your Own Operating System | advanced |
Start with --track learner and treat it like a guided lab, not a quick tutorial |
For more detail on the current recipe, see recipes/operating-system/README.md.
Primer supports two interaction styles:
| Track | What it feels like | Best for |
|---|---|---|
learner |
The agent explains the step, teaches while building, and pauses at natural checkpoints | beginners, students, and first-time Primer users |
builder |
The agent implements directly with minimal commentary | users who already understand the workflow and want less narration |
Examples:
primer init operating-system --tool codex --track learner --path ~/projects/my-osprimer init operating-system --tool codex --track builder --path ~/projects/my-osIf you do not pass --track, Primer uses learner.
You can switch later without re-initializing:
primer track builder
primer track learnerOnce the workspace is initialized, this is the primary way to use Primer:
| Action | What it does | When to use it |
|---|---|---|
primer-build |
Load the current milestone scope and implement only that step | when you are actively building |
primer-track |
Switch the active learner or builder track for the workspace | when you want a different guidance style without re-initializing |
primer-status |
Show current milestone, verification state, and progress | anytime you want orientation |
primer-explain |
Show the deeper explanation for the current milestone | when you want more context or teaching |
primer-verify |
Run milestone verification and mark it verified on success | when you think the milestone is done |
primer-next-milestone |
Unlock the next milestone only after verification passes | when you are ready to advance |
Primer also exposes matching CLI commands such as primer build, primer track, primer status, primer explain, primer verify, and primer next-milestone, but the default experience is to use the generated actions inside your AI coding agent.
Use primer status --json when you need the current workflow state in a machine-readable form.
Use primer verify --json when you need the latest verification result as a machine-readable event.
Use primer next-milestone --json when you need the milestone advancement result as a machine-readable transition.
Use primer build --json when you need the current milestone contract, track guidance, and optional workstream intent context in a machine-readable form.
Use the CLI directly for setup, diagnostics, and terminal utilities:
| Command | What it does | When to use it |
|---|---|---|
primer list |
List available recipes | when you are exploring |
primer recipe lint |
Lint local recipe structure and milestone quality guidance | when you are authoring or reviewing recipes |
primer milestone lint |
Lint one milestone contract and sizing boundary from a workspace, recipe, or workstream | when you want feedback on the current or target milestone |
primer init |
Create a workspace and generate adapter files | when you are starting a new project |
primer doctor |
Check local prerequisites for a recipe milestone | before you begin or when setup is failing |
primer workstream list |
List initialized brownfield workstreams in the current repository, including active state and saved progress | when you want to see what is available, active, and where each workstream will resume |
primer workstream analyze |
Analyze repository boundaries and suggest safe first-milestone candidates | when you need help choosing the first brownfield milestone |
primer workstream init |
Bootstrap Primer inside the current repository for one brownfield workstream | when you want a milestone path inside an existing repo |
primer workstream switch |
Activate and resume another initialized brownfield workstream in the current repository | when you want to move between repo-local workstreams |
primer track |
Switch the active learner or builder track in the current workspace | when you want to change interaction style mid-workflow |
primer completions |
Generate shell completion scripts | when you want faster terminal use |
Useful safety flags:
primer init --dry-runshows what would happen without writing files.primer init --forceallows initialization into a non-empty directory.
For an existing repository, bootstrap a repo-local workstream from the repository root:
primer workstream list
primer workstream analyze --goal "Reduce auth pipeline complexity"
primer workstream init auth-refactor --goal "Reduce auth pipeline complexity" --tool codex --track learner
primer workstream switch auth-refactorprimer workstream init also scaffolds .primer/workstreams/<workstream-id>/workstream-intent.md so you can keep goal, non-goals, constraints, and done-when short but durable while you rewrite the placeholder first milestone.
Use primer workstream list --json when you need the same repository-local workstream state in a machine-readable form.
Use primer workstream analyze --json when you need brownfield candidate suggestions in a machine-readable form.
Use primer recipe lint --json when you need recipe lint findings in a machine-readable form.
Use primer milestone lint --json when you need one milestone's lint findings in a machine-readable form.
Primer's JSON output is meant for small wrappers and automation, not just tests.
The repo now includes example integrations in examples/json/README.md:
status-summary.shreadsprimer status --jsonand prints a compact milestone summaryverify-summary.shrunsprimer verify --json, prints a compact result summary, and exits with the same status as the verification runworkstream-dashboard.shreadsprimer workstream list --jsonand prints a compact repository dashboard
They use shell plus python3, so you can try them without adding jq:
bash examples/json/status-summary.sh /path/to/workspace
bash examples/json/verify-summary.sh /path/to/workspace
bash examples/json/workstream-dashboard.sh /path/to/repositoryPrimer uses two separate locations:
- the
primerrepo: recipes, adapter generation, the CLI engine, and shared workflow logic - your generated project workspace: the code and Primer state for the project you are building
- your AI coding agent: the main place where you read, build, verify, and advance milestones
Do not build inside the primer repo itself. primer init is designed to create or prepare a separate workspace for that work.
After primer init, your generated workspace contains:
- the project files your agent will actually build
- the current Primer state
- tool-specific instructions and workflow actions
For most users, the generated workspace opened inside the AI coding agent is the primary interface. The CLI exists to support that workflow.
For brownfield work inside an existing repository, Primer can also run in repo-local workstream mode. In that case it stores authored workstream files under .primer/workstreams/<workstream-id>/ and runtime state under .primer/runtime/workstreams/<workstream-id>/, while keeping one active workstream in the root adapter context at a time via primer workstream switch.
- Run
primer doctorafterprimer initif you are unsure whether your local toolchain is ready for the current milestone. - If your AI tool does not see the generated Primer workflow actions, make sure you opened the generated workspace, not the
primerrepository. - If your AI tool cannot run
primer, install or build the CLI first and make sure it is on yourPATH. primer initis safe by default. Use--forceonly when you deliberately want to initialize into a non-empty directory.
Primer is not only for people using recipes. It is also for people who want to author them.
See CONTRIBUTING.md for contributor workflow, quality bar, and community direction.
If you want to propose a new community learning path, start with docs/community-recipes.md.
Primer is available under the MIT License.