Skip to content

feat: add team snapshot/restore for checkpoint and recovery#24

Closed
he-yufeng wants to merge 1 commit intoHKUDS:mainfrom
he-yufeng:feat/team-snapshots
Closed

feat: add team snapshot/restore for checkpoint and recovery#24
he-yufeng wants to merge 1 commit intoHKUDS:mainfrom
he-yufeng:feat/team-snapshots

Conversation

@he-yufeng
Copy link
Copy Markdown
Contributor

Summary

  • New clawteam team snapshot / restore / snapshots / snapshot-delete commands
  • Captures full team state (config, tasks, events, sessions, costs, pending inbox messages) into a single JSON bundle under {data_dir}/snapshots/{team}/
  • Restore with --dry-run to preview before writing, --force to skip confirmation
  • Atomic writes throughout (tmp + rename), consistent with existing store patterns

Motivation

Long-running agent swarms need a way to checkpoint and recover. Today, if a session crashes mid-way there's no holistic team-level snapshot — session save only covers individual agents. This fills that gap.

What's included

File What
clawteam/team/snapshot.py SnapshotManager — create, list, restore, delete snapshots
clawteam/cli/commands.py 4 new CLI commands under team subgroup
tests/test_snapshots.py 16 tests: create, list, restore, delete, dry-run, full round-trip

Test plan

  • pytest tests/test_snapshots.py — 16/16 passed
  • pytest tests/ — 151/151 passed (no regressions)
  • ruff check — clean

New commands under `clawteam team`:
- `snapshot` — capture full team state (config, tasks, events,
  sessions, costs, pending inbox messages) into a single bundle
- `snapshots` — list available snapshots with metadata
- `restore` — restore team state from a snapshot (with --dry-run)
- `snapshot-delete` — remove a snapshot

Useful for long-running agent swarms that need pause/resume,
disaster recovery, or rollback to a known-good state.

Includes 16 new tests covering create, list, restore, delete,
dry-run, round-trip cleanup→restore, and edge cases.
@he-yufeng
Copy link
Copy Markdown
Contributor Author

@tjb-tech

@tjb-tech
Copy link
Copy Markdown
Collaborator

Thanks for the feature work here.

I didn’t merge this PR as-is, but I did absorb it into main in a hardened form.

What landed in main:

  • the snapshot / list / restore / delete feature set from this PR
  • an additional follow-up hardening pass on restore semantics
  • safe snapshot ID handling for path-like tags

Merged into main via:

  • e5d4543 Merge pull request #24 from he-yufeng/feat/team-snapshots

So I’m closing this PR since the functionality is now in main, just not as the exact branch contents originally proposed.

Thanks again — the feature direction was good and this PR directly led to the final implementation.

@tjb-tech tjb-tech closed this Mar 19, 2026
@he-yufeng
Copy link
Copy Markdown
Contributor Author

Thanks for the review and the hardening pass! Glad the feature direction worked out.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants