phycool-mcp-discipline

Enforces schema validation and write discipline for 36 MCP tools writing to a SQLite memory database.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing to the PhyCool Context Memory SQLite database through MCP tools fails in six recurring ways: missing required fields, enum case violations, UTC versus UTC+8 timestamp drift, duplicate writes, UTF-8 BOM breaking JSON parsing, and SQLITE_BUSY errors from concurrent writes. This Skill provides the tool catalog, schema cheat-sheet, and mandatory call discipline to prevent all six failure modes. ## Core Features & Use Cases - 36-Tool Catalog with Required Fields: Complete reference of every phycool-context MCP tool (Add, Upsert, Search, Get, Workflow, Instinct, Worker Protocol, Ctrl-Channel) with required fields, enums, and CAS semantics. - 30+ Table Schema Cheat-Sheet: Column-level documentation for stories, intentional_decisions, tech_debt_items, worker_runs, ctrl_threads, and more, including hot-row conflict markers. - Six Root-Cause Error Patterns with Fixes: Concrete wrong/right examples for each failure mode, plus the Invoke-PhycoolMcpSafe PowerShell helper that bundles validation, UTF-8 No-BOM encoding, UTC+8 timestamps, and SQLITE_BUSY retry with exponential backoff. - Use Case: Before calling add_intentional_decision from a PowerShell pipeline, check the catalog to confirm sub_type is required, route the call through Invoke-PhycoolMcpSafe, and run a search-first dedup check to avoid polluting the database. ## Quick Start Ask the AI to write a new context entry to the memory database using the MCP discipline rules, verifying required fields and using search-first dedup before the add_context call.

Frequently Asked Questions about phycool-mcp-discipline

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

FAQPage Schema
How do I avoid SQLITE_BUSY errors with concurrent SQLite writes?

Route all writes through Invoke-PhycoolMcpSafe, which retries SQLITE_BUSY three times with exponential backoff of 200, 400, and 600 milliseconds. The database also runs in WAL mode with busy_timeout set to 5000ms, allowing concurrent reads and writes across workers.

What are the required fields for add_intentional_decision MCP tool?

add_intentional_decision requires idd_type, sub_type, story_id, decision, and rationale. The idd_type must be one of IDD-COM, IDD-STR, IDD-REG, or IDD-USR, and sub_type must be lowercase such as communication or strategic. Omitting sub_type throws a missing required field error.

Why does PowerShell Set-Content break JSON parsing in Node.js?

PowerShell 5.1 Set-Content with -Encoding UTF8 writes a BOM (EF BB BF) as the first bytes, which causes Node.js JSON.parse to throw an unexpected character error. Use the Write-JsonFile helper instead, which writes UTF-8 without BOM.

How do I prevent duplicate entries when writing to a memory database?

Use the search-first pattern: call search_context with the title and category before writing, and only call add_context if no matching entry exists. This prevents duplicate rows that crowd out relevant results in later searches.

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

No, direct sqlite3 CLI writes are forbidden because they bypass MCP schema validation, allowing enum case errors, missing required fields, and foreign key violations to pass silently. Always use the MCP tools or the provided CLI scripts like upsert-story.js.

Why does my MCP server not reflect code fixes after editing scripts?

Node.js module cache is process-level, so a long-running MCP server never hot-reloads modified modules it imported. Verify fixes through a fresh process such as vitest, a CLI script, or a new session, or restart the server first.