Skip to main content
charter fix is Charter’s repair command. It is intentionally narrow: it only applies safe, explicit fixes to a small set of supported rules, always shows you a unified diff before writing anything, and backs up existing files before replacing them. The guarantee: Charter always shows you a diff before writing. No silent mutation.
charter fix dry run showing unified diff

Fixable Rules

RuleWhat the fixer does
AE-CTX-001Creates AGENTS.md from a minimal template
AE-CTX-004Creates or appends .gitignore with agent artifact patterns
AE-CI-002Creates the Charter CI workflow at .github/workflows/charter.yaml
AE-MCP-001Bumps an MCP server package to the catalog’s stable version
Secrets (AE-SEC-001, AE-SEC-002) and dangerous-command findings (AE-CC-001) are never auto-fixed. Charter shows evidence and remediation guidance for these but requires manual action. If you target a rule with no registered fixer, Charter reports that it is not auto-fixable.

Usage

charter fix --dry-run
1

Preview every diff

charter fix --dry-run
Read each unified diff carefully before accepting it. The dry-run output is identical to what fix would apply.
2

Apply the fixes

charter fix
Originals are backed up to .charter/backups/<timestamp>/ before any write. Pure creates (new files) have no prior content to back up.
3

Verify the score improved

charter doctor
Confirm the fixed rules no longer appear as active findings and the score moved in the expected direction.

Flags

--path
string
Explicit repository root. Defaults to the current working directory.
--rule
string
Limit the repair to a single rule ID such as AE-MCP-001. When omitted, all fixable findings are planned.
--dry-run
boolean
Print unified diffs without writing any files. Safe to run repeatedly.
--all
boolean
Plan every fixable rule. This is already the default behavior; the flag is accepted for explicitness.
--yes
boolean
Skip per-fix confirmation prompts. Because fix is already non-interactive in normal use, this flag is accepted for scripting compatibility.

Backup Mechanism

Before replacing or updating an existing file, Charter copies the previous version into .charter/backups/<timestamp>/ where the timestamp is ISO 8601 UTC (for example, 2026-06-10T07:42:00Z). The original file’s relative path is preserved inside the backup directory.Pure creates — fixes that write a brand new file where none existed — do not produce a backup because there is no prior content to save.Charter never deletes backup directories automatically. They accumulate across runs and serve as a local audit trail of every mutation fix has applied.To recover a backed-up file:
cp .charter/backups/2026-06-10T07:42:00Z/AGENTS.md ./AGENTS.md