Initialize a memory bank for a new or existing project following the v6.12 protocol. Use when starting work on a project that lacks memory-bank documentation...
记忆
Mb Db Workflow
试用Record and read Memory Bank state via mb-cli. Use for projects with memory-bank/database/ and a memory_bank.db. Triggers on: db workflow, record session work...
它能做什么
Record and read Memory Bank state via mb-cli. Use for projects with memory-bank/database/ and a memory_bank.db. Triggers on: db workflow, record session work, regenerate memory bank, update tasks.
技能文档
Memory Bank DB-Native Workflow (v6.12)
Use the mb CLI to read and write project memory banks that use the SQLite backend. Do not hand-edit generated markdown files — they are overwritten on regeneration.
Prerequisites
mbCLI is installed and on PATH- Project has
memory-bank/database/(create withmb init --database) - SQLite database exists at
memory-bank/database/memory_bank.db(create withmb db init)
Quick Reference
Read state
# List tasks
mb task list
mb task list --status in_progress
# Show task details
mb task show T25
# Query DB directly (table output)
mb db query "SELECT * FROM task_items WHERE status = 'in_progress'"
# Query DB (JSON output)
mb db query "SELECT * FROM edit_entries ORDER BY timestamp DESC LIMIT 5" --json
# List sessions
mb session list
# Show session cache
mb session cache
Record work
# Record edit entry + file changes + optional status update
mb workflow --task T3 --description "Implemented feature X" \
--files "Created:src/feature.js,Modified:src/app.js" \
--status in_progress --period afternoon
# Same, but also regenerate all markdown files immediately
mb workflow --record --regenerate --task T3 \
--description "Implemented feature X" \
--files "Created:src/feature.js" --status completed
# Regenerate markdown without recording new work
mb workflow --regenerate
Task management
mb task create "Build quantum simulator" --id T26 --priority high
mb task update T26 --status in_progress
mb task delete T26 --yes
Session management
mb session start --focus T26 --period afternoon
mb session complete --notes "Finished core logic"
Sync templates
When mb-core template files change, update the project's DB files:
mb db sync --all # Sync everything
mb db sync --libs # Sync lib/ only (workflow.js, inserts.js, regenerate.js, sqlite.js)
mb db sync --parsers # Sync parser scripts only
mb db sync --dry-run # Preview what would change
Two-Layer Documentation
The DB workflow automates the chronological layer (edit entries, tasks, sessions). You must still maintain the knowledge layer manually:
implementation-details/— architecture, design decisionstechContext.md— system architecture, dependenciesproductContext.md— goals, user storiessystemPatterns.md— established patterns
Anti-pattern: "The DB workflow handled the update, so I'm done." It only writes the timeline. The knowledge layer requires manual attention.
File Change Syntax
--files uses comma-separated action:path pairs:
Created:src/index.jsModified:lib/util.jsUpdated:package.jsonDeleted:old-file.js
Example:
mb workflow --task T1 --description "Setup project" \
--files "Created:package.json,Modified:README.md,Deleted:legacy.py"
Workflow vs Update
mb workflow— Low-level: record work, optionally regenerate. Explicit flags for each action.mb update— High-level: combines record + regenerate in one shot. Simpler but less granular.
Use mb workflow when you need precise control. Use mb update for quick session wraps.
Anti-Patterns
- NEVER edit generated markdown directly (
edit_history.md,tasks.md,session_cache.md) — they are overwritten on regeneration - NEVER run DB workflow in projects without
memory-bank/database/schema.sql - NEVER skip knowledge-layer updates after recording chronological work
- NEVER pass
--fileswith spaces around the colon — useaction:pathexactly
Error Recovery
- No database found:
mb db initthenmb init --database - Missing lib files:
mb db sync --libs - Schema mismatch:
mb db sync --database-filesto refresh schema.sql
References
references/api-reference.md— Full JS library API (recordSessionWork, regenerateAll, etc.)references/schema.sql— Full SQLite schemareferences/integrated-rules-v6.12.md— Complete v6.12 protocol rules
相关技能
Memory Bank text-based update workflow following integrated-rules v6.12. Use when updating memory bank files manually via markdown editing — creating edit chunks, updating tasks.md, session_cache.md, session files, and task files. NOT for database-native workflows (use mb-db-workflow instead). Triggers on phrases like "update memory bank", "create edit chunk", "update tasks.md", "update session cache", "memory bank update workflow".
Global workflow for loading memory bank files based on recent activity and context Use when the user invokes $mem-load or asks for this workflow by name.
Memory Bank Template Compliance Cleaner Workflow Use when the user invokes $mem-format or asks for this workflow by name.
Memory Bank Update Workflow — v6.12 compliant with project-repo awareness. Use when the user invokes $mem-update or asks for this workflow by name.
Recall and store persistent memories in the user's brain (~/.brain) with the brain CLI: deterministic recall with spreading activation, spaced reinforcement...