Commit Graph

13 Commits

Author SHA1 Message Date
cal
4784bc75b4 Merge pull request 'fix: filter archived/dormant memories from semantic_recall() (#3)' (#7) from ai/cognitive-memory-3 into main
Reviewed-on: #7
2026-03-03 16:57:44 +00:00
Cal Corum
5ce9363bcb fix: filter archived/dormant memories from semantic_recall() (#3)
Apply THRESHOLD_DORMANT decay filter in semantic_recall() before
scoring, consistent with the keyword path in recall(). Memories
with decay_score < 0.05 are now excluded from semantic search,
preventing the decay system's intent from being bypassed via
high-similarity embedding matches.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 23:07:00 -06:00
Cal Corum
11a046ffc3 feat: add migrate-memories.py for default-to-named-graph migration
Standalone script that moves memories between graphs based on tag
matching. Handles memory files, edges, index/embedding/state metadata,
cross-graph edge cleanup, and overlap detection (copy to multiple
graphs). Supports dry-run, idempotent re-runs, and git auto-commit.

Closes: #4, #5, #6

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 16:15:28 -06:00
Cal Corum
dcfd0af503 chore: update feature.json with v3.2.0 — auto-edges and multi-graph support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:08:37 -06:00
Cal Corum
082ef9c8a7 feat: per-project graph routing via COGNITIVE_MEMORY_GRAPH env var
Allows projects to automatically route all memory operations to a
specific graph without passing graph= on every MCP call. Set the env
var in a project's .claude/settings.json to target a named graph.

Resolution order: explicit graph param > env var > "default".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 22:48:19 -06:00
Cal Corum
1fefb1d5e2 perf: skip per-edge git commits during auto-edge creation
Auto-edges called relate() up to 3 times per store, each triggering a
blocking git subprocess (~50-100ms each). Now relate() accepts
skip_commit=True so auto-edges defer to the fire-and-forget git sync,
cutting 150-300ms of latency from every memory_store call.

Closes #2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 22:44:06 -06:00
Cal Corum
d8dd1f35a5 feat: complete multi-graph support across CLI, scripts, and systemd timers
Non-default graphs were second-class citizens — timers only maintained the
default graph, git sync ignored named graphs, there was no way to create
a graph without editing config manually, cross-graph edge errors were
confusing, and utility scripts were hardcoded to the default graph.

- Add `graph-create` CLI command + `create_graph()` in common.py, with
  custom path registration written to the default graph's _config.json
- Add `scripts/maintain-all-graphs.sh` to loop decay/core/embed/reflect
  over all discovered graphs; update systemd services to call it
- Refactor `memory-git-sync.sh` into sync_repo() function that iterates
  default + all named graphs with .git directories
- Improve cross-graph edge ValueError to explain the same-graph constraint
- Add --graph flag to edge-proposer.py and session_memory.py
- Update systemd/README.md with portable paths and new architecture

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 22:35:55 -06:00
Cal Corum
adc9a64c8d fix: multi-graph bugs — embed path, git sync routing, dynamic project detection
- embeddings.py: embed() early-exit returned hardcoded EMBEDDINGS_PATH
  constant instead of self.memory_dir path, giving wrong path for
  non-default graphs
- mcp_server.py: _trigger_git_sync() now passes the active graph's
  memory_dir via COGNITIVE_MEMORY_DIR env var so non-default graphs
  get synced correctly
- analysis.py: replaced hardcoded project name list with auto-detection
  (tags in 5+ memories with 4+ co-occurring tags) so reflection works
  for any graph without manual maintenance

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 22:23:01 -06:00
Cal Corum
5312402a7b fix: improve auto-edge reliability — error visibility, similarity-based strength, heuristic docs
- Surface auto-edge errors in store response (auto_edge_error key) instead
  of silently swallowing exceptions, making failures diagnosable
- Pass similarity score as edge strength so higher-confidence matches get
  stronger edges instead of always defaulting to 0.8
- Document why same-type pairs and REQUIRES/FOLLOWS are excluded from the
  heuristic table vs edge-proposer.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 22:11:15 -06:00
Cal Corum
194990d424 feat: auto-create edges on memory_store in MCP server
Automatically find and link related memories after every store operation,
removing reliance on Claude manually creating edges. Uses recall + type
heuristics to choose edge types (SOLVES, BUILDS_ON, RELATED_TO) and
returns created edge IDs in the store response for optional review.

Key design choices:
- Keyword-only fallback requires tag overlap to prevent spurious edges
- Similarity threshold (0.4) filters before max-edge cap (3)
- Edge description arrow matches actual from/to direction
- Failures never break the store operation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 22:07:05 -06:00
Cal Corum
e87c7598d1 chore: update feature.json with current file inventory
Remove stale entries (dev/, ensure-symlinks.sh, SKILL.md/SCHEMA.md) and
add missing modules (cli.py, common.py, analysis.py, edges.py, embeddings.py,
edge-proposer.py, memory-git-sync.sh). Add skill_layer pointer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 16:08:03 -06:00
Cal Corum
b9cc1e0c6f docs: add CLAUDE.md for project conventions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 16:07:30 -06:00
Cal Corum
48df2a89ce Initial commit: extract cognitive-memory app from skill directory
Moved application code from ~/.claude/skills/cognitive-memory/ to its own
project directory. The skill layer (SKILL.md, SCHEMA.md) remains in the
skill directory for Claude Code to read.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 16:02:28 -06:00