Skip to content

feat: Add scratch pad persistence with flexible configuration #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 6, 2025

Conversation

markaddleman
Copy link
Contributor

Summary

  • Add file persistence capability to the scratch pad tool
  • Provide two configuration mechanisms: config file and runtime tool operation
  • Add persistence_config and status operations for runtime control
  • Updated to be compatible with latest upstream changes

Changes

New Features

  • Scratch pad persistence: Save and load scratch pad data to/from EDN files
  • Configuration flexibility: Users can configure persistence via:
    • Config file (.clojure-mcp/config.edn) - set on startup
    • Runtime operation (persistence_config) - change during session
  • New operations:
    • persistence_config - Enable/disable persistence and set filename at runtime
    • status - Check persistence state, file location, and data statistics
  • Automatic config synchronization: Runtime changes update the config file

Configuration Options

  • :scratch-pad-load - Enable/disable persistence (default: false)
  • :scratch-pad-file - Specify filename (default: "scratch_pad.edn")

Implementation Details

  • Atom watcher automatically saves changes when persistence is enabled
  • Loads existing data when enabling persistence
  • Graceful error handling for corrupted files and save failures
  • Creates .clojure-mcp/ directory as needed
  • Disables persistence on save errors to prevent cascading failures

Merge with Upstream

  • CHANGELOG.md: Uses upstream version (v0.1.6-alpha from 2025-06-30)
  • Configuration: Added scratch pad options alongside new bash-over-nrepl option
  • Compatibility: Updated to work with latest bash tool improvements and performance enhancements

Documentation

  • Updated PROJECT_SUMMARY.md with persistence details and test runner syntax fix
  • Updated README.md with configuration examples showing both scratch pad and bash options
  • Enhanced tool descriptions with persistence operations

Test plan

  • All existing tests pass (including new upstream tests)
  • Added comprehensive test coverage:
    • Config file management tests
    • Persistence operation tests
    • Error handling scenarios
  • Tested both configuration mechanisms
  • Verified file save/load operations
  • Tested error recovery
  • Verified compatibility with upstream changes

🤖 Generated with Claude Code

Bruce Hauman and others added 4 commits June 26, 2025 09:26
- Implement dual-mode persistence configuration (config file + runtime tool)
- Add persistence_config and status operations to scratch_pad tool
- Add automatic config file updates when using tool-based configuration
- Implement lock file management to prevent data corruption
- Add comprehensive error handling for corrupted files and save errors
- Update PROJECT_SUMMARY.md with correct test runner syntax
- Add extensive test coverage (7 test files, 1535+ lines)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Resolved conflicts in PROJECT_SUMMARY.md and README.md by combining configurations
- Used upstream CHANGELOG.md as requested
- Added bash-over-nrepl configuration alongside scratch pad persistence options
@markaddleman
Copy link
Contributor Author

Let me know if there's anything you disagree with. I think the most controversial decision is the scratch pad persistence is disabled by default. I figured it was safer to make it opt-in until we got some feedback but I'm good with it enabled by default.

@markaddleman
Copy link
Contributor Author

I don't fully understand when Claude decides to remove items from the scratch pad. I suspect we're going to want clear operation that, perhaps, occurs during a commit workflow

@bhauman bhauman merged commit 1529da2 into bhauman:main Jul 6, 2025
1 check passed
@bhauman
Copy link
Owner

bhauman commented Jul 6, 2025

I am going to remove the extra ops persistence_config and status from this for now... I'm open to adding them back in the future. I just want to live with persistence for a while and see how it works.

@bhauman
Copy link
Owner

bhauman commented Jul 7, 2025

Just added prompts to load and save scratch pads

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