strata init sets up Strata in a repository. It detects your layout, writes a
strata.toml matched to how much code you already have, runs an initial check to
show the current drift, and offers to install agent skill files.
It never guesses silently: every detected path shows where it came from, and
nothing is written until you confirm (or pass --yes).
What it does
- Detects your layout. Package roots come from
pyproject.tomlmetadata (hatch, setuptools, poetry, flit, uv workspaces, the project name), ruff’ssrcsetting, and a directory scan. Test paths come from pytesttestpathsandtests/testdirectories; tooling fromscripts,tools,bin, andtasksdirectories with Python files. - Picks a starting ruleset. An existing codebase starts
gradual:
select = ["SFL", "SFH", "SFA", "SFN"]. An empty repository gets the fullselect = ["SF"]and a scaffoldedsrc/<name>/package plustests/. - Writes
strata.tomland updates your.gitignoreto cover Strata’s cache directory. - Measures current drift by running the starting ruleset once and printing per-family fault counts.
- Installs agent skill files (
.claude/,.opencode/,.agents/) unless you decline; seestrata skills.
Options
| Option | Description |
|---|---|
--yes | Accept every detected choice; required when no terminal is attached. |
--root PATH | Use these package roots instead of the detected ones. Repeatable. |
--tests PATH | Use these test paths. Repeatable. |
--tooling PATH | Use these tooling paths. Repeatable. |
--full | Start with the full ruleset (select = ["SF"]) regardless of detection. |
--gradual | Start with the gradual ruleset regardless of detection. |
--skills / --no-skills | Install or skip agent skill files without prompting. |
--name NAME | Package name for an empty-repository scaffold. Only valid when no Python package is detected. |
--full and --gradual are mutually exclusive, as are --skills and
--no-skills. --root, --tests, and --tooling only apply when a codebase is
detected; --name only applies when none is.
An existing repository
On a repository with code,strata init shows what it detected and why, then
confirms before writing:
e at the confirmation lets you edit the paths; n aborts without
writing anything. When several package roots are detected, you pick which to
include by number.
The gradual starting point deliberately holds back the families that imply
refactors (SFR roles, SFS shape, SFT tests). Widen select as you go; see
Adopting Strata.
An empty repository
With no Python code detected,strata init scaffolds a fresh layout instead. It
asks for a package name (or derives it from the directory name, or takes
--name), then starts fully enforced from the first commit. With
--yes --name Sample-App --no-skills:
Gitignore handling
Strata’s result cache lives under.strata/, which should not be committed.
- If a root
.gitignoreexists and does not already cover the cache path,strata initappends a.strata/entry to it. - An empty repository with no
.gitignoregets one created from the standard GitHub Python template, plus the.strata/entry. - An existing repository with no
.gitignoregets one containing just the.strata/entry.
Rerunning is safe
If the directory already has astrata.toml or a [tool.strata] table,
strata init changes nothing and exits 0:
Non-interactive use
Prompts require a terminal. In CI or scripts, pass--yes (or make every choice
explicit with flags); otherwise init fails:
Exit codes
| Code | Meaning |
|---|---|
0 | Configuration written, or a local configuration already exists. |
2 | Detection, validation, or write failure; declined confirmation; missing TTY. |
Related
Quickstart
The manual version of what init automates.
Adopting Strata
Growing from the gradual ruleset to full enforcement.
Configuration
Every key in the file init writes.
strata skills
The agent guidance init offers to install.

