Skip to content

feat(session-gists): auto-backup AI sessions (Claude, Codex, Gemini) to private gists on push#145

Merged
skulidropek merged 10 commits intoProverCoderAI:mainfrom
konard:issue-143-8b42b7a3b21f
Mar 19, 2026
Merged

feat(session-gists): auto-backup AI sessions (Claude, Codex, Gemini) to private gists on push#145
skulidropek merged 10 commits intoProverCoderAI:mainfrom
konard:issue-143-8b42b7a3b21f

Conversation

@konard
Copy link
Contributor

@konard konard commented Mar 16, 2026

Summary

  • Auto-backup AI agent sessions (~/.codex, ~/.claude, ~/.gemini) to private GitHub Gists on git push
  • Post PR comment with gist link when pushing to an open PR
  • Add CLI commands to manage session backups: docker-git session-gists [backup|list|view|download]
  • Reference context-doc for extracting session dialogs

Changes

Pre-push Hook Enhancement

The .githooks/pre-push hook now automatically:

  1. Collects AI session files from ~/.codex, ~/.claude, and ~/.gemini directories
  2. Uploads them to a private GitHub Gist
  3. Posts a comment to the PR (if one exists) with the gist link

Skip automatic backup by setting DOCKER_GIT_SKIP_SESSION_BACKUP=1.

New CLI Commands

# Backup current session to gist
docker-git session-gists backup [--pr-number N] [--repo owner/repo] [--no-comment]

# List previous session backups
docker-git session-gists list [--limit N] [--repo owner/repo]

# View gist contents
docker-git session-gists view <gist-id>

# Download gist to local directory
docker-git session-gists download <gist-id> [--output dir]

Scripts

  • scripts/session-backup-gist.js - Core backup logic (supports Claude, Codex, Gemini)
  • scripts/session-list-gists.js - Gist listing and download utilities

