Batch git commits in relate() to reduce noise from auto-edges #2

Closed
opened 2026-03-01 04:09:17 +00:00 by cal · 1 comment
Owner

Problem

Each relate() call in edges.py triggers its own git commit via _git_commit(). With the new auto-edge feature in memory_store, a single store operation can now cause up to 4 git commits (1 for the memory file + up to 3 for auto-edges) plus 1 background sync.

This makes git log noisy with opaque messages like relate: abc12345 --BUILDS_ON--> def67890 and slows down the store path due to serialized subprocess calls.

Proposed Solution

Add an optional skip_commit parameter to relate() in edges.py, allowing callers to batch multiple edge writes and issue a single git commit afterward. The MCP memory_relate handler would continue committing per-call (existing behavior), while _auto_create_edges() would skip per-edge commits and let _trigger_git_sync() handle persistence.

Alternatively, relate() could accept a batch mode or _auto_create_edges() could call a lower-level edge-write method that defers the commit.

Scope

  • edges.pyrelate() method needs skip_commit support
  • mcp_server.py_auto_create_edges() passes skip_commit=True
  • Existing memory_relate MCP tool behavior must not change
## Problem Each `relate()` call in `edges.py` triggers its own git commit via `_git_commit()`. With the new auto-edge feature in `memory_store`, a single store operation can now cause up to 4 git commits (1 for the memory file + up to 3 for auto-edges) plus 1 background sync. This makes `git log` noisy with opaque messages like `relate: abc12345 --BUILDS_ON--> def67890` and slows down the store path due to serialized subprocess calls. ## Proposed Solution Add an optional `skip_commit` parameter to `relate()` in `edges.py`, allowing callers to batch multiple edge writes and issue a single git commit afterward. The MCP `memory_relate` handler would continue committing per-call (existing behavior), while `_auto_create_edges()` would skip per-edge commits and let `_trigger_git_sync()` handle persistence. Alternatively, `relate()` could accept a batch mode or `_auto_create_edges()` could call a lower-level edge-write method that defers the commit. ## Scope - `edges.py` — `relate()` method needs `skip_commit` support - `mcp_server.py` — `_auto_create_edges()` passes `skip_commit=True` - Existing `memory_relate` MCP tool behavior must not change
Author
Owner

Fixed by adding skip_commit=True parameter to relate() in edges.py. Auto-edge creation in _auto_create_edges() now passes this flag, skipping the per-edge _git_commit() subprocess calls. The fire-and-forget _trigger_git_sync() at the end of memory_store handles persistence.

Result: memory_store with auto-edges goes from 4 blocking git commits (~200-400ms) to 1 (the store's own commit). The memory_relate MCP tool and CLI still commit per-edge (unchanged default behavior).

Fixed by adding `skip_commit=True` parameter to `relate()` in `edges.py`. Auto-edge creation in `_auto_create_edges()` now passes this flag, skipping the per-edge `_git_commit()` subprocess calls. The fire-and-forget `_trigger_git_sync()` at the end of `memory_store` handles persistence. Result: `memory_store` with auto-edges goes from 4 blocking git commits (~200-400ms) to 1 (the store's own commit). The `memory_relate` MCP tool and CLI still commit per-edge (unchanged default behavior).
cal closed this issue 2026-03-01 04:43:01 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/cognitive-memory#2
No description provided.