Skip to main content
Rule ID: AE-CTX-004 · Severity: Medium · Category: Context · Auto-fixable: Yes — charter fix --rule AE-CTX-004

Why this rule

Agent session files checked into git expose local machine state and session history to the repo’s commit record. They also inflate the tracked file set every agent scans on each task, adding irrelevant noise to the agent’s view of the codebase.

What triggers it

Charter checks whether .gitignore excludes the following agent session artifact patterns:
PatternWhat it covers
.charter/Charter local run state and session cache
*.charter-sessionCharter session files
.claude/local/Claude Code local settings and session data
.cursor/cache/Cursor IDE agent cache
The finding also fires if any of these patterns are already tracked in git — a .gitignore entry alone does not remove a file that was previously committed.
Team-owned config files such as .cursor/rules, .claude/settings.json, and hk.pkl should stay committed. AE-CTX-004 targets local cache and session state, not shared configuration.

Examples

.gitignore (missing entries)
node_modules/
dist/
# No entries for .charter/, *.charter-session, .claude/local/, .cursor/cache/
# OR: any of these patterns are tracked in git
$ git ls-files .claude/local/
.claude/local/preferences.json   ← tracked, fires finding

How to fix

1

Preview the changes

Run charter fix --rule AE-CTX-004 --dry-run to see which .gitignore entries will be added.
2

Apply the fix

Run charter fix --rule AE-CTX-004 to append the missing patterns to .gitignore.
3

Remove any already-tracked artifacts

If agent artifacts were previously committed, untrack them without deleting the local files:
git rm --cached .claude/local/ -r
git rm --cached ".charter/" -r
git commit -m "chore: untrack agent session artifacts"

Score impact

Medium severity: −4 to the base score. No hard cap.
  • AE-CTX-001 — context file must exist and be within budget

CLI

charter explain AE-CTX-004