Gemini Support

  • Added ~/.gemini to session backup directories
  • Added gemini --resume <session-id> to restore instructions
  • Added .gemini/* files to download restore path

Session Dialog Extraction

For extracting session dialogs from Claude, Codex, and Gemini, see: https://github.com/ProverCoderAI/context-doc

Test plan

  • Lint passes (pnpm --filter ./packages/app lint)
  • Tests pass (pnpm --filter ./packages/app test)
  • Lib lint passes (pnpm --filter ./packages/lib lint)
  • Lib tests pass (pnpm --filter ./packages/lib test)
  • CI checks pass on GitHub Actions

Issue Reference

Fixes #143

QUOTE(ТЗ): "когда происходит push мы сразу заливаем текущую сессию с AI агентом в gits приватный и прикладываем эту ссылку в комментарии к push в PR"

🤖 Generated with Claude Code

konard and others added 2 commits March 16, 2026 09:43
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: ProverCoderAI#143
- Add pre-push hook to backup ~/.codex and ~/.claude sessions to GitHub Gists
- Add CLI commands: docker-git session-gists [backup|list|view|download]
- Post PR comment with gist link when pushing to an open PR
- Support --pr-number, --repo, --no-comment, --limit, --output options
- Extract shared parser helpers (splitSubcommand, parsePositiveInt)
- Add jscpd ignore pattern for Effect-TS Match-based parser boilerplate

Closes ProverCoderAI#143

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@konard konard changed the title [WIP] Сделать что бы в самом PR лежали чаты из ~/.codex ~/.claude и была команда с помощью которой агент мог бы обратиться к любой истории чата. типо codex resume id | claude --resume id feat(session-gists): auto-backup AI sessions to private gists on push Mar 16, 2026
@konard konard marked this pull request as ready for review March 16, 2026 10:05
@konard
Copy link
Contributor Author

konard commented Mar 16, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $13.513559
  • Calculated by Anthropic: $8.380626 USD
  • Difference: $-5.132934 (-37.98%)
    📎 Log file uploaded as Gist (2496KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Contributor Author

konard commented Mar 16, 2026

🔄 Auto-restart 1/3

Detected uncommitted changes from previous run. Starting new session to review and commit them.

Uncommitted files:

?? lint-lib-output.log
?? lint-output.log
?? test-app-output.log
?? test-lib-output.log

Auto-restart will stop after changes are committed or after 2 more iterations. Please wait until working session will end and give your feedback.

@konard
Copy link
Contributor Author

konard commented Mar 16, 2026

🔄 Auto-restart 1/3 Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $1.188388
  • Calculated by Anthropic: $0.461942 USD
  • Difference: $-0.726446 (-61.13%)
    📎 Log file uploaded as Gist (2768KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Contributor Author

konard commented Mar 16, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@skulidropek
Copy link
Contributor

Надо добавить поддержку gemini

Ещё на счёт того как получать нужные диалоги то есть для Claude Code, Codex вот тут:
https://github.com/ProverCoderAI/context-doc

@skulidropek
Copy link
Contributor

Ну и исправь конфликты

@konard konard marked this pull request as draft March 17, 2026 19:40
@konard
Copy link
Contributor Author

konard commented Mar 17, 2026

🤖 AI Work Session Started

Starting automated work session at 2026-03-17T19:40:38.200Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback.

konard and others added 2 commits March 17, 2026 20:00
- Add ~/.gemini to session backup directories for Gemini CLI sessions
- Extract SessionGistCommand types to dedicated session-gist-domain.ts module
- Add context-doc reference link for extracting session dialogs
- Update restore instructions to include .gemini files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title feat(session-gists): auto-backup AI sessions to private gists on push feat(session-gists): auto-backup AI sessions (Claude, Codex, Gemini) to private gists on push Mar 17, 2026
@konard konard marked this pull request as ready for review March 17, 2026 20:34
@konard
Copy link
Contributor Author

konard commented Mar 17, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $7.246959
  • Calculated by Anthropic: $1.036889 USD
  • Difference: $-6.210070 (-85.69%)

🤖 Models used:

  • Tool: Claude
  • Requested: opus
  • Main model: (ID: <synthetic>)
  • ⚠️ Warning: Main model <synthetic> does not match requested model opus
  • Supporting models:

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Contributor Author

konard commented Mar 17, 2026

🔄 Auto-restart 1/3

Detected uncommitted changes from previous run. Starting new session to review and commit or discard them.

Uncommitted files:

?? lint-app-output.log
?? lint-lib-output.log
?? test-app-output.log
?? test-lib-output.log

Auto-restart will stop after changes are committed or discarded, or after 2 more iterations. Please wait until working session will end and give your feedback.

@konard
Copy link
Contributor Author

konard commented Mar 17, 2026

🔄 Auto-restart 1/3 Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $7.903358
  • Calculated by Anthropic: $0.360259 USD
  • Difference: $-7.543099 (-95.44%)

🤖 Models used:

  • Tool: Claude
  • Requested: opus
  • Main model: (ID: <synthetic>)
  • ⚠️ Warning: Main model <synthetic> does not match requested model opus
  • Supporting models:

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Contributor Author

konard commented Mar 17, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@skulidropek
Copy link
Contributor

AI Session Backup

A snapshot of the AI agent session has been saved to a private gist:

Commit: b17eb5008db4605a84f286e4851c6b00b356a7b6

Gist URL: https://gist.github.com/skulidropek/63b84ba6b661a206f4c55e88ec88c6e6

To resume this session, you can use:

# For Codex
codex resume <session-id>

# For Claude
claude --resume <session-id>

# For Gemini
gemini --resume <session-id>

For extracting session dialogs, see: https://github.com/ProverCoderAI/context-doc


Backup created at: 2026-03-18T14:12:48.818Z

@skulidropek
Copy link
Contributor

AI Session Backup

A snapshot of the AI session context used during development has been saved.

Backup Repo: skulidropek/docker-git-sessions
Source Commit: 25caef9
Created At: 2026-03-19T09:27:12.321Z
Files: 78 (42.83 MB)

README: https://github.com/skulidropek/docker-git-sessions/blob/main/ProverCoderAI/docker-git/pr-145/commit-25caef95e8b76661a1d983840b1e823b760d23d9/2026-03-19T09-27-12-321Z/README.md
Manifest: https://github.com/skulidropek/docker-git-sessions/blob/main/ProverCoderAI/docker-git/pr-145/commit-25caef95e8b76661a1d983840b1e823b760d23d9/2026-03-19T09-27-12-321Z/manifest.json

This snapshot metadata was used during development.

@skulidropek skulidropek merged commit bc88d0a into ProverCoderAI:main Mar 19, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants