docs/commands/invariants.md
Validate project invariants declared in flow.toml.
This command checks the [invariants] section and reports violations in changed code.
# Check all local changes vs HEAD
f invariants
# Check only staged changes
f invariants --staged
forbidden: disallowed patterns in added diff lines.deps.approved: unapproved dependencies in package.json sections (dependencies, devDependencies, peerDependencies).files.max_lines: changed files exceeding the configured line limit.Set in flow.toml:
mode = "off": disable checks.mode = "warn": print findings, exit success.mode = "block": fail command when blocking findings exist.flow.toml[invariants]
mode = "block"
architecture_style = "layered monorepo, event-driven core"
non_negotiable = [
"no inline imports",
"no any types unless justified",
]
forbidden = [
"git add -A",
"git reset --hard",
]
[invariants.terminology]
"pi-ai" = "LLM abstraction layer"
"pi-agent" = "stateful agent runtime"
[invariants.deps]
policy = "approval_required"
approved = ["@sinclair/typebox", "@reatom/core"]
[invariants.files]
max_lines = 300
f commit runs the invariant gate during commit-with-check flow.
mode = "block", commits are blocked on invariant warnings/critical findings.