Skip to content

Commit c1bf76d

Browse files
author
Bruce Hauman
committed
edit new scratch_pad persistence functionality
1 parent 0ebfb85 commit c1bf76d

File tree

7 files changed

+43
-1136
lines changed

7 files changed

+43
-1136
lines changed

PROJECT_SUMMARY.md

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ The project allows AI assistants to:
6262
- `/src/clojure_mcp/tools/architect/`: Technical planning and architecture assistance
6363
- `/src/clojure_mcp/tools/scratch_pad/`: Persistent scratch pad for inter-tool communication
6464
- `core.clj`: Core functionality for data storage and retrieval
65-
- `tool.clj`: MCP integration with path-based operations (set_path, get_path, delete_path, persistence_config, status)
66-
- `config.clj`: Configuration file management for dual-mode persistence (config file + runtime tool)
65+
- `tool.clj`: MCP integration with path-based operations (set_path, get_path, delete_path)
66+
- `config.clj`: Configuration file management for persistence
6767
- `truncate.clj`: Pretty-printing with depth truncation
6868

6969
#### Unused Tools (moved to other_tools/)
@@ -150,11 +150,9 @@ your-project/
150150
- `scratch-pad-load`: Boolean flag to enable/disable scratch pad persistence (default: `false`)
151151
- `true` - Loads existing data on startup and saves changes to disk
152152
- `false` - Scratch pad operates in memory only, no file persistence
153-
- Can be configured via config file OR runtime using `persistence_config` operation
154153
- `scratch-pad-file`: Filename for scratch pad persistence (default: `"scratch_pad.edn"`)
155154
- Specifies the filename within `.clojure-mcp/` directory
156155
- Only used when `scratch-pad-load` is `true`
157-
- Can be modified at runtime using `persistence_config` operation
158156

159157
### Example Configuration
160158
```edn
@@ -220,7 +218,7 @@ The following tools are available in the default configuration (`main.clj`):
220218

221219
| Tool Name | Description | Example Usage |
222220
|-----------|-------------|---------------|
223-
| `scratch_pad` | A persistent scratch pad for storing structured data between tool calls | Task tracking, intermediate results, inter-agent communication, with dual-mode persistence configuration |
221+
| `scratch_pad` | A persistent scratch pad for storing structured data between tool calls | Task tracking, intermediate results, inter-agent communication |
224222
| `code_critique` | Starts an interactive code review conversation that provides constructive feedback on your Clojure code | Iterative code quality improvement |
225223

226224
## Tool Examples
@@ -283,18 +281,6 @@ scratch_pad:
283281
path: ["todos", 0]
284282
explanation: Checking first task
285283
Output: Value at ["todos", 0]: {task: "Write tests", done: false}
286-
287-
scratch_pad:
288-
op: persistence_config
289-
enabled: true
290-
filename: "my_workspace.edn"
291-
explanation: Enable persistence with custom filename
292-
Output: Persistence enabled (file: my_workspace.edn)
293-
294-
scratch_pad:
295-
op: status
296-
explanation: Check persistence status
297-
Output: Scratch Pad Status with file info, size, and entry count
298284
```
299285

300286
## Architecture and Design Patterns
@@ -363,13 +349,8 @@ scratch_pad:
363349
- Path elements as arrays of strings and numbers
364350
- Tree visualization for debugging and inspection
365351
- Pretty-printed output with truncation at depth 3 for readability
366-
- Dual-mode persistence configuration:
367-
- **Config File Based**: Enable persistence via `.clojure-mcp/config.edn` file
368-
- **Runtime Tool Based**: Use `persistence_config` operation to enable/disable and configure filename
369-
- Tool-based changes automatically update config file for session persistence
370-
- Lock file management to prevent data corruption from multiple instances
352+
- **Config File Based**: Enable persistence via `.clojure-mcp/config.edn` file
371353
- Error handling for corrupted files with user notification
372-
- Status operation showing persistence state, file info, and statistics
373354

374355
## Development Workflow Recommendations
375356

@@ -392,7 +373,6 @@ scratch_pad:
392373
- Storing intermediate computation results
393374
- Building up complex data structures incrementally
394375
- Sharing context between different agents or tool calls
395-
- Enable persistence via config file or `persistence_config` operation for data that should survive sessions
396376

