Skip to content

refactor: simplify codebase by consolidating snapshot functionality#26

Merged
CrazyBoyM merged 1 commit intomainfrom
feat/sdk-positioning-and-graceful-shutdown
Jan 22, 2026
Merged

refactor: simplify codebase by consolidating snapshot functionality#26
CrazyBoyM merged 1 commit intomainfrom
feat/sdk-positioning-and-graceful-shutdown

Conversation

@CrazyBoyM
Copy link
Contributor

Summary

This PR performs a gentle cleanup of the codebase by removing the standalone Checkpointer module, whose functionality is already fully covered by the existing Store.snapshot system.

Background

During our architecture review, we noticed that the Checkpointer interface (with MemoryCheckpointer, FileCheckpointer, and RedisCheckpointer implementations) was designed but never actually integrated into the Agent runtime. The Agent class uses Store.saveSnapshot() and Store.loadSnapshot() directly for all snapshot/fork operations.

What's Changed

  • Removed src/core/checkpointer.ts and src/core/checkpointers/ directory
  • Removed related test file
  • Updated exports in src/index.ts
  • Fixed documentation to use correct API names (snapshot() instead of checkpoint())

Why This is Safe

Feature Before (Checkpointer) Now (Store)
Save snapshot Never used by Agent Store.saveSnapshot()
Load snapshot Never used by Agent Store.loadSnapshot()
List snapshots Never used by Agent Store.listSnapshots()
Fork agent Never used by Agent Agent.fork() uses Store directly ✓

Benefits

  • Simpler codebase with clearer responsibilities
  • Reduced maintenance surface
  • Less confusion for developers about which API to use
  • Documentation now accurately reflects the actual API

Test Results

Build:  ✅ Passing
Tests:  ✅ 188 passing (3 checkpointer tests removed)

This cleanup was identified during our SDK architecture review. The Store interface already provides a well-designed snapshot system that serves all current needs.

The Checkpointer interface and implementations (Memory, File, Redis) were
designed but never integrated into the Agent runtime. Store.snapshot already
provides all the functionality needed for fork/resume operations.

Removed:
- src/core/checkpointer.ts (interface + MemoryCheckpointer)
- src/core/checkpointers/ (FileCheckpointer, RedisCheckpointer)
- tests/unit/core/checkpointer.test.ts

Updated:
- src/index.ts: removed Checkpointer exports
- README.md: fixed example to use agent.snapshot() instead of agent.checkpoint()
- docs/ROADMAP.md: replaced "Checkpointer" with "Snapshot/Fork"
- tests/README.md: removed Checkpointer reference

This removes ~500 lines of dead code without affecting any functionality.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@CrazyBoyM CrazyBoyM merged commit f5eed28 into main Jan 22, 2026
1 of 2 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

Development

Successfully merging this pull request may close these issues.

1 participant