phycool-context-memory

Query and maintain a SQLite FTS5 context memory database via 36 MCP tools.

10|3|Updated Mar 7, 2026
One-click install
npx skills add https://github.com/Cynthia1070711/PHYCOOL_Tools --skill phycool-context-memory-cynthia1070711
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: phycool-context-memory
Source: https://github.com/Cynthia1070711/PHYCOOL_Tools/tree/main/config-templates/claude/skills/phycool-context-memory
Command: npx skills add https://github.com/Cynthia1070711/PHYCOOL_Tools --skill phycool-context-memory-cynthia1070711

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires better-sqlite3, @huggingface/transformers, and includes references (resource) components.

What problem does it solve? AI coding agents lose context between sessions and repeatedly guess database column names, causing silent query failures and corrupted memory records. This Skill defines the complete standard for the PhyCool Context Memory DB (SQLite + FTS5 + MCP server) so agents can reliably store, search, and verify long-term project memory across conversations. ## Core Features & Use Cases - Schema-First Query Discipline: Enforces PRAGMA verification or a schema cheatsheet lookup before any SQL references column names, preventing silent failures like assuming created_at exists on context_entries. - 36 MCP Tools for Memory Operations: Search context entries, stories, tech debt, intentional decisions, conversations, documents, and god nodes; write via add_context, add_tech, log_workflow, plus worker-protocol and ctrl-channel CAS tools. - Hook Triple-Write & 5-Layer Memory: Stop/SessionEnd/PreCompact hooks guarantee session persistence, with layered memory (session/decision/tech/debt/IDD) and CMI-10 hybrid fusion search (ONNX vector + FTS5 + LIKE fallback). - Use Case: Before writing a query against intentional_decisions, an agent reads the Speed Lookup Cheatsheet, confirms the PK is idd_id (TEXT, not id), then runs search_intentional_decisions to retrieve forbidden_changes for a code review. ## Quick Start Ask the agent to search the context memory database for past decisions about a topic, for example by invoking the search_context MCP tool with a query and category filter.

Frequently Asked Questions about phycool-context-memory

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I search the context memory database with MCP tools?

Use search_context for general memory entries, search_stories for story records, search_debt for tech debt, and search_intentional_decisions for IDD entries. Each supports filters like category, story_id, status, or severity, and results come from FTS5 trigram indexes.

Why does my SQL query against the memory database fail silently?

Column name assumptions are the most common cause: context_entries uses `timestamp` not `created_at`, intentional_decisions uses TEXT PK `idd_id` not `id`, and embedding_queue uses `processed` INTEGER not `status`. Always run PRAGMA table_info or read the db-schema.md cheatsheet first.

How does hybrid search work in the context memory system?

CMI-10 hybrid fusion combines ONNX 384D vector cosine similarity (weight 0.6), dependency graph score (0.2), FTS5 BM25 (0.2), and centrality (0.05). If the ONNX model fails to load, it degrades to FTS5-only, then to LIKE matching, so search never fully breaks.

Why does FTS5 search return empty results for short queries?

The trigram tokenizer requires at least 3 characters per term. Queries of 1-2 characters fall back to LIKE matching in some tools, but single-character queries can silently return zero rows in others. Use longer terms or an empty query with a category filter.

Can I write to the memory database directly with sqlite3 CLI?

No, direct sqlite3 CLI writes are forbidden because they bypass MCP schema validation. Use the MCP add_* tools or the upsert-*.js scripts, which enforce prepared statements, UTC+8 timestamps, and search-first deduplication before inserting.

What timestamp format should I use when writing memory records?

All timestamps must be UTC+8, never JavaScript's new Date().toISOString() which produces UTC and shifts times by 8 hours. Use the nowTs() helper in Node.js or datetime('now', '+8 hours') in SQLite.