397377
4. **Logging System**:
398378
- Uses `clojure.tools.logging` with Logback backend
@@ -495,9 +475,6 @@ See `/doc/custom-mcp-server.md` for comprehensive documentation on creating cust
495475
- Building complex data structures incrementally
496476
- Path-based data manipulation using `set_path`/`get_path`/`delete_path` operations
497477
- Direct storage of JSON-compatible values
498-
- **Dual-mode persistence configuration**: Configure persistence via config file OR runtime tool operations
499-
- Runtime configuration operations (`persistence_config`, `status`) with immediate effect
500-
- Automatic config file updates when using tool-based configuration
501478

502479
**Tool Reorganization**: To improve codebase maintainability, unused tools have been moved to `/src/clojure_mcp/other_tools/`. This separation clarifies which tools are actively used in the main MCP server (`main.clj`) versus those that remain available but are not currently essential.
503480

README.md

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ it is.
4444

4545
## The Good News
4646

47-
There is a story that Clojure developers you may have come to believe. The
47+
There is a story that Clojure developers may have come to believe. The
4848
story that LLMs are overwhelmingly trained on more mainstream
4949
languages and as a result those languages have the upper hand when it
5050
comes to LLM assisted coding. I'm here to tell you that this is just
@@ -658,7 +658,6 @@ The default tools included in `main.clj` are organized by category to support di
658658
- **Persistent Workspace**: Store structured data for planning and inter-tool communication
659659
- **Memory-Only by Default**: Data is stored in memory only and lost when session ends (default behavior)
660660
- **Optional File Persistence**: Enable to save data between sessions and server restarts
661-
- **Dual-Mode Configuration**: Configure persistence via config file or runtime tool operations
662661
- **Path-Based Operations**: Use `set_path`, `get_path`, `delete_path` for precise data manipulation
663662
- **JSON Compatibility**: Store any JSON-compatible data (objects, arrays, strings, numbers, booleans)
664663

@@ -667,28 +666,6 @@ By default, the scratch pad operates in memory only. Data persists during the se
667666

668667
**Enabling Persistence:**
669668

670-
Option 1 - Runtime Configuration (Immediate Effect):
671-
```
672-
# Enable persistence via tool operation
673-
scratch_pad:
674-
op: persistence_config
675-
enabled: true
676-
filename: "my_workspace.edn" # optional, defaults to "scratch_pad.edn"
677-
explanation: Enable persistence with custom filename
678-
679-
# Check persistence status
680-
scratch_pad:
681-
op: status
682-
explanation: Check current persistence settings
683-
684-
# Disable persistence (data remains in memory)
685-
scratch_pad:
686-
op: persistence_config
687-
enabled: false
688-
explanation: Disable file persistence
689-
```
690-
691-
Option 2 - Configuration File (On Startup):
692669
Add to `.clojure-mcp/config.edn`:
693670
```edn
694671
{:scratch-pad-load true ; false by default
@@ -699,9 +676,6 @@ Add to `.clojure-mcp/config.edn`:
699676
- Files are saved in `.clojure-mcp/` directory within your project
700677
- Changes are automatically saved when persistence is enabled
701678
- Corrupted files are handled gracefully with error reporting
702-
- Runtime configuration updates the config file for persistence across restarts
703-
704-
705679

706680
## 🔧 Customization
707681

@@ -780,7 +754,7 @@ Boolean flag to control bash command execution mode (default: `true`). This sett
780754
- `false` - Useful when the nREPL server is not a Clojure process, i.e. CLJS, Babashka, Scittle
781755

782756
**Technical details:**
783-
- When `true`, bash commands run in a separate nREPL session to prevent interference with your REPL state
757+
- When `true`, bash commands run in a separate nREPL session
784758
- Both modes apply consistent output truncation (8500 chars total, split between stdout/stderr)
785759
- Local execution may be faster for simple commands but requires the MCP server to have necessary tools installed
786760

@@ -810,16 +784,11 @@ Boolean flag to enable/disable scratch pad persistence on startup (default: `fal
810784
- `false` - Best for temporary planning and session-only data
811785
- `true` - When you want data to persist across sessions and server restarts
812786

813-
**Note:** This setting controls persistence at startup. You can also enable/disable persistence at runtime using the `persistence_config` operation.
814-
815787
#### `scratch-pad-file`
816788
Filename for scratch pad persistence (default: `"scratch_pad.edn"`).
817789

818790
**Configuration:**
819791
- Specifies the filename within `.clojure-mcp/` directory
820-
- Only used when `scratch-pad-load` is `true`
821-
- Can be modified at runtime using `persistence_config` operation
822-
- Runtime changes are saved to the config file for future sessions
823792

824793
### Example Configuration
825794

src/clojure_mcp/tools/scratch_pad/config.clj

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)