v3.6.0: Memory system, pattern analysis, skill recommendation#12
v3.6.0: Memory system, pattern analysis, skill recommendation#12redredchen01 wants to merge 5 commits intomainfrom
Conversation
- Add buildDocIDF(), buildDocVector(), cosineSimilarity(), tokenizeDoc() to scoring.mjs - Add stopword filtering for document vectorization - Replace calculateKeywordOverlap (capped +2) in scorePairs() with cosine sim * 3 - Add getDocVectors() cache to SimilarityEngine (keyed by content fingerprint) - Upgrade findRelated() to include query vector cosine similarity (scale ×2) - Add 8 new tests: tokenization, IDF weights, vector building, cosine properties, content-similarity ranking
…commendation - Add MemoryGraph, SessionMemory, MemoryBridge for agent memory persistence - Implement CodePatternAnalyzer for code pattern scoring and analysis - Add SkillRecommender for agent capability recommendations - Enhance pattern-detector.mjs with TF-IDF and complexity scoring - Fix pattern-detector test: scoreComplexity returns 1-10 (not 0-10) - Expand event types and registry integration for memory system - Update documentation and changelog for v3.6.0 All 416 tests passing.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3be2da6c5c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const { unlinkSync } = require('fs'); | ||
| unlinkSync(memoryPath); |
There was a problem hiding this comment.
Remove deleted memory files with ESM-compatible fs API
_removeFromClaudeMemory uses require('fs') inside an ESM module, which throws at runtime and is silently swallowed by the catch, so deleted notes are never removed from Claude memory. In the delete flow (_handleNoteDeleted), this leaves stale vault-*.md files behind, and a later fullSync can recreate the note via _pullClaudeMemory when it sees memory content with no vault note.
Useful? React with 👍 / 👎.
| const files = readdirSync(this.config.claudeMemoryDir) | ||
| .filter(f => f.startsWith('vault-') && f.endsWith('.md')); |
There was a problem hiding this comment.
Pull project-scoped memory files during bidirectional sync
Project notes are pushed to ~/.claude/projects/<project>/memory/... in _pushToClaudeMemory, but _pullClaudeMemory only lists files directly under claudeMemoryDir (default ~/.claude/memory). This means edits made to project-scoped memory entries are never pulled back into the vault, so bidirectional sync is incomplete for a core note type.
Useful? React with 👍 / 👎.
| existing.label = note.title; | ||
| existing.metadata.tags = note.tags; | ||
| existing.metadata.status = note.status; | ||
| existing.metadata.type = note.type; | ||
| continue; |
There was a problem hiding this comment.
Recompute edges for existing nodes during vault sync
When syncFromVault encounters an existing node it continues before running either relationship-building loop, so related/tag-similar edges are only created on first insertion. This causes one-way related links to be permanently missed (if the target node was added later) and prevents relationship updates when note metadata changes.
Useful? React with 👍 / 👎.
| const result = bridge.fullSync(); | ||
| console.log(JSON.stringify(result, null, 2)); |
There was a problem hiding this comment.
Await full-sync result before serializing CLI output
memoryFullSync calls the async bridge.fullSync() without await, then stringifies the unresolved Promise, which prints {} in normal CLI mode. Users lose the actual sync diagnostics (graphSync, pushSync, etc.) even though the operation runs, making the command output misleading compared with other memory subcommands.
Useful? React with 👍 / 👎.
Remove placeholder tests and non-existent cache layers: - Delete 3 placeholder test files (cluster-cache, file-hasher, vault-selective-invalidation) All had only 'assert.ok(true)' — no real assertions - Simplify ARCHITECTURE.md: remove descriptions of ClusterCache, SelectiveInvalidation, FileHasher These source files don't exist in src/; only SearchCache is implemented - Move 4-layer cache design to 'Planned Features' section - Keep SearchCache (only implemented layer) with accurate description - 394 tests pass, 0 failures
- Implement EmbeddingStore class with TF-IDF vector index and k-NN search - Add semanticSearch() method to SimilarityEngine - Zero external dependencies, reuses existing scoring.mjs utilities - Vector index cached and vault-version aware - Persistence helpers for embeddings.json (optional) Remaining: CLI command (memory semantic) + MCP tool registration
- Add `memory semantic <query>` CLI subcommand for k-NN semantic search - Register memory-semantic-search MCP tool with query + k parameters - Fix SimilarityEngine.semanticSearch() cache invalidation (version hash) - Fix vault note transformation to embedding store format (id/title/summary/body) - All 394 tests pass (compatibility with existing memory system maintained) Zero-dependency: reuses scoring.mjs TF-IDF infrastructure MCP-ready: memory semantic query available via Model Context Protocol Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Summary
Clausidian v3.6.0 introduces a comprehensive memory system framework enabling Claude agents to persist, query, and reason about prior work and sessions. This release also adds code pattern analysis and skill recommendation capabilities, positioning Clausidian as a full intelligence platform for vault-aware agent development.
Test status: ✅ 416/416 tests passing
Key Changes
1. Memory System Framework
src/memory-graph.mjs) — Encodes semantic relationships between notes, enabling graph-based traversal and cross-document discoverysrc/session-memory.mjs) — Persists conversation state, previous interactions, and learned patterns across Claude agent sessionssrc/memory-bridge.mjs) — Unifies CLI memory, session memory, and vault indexing for seamless agent access to context2. Code Pattern Analysis
src/code-pattern-analyzer.mjs) — Scores code patterns on impact, completeness, maturity, reusability, complexity, and risk level3. Skill Recommendation
src/skill-recommender.mjs) — Routes agent requests to appropriate Claudian commands based on vault state and prior learnings4. Supporting Enhancements
5. Documentation & Tests
test/memory-system.test.mjscovering MemoryGraph, SessionMemory, and MemoryBridge integrationDesign Decisions
Breaking Changes
None. Memory system is opt-in via new
memorycommand; existing search, vault, and note operations are unaffected.Test Coverage
memory-system.test.mjs🤖 Generated with Claude Opus 4.6 (200K context) via Claude Code