nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] Checkpoints, which store the whole conversation, are written into the project with no .gitignore, so git add -A commits them

Open addyCooks opened this issue 1 month ago • 2 comments

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

  1. In a git repo, commit app.js and a file .nanocoder/commands/review.md.
  2. Save a checkpoint with a conversation that contains my API key is sk-test-SECRET-IN-CHAT (or use /checkpoint save in the app).
  3. Run git status --short, then git add -A -n, then git check-ignore -v .nanocoder/checkpoints.
  4. Look for a .gitignore inside .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) or daemon.json (daemon/lockfile.ts:29), also create .nanocoder/.gitignore containing checkpoints/, timeline/, daemon.* (and tasks.json if it is runtime-only). Do not overwrite an existing file; append missing lines.
  • Add a test that fails if git check-ignore does 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

addyCooks avatar Oct 13 '26 12:10 addyCooks

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.

Srinidhi444 avatar Oct 13 '26 12:10 Srinidhi444

Go for it @Srinidhi444 !

addyCooks avatar Oct 14 '26 06:10 addyCooks