qq/.claude/skills-test/memory/SKILL.md
Unified memory management for notes, knowledge graph, RAG search, and file analysis. Use when working with: (1) Core memory — protected identity, projects, relationships, and system facts that should never be forgotten, (2) Working notes — per-session ephemeral notes organized by section, (3) MongoDB RAG — vector-search-enabled notes with importance scoring, decay, deduplication, and archival, (4) Neo4j knowledge graph — entities, relationships, merge duplicates, reinforce mentions, Cypher queries, (5) File analysis — deep file reading that extracts knowledge into all memory layers, (6) Service initialization — health-check, start/stop MongoDB, Neo4j, TEI embeddings via docker-compose with partial setup support.
npx skillsauth add orinachum/autonomous-intelligence memoryInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Multi-layer memory system: core notes, working notes, MongoDB RAG, Neo4j knowledge graph, and file analysis.
Edit config.json in this skill directory. See config reference for all fields and env-var overrides.
python scripts/check_services.py # verify connectivity
python scripts/start_services.py # launch all backends
python scripts/start_services.py mongodb # launch subset
For OpenAI API instead of local vLLM:
python scripts/setup_openai.py --base-url https://api.openai.com/v1 --api-key sk-... --model gpt-4o
Store identity, projects, relationships, system facts in memory/core.md. These survive all memory maintenance operations.
from qq.memory.core_notes import CoreNotesManager
mgr = CoreNotesManager()
mgr.add_core("User prefers dark mode", "preferences")
mgr.get_items_by_category("identity")
mgr.get_all_items() # {category: [items]}
mgr.remove_core("dark mode", "preferences")
mgr.is_protected("User prefers dark mode") # True if in core
Protected categories: identity, projects, relationships, system.
Full API: references/notes-core.md
Sectioned notes in memory/notes.md. Per-agent isolation via notes.{id}.md.
from qq.memory.notes import get_notes_manager
mgr = get_notes_manager("./memory")
mgr.add_item("Key Topics", "QQ memory architecture")
mgr.get_section_items("Key Topics")
mgr.remove_item("Key Topics", "QQ memory")
mgr.apply_diff(
additions=[{"section": "Important Facts", "item": "New fact"}],
removals=["Old fact"]
)
Sections: Key Topics, Important Facts, People & Entities, Ongoing Threads, File Knowledge.
Full API: references/notes-working.md
Store notes with embeddings. Query by semantic similarity. Importance scoring with time-based decay, deduplication, and archival.
from qq.memory.mongo_store import MongoNotesStore
from qq.embeddings import EmbeddingClient
embeddings = EmbeddingClient()
store = MongoNotesStore()
# Store
embedding = embeddings.get_embedding("QQ uses MongoDB for notes")
store.upsert_note("note_abc", "QQ uses MongoDB for notes", embedding, "Key Topics", importance=0.7)
# Search
query_emb = embeddings.get_embedding("what database does QQ use?")
results = store.search_similar(query_emb, limit=5)
# Reinforce
store.increment_access("note_abc")
store.append_source_history("note_abc", {"source_type": "conversation"}, boost_importance=0.1)
# Maintenance
store.get_stale_notes(days_threshold=30)
store.get_by_importance_range(min_importance=0.0, max_importance=0.1)
Full API + schema + dedup + archive: references/mongo-rag.md
Entities as labeled nodes, relationships as edges. Embedding-based semantic search. Source provenance tracking.
from qq.knowledge.neo4j_client import Neo4jClient
from qq.embeddings import EmbeddingClient
embeddings = EmbeddingClient()
client = Neo4jClient()
# Create entities
emb = embeddings.get_embedding("John, software engineer")
client.create_entity("Person", "John", {"description": "Software engineer"}, emb)
# Create relationships
client.create_relationship("John", "Anthropic", "WORKS_AT", {"role": "Engineer"})
# Query
client.get_entity("John")
client.get_related_entities("John", depth=2, limit=20)
client.search_entities_by_embedding(query_emb, entity_type="Person", limit=10)
# Reinforce
client.increment_mention_count("John")
# Raw Cypher
client.execute("MATCH (n:Person) RETURN n.name, n.description LIMIT 10")
client.get_graph_summary()
Full API + Cypher examples + merge spec: references/neo4j-graph.md
Read a file, LLM-extract notes/entities/relationships, store in all memory layers.
from qq.services.analyzer import FileAnalyzer
analyzer = FileAnalyzer(file_manager)
analyzer.analyze("src/app.py", focus="error handling")
analyzer.analyze_pattern(r"\.py$", "src/", focus="API endpoints")
Supports: text, PDF, DOCX, XLSX, PPTX. Chunks large files automatically. Detects re-analysis via checksum.
Full API: references/analyze-files.md
Each backend is independently optional. The system degrades gracefully:
| Service Down | Effect |
|-------------|--------|
| MongoDB | Notes in notes.md only (no vector search) |
| Neo4j | No knowledge graph (entities/relationships skipped) |
| TEI | No embeddings (notes stored, no similarity search) |
| LLM | No extraction/summarization (manual notes only) |
python scripts/check_services.py # status of all
python scripts/start_services.py # start all
python scripts/start_services.py mongodb neo4j # start subset
python scripts/start_services.py --stop # stop all
python scripts/start_services.py --stop tei # stop subset
Use assets/docker-compose.yml for standalone deployment of memory backends.
from qq.memory.core_notes import CoreNotesManager
from qq.memory.mongo_store import MongoNotesStore
from qq.embeddings import EmbeddingClient
# Store in core (protected)
core = CoreNotesManager()
core.add_core("User's name is Alice", "identity")
# Store in MongoDB (searchable)
emb_client = EmbeddingClient()
store = MongoNotesStore()
embedding = emb_client.get_embedding("User's name is Alice")
store.upsert_note("note_name", "User's name is Alice", embedding, "People & Entities", importance=0.9)
# Analyze
analyzer.analyze("README.md", focus="project overview")
# Query what was learned
results = store.search_similar(emb_client.get_embedding("project overview"), limit=5)
entities = client.search_entities_by_embedding(emb_client.get_embedding("project"), limit=5)
# Find duplicates via Cypher
dupes = client.execute("""
MATCH (a:Person), (b:Person)
WHERE a.name < b.name AND a.canonical_name = b.canonical_name
RETURN a.name, b.name
""")
# Manual merge (move relationships, combine properties, delete secondary)
# See references/neo4j-graph.md for merge_entities procedure
from qq.memory.importance import ImportanceScorer
from qq.memory.archive import ArchiveManager
from qq.memory.deduplication import NoteDeduplicator
scorer = ImportanceScorer()
archive = ArchiveManager("./memory")
dedup = NoteDeduplicator(store, emb_client)
# Decay importance over time
notes = store.get_recent_notes(limit=100)
# ... apply scorer.decay_importance() and store.update_importance()
# Archive low-importance notes
archive.archive_low_importance(threshold=0.05)
# Deduplicate
dedup.run_consolidation_pass(archive)
See references/architecture.md for memory flow diagrams and design decisions.
testing
Run TTS round-trip tests — pure-logic unit tests and optional integration tests against live TTS/STT services.
development
Speak text aloud using the Magpie TTS container in the realtime-api Docker stack. Zero external dependencies — just curl + aplay.
development
Build and deploy the realtime-api Docker container with full verification that deployed code matches local source.
tools
Enhanced coding assistance