Skip to main content

agentinit

Scaffold and maintain context files for AI coding agents.

CI PyPI Python 3.10+

agentinit preview

agentinit generates a structured set of context files that modern AI coding assistants (Claude Code, Cursor, GitHub Copilot, Gemini CLI) read automatically. It uses a router-first architecture: you write your project rules once in AGENTS.md, and agentinit keeps the vendor-specific files in sync.

No runtime dependencies. Pure Python standard library. Works on Linux, macOS, and Windows.

Why agentinit

AI coding agents perform better when they have clear, structured context about your project. Without it, they guess at your stack, conventions, and constraints.

agentinit solves this by:

  • One source of truth -- Write project rules in AGENTS.md. Vendor files (CLAUDE.md, GEMINI.md, .cursor/rules/, .github/copilot-instructions.md) are generated routers that import it.
  • Low-drift workflow -- sync --check and status --check detect when files fall out of date. Run them in CI to catch drift early.
  • Lean context model -- Keep always-loaded files short (under 300 lines). Push details into docs/ where agents load them on demand.
  • Deterministic output -- No LLM calls, no network requests. Every command produces the same output from the same input.

Installation

Requires Python 3.10 or later.

# With pipx (recommended, installs in an isolated environment)
pipx install agentinit

# With pip
pip install agentinit

# Verify
agentinit --version

Quick start

Add context files to an existing project

cd your-project
agentinit init

This creates the full set of context files:

your-project/
├── AGENTS.md                          # Primary agent instructions (source of truth)
├── CLAUDE.md                          # Claude Code router → imports AGENTS.md
├── GEMINI.md                          # Gemini CLI router → imports AGENTS.md
├── llms.txt                           # Project discovery index
├── .claude/rules/                     # Claude Code modular rules
│   ├── coding-style.md
│   ├── testing.md
│   └── repo-map.md
├── .cursor/rules/project.mdc          # Cursor rule routing
├── .github/copilot-instructions.md    # GitHub Copilot context
├── .contextlintrc.json                # Lint configuration
└── docs/
    ├── PROJECT.md                     # Stack, commands, layout, constraints
    ├── CONVENTIONS.md                 # Style, naming, testing, git workflow
    ├── TODO.md                        # Task tracking for agents
    ├── DECISIONS.md                   # Architecture decision records
    └── STATE.md                       # Session handoff notes

Minimal mode

For smaller projects, generate only the essential files:

agentinit init --minimal
your-project/
├── AGENTS.md
├── CLAUDE.md
├── llms.txt
└── docs/
    ├── PROJECT.md
    └── CONVENTIONS.md

After scaffolding

  1. Open docs/PROJECT.md and describe your project, stack, and commands.
  2. Fill in docs/CONVENTIONS.md with your team's standards.
  3. Run your coding agent -- it reads AGENTS.md (or its vendor-specific router) automatically.

Track the generated files in git so your agents can find them:

git add AGENTS.md CLAUDE.md GEMINI.md llms.txt docs/

How it works

agentinit uses a router-first design. Each AI tool has its own context file format, but the content should be consistent. Instead of maintaining multiple files manually, agentinit generates thin router files that all point back to AGENTS.md:

AGENTS.md            ← You edit this (source of truth)
  ├── CLAUDE.md      ← @AGENTS.md  (auto-generated router)
  ├── GEMINI.md      ← @AGENTS.md  (auto-generated router)
  ├── .cursor/rules/ ← @AGENTS.md  (auto-generated router)
  └── .github/copilot-instructions.md  (auto-generated router)

When you run agentinit sync, it regenerates the router files from templates. When you run agentinit sync --check, it exits with code 1 if any router has drifted from the template -- useful in CI to prevent silent staleness.

The docs/ directory holds detailed project context that agents load on demand. This keeps the always-loaded router files short and focused.

Commands

Scaffolding

Command Description
agentinit init Add missing context files to the current directory
agentinit init --minimal Generate only the minimal file set
agentinit minimal Shortcut for init --minimal
agentinit new <name> Create a new project directory and scaffold context files
agentinit remove Delete agentinit-managed files (with confirmation)

Common flags for init, minimal, and new:

