feat(roo): add Patrick-persona custom modes, skills, and mode-specific rules
Add 4 new custom modes with BigMind guidance: - rules-bigmind/: Introspective Patrick mode (BigMind development) - rules-homelab/: Tinkerer Patrick mode (TrueNAS, Docker, infra) - rules-mcp-builder/: Craftsman Patrick mode (pi_mcps MCP servers) - rules-paisy/: Professional Patrick mode (ADP Germany payroll) Add reusable skills: - skills/assessment-first/: structured assessment.md before implementation - skills/bigmind-session-ritual/: mandatory session start/end ritual - skills/gitea-push/: conventional commit + Gitea push workflow - skills/new-mcp-server/: FastMCP scaffold procedure - skills-bigmind/, skills-homelab/, skills-mcp-builder/, skills-paisy/: mode-specific skill dirs Update existing rules: - rules-architect, rules-ask, rules-code, rules-debug, rules-orchestrator: add BigMind session guidance (search before task, announce focus, hypotheses) Add plans/MODES_AND_SKILLS_PLAN.md: full architecture document
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
---
|
||||
name: bigmind-health
|
||||
description: Runs a BigMind health check, closes stale sessions, vacuums old data, and reports system status. Use this skill at the start of a BigMind development session or when the system feels sluggish or has orphaned sessions.
|
||||
---
|
||||
|
||||
# BigMind Health Check
|
||||
|
||||
## When to use
|
||||
- Start of a BigMind development session
|
||||
- Sessions appear orphaned or counts look wrong
|
||||
- DB feels slow or bloated
|
||||
- Monthly maintenance
|
||||
|
||||
## When NOT to use
|
||||
- Normal work sessions (health check is optional unless something seems wrong)
|
||||
|
||||
## Workflow
|
||||
|
||||
### Step 1 — Get system stats
|
||||
```
|
||||
memory_get_stats()
|
||||
```
|
||||
Check: session count, fact count, chunk count, DB size. Flag anything that looks anomalous.
|
||||
|
||||
### Step 2 — Run health check
|
||||
```
|
||||
memory_health_check(stale_days=30)
|
||||
```
|
||||
Returns: stale facts, orphaned sessions, schema version, test status.
|
||||
|
||||
### Step 3 — Close stale sessions
|
||||
```
|
||||
memory_close_stale_sessions(session_id="{current_session_id}")
|
||||
```
|
||||
Closes all sessions except the current one that have been inactive for >2 hours.
|
||||
|
||||
### Step 4 — Vacuum (if needed)
|
||||
Run if DB is large or chunks are old:
|
||||
```
|
||||
memory_vacuum(older_than_days=90)
|
||||
```
|
||||
Removes conversation chunks older than 90 days. Facts and session summaries are preserved.
|
||||
|
||||
### Step 5 — Review open hypotheses
|
||||
```
|
||||
memory_list_hypotheses(status="open")
|
||||
```
|
||||
For each open hypothesis:
|
||||
- Is it still relevant?
|
||||
- Can it be resolved now?
|
||||
- Is confidence still accurate?
|
||||
|
||||
Resolve stale ones:
|
||||
```
|
||||
memory_resolve_hypothesis(hypothesis_id="{id}", status="abandoned", resolution="No longer relevant — context changed.")
|
||||
```
|
||||
|
||||
### Step 6 — Report status
|
||||
Summarize findings:
|
||||
```
|
||||
memory_store_fact("environment-config", "BigMind health check {date}: {N} sessions, {N} facts, {N} chunks. Schema v{N}. All OK / Issues found: [list].")
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
- **DB locked:** Another IDE has BigMind open. Check `memory_get_active_sessions()` first
|
||||
- **Vacuum fails:** WAL checkpoint may be pending — try `PRAGMA wal_checkpoint(TRUNCATE)` via direct SQLite if needed
|
||||
- **Health check shows schema mismatch:** Run migrations manually via BigMind restart
|
||||
@@ -0,0 +1,105 @@
|
||||
---
|
||||
name: bigmind-migration
|
||||
description: Scaffolds a new BigMind database schema migration (v_n to v_{n+1}), including the migration function, SCHEMA_VERSION bump, and test stubs. Use this skill when adding new tables or columns to the BigMind SQLite database.
|
||||
---
|
||||
|
||||
# BigMind Migration
|
||||
|
||||
## When to use
|
||||
- Adding a new table to BigMind
|
||||
- Adding columns to an existing table
|
||||
- Creating a new FTS5 virtual table
|
||||
|
||||
## When NOT to use
|
||||
- Non-schema changes (just code, no DB structure changes)
|
||||
- Dropping or renaming columns (requires extra deprecation care — discuss first)
|
||||
|
||||
## Inputs required
|
||||
- **Current schema version** — check `SCHEMA_VERSION` in `db.py`
|
||||
- **New version** — `current + 1`
|
||||
- **Changes** — what tables/columns are being added
|
||||
|
||||
## Workflow
|
||||
|
||||
### Step 1 — Read current schema
|
||||
```bash
|
||||
grep -n "SCHEMA_VERSION" ~/.mcp/bigmind/bigmind/db.py
|
||||
grep -n "_migrate_v" ~/.mcp/bigmind/bigmind/db.py
|
||||
```
|
||||
Know what version you're migrating FROM.
|
||||
|
||||
### Step 2 — Write migration function in `db.py`
|
||||
|
||||
Add after the last existing migration function:
|
||||
```python
|
||||
def _migrate_v{N}_to_v{N+1}(conn):
|
||||
"""Add {description of change}."""
|
||||
cursor = conn.cursor()
|
||||
|
||||
# Example: new table
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS {table_name} (
|
||||
id TEXT PRIMARY KEY,
|
||||
user_id TEXT NOT NULL,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
-- other columns
|
||||
FOREIGN KEY (user_id) REFERENCES users(id)
|
||||
)
|
||||
""")
|
||||
|
||||
# Example: FTS5 virtual table
|
||||
cursor.execute("""
|
||||
CREATE VIRTUAL TABLE IF NOT EXISTS {table_name}_fts
|
||||
USING fts5(content, tokenize='porter')
|
||||
""")
|
||||
|
||||
conn.commit()
|
||||
```
|
||||
|
||||
### Step 3 — Wire into `init_db()`
|
||||
|
||||
In the migration chain inside `init_db()`:
|
||||
```python
|
||||
SCHEMA_VERSION = {N+1} # bump this
|
||||
|
||||
# In the migration section:
|
||||
if current_version < {N+1}:
|
||||
_migrate_v{N}_to_v{N+1}(conn)
|
||||
current_version = {N+1}
|
||||
```
|
||||
|
||||
### Step 4 — Write tests
|
||||
|
||||
In `tests/test_memory_store.py` (or a new test file):
|
||||
```python
|
||||
class TestMigration_v{N}_to_v{N+1}:
|
||||
def test_fresh_db_has_new_table(self, tmp_path):
|
||||
db_path = tmp_path / "test.db"
|
||||
conn = get_connection(str(db_path))
|
||||
init_db(conn)
|
||||
# Assert new table exists
|
||||
cursor = conn.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='{table_name}'")
|
||||
assert cursor.fetchone() is not None
|
||||
|
||||
def test_existing_db_migrates_cleanly(self, tmp_path):
|
||||
# Create a v{N} db, then run init_db() and check migration ran
|
||||
...
|
||||
```
|
||||
|
||||
### Step 5 — Run full test suite
|
||||
```bash
|
||||
cd ~/.mcp/bigmind
|
||||
uv run pytest tests/ -v
|
||||
```
|
||||
All tests must pass.
|
||||
|
||||
### Step 6 — Store migration fact
|
||||
```
|
||||
memory_store_fact("codebase", "BigMind schema migrated v{N}→v{N+1}: added {description}. Migration function: _migrate_v{N}_to_v{N+1}.")
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
- **`IF NOT EXISTS` is your friend:** Always use it so the migration is idempotent
|
||||
- **FTS5 table ordering:** Create the base table before the FTS5 virtual table that references it
|
||||
- **Migration not running:** Check the `if current_version < X:` guard — verify `current_version` is read correctly from `PRAGMA user_version`
|
||||
- **Test DB state:** Use `tmp_path` fixture for isolated test databases — never test against the real `memory.db`
|
||||
Reference in New Issue
Block a user