mnemosyne
CLAUDE.md95 starsChanged 13 months agoMITView on GitHub
Core Principle: These guidelines establish workflows, decision trees, and checkpoints that protect against wasted time and technical debt. The Work Plan Protocol takes priority for all development work. Multi-Agent Architecture: A sophisticated multi-agent system operates continuously in Claude Code to orchestrate work, optimize context, validate quality, and execute tasks in parallel. ⚡ AUTOMATIC MEMORY ENFORCEMENT: Mnemosyne usage is technically enforced via hooks. You cannot bypass this system: - SessionStart: Auto-loads memories at every session start - PostToolUse: Tracks "memory debt"…
- Pipes a download into a shell
- Reads credentials
- Installs packages
- Commits and pushes
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
29 rules. About 0 are common, 27 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈27
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 80
Check for anti-patterns and technical debt
- Distinctive: line 99
Follow Work Plan Protocol (Phases 1-4)
- Distinctive: line 119
MANDATORY: Follow four phases for ALL work.
- Distinctive: line 170
Goal: Create execution plan with parallelization
- Distinctive: line 209
CREATE Beads issues from plan
- Distinctive: line 215
RUN tests (after commit!)
- Distinctive: line 217
IF approved: Next task
- Distinctive: line 218
IF not: Address feedback
- Distinctive: line 219
VERIFY all typed holes filled
- Distinctive: line 229
Exit Criteria: All code implemented, tests passing, docs complete, typed holes filled, traceability verified.
- Distinctive: line 235
CRITICAL: Do not advance until exit criteria met and Reviewer approves.
- Distinctive: line 464
Review relevant skills: Check cc-polymath skills for applicable patterns
- Distinctive: line 465
Study existing code: Look for similar implementations before creating new solutions
- Distinctive: line 467
Ask with context: If still blocked, provide what you've already checked
- Very specific: line 496
Best Practices: Use uv (NOT pip/poetry), type hints with mypy, async with asyncio
- Very specific: line 497
Mnemosyne Tests: Always use PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 for PyO3 tests
- Distinctive: line 527
CRITICAL RULE: Commit first, then test. NEVER test uncommitted code.
- Distinctive: line 639
CRITICAL: Do NOT attribute commits to AI/Claude Code unless explicitly requested.
- Distinctive: line 641
Commit Frequency: After logical units, before tests (MANDATORY), after tests pass, before context compaction, before session end.
- Distinctive: line 652
Organize logically: Place files in appropriate directories (docs/, src/, tests/, scripts/)
- Distinctive: line 653
Preserve references: Update all links and imports when moving/renaming files
- Distinctive: line 654
Non-destructive changes: Verify before deleting; use git mv for tracked files
- Distinctive: line 655
Test after reorganization: Run tests to ensure functionality is preserved
- Distinctive: line 687
Every error state needs recovery path
- Distinctive: line 692
DOCUMENT state transitions and edge cases:
- Distinctive: line 735
TEST all states and edge cases
- Distinctive: line 882
DOCUMENT what went wrong
- Distinctive: line 1049
Before completing ANY task:
- Distinctive: line 1085
Stop hook automatically validates memory usage
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Claude Development Guidelines
Core Principle: These guidelines establish workflows, decision trees, and checkpoints that protect against wasted time and technical debt. The Work Plan Protocol takes priority for all development work.
Multi-Agent Architecture: A sophisticated multi-agent system operates continuously in Claude Code to orchestrate work, optimize context, validate quality, and execute tasks in parallel.
⚡ AUTOMATIC MEMORY ENFORCEMENT: Mnemosyne usage is technically enforced via hooks. You cannot bypass this system:
- SessionStart: Auto-loads memories at every session start
- PostToolUse: Tracks "memory debt" after Edit/Write/Commit
- PreToolUse: BLOCKS git push and PR creation if debt > 0
- Stop: Validates memory usage before finishing responses
Memory debt system: Every Edit, Write, or Commit increments debt. After 3 events, you'll be prompted.
git pushis blocked until memories are stored. This is not optional.
Table of Contents
- Multi-Agent Orchestration System
- Work Plan Protocol START HERE
- Agentic Workflow (Beads)
- Critical Thinking & Pushback
- Language Stack & Tooling
- Testing & Validation
- Version Control & Git
- Experience Design + Development
- Skills System
- Anti-Patterns
- Quick Reference
1. Multi-Agent Orchestration System
Four primary agents operate continuously in every Claude Code session:
Agent 1: Orchestrator
Role: Central coordinator and state manager
Responsibilities:
- Coordinate handoffs between agents with zero-copy data passing
- Monitor execution state across parallel workstreams
- Prevent race conditions and deadlocks through dependency-aware scheduling
- Preserve context before compaction (75% threshold →
.claude/context-snapshots/) - Maintain global work graph and schedule parallel work
Context Preservation: Trigger pre-emptive snapshots at 75% utilization, compress non-critical data, checkpoint before phase transitions.
Deadlock Prevention: Maintain dependency graph, detect circular dependencies, implement timeout monitoring, use priority-based preemption.
Agent 2: Optimizer
Role: Context and resource optimization specialist
Responsibilities:
- Construct optimal context payloads for each agent
- Apply ACE principles: incremental updates, structured accumulation, strategy preservation
- Monitor all context sources: agents, files, commits, plans, beads, skills, session
- Prevent brevity bias and context collapse
- Dynamically discover and load relevant skills from filesystem
Skills Discovery:
Task → Analyze keywords/domains
→ Scan skills/ directory
→ Score relevance (0-100)
→ Load top 3-7 skills
→ Cache for session
→ Refine as needs evolveContext Budget Allocation: Critical (40%), Skills (30%), Project (20%), General (10%)
Agent 3: Reviewer
Role: Quality assurance and validation specialist
Responsibilities:
- Validate intent satisfaction, documentation, test coverage
- Fact-check claims, references, external dependencies
- Check for anti-patterns and technical debt
- Block work until quality standards met
- Mark "COMPLETE" only when all gates pass
Quality Gates (all must pass):
- Intent satisfied
- Tests written and passing
- Documentation complete
- No anti-patterns
- Facts/references verified
- Constraints maintained
- No TODO/mock/stub comments
Agent 4: Executor
Role: Primary work agent and sub-agent manager
Responsibilities:
- Follow Work Plan Protocol (Phases 1-4)
- Execute atomic tasks from plans
- Spawn sub-agents for safe parallel work
- Apply loaded skills
- Challenge vague requirements
- Implement code, tests, documentation
- Commit at checkpoints
Sub-Agent Spawning (all must pass):
- Task truly independent
- Context budget allows
- No circular dependencies
- Clear success criteria
- Handoff protocol established
- Rollback strategy exists
2. Work Plan Protocol
MANDATORY: Follow four phases for ALL work. Do not skip phases.
Phase 1: Prompt → Spec
Goal: Transform request into clear specification
Process:
- READ user request
- DISCOVER relevant skills (Optimizer scans skills/)
- LOAD discovered skills
- IDENTIFY ambiguities
- ASK clarifying questions
- CONFIRM tech stack, deployment, constraints
- WRITE spec.md
- SUBMIT to Reviewer
Exit Criteria: Intent clear, ambiguities resolved, tech stack confirmed, skills loaded, spec reviewed.
Phase 2: Spec → Full Spec
Goal: Decompose into components with dependencies and test plan
Process:
- DECOMPOSE into components
- IDENTIFY dependencies
- DEFINE typed holes (interfaces/contracts)
- SPECIFY constraints and invariants
- CREATE test-plan.md
- DOCUMENT edge cases
- SUBMIT to Reviewer
Test Plan (create test-plan.md):
## Test Types
- [ ] Unit tests for [components]
- [ ] Integration tests for [boundaries]
- [ ] E2E tests for [workflows]
- [ ] Property tests for [invariants]
## Coverage Targets
- Critical path: 90%+
- Business logic: 80%+
- UI layer: 60%+
- Overall: 70%+Exit Criteria: Decomposed, dependencies mapped, typed holes defined, test plan created, reviewed.
Phase 3: Full Spec → Plan
Goal: Create execution plan with parallelization
Process:
- ORDER tasks by dependencies
- IDENTIFY parallelization opportunities
- COMPUTE critical path
- PLAN checkpoints
- CREATE plan.md
- SUBMIT to Reviewer
Execution Plan (create plan.md):
## Critical Path
1. [Highest priority task]
2. [Next critical task]
## Parallel Streams
### Stream A
- [ ] Task A1
- [ ] Task A2
### Stream B
- [ ] Task B1
## Dependencies
- Task X depends on Task Y
## Integration Points (Typed Holes)
- Interface X: Component A ↔ BExit Criteria: Tasks ordered, parallelization identified, critical path computed, reviewed.
Phase 4: Plan → Artifacts
Goal: Execute plan, create code/tests/docs
Process:
- CREATE Beads issues from plan
- For each task:
- IMPLEMENT code
- WRITE tests
- DOCUMENT APIs
- COMMIT changes
- RUN tests (after commit!)
- SUBMIT to Reviewer
- IF approved: Next task
- IF not: Address feedback
- VERIFY all typed holes filled
- CONFIRM all tests passing
Traceability (maintain traceability.md):
| Requirement | Spec | Implementation | Tests | Status |
|-------------|------|----------------|-------|--------|
| REQ-001 | spec.md#auth | auth.py | test_auth.py | ✓ |Exit Criteria: All code implemented, tests passing, docs complete, typed holes filled, traceability verified.
Phase Transitions
CRITICAL: Do not advance until exit criteria met and Reviewer approves.
Phase N complete? → Proceed to N+1
Phase N incomplete? → STOP, address gaps
Fundamental issues? → Roll back to earlier phase3. Agentic Workflow (Beads)
Tool: Beads (https://github.com/steveyegge/beads) - AI-native task tracking
Installation
NPM (Node.js environments):
npm install -g @beads/bdQuick Install (All Platforms):
curl -fsSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bashHomebrew (macOS/Linux):
brew tap steveyegge/beads
brew install bdGo Install (Alternative):
go install github.com/steveyegge/beads/cmd/bd@latestInitial Setup
One-time initialization:
# Basic setup (creates .beads/, imports issues, installs git hooks, starts auto-sync)
bd init
# For open-source contributors (fork workflow)
bd init --contributor
# For team members (branch workflow)
bd init --team
# For protected branches (GitHub/GitLab)
bd init --branch beads-metadata
# Non-interactive for agents
bd init --quietWorkflow
Session Start (optional - auto-sync handles this):
bd doctor # Validate installation
bd ready --json --limit 5 # Get ready tasksTask Discovery:
bd ready --json --limit 5 # Unblocked tasks
bd list --status open --json # All open issues
bd list --type bug --priority 0 --json # Critical bugs
bd list --assignee alice --json # User's tasks
bd list --label backend,urgent --json # AND label filter
bd list --label-any frontend,backend --json # OR label filter
bd list --no-assignee --json # Unassigned
bd list --created-after 2024-01-01 --json # Date filters
bd show bd-a1b2 # Full detailsTask Creation:
# Basic creation (auto-syncs to git)
bd create "Implement rate limiting" -t feature -p 1 --json
bd create "Fix auth bug" -t bug -p 0 -a alice --json
bd create "Security review" -l security,urgent --json
# From templates
bd create --from-template epic "Q4 Platform Improvements"
bd create --from-template bug "Token validation fails"
bd create --from-template feature "Add OAuth support"
# From markdown file
bd create -f feature-plan.md --json
# Hierarchical children (dot notation for structured work)
bd create "Auth System" -t epic --id bd-a3f8 # Parent epic
bd create "Design login UI" -t task --id bd-a3f8.1 # Child task
bd create "Backend validation" -t task --id bd-a3f8.2 # Child taskTask Execution:
bd update bd-a1b2 --status in_progress --json
bd update bd-a1b2 --priority 0 --json
bd update bd-a1b2 --assignee alice --json
bd update bd-a1b2 --comment "Implemented auth layer" --jsonDependency Management:
# Link dependencies (types: blocks, related, parent-child, discovered-from)
bd dep add bd-a1b2 bd-c3d4 --type blocks
bd dep add bd-new bd-parent --type discovered-from
bd dep tree bd-a1b2 # Visualize dependencies
bd ready --json # Auto-filters blocked tasksTask Completion:
bd close bd-a1b2 --reason "Complete" --json # After Reviewer approval
bd close bd-a1b2 --reason "Duplicate" --json
bd close bd-a1b2 --reason "Wontfix" --jsonGit Synchronization (automatic with 5-second debounce):
# Auto-sync on changes (default behavior)
bd create "Issue" # Auto-exports to .beads/issues.jsonl
git add .beads/issues.jsonl
git commit -m "Working on issue"
git push
# Pull and auto-import
git pull # Auto-imports on next bd command
bd ready --json # Fresh data from git
# Manual sync (rarely needed)
bd sync # Force immediate sync
# Skip auto-sync (advanced)
bd --no-auto-flush create "Issue" # Skip auto-export
bd --no-auto-import list --json # Skip auto-import checkHash-Based Issue IDs
Version 0.20.1+ uses collision-resistant hash IDs:
- Old format: bd-1, bd-2, bd-152 (sequential)
- New format: bd-a1b2, bd-f14c, bd-3e7a (4-6 character hashes)
Progressive scaling:
- 0-500 issues: 4-character hashes
- 500-1,500 issues: 5-character hashes
- 1,500-10,000 issues: 6-character hashes
Migration:
bd migrate --dry-run # Preview migration
bd migrate --inspect --json # Inspect plan (for agents)
bd migrate # Execute migrationTemplates
bd template list # Available templates
bd help template # Template managementAdvanced Features
Health & Diagnostics:
bd doctor # Validate installation and database
bd info # Database path, daemon status
bd info --json # JSON output
bd info --schema # Schema versionAgent Workflow:
# Find ready work
bd ready --json | jq '.[0]'
# Create discovered issues
bd create "Discovered bug" -t bug -p 0 --json
# Link back to parent
bd dep add <new-id> <parent-id> --type discovered-from
# Update work status
bd update <issue-id> --status in_progress --json
# Complete work
bd close <issue-id> --reason "Implemented" --json4. Critical Thinking & Pushback
When to Challenge
ALWAYS challenge:
- Vague requirements
- Unspecified tech stack
- Missing deployment details
- Unclear success criteria
- Requests to skip testing
- Pressure to skip phases
Red Flags:
🚩 "Quickly add..." → Scope vague
🚩 "Just make it work..." → Requirements unclear
🚩 "Don't worry about tests..." → Tech debt
🚩 "Use whatever..." → Stack undecided
🚩 "Skip the planning..." → Recipe for reworkGood Pushback:
"Before implementing, let's clarify [specific detail] to avoid
[specific risk]. This will prevent [specific bad outcome]."Troubleshooting Protocol
When encountering challenges in mnemosyne development:
- Check docs/ first:
docs/specs/,docs/features/,docs/guides/,docs/INDEX.md - Review relevant skills: Check cc-polymath skills for applicable patterns
- Study existing code: Look for similar implementations before creating new solutions
- Consult architecture: Understanding system design prevents anti-patterns
- Ask with context: If still blocked, provide what you've already checked
5. Language Stack & Tooling
Mnemosyne Build & Installation
# Fast rebuild (recommended for development - ~1-3s incremental)
./scripts/rebuild-and-update-install.sh
# Production build (full optimizations)
./scripts/rebuild-and-update-install.sh --full-release
# First-time setup (full installation)
./scripts/build-and-install.sh
# CRITICAL: Do NOT use cargo build/install directly
# The scripts ensure proper installation to ~/.local/bin/mnemosyne
# with macOS code signing and correct permissionsPython
uv init # Initialize
uv add package # Add dependency
uv run script.py # Run
uv run pytest # TestBest Practices: Use uv (NOT pip/poetry), type hints with mypy, async with asyncio
Mnemosyne Tests: Always use PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 for PyO3 tests
Zig
zig init && zig build && zig build testBest Practices: Explicit allocators, comptime for metaprogramming, error unions
Rust
cargo new && cargo add anyhow tokio && cargo build && cargo testBest Practices: Result<T, E> for errors, leverage type system, async/await with tokio
Go
go mod init && go get package && go build && go test ./...Best Practices: Simple idiomatic Go, interface-based design, table-driven tests
TypeScript
pnpm create vite@latest && pnpm install && pnpm dev && pnpm buildBest Practices: Strict TypeScript, Vite for tooling, React 18+ hooks, TanStack Query
6. Testing & Validation
CRITICAL RULE: Commit first, then test. NEVER test uncommitted code.
Testing Protocol
# 1. Commit
git add . && git commit -m "Message" && git log -1 --oneline
# 2. Kill running tests
pkill -f "test"
# 3. Run tests in background
./run_tests.sh > /tmp/test_$(date +%Y%m%d_%H%M%S).log 2>&1 & wait
# 4. Check results
tail -f /tmp/test_output.log
# If fail: Fix → Commit → Re-testTest Types
- Unit: Individual functions/methods
- Integration: Module boundaries
- E2E: Complete workflows
- Property: Invariants across inputs
- Performance: Efficiency requirements
Coverage Targets
- Critical path: 90%+
- Business logic: 80%+
- UI layer: 60%+
- Overall: 70%+
API Key Access
Anthropic API Key Configuration (required for DSPy integration tests):
The system checks for API keys in this priority order:
- Environment variable:
ANTHROPIC_API_KEY - Age-encrypted config:
~/.config/mnemosyne/secrets.age(or macOS Application Support) - OS Keychain:
mnemosyne.anthropic_api_key
Check Configuration Status:
# Verify secrets system status
mnemosyne secrets info
# Show API key configuration
mnemosyne config show-keySet API Key (choose one method):
# Method 1: Environment variable (temporary, session-only)
export ANTHROPIC_API_KEY="sk-ant-..."
# Method 2: Secure encrypted storage (recommended, persistent)
mnemosyne secrets init # Interactive setup, creates encrypted config
# OR
mnemosyne config set-key # Stores in OS keychain
# Method 3: Non-interactive setup
mnemosyne config set-key "sk-ant-..." # Pass key as argumentGet API Key: https://console.anthropic.com/settings/keys
Before Running DSPy Tests:
# 1. Verify API key is accessible
mnemosyne config show-key
# 2. If not configured, set via environment or secrets
export ANTHROPIC_API_KEY="sk-ant-..."
# 3. Run tests with Python 3.14 compatibility
PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 cargo test --features pythonTesting with API Calls:
# Python DSPy module tests (use uv)
cd src/orchestration/dspy_modules
PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 uv run pytest test_*.py -v
# Rust adapter integration tests (marked #[ignore], require API key)
PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 cargo test --features python -- --ignoredReference: See SECRETS_MANAGEMENT.md for detailed documentation on the secrets system.
7. Version Control & Git
Branching
# ALWAYS use feature branches (NEVER commit to main directly)
git checkout -b feature/name
git checkout -b fix/bugCommits
# Good
git commit -m "Add user authentication with JWT"
git commit -m "Fix race condition in cache"
# Bad
git commit -m "changes"
git commit -m "wip"CRITICAL: Do NOT attribute commits to AI/Claude Code unless explicitly requested. Commit messages should describe the work, not the tool.
Commit Frequency: After logical units, before tests (MANDATORY), after tests pass, before context compaction, before session end.
Pull Requests
git push -u origin feature/name
gh pr create --title "Title" --body "Description"Repository Organization
Keep the mnemosyne repository tidy and well-organized:
- Organize logically: Place files in appropriate directories (docs/, src/, tests/, scripts/)
- Preserve references: Update all links and imports when moving/renaming files
- Non-destructive changes: Verify before deleting; use git mv for tracked files
- Test after reorganization: Run tests to ensure functionality is preserved
- Update documentation: Reflect structural changes in docs/INDEX.md and README
For detailed repository organization guidelines, see:
- AGENT_GUIDE.md: Repository Organization
- AGENT_GUIDE.md: Documentation Management
- AGENT_GUIDE.md: Release Management
8. Experience Design + Development
Principle: Map experiences before implementing. Design flows, then build interfaces.
Experience Mapping
Purpose: Visualize complete user journeys, identify failure modes, eliminate friction.
Process:
- MAP states and flows using diagrams:
- Mermaid: State machines, flowcharts, sequence diagrams
- Graphviz: Complex state graphs, dependency trees
- Railroad diagrams: Command syntax, input validation flows
- ASCII diagrams: Quick sketches in docs/comments
- ITERATE until flow is clean and intuitive:
- Minimize clicks/steps to core actions
- Reduce branching and decision points
- Eliminate circular dependencies
- Simplify state transitions
- MINIMIZE failure states and dead ends:
- Every error state needs recovery path
- No "nowhere to go" screens
- Failed actions suggest alternatives
- Timeouts provide retry mechanisms
- DOCUMENT state transitions and edge cases:
- What triggers each transition?
- What can go wrong at each step?
- What's the recovery path?
- Where can users get stuck?
Example Flow Mapping:
stateDiagram-v2
[*] --> Unauthenticated
Unauthenticated --> Authenticating: Login attempt
Authenticating --> Authenticated: Success
Authenticating --> LoginError: Failure
LoginError --> Unauthenticated: Retry
LoginError --> PasswordReset: Forgot password
PasswordReset --> Unauthenticated: Reset complete
Authenticated --> [*]: LogoutState Design Checklist
Every experience must handle:
- Loading: Show progress, not blank screens
- Error: Clear message + recovery action
- Empty: Helpful guidance, not void
- Success: Confirmation + next action
- Partial: Handle incomplete data gracefully
Anti-patterns:
❌ Spinner without timeout → Infinite wait
❌ Error without action → Dead end
❌ Empty state without guidance → Confusion
❌ Success without next step → "Now what?"Implementation Priority
Order of operations:
- MAP experience flows (diagrams)
- IDENTIFY all states (loading, error, empty, success, partial)
- DESIGN state transitions and recovery paths
- IMPLEMENT using shadcn/ui blocks
- TEST all states and edge cases
Flow Documentation
Create flow artifacts in Phase 1-2:
flows/user-journey.mmd: High-level user journeysflows/state-machine.mmd: Detailed state transitionsflows/error-recovery.mmd: Error handling pathsdocs/edge-cases.md: Documented edge case behaviors
Tools:
# Generate diagram from mermaid
mmdc -i flows/state-machine.mmd -o flows/state-machine.svg
# Validate graphviz
dot -Tsvg flows/dependency.dot -o flows/dependency.svgExperience Validation
Before implementation:
- All user goals achievable
- No unreachable states
- Every error has recovery
- State machine is acyclic (no infinite loops)
- Edge cases documented
During implementation:
- Loading states implemented
- Error states with recovery actions
- Empty states with guidance
- Success states with next steps
- Responsive across devices
Review criteria:
- Can user achieve goal in minimum steps?
- Are failure modes obvious and recoverable?
- Does every screen have a clear purpose?
- Is navigation intuitive without documentation?
9. Skills System
Dynamic Discovery
Approach: Skills discovered on-demand based on task requirements, not front-loaded.
Skills Structure:
skills/
├── _INDEX.md # Reference
├── skill-repo-discovery.md # Auto-discovery for repos
├── skill-prompt-discovery.md # Auto-discovery from prompts
├── api-*.md # API skills
├── testing-*.md # Testing skills
├── database-*.md # Database skills
├── frontend-*.md # Frontend/experience design skills
├── [domain]-*.md # Domain-specificDiscovery Protocol
Automatic (Phase 1):
User Request → Optimizer analyzes keywords/domains
→ Scans skills/ directory
→ Scores relevance (0-100)
→ Loads top 3-7 skills
→ Caches for session
→ Refines as task evolvesManual:
ls skills/*.md # List all
ls skills/zig-*.md # Domain-specific
cat skills/_INDEX.md # View catalogDiscovery Skills:
skill-repo-discovery.md: Analyzes repo, activates relevant skillsskill-prompt-discovery.md: Analyzes prompts, suggests skills
Context-Aware Loading
Budget: Critical (40%), Skills (30%), Project (20%), General (10%)
Strategy: Load based on relevance, cache frequently-used, unload low-priority when constrained, pre-load common combinations.
Skill Composition
Complex tasks load multiple skills compositionally:
"Build authenticated API with database"
→ api-rest-design.md
→ api-authentication.md
→ database-postgres.md
→ testing-integration.md
→ containers-dockerfile.mdQuality Standards
- ✅ YAML frontmatter with metadata
- ✅ CI-validated
- ✅ Size optimized (~300 lines avg)
- ✅ Clear, actionable guidance
10. Anti-Patterns
Critical Violations
❌ Test before committing → Debug stale code
❌ Test while changing code → Invalid results
❌ Leave TODO/mocks/stubs → Implement or create Beads issue
❌ Commit to main directly → Use feature branches
❌ Accept vague requirements → Rework
❌ Skip multi-agent coordination → Race conditions
❌ Ignore context budgets → Context loss
❌ Bypass Reviewer → Bugs in production
❌ Front-load all skills → Context wasteQuality Issues
❌ Assume tech stack
❌ Skip experience flow mapping
❌ Implement before mapping states
❌ Skip shadcn blocks exploration
❌ Restructure shadcn components
❌ Missing recovery paths for errors
❌ Use pip/poetry (use uv for mnemosyne)
❌ Use cargo build/install directly (use ./scripts/rebuild-and-update-install.sh)
❌ Skip checking docs/ when encountering challenges
❌ Disorganize repository (move/rename without preserving references)
❌ Leave cloud resources running
❌ Add AI attribution to commits (unless explicitly requested by user)Recovery Protocol
- STOP immediately
- ASSESS damage
- RESET to last known good state
- FOLLOW correct procedure
- DOCUMENT what went wrong
11. Quick Reference
Language Commands
# Python (use uv, NOT pip/poetry)
uv init && uv add pkg && uv run script.py
# Zig
zig init && zig build && zig build test
# Rust
cargo new && cargo add anyhow tokio && cargo build
# Mnemosyne (use fast rebuild script, NOT cargo directly)
./scripts/rebuild-and-update-install.sh
# Go
go mod init && go get package && go run .
# TypeScript
pnpm create vite@latest && pnpm install && pnpm devCloud Commands
modal app deploy && modal app stop [name]
wrangler dev && wrangler deployGit Commands
git checkout -b feature/name
git add . && git commit -m "message"
git push -u origin feature/name
gh pr create --title "Title" --body "Description"Beads Commands
# Installation & Setup
npm install -g @beads/bd
# OR: curl -fsSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
# OR: brew tap steveyegge/beads && brew install bd
bd init # One-time setup
# Health & Info
bd doctor # Validate installation
bd info --json # Database status
# Discovery
bd ready --json --limit 5 # Unblocked tasks
bd list --status open --type bug --json # Filter tasks
bd show bd-a1b2 # Full details
# Creation
bd create "Task" -t feature -p 1 --json
bd create --from-template bug "Description"
bd create "Epic" -t epic --id bd-a1b2 # Parent
bd create "Subtask" -t task --id bd-a1b2.1 # Child
# Updates
bd update bd-a1b2 --status in_progress --json
bd update bd-a1b2 --priority 0 --json
bd close bd-a1b2 --reason "Complete" --json
# Dependencies
bd dep add bd-a1b2 bd-c3d4 --type blocks
bd dep tree bd-a1b2 # Visualize
# Sync (auto-sync enabled by default)
bd sync # Force sync (rarely needed)Testing Flow
git add . && git commit -m "Changes" && git log -1 --oneline
pkill -f "test"
./run_tests.sh > /tmp/test_$(date +%Y%m%d_%H%M%S).log 2>&1 & wait
tail -f /tmp/test_output.logDocumentation & Release Commands
# Update documentation
vim README.md AGENT_GUIDE.md CHANGELOG.md
vim docs/INDEX.md # Update navigation
# Verify cross-references
grep -r "old-reference" docs/
# Create release
git tag -a v2.2.0 -m "Release v2.2.0"
gh release create v2.2.0 --title "v2.2.0" --notes-file RELEASE_NOTES.md
# Verify GitHub Pages deployment
# https://yourusername.github.io/mnemosyne/Skills Discovery
# Automatic in Phase 1 - Optimizer discovers based on task
# Manual
ls skills/*.md # List all
ls skills/zig-*.md # Domain-specific
cat skills/_INDEX.md # View catalogMulti-Agent Commands
# Session start (one-time setup)
npm install -g @beads/bd && bd init
# OR: curl -fsSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash && bd init
# Session start (regular)
bd doctor && bd ready --json --limit 5
# Context checkpoint
mkdir -p .claude/context-snapshots && \
date +%Y%m%d_%H%M%S | xargs -I {} cp context-current.json .claude/context-snapshots/session-{}.json
# Session end (auto-sync handles Beads)
git add . && git commit -m "Session complete"Master Decision Tree
New request
↓
MULTI-AGENT ACTIVATION
├─ Orchestrator: Coordinating
├─ Optimizer: Discovering skills from skills/
├─ Reviewer: Ready to validate
└─ Executor: Ready to work
↓
PHASE 1: Prompt → Spec (clarify, discover skills, refine)
↓
PHASE 2: Spec → Full Spec (decompose, deps, holes, test plan)
↓
PHASE 3: Full Spec → Plan (steps, deps, parallelization)
↓
PHASE 4: Plan → Artifacts (implementation, tests, docs)
↓
Requirements clear? NO → ASK
Tech stack confirmed? NO → CONFIRM
Edge cases considered? NO → CHALLENGE
Using Beads? YES → Follow workflow
Making changes? YES → Feature branch
Need validation? YES → Testing protocol (commit first!)
Context > 75%? YES → Compression, unload low-priority skills
Work complete? → Submit to Reviewer
Session ending? YES → Commit, cleanup (auto-sync handles Beads)
↓
ExecuteEnforcement Checklist
Before completing ANY task:
[ ] Multi-agents active and coordinating
[ ] Optimizer discovered and loaded relevant skills (not all)
[ ] Work Plan Protocol: Phase 1→2→3→4, all exit criteria met
[ ] ✅ AUTOMATIC: Memory enforcement active (session-start hook loaded memories)
[ ] ✅ AUTOMATIC: Memory debt tracked (post-tool-use hooks increment debt)
[ ] Verified date/time if using timestamps
[ ] Challenged vague requirements
[ ] Confirmed tech stack and deployment
[ ] Used correct package manager (uv for Python, NOT pip/poetry)
[ ] Used fast rebuild script (./scripts/rebuild-and-update-install.sh) for mnemosyne builds
[ ] Checked docs/ and skills/ when encountering challenges
[ ] Mapped experience flows before implementation
[ ] Designed all states (loading, error, empty, success)
[ ] Considered shadcn blocks
[ ] Used feature branch
[ ] Testing protocol: commit first
[ ] Context managed proactively
[ ] Cloud resources cleaned up
[ ] Beads state synced (auto-sync enabled)
[ ] Repository kept tidy (logical organization, preserved references)
[ ] Documentation updated for significant changes (see AGENT_GUIDE.md)
[ ] docs/INDEX.md updated if documentation structure changed
[ ] Release process followed for version milestones (see AGENT_GUIDE.md)
[ ] Changes committed (NO AI attribution unless user explicitly requests it)
[ ] ✅ AUTOMATIC: Memory debt cleared before push (pre-destructive hook blocks otherwise)
[ ] All agents checkpointed before session endIf any unchecked, stop and address it.
Note on Memory Enforcement:
- SessionStart hook automatically loads project memories
- PostToolUse hooks automatically track memory debt (Edit, Write, Commit)
- PreToolUse hooks automatically block git push/PR if debt > 0
- Stop hook automatically validates memory usage
- You cannot bypass this - it's enforced at the tool level
Conclusion
The multi-agent system with dynamic skill discovery, Work Plan Protocol, and quality gates prevents:
- Context loss and waste
- Quality issues
- Coordination failures
- Wasted effort
- Testing violations
- Vague requirements
- Wrong tools
- Poor Git hygiene
Follow the Work Plan Protocol. Let agents orchestrate. Let Optimizer discover skills. Verify before advancing. Challenge assumptions. Commit before testing. Checkpoint before operations.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

