Skip to content
Fallow home
All docs pages

Docs home

fallow init

fallow init creates a config file for the project, and optionally an AGENTS.md guide or a Git pre-commit hook.

Create a config file that fits the project, and optionally an AGENTS.md guide or a Git pre-commit hook.

For a first setup of fallow in a project, read Adopt fallow.

Synopsis

fallow init [OPTIONS]

Options

OptionDescription
--tomlGenerate TOML instead of JSONC
--agentsScaffold a starter AGENTS.md guidance file for coding agents
--hooksScaffold a shell-level pre-commit git hook in .git/hooks/ that runs fallow on changed files. Alias for fallow hooks install --target git
--declineRecord that this project deliberately stays unconfigured: persists a decline so the first-contact setup hint and the setup next-step stop appearing here. Writes no config file; idempotent

The global options are in these groups: Project, Output, Scope, Baselines, Gates, Duplication, Type-aware, Performance.

Fallow detects TypeScript, the workspace patterns and the frameworks of the project, and writes the matching entry patterns and rules. Without --toml, the file is .fallowrc.json with JSONC content. Rename it to .fallowrc.jsonc to get editor support for comments. Fallow finds both names.

Fallow also adds .fallow/ to .gitignore. That directory holds local data, for example the cache. Fallow creates .gitignore when it does not exist, and changes nothing when the file already has the entry. When .gitignore is a symlink that leaves the project, fallow prints a warning and does not change it.

After it writes the config file, fallow prints the next step. When the config root is not the current folder, both commands of that line have --root. --quiet removes the line.

--agents writes a starter AGENTS.md with a table of agent tasks and their fallow commands. Fallow fills in the install, test and typecheck commands only when it can detect them without doubt. It does not change an existing AGENTS.md, and exits with code 2 when the file exists. The rules for each line:

LineFallow fills it when
InstallThe packageManager field of package.json names the package manager, or pnpm-workspace.yaml exists. Fallow never guesses from a lockfile.
TestExactly one test framework (Vitest, Jest or Playwright) is installed.
Typecheck or linttsconfig.json exists. The line is tsc --noEmit.
Module boundariesThe project is a monorepo. The line names the workspace patterns.

An HTML comment above the filled lines says that fallow took them from package.json. Check these lines before you rely on them. fallow agent install writes the same task map, together with the skills, the MCP entry and the commit gate.

--hooks is the same as fallow hooks install --target git.

--decline writes no file. It stops the setup hint that a bare fallow run shows in a project without a config file.

Output

fallow init
Created .fallowrc.json
  Detected: TypeScript
  Detected: Vitest
  Config includes test framework rules
Added .fallow/ to .gitignore
Next: run `fallow` for a first report. Run `fallow agent install --dry-run` to see the setup for coding agents.

The new file for this project:

{
  // This file is JSONC: fallow reads these comments; generic JSON tools may not.
  "$schema": "https://raw.githubusercontent.com/fallow-rs/fallow/main/schema.json",
  "entry": [
    "src/index.{ts,tsx,js,jsx}",
    "src/main.{ts,tsx,js,jsx}"
  ],
  "duplicates": {
    // Hide pair-only clones; focus on widespread copy-paste
    // worth refactoring. Lower to 2 to report every duplicate pair.
    "minOccurrences": 3
  },
  "rules": {
    "unused-dependencies": "warn"
  }
}

The real file also holds a commented example of duplicates.ignore. The $schema line gives completion and validation in the editor.

Exit codes

CodeMeaning
0Fallow wrote the file.
2A config file exists already, a target file is a symlink that leaves the project, or --decline cannot save its choice: the history file of fallow impact is from a newer fallow, cannot be read or does not parse, no user config folder resolves, or the write fails.

See Exit codes.

Examples

# Create .fallowrc.json
fallow init

# Create fallow.toml
fallow init --toml

# Create the config file and a starter AGENTS.md
fallow init --agents

# Create the config file and a Git pre-commit hook
fallow init --hooks

# Keep the project without a config file, and hide the setup hint
fallow init --decline