Scaffold agent context files into a project.
Project description
agentinit
Scaffold tiny context files so your AI coding agents stop guessing your setup. Pure Python stdlib, no runtime dependencies, nothing touches your source code.
Works with Claude Code, Codex, Cursor, Copilot, and Gemini CLI.
If you've ever had an agent guess your test command, ignore your style rules,
or forget what the project does — agentinit creates a small set of "router-first" Markdown
files. Top-level files stay tiny and route every agent to docs/ for the real context,
saving thousands of tokens every session.
Save tokens fast (Minimal mode, 2 minutes)
# Existing repo/folder:
agentinit init --minimal
# New project:
agentinit new myproject --yes --minimal
Then fill only docs/PROJECT.md and docs/CONVENTIONS.md.
Next time, tell your agent: follow CLAUDE.md / AGENTS.md.
What you get:
your-project/
├── AGENTS.md # entry point for all agents
├── CLAUDE.md # Claude Code router
└── docs/
├── PROJECT.md # what this project is (fill this)
└── CONVENTIONS.md # how to work in it (fill this)
- On a terminal, a short interactive wizard runs automatically — use
--yesto skip it. - Use
--purpose "..."to prefill Purpose non-interactively (e.g. in CI). - Keep reading only if you want full mode or advanced usage.
Token savings (rough estimate)
- Top-level routers (
CLAUDE.md,GEMINI.md, Cursor rules) are kept strictly under 15 lines. - Tokens saved ≈ tokens you usually re-type per session × number of sessions.
- If you re-type ~200–400 tokens and do 10–20 sessions/month: ~2k–8k tokens/month.
- Actual savings depend on your workflow and which tool loads which files.
Quickstart (60 seconds)
# 1. Install (stable)
pipx install agentinit
# Or bleeding edge:
# pipx install git+https://github.com/Lucenx9/agentinit.git@main
# 2. Scaffold a new project
agentinit new myproject --yes
cd myproject
# 3. Open these files in your code editor (VSCode, Cursor, etc.)
# and fill them in with your project's real info.
# (see "Fill the docs fast" below for an AI-assisted shortcut)
# 4. Commit and you're done
git init && git add -A && git commit -m "init: add agent context files"
For an existing project, run agentinit init in the repo root instead of agentinit new.
Fill the docs fast (AI prompt)
After scaffolding, paste this into your agent to auto-populate the docs:
Read the entire repository. Then fill in
docs/PROJECT.mdanddocs/CONVENTIONS.mdusing only information you find in the repo (package files, existing configs, source code, CI workflows, etc.). Do not invent commands or assumptions. Where information is missing or ambiguous, writeTODO: <what's needed>so the developer can fill it in later. Do not modify any other files.
Review the result, fix any TODOs, and commit.
Install
Requires Python 3.10+.
# With pipx (recommended, stable)
pipx install agentinit
# With pip
pip install agentinit
# Or run one-off without installing
pipx run agentinit --help
# Bleeding edge (latest on main)
# pipx install git+https://github.com/Lucenx9/agentinit.git@main
Usage
Create a new project
agentinit new myproject
On a terminal, a short interactive wizard asks for purpose, environment,
constraints, and commands. Use --yes to skip it, or --purpose "..." to
prefill non-interactively.
Flags:
--yes/-y— skip the interactive wizard--dir <path>— create the project under a different parent directory--force— overwrite agentinit files (including TODO/DECISIONS) if the directory already exists--minimal— create only core files (AGENTS.md, CLAUDE.md, docs/PROJECT.md, docs/CONVENTIONS.md)--purpose "<text>"— prefill Purpose non-interactively--prompt— force the interactive wizard (even if stdin is not a TTY)--detect— auto-detect stack and commands from manifest files (facts-first, deterministic; leavesTBDif parsing fails). May apply safe conventional defaults for Setup (e.g.npm install) when manifests don't specify explicit scripts.
Add to an existing project
cd your-project
agentinit init
Copies only missing template files. Safe to run multiple times (idempotent).
The interactive wizard runs by default on a terminal; pass --yes to skip it.
Flags:
--yes/-y— skip the interactive wizard--force— overwrite existing agentinit files (including TODO/DECISIONS)--minimal— create only core files (AGENTS.md, CLAUDE.md, docs/PROJECT.md, docs/CONVENTIONS.md)--purpose "<text>"— prefill Purpose non-interactively--prompt— force the interactive wizard (even if stdin is not a TTY)--detect— auto-detect stack and commands from manifest files (facts-first, deterministic; handles missing/odd values safely). May apply safe conventional defaults for Setup when manifests don't specify explicit scripts.
Quick minimal scaffold
agentinit minimal
Shortcut for agentinit init --minimal. Accepts the same flags (--yes, --force, --purpose, --prompt).
Token discipline (status)
agentinit status acts as a guardrail against context bloat. It verifies file presence and completeness (checks for TBD), while enforcing line budgets and link integrity.
- Line budgets: Warns if context files exceed 200 lines (soft limit) or 300 lines (hard limit).
- Link integrity: Detects broken file references within
AGENTS.md. - Top offenders: Summarizes the largest files when issues exist.
Top offenders:
.github/copilot-instructions.md (25 lines)
AGENTS.md (17 lines)
CLAUDE.md (12 lines)
Router-first templates: agentinit keeps your always-loaded context tiny. Files like CLAUDE.md, GEMINI.md, and Cursor rules are strictly 10–20 lines. They serve only to route the agent to AGENTS.md, which then points to deeper details in docs/.
# View current status, warnings, and missing files
agentinit status
# Exit non-zero on hard limit violations, broken refs, or missing/TBD files
agentinit status --check
Flags:
--check— exit non-zero on hard violations, broken refs, or missing/TBD files--minimal— check only the core minimal files
Remove agentinit files
agentinit remove --dry-run # preview what would be removed
agentinit remove # remove with confirmation prompt
agentinit remove --archive # move to .agentinit-archive/ instead of deleting
agentinit remove --force # skip confirmation prompt
Generated files and maintenance tips
Source of truth
| File | Purpose |
|---|---|
AGENTS.md |
Primary router — all agents start here |
docs/PROJECT.md |
Project purpose, stack, commands, layout, constraints |
docs/CONVENTIONS.md |
Style, naming, testing, git workflow |
docs/TODO.md |
Active work (in progress / next / blocked / done) |
docs/DECISIONS.md |
ADR-lite decision log |
Tool-specific routers
| File | Tool |
|---|---|
CLAUDE.md |
Claude Code |
GEMINI.md |
Gemini CLI |
.github/copilot-instructions.md |
GitHub Copilot |
.cursor/rules/project.mdc |
Cursor |
Each router points to AGENTS.md → docs/*. Keep them short.
Keeping it healthy
- If guidance changes: update docs/ first, not router files.
- Keep router files under ~20 lines.
- Log durable decisions in
docs/DECISIONS.md(date · decision · rationale · alternatives). - Use
docs/TODO.mdas the "current state" so new sessions start with the right focus.
Manual setup (no CLI)
Copy into your repo root: AGENTS.md, CLAUDE.md, GEMINI.md, docs/, .github/, .cursor/ — then customize docs/* and commit.
Updating (pipx)
# From PyPI / GitHub (installed with pipx)
pipx upgrade agentinit
# From a Git install pinned to main
pipx install --force git+https://github.com/Lucenx9/agentinit.git@main
Color output
Output is colored by default on terminals. Color is automatically disabled when piping, redirecting, or in CI. You can also disable it explicitly:
NO_COLOR=1 agentinit init
Respects the NO_COLOR standard and TERM=dumb.
Development
pip install -e . --group dev
python3 -m pytest tests/ -v
Maintainers
Release
- Tags follow
vX.Y.Z(e.g.v0.2.0). - Tag a commit on
main, then publish a GitHub Release from the Releases UI.
Safe testing
Use git worktree to test changes in isolation:
git worktree add ../agentinit-test -b agentinit-test
cd ../agentinit-test
# test template changes
cd -
git worktree remove ../agentinit-test
git branch -D agentinit-test
Planned
--jsonoutput mode for scripting and CI pipelines
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.2.8.tar.gz.
File metadata
- Download URL: agentinit-0.2.8.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cbfc3f93698bdc1d45e0fb7aeb94ad1872922560cd93678f5b59a10ef186472
|
|
| MD5 |
1602c0b83e1527b3a859c3530afb0785
|
|
| BLAKE2b-256 |
f1d43a952449acf0a1cc45b6c996a8aedbd002ea7b64028a6c50b667a01788d5
|
Provenance
The following attestation bundles were made for agentinit-0.2.8.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.2.8.tar.gz -
Subject digest:
1cbfc3f93698bdc1d45e0fb7aeb94ad1872922560cd93678f5b59a10ef186472 - Sigstore transparency entry: 1005572885
- Sigstore integration time:
-
Permalink:
Lucenx9/agentinit@186fac67ad803ea515f98cee48014e5cf8cec22d -
Branch / Tag:
refs/tags/v0.2.8 - Owner: https://github.com/Lucenx9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@186fac67ad803ea515f98cee48014e5cf8cec22d -
Trigger Event:
release
-
Statement type:
File details
Details for the file agentinit-0.2.8-py3-none-any.whl.
File metadata
- Download URL: agentinit-0.2.8-py3-none-any.whl
- Upload date:
- Size: 20.0 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 |
de6245a5854b39d73bcf38328dba9227935c90c832d93114651c78d24489773f
|
|
| MD5 |
e8e0c8909346e7c37cdf456fd381838f
|
|
| BLAKE2b-256 |
dfaaf31b960738189c0cc09d69148a62528c679b7f4c0526911f1dc7894ade79
|
Provenance
The following attestation bundles were made for agentinit-0.2.8-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.2.8-py3-none-any.whl -
Subject digest:
de6245a5854b39d73bcf38328dba9227935c90c832d93114651c78d24489773f - Sigstore transparency entry: 1005572887
- Sigstore integration time:
-
Permalink:
Lucenx9/agentinit@186fac67ad803ea515f98cee48014e5cf8cec22d -
Branch / Tag:
refs/tags/v0.2.8 - Owner: https://github.com/Lucenx9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@186fac67ad803ea515f98cee48014e5cf8cec22d -
Trigger Event:
release
-
Statement type: