[Bug] Checkpoints, which store the whole conversation, are written into the project with no .gitignore, so git add -A commits them
Description
Nanocoder writes runtime state into the project's .nanocoder/ folder: checkpoints/ (full conversation and file snapshots), timeline/, daemon.log, and daemon.json. The same folder also holds files meant to be committed (commands/, agents/, tools/, skills/, plugins/), so users cannot just ignore .nanocoder/. Nothing creates a .gitignore for the runtime files, so git add -A stages chat transcripts that may contain secrets.
Environment
- OS: Windows 11 (10.0.26300)
- Node version: 22.22.3
- Nanocoder version: 1.31.0 (main at 9d88dda7)
- Provider / Model: not relevant (reproduced by calling
CheckpointManager.saveCheckpoint)
Steps to Reproduce
- In a git repo, commit
app.jsand a file.nanocoder/commands/review.md. - Save a checkpoint with a conversation that contains
my API key is sk-test-SECRET-IN-CHAT(or use/checkpoint savein the app). - Run
git status --short, thengit add -A -n, thengit check-ignore -v .nanocoder/checkpoints. - Look for a
.gitignoreinside.nanocoder/.
Expected Behavior
The runtime folders and files are ignored by default, and .nanocoder/commands/ and similar folders stay committable.
Actual Behavior
git status --short: M app.js
?? .nanocoder/checkpoints/
git add -A -n: add '.nanocoder/checkpoints/before-refactor/conversation.json'
add '.nanocoder/checkpoints/before-refactor/files/app.js'
add '.nanocoder/checkpoints/before-refactor/metadata.json'
.nanocoder/ contains: checkpoints commands (no .gitignore)
conversation.json and metadata.json both contain the secret text. The docs only say Consider adding .nanocoder/checkpoints to your .gitignore (docs/features/checkpointing.md:68). The repo ignores .nanocoder/timeline/ for itself (see the comment at source/services/timeline-manager.ts:34), but user projects do not.
Suggested Fix
- When Nanocoder first creates
.nanocoder/checkpoints,.nanocoder/timeline(checkpoint-manager.ts:35,timeline-manager.ts:70),daemon.log(daemon/cli.ts:34) ordaemon.json(daemon/lockfile.ts:29), also create.nanocoder/.gitignorecontainingcheckpoints/,timeline/,daemon.*(andtasks.jsonif it is runtime-only). Do not overwrite an existing file; append missing lines. - Add a test that fails if
git check-ignoredoes not match a saved checkpoint.
Additional Context
- [x] I have searched existing issues to ensure this is not a duplicate
- [x] I can reproduce this issue consistently
- [x] This issue occurs with the latest version of nanocoder
Hey @addyCooks, I'd like to work on this My approach would be to create a shared utility that ensures .nanocoder/.gitignore exists and contains the necessary rules for runtime files (checkpoints/, timeline/, daemon.log, and daemon.json), while preserving any existing entries and avoiding duplicates.
I'll then integrate it into the relevant initialization paths and add regression tests using git check-ignore to verify that runtime files are ignored while user configuration files remain trackable.
Go for it @Srinidhi444 !