Skip to content

feat: metrics collection and memory snapshots#20

Open
KetchCyork wants to merge 1 commit into
mainfrom
feature/metrics-and-versioning
Open

feat: metrics collection and memory snapshots#20
KetchCyork wants to merge 1 commit into
mainfrom
feature/metrics-and-versioning

Conversation

@KetchCyork

Copy link
Copy Markdown
Owner

Summary

  • Adds MetricsCollector singleton (search/index latency, work memory, consolidation, feedback counts) with reset() support
  • Adds SnapshotStore for creating, listing, restoring, and deleting timestamped memory snapshots; auto-creates a safety backup before any restore
  • Instruments MemoryEngine with try/catch latency recording on search() and reindex(); all write methods record the appropriate metric
  • Exposes metrics and snapshot operations via HTTP (GET /metrics, POST /metrics/reset, CRUD /snapshots, POST /snapshots/:id/restore) and MCP (create_snapshot, list_snapshots, restore_snapshot)

Test plan

  • MetricsCollector unit tests (counts, latency, errors, reset)
  • SnapshotStore unit tests (create, list ordering, get, restore, delete, missing-file handling)
  • All existing 80+ tests still pass
  • npm run typecheck exits 0

Closes #10
Closes #11

🤖 Generated with Claude Code

- MetricsCollector singleton tracks search/index latency, work memory,
  consolidation, and feedback event counts with reset support
- SnapshotStore copies work memory, context graph, and feedback JSON
  into timestamped snapshot directories; auto-creates safety backup
  before any restore
- Engine instrumented with try/catch latency recording on search and
  reindex; all write operations record the appropriate metric
- HTTP routes: GET/POST /metrics, POST /metrics/reset, CRUD /snapshots,
  POST /snapshots/:id/restore
- MCP tools: create_snapshot, list_snapshots, restore_snapshot
- Test suites: MetricsCollector (14 assertions), SnapshotStore (12 assertions)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Versioning & Rollback for memory state Monitoring & Metrics

1 participant