feat: backup-sessions command to prevent tool auto-deletion of sessions#18
Open
xliry wants to merge 1 commit intopeteromallet:mainfrom
Open
feat: backup-sessions command to prevent tool auto-deletion of sessions#18xliry wants to merge 1 commit intopeteromallet:mainfrom
xliry wants to merge 1 commit intopeteromallet:mainfrom
Conversation
…romallet#16) Prevent data loss from automatic session cleanup by Claude Code and Gemini CLI: - Add `dataclaw backup-sessions` CLI command that copies session files from ~/.claude/projects/ and ~/.gemini/tmp/ to ~/.dataclaw/session_backup/ - Parser now reads from backup location as fallback, so sessions deleted by tool cleanup are still included in exports - Document cron setup and tool configuration options in README Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16
Problem
Claude Code and Gemini CLI automatically delete sessions older than 30 days. This causes data loss for dataclaw users who haven't exported their data yet.
Solution
1.
dataclaw backup-sessionscommand (new)Copies all session files from
~/.claude/projects/and~/.gemini/tmp/to~/.dataclaw/session_backup/— a location that coding tools don't clean up.Output:
{ "backed_up": 42, "already_current": 100, "backup_dir": "~/.dataclaw/session_backup", "next_steps": ["...cron instructions..."] }2. Parser reads from backup as fallback
_discover_claude_projects(),_discover_gemini_projects(), andparse_project_sessions()now merge results from both the original source directory and~/.dataclaw/session_backup/. Sessions deleted by tool cleanup are still included in exports.3. README documentation
Added a "Preventing session deletion" section with:
backup-sessionscommand and cron setupcleanupPeriodDays: 0insettings.json) and Gemini CLI to retain sessions longerTesting
All existing 290 tests pass. Test helpers updated to monkeypatch the new backup dir constants so they don't leak into isolation tests.