Skip to content

feat: scratchpad support for resumable analyses (#58)#66

Open
marknutter wants to merge 2 commits intomainfrom
issue-58
Open

feat: scratchpad support for resumable analyses (#58)#66
marknutter wants to merge 2 commits intomainfrom
issue-58

Conversation

@marknutter
Copy link
Copy Markdown
Owner

Summary

  • Adds a scratchpad SQLite table (in the existing memory DB) with TTL-based auto-expiry for short-lived working memory
  • New rlm/scratchpad.py module with save, get, list_entries, clear, delete, and promote operations
  • CLI subcommands: rlm scratchpad save|list|get|clear|promote with configurable --ttl, --tags, --label, --session
  • rlm scratchpad promote <id> graduates a scratchpad entry into long-term memory via the existing pipeline, merging tags and removing from scratchpad
  • 5 new MCP tools: rlm_scratchpad_save, rlm_scratchpad_list, rlm_scratchpad_get, rlm_scratchpad_clear, rlm_scratchpad_promote
  • Default TTL is 24 hours; configurable per-entry

Closes #58

Test plan

  • uv run rlm scratchpad save "content" --label "test" --tags "foo" --ttl 2 creates an entry
  • uv run rlm scratchpad list shows active entries with expiry time
  • uv run rlm scratchpad get <id> returns full content
  • uv run rlm scratchpad promote <id> --tags "extra" moves entry to long-term memory
  • uv run rlm scratchpad clear / --expired removes entries
  • All 131 existing tests pass

🤖 Generated with Claude Code

Mark Nutter and others added 2 commits March 1, 2026 22:26
Implements short-lived working memory for in-progress RLM analyses,
based on the "Everything is Context" paper's scratchpad concept.

- Add `scratchpad` SQLite table to the existing memory DB with TTL support
- New `rlm/scratchpad.py` module: save, get, list, clear, promote
- CLI: `rlm scratchpad save|list|get|clear|promote` subcommands
- Auto-expire entries after configurable TTL (default 24h)
- `promote` graduates scratchpad entries to long-term memory via existing
  memory pipeline, merging tags and removing from scratchpad
- 5 new MCP tools: rlm_scratchpad_save, _list, _get, _clear, _promote

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
26 tests covering db CRUD, high-level scratchpad API (save/get/list/clear/promote),
TTL expiry logic, tag round-trips, promote-to-long-term-memory, and CLI formatting.
Total test count: 157 (was 131).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marknutter
Copy link
Copy Markdown
Owner Author

Added 26 scratchpad tests in tests/test_scratchpad.py covering:

  • DB CRUD (insert, get, delete, list with/without expired, clear all vs expired-only, tag round-trip)
  • High-level API (save, get, list_entries, clear, promote to long-term memory, TTL defaults, session association)
  • Promote behavior (tag merging without duplicates, custom summary, removes from scratchpad)
  • Formatting helpers (format_entry_list, format_entry, EXPIRED display)

Total test count is now 157 (was 131). All passing. 🧱

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.

[Priority 1] Add explicit scratchpad support for resumable analyses

1 participant