The three-step loop
Scan
Run
charter doctor to identify fixable findings. Charter marks each finding with a fixable indicator when a deterministic remediation exists. Findings without a fixer — secrets, dangerous hook configurations — are flagged but not offered as automated fixes.Preview
Run Every file the fixer would touch gets a before/after diff block. If you see something unexpected, stop here.
charter fix --dry-run to see the unified diff for every proposed change. Nothing is written. The command exits with the same success or failure code that the apply step would produce, so you can use it in review scripts.
Fixable rules
| Rule | Fixer action | Safety class |
|---|---|---|
AE-CTX-001 | Creates AGENTS.md from a standard template if the file is absent | ✅ Create-only — never overwrites |
AE-CTX-004 | Creates or appends .gitignore with agent artifact patterns (.aider/, .claude/, .cursor/, etc.) | ✅ Append-only — never removes existing entries |
AE-CI-002 | Creates .github/workflows/charter.yaml with the standard scan workflow | ✅ Create-only — never overwrites |
AE-MCP-001 | Updates an MCP server package reference to the catalog’s current stable version | ✅ Token replace — single version string, full diff shown |
Why secrets are never auto-fixed
The same logic applies to dangerous hook configurations (AE-CC-001). Rules that flag unrestricted shell execution or broad glob allowlists in agent configs require a human to evaluate the intent behind the configuration and decide on a safer alternative. Charter cannot know whether the hook is a legitimate use case that needs a narrow permission or an oversight that should be removed entirely. These are deliberate boundaries, not gaps to fill in a future release.
Backup mechanism
How backups work
How backups work
Before every write, Charter copies the original file to:For example, if the fixer modifies The backup directory is created fresh for each If a fixer produces an unexpected result, the original is always recoverable from the most recent backup directory.
.github/workflows/ci.yml, the original is preserved at:charter fix invocation, keyed by a UTC timestamp. Charter never deletes backup directories and never truncates existing ones. They accumulate until you choose to remove them.Add .charter/backups/ to .gitignore to keep them local:MCP catalog-aware pin bumps
TheAE-MCP-001 fixer has special logic for the three distinct cases it may encounter:
- Advisory-affected version → bumps to the
fixedInversion recorded in the catalog advisory. Charter will not bump to a version that is itself subject to a known advisory. - Unpinned or behind catalog stable → bumps to the catalog’s
stableVersionfor that package. - Deprecated or archived package → NOT auto-fixed. The package requires migration to a successor, which is a manual step. Charter provides the successor package name in the finding detail.