Flag Effect
--detect Auto-detect stack and commands from pyproject.toml, package.json, Cargo.toml, or go.mod
--purpose "..." Set the project purpose non-interactively
--prompt Run the interactive setup wizard (default on TTY)
--translate-purpose Translate non-English purpose text to English for docs/ files
--skeleton fastapi Copy a starter project boilerplate after scaffolding
--force / --yes / -y Overwrite existing files without confirmation

Maintenance

Command Description
agentinit sync Regenerate vendor router files from templates
agentinit sync --check Exit 1 if routers have drifted (CI mode)
agentinit sync --diff Show unified diff for out-of-sync routers
agentinit refresh-llms Regenerate llms.txt from project files
agentinit add <type> <name> Install a modular resource (see below)
agentinit remove --archive Move managed files to .agentinit-archive/ instead of deleting

Validation

Command Description
agentinit status Show missing files, incomplete content, and line budget warnings
agentinit status --check Exit 1 if any issues found (CI mode)
agentinit lint Run contextlint checks (broken refs, bloat, duplication)
agentinit doctor Run all checks and suggest fix commands

Modular resources (add)

Add reusable agent instructions to your project:

# List available resources of a type
agentinit add skill --list

# Install a skill (copies to .agents/skills/ or .claude/skills/)
agentinit add skill code-reviewer
agentinit add skill testing
agentinit add skill frontend-reviewer

# Install MCP integration guides (copies to .agents/)
agentinit add mcp github
agentinit add mcp postgres

# Install security guardrails
agentinit add security

# Install agent personality definition
agentinit add soul

Each add command also appends a reference to the resource in AGENTS.md.

CI integration

Add these checks to your CI pipeline to catch documentation drift:

# .github/workflows/ci.yml
- name: Check agent context
  run: |
    pip install agentinit
    agentinit sync --check    # Fail if router files drifted from templates
    agentinit status --check  # Fail if files are missing or incomplete
    agentinit lint            # Fail on broken refs, bloat, or duplication

For minimal-profile projects, sync --check and status --check auto-detect the profile. You can also force it with --minimal.

Supported tools

Tool Generated file How it works
Claude Code CLAUDE.md Router that @-imports AGENTS.md and docs/ files
Cursor .cursor/rules/project.mdc Project-level rules pointing to AGENTS.md
GitHub Copilot .github/copilot-instructions.md Repository-level instructions referencing AGENTS.md
Gemini CLI GEMINI.md Router that imports AGENTS.md and docs/ files
llms.txt llms.txt Standard discovery index with project summary and key files

Development

python3 -m venv .venv
. .venv/bin/activate
pip install -e . --group dev

# Run tests
python3 -m pytest tests/ -v

# Lint and format check
python3 -m ruff check agentinit tests cli
python3 -m ruff format --check agentinit tests cli

On distro-managed Python installs that enforce PEP 668, use a virtual environment instead of the system interpreter.

Documentation

  • Changelog
  • Wiki -- detailed guides, workflows, architecture, and FAQ

License

MIT

Metadata

Release files for agentinit 0.3.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentinit 0.3.15
File Size Uploaded Provenance
agentinit-0.3.15.tar.gz 71.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agentinit 0.3.15
File Interpreter ABI Platform
agentinit-0.3.15-py3-none-any.whl Python 3 none any Details

Total release size: 140.2 kB

Release files / agentinit-0.3.15.tar.gz

Download URL agentinit-0.3.15.tar.gz
Size 71.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d59505c857b0ca57b57c9c5f7195b70a3727c73124b51d8400740e9c3e95af80
BLAKE2b-256 checksum
How to use checksums
4a18c1792637b5d5d15360d67c1faad445d84811245d96438c09003f39a2e767
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.

Transparency log

Release files / agentinit-0.3.15-py3-none-any.whl

Download URL agentinit-0.3.15-py3-none-any.whl
Size 68.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5821abeb93648459c6552249b27d4226c5caafa7c3bbc075a05df513c35351a0
BLAKE2b-256 checksum
How to use checksums
3abdf8048508e98988dc2d60ade2670ec769b04416c475ffb97c40bee4d7bd95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.

Transparency log

Security for agentinit 0.3.15

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agentinit-0.3.15.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page