Skip to content

hygiene: codemap leaves .codemap/ state in every repo it touches, unignored and sometimes committed; agent worktrees pollute scans #184

Description

@JordanCoin

Symptoms, measured 2026-09-04 on one machine

  • Every repository under that a hook or scan touched has a .codemap/ directory. In at least 10 repos it shows as untracked in git status because nothing ever added it to an ignore list.
  • In business-skills, .codemap/agent_edits.jsonl and .codemap/status were committed, and they change on every session, so every later commit carries state churn.
  • codemap . on this repo counted watch/testdata five times because agent worktrees under .claude/worktrees/ are scanned; that produced a wrong before/after figure in PR feat(scanner): Skip testdata directories by default #179's original body.
  • The reputation this earns: "codemap leaves a lot behind."

Proposed fix

  1. State goes somewhere the repo does not see. Prefer a per-repo directory under the user cache ($XDG_CACHE_HOME/codemap/<hash of repo root>/), or, if the in-repo location must stay, write .codemap/ into .git/info/exclude on first use so it is ignored without touching a tracked .gitignore.
  2. codemap setup and codemap doctor report any tracked .codemap/* files and offer git rm --cached.
  3. Ignore .claude/worktrees/ and .git/ worktree checkouts by default in the walker, alongside vendor and testdata.
  4. Hooks must never create .codemap/ in a repo that has no codemap config and was only visited by a scan (e.g. a one-off codemap . in someone else's project).

Exit test

Fresh clone of any repo, run codemap ., run a session with hooks, then git status --porcelain is empty and codemap . file counts match git ls-files | wc -l modulo ignore rules.

Related: #179, #183, #172.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TcyheQmM3HCvxF5wRL3s5t

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions