Scaffold agent context files into a project.
Project description
agentinit
Scaffold and maintain context files for AI coding agents.
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 --checkandstatus --checkdetect 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
- Open
docs/PROJECT.mdand describe your project, stack, and commands. - Fill in
docs/CONVENTIONS.mdwith your team's standards. - 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
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentinit-0.3.13.tar.gz.
File metadata
- Download URL: agentinit-0.3.13.tar.gz
- Upload date:
- Size: 71.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee30e9964c0f6c68b5b1866ffb803384952c4e4403a2544b64b0aaaaabf0ab82
|
|
| MD5 |
4ad0848b892347d89bfca752f13ca1ac
|
|
| BLAKE2b-256 |
76d834baec67895e46df5e8e1b502e3c5c6654c268290e9e926e9d4bbd19cc64
|
Provenance
The following attestation bundles were made for agentinit-0.3.13.tar.gz:
Publisher:
publish.yml on Lucenx9/agentinit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentinit-0.3.13.tar.gz -
Subject digest:
ee30e9964c0f6c68b5b1866ffb803384952c4e4403a2544b64b0aaaaabf0ab82 - Sigstore transparency entry: 1051762813
- Sigstore integration time:
-
Permalink:
Lucenx9/agentinit@19518fd3641c3544c03b99f7a317086544a49389 -
Branch / Tag:
refs/tags/v0.3.13 - Owner: https://github.com/Lucenx9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@19518fd3641c3544c03b99f7a317086544a49389 -
Trigger Event:
release
-
Statement type:
File details
Details for the file agentinit-0.3.13-py3-none-any.whl.
File metadata
- Download URL: agentinit-0.3.13-py3-none-any.whl
- Upload date:
- Size: 67.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c45852de55f60137f7e6234a4fd5e0d8d4ae4eb702a293bc372d1931f94159f
|
|
| MD5 |
2351bcebc4d19e656622bb6d85052caa
|
|
| BLAKE2b-256 |
8f0dbfa5ceeb9dcc8a0a2cd31dc5f2cca99a655c6a13546165b740fd61dc2f73
|
Provenance
The following attestation bundles were made for agentinit-0.3.13-py3-none-any.whl:
Publisher:
publish.yml on Lucenx9/agentinit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentinit-0.3.13-py3-none-any.whl -
Subject digest:
5c45852de55f60137f7e6234a4fd5e0d8d4ae4eb702a293bc372d1931f94159f - Sigstore transparency entry: 1051762816
- Sigstore integration time:
-
Permalink:
Lucenx9/agentinit@19518fd3641c3544c03b99f7a317086544a49389 -
Branch / Tag:
refs/tags/v0.3.13 - Owner: https://github.com/Lucenx9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@19518fd3641c3544c03b99f7a317086544a49389 -
Trigger Event:
release
-
Statement type: