Shell
Claude Code Knowledge Base
Central repository for patterns, workflows, and techniques that compound over time. Philosophy: Build reusable patterns once, benefit across all projects and model upgrades.
π Patterns
Claude Code Mastery
- Longform Guide β CORE
- Token optimization strategies
- Memory persistence patterns
- Verification loops and evals
- Parallelization philosophy
- Sub-agent orchestration
- Status: Active - In daily use
Agentic Architectures
- 17 Architecture Implementations π External Repo
- All architectures as runnable Jupyter notebooks
- Ordered learning path from foundational to advanced
- LangChain + LangGraph implementations
Quick Reference:
| # | Architecture | Use Case |
|---|---|---|
| 01 | Reflection | High-quality code generation |
| 02 | Tool Use | Real-time research, enterprise bots |
| 03 | ReAct | Multi-hop Q&A, web research |
| 04 | Planning | Predictable workflows |
| 05 | Multi-Agent | Software dev pipelines |
| 06 | PEV | High-stakes automation, finance |
| 07 | Blackboard | Complex diagnostics |
| 08 | Episodic + Semantic | Long-term personalization |
| 09 | Tree of Thoughts | Logic puzzles, constrained planning |
| 10 | Mental Loop | Robotics, safety-critical systems |
| 11 | Meta-Controller | Multi-service platforms |
| 12 | Graph Memory | Corporate intelligence |
| 13 | Ensemble | High-stakes decision support |
| 14 | Dry-Run | Production deployment, debugging |
| 15 | RLHF | High-quality content, continual learning |
| 16 | Cellular Automata | Spatial reasoning, logistics |
| 17 | Reflexive Metacognitive | Medical, legal, finance advisory |
ID8Pipeline
- Build Laws π Global Config
- 11 stages from Concept Lock to Listen & Iterate
- Agent-Native additions for all stages
- Approval flow matrix
- Pipeline status tracking
π Workflows
Memory & Context
- Session Storage Pattern:
~/.claude/sessions/YYYY-MM-DD-topic.tmp - Strategic Compacting: Phase-based context clearing
- Dynamic System Prompts: Context injection via CLI flags
- Memory Persistence Hooks: PreCompact β SessionStart β Stop
Continuous Learning
- Stop Hook Evaluation: Extract patterns at session end
- Manual /learn Command: Mid-session knowledge capture
- Learned Skills Storage:
~/.claude/skills/learned/
Verification Patterns
- Checkpoint-Based: Linear workflows with explicit milestones
- Continuous: Long sessions, exploratory refactoring
- Metrics: pass@k (any success) vs pass^k (all succeed)
π οΈ Tools
MCP β Skills Conversion
When to convert:
- Heavy repeated operations
- Token cost concerns
- MCP adds minimal convenience
Pattern:
# Instead of GitHub MCP
/gh-pr # Wraps: gh pr create --fill
# Instead of Supabase MCP
/sb-status # Wraps: supabase status
/sb-diff # Wraps: supabase db diff
CLI Wrappers
- GitHub:
ghCLI - Supabase:
supabaseCLI - Vercel:
vercelCLI - Railway:
railwayCLI
Benefits:
- Same functionality, lower token cost
- Skills act as pseudo-MCPs
- No context window consumption
π Token Economics
Model Selection Matrix
| Task | Model | Cost vs Opus | When to Use |
|---|---|---|---|
| Repetitive/clear | Haiku | 5x cheaper | Worker tasks, simple ops |
| Default coding | Sonnet | 1.67x cheaper | 90% of tasks |
| Complex/critical | Opus | Baseline | 5+ files, architecture, security |
Optimization Strategies
- Modular codebase: Hundreds of lines per file, not thousands
- Tool replacement: mgrep instead of grep (~50% token reduction)
- Background processes: tmux + summarization for long outputs
- Continuous cleanup: Dead code removal, refactoring passes
π― Best Practices
Agent Abstraction Tierlist
Tier 1 (Start Here):
- β Subagents - Context rot prevention
- β Metaprompting - Stability and assumption validation
- β Ask user more at beginning - Clarify requirements early
Tier 2 (Advanced):
- β οΈ Long-running agents - Requires trial-and-error tuning
- β οΈ Parallel multi-agent - High variance, only for segmented tasks
- β οΈ Role-based multi-agent - Model evolution makes heuristics fragile
- β οΈ Computer use agents - Very early paradigm
Sub-Agent Orchestration
The Context Problem:
- Orchestrator has PURPOSE + context
- Sub-agent only has QUERY
- Summaries miss key details
Solution: Iterative Retrieval
- Pass objective + query (not just query)
- Evaluate every sub-agent return
- Ask follow-up questions
- Loop max 3 cycles
- Accept when sufficient
Sequential Phases Pattern:
Research β Plan β Implement β Review β Verify
βββΊ File outputs between each phase
Parallelization Philosophy
Goal: Maximum productivity with minimum viable parallelization
Recommended:
- Start with 1 instance, master workflow
- Scale to 2-3 for different concerns (code vs research)
- Rarely need more than 4
- Use git worktrees for overlapping code
- Use /rename for clarity
Avoid:
- Arbitrary terminal counts ("always 5 instances")
- Over-parallelization before mastery
- Mental overhead > productivity gains
ποΈ Groundwork
Two-Instance Kickoff
- Instance 1: Scaffolding (structure, configs, conventions)
- Instance 2: Research (PRD, architecture, docs compilation)
llms.txt Pattern
https://docs.example.com/llms.txt
LLM-optimized documentation, feed directly to Claude
Build Reusable Patterns
Invest in:
- Subagents (see shorthand guide)
- Skills (see shorthand guide)
- Commands (see shorthand guide)
- Planning patterns
- MCP tools
- Context engineering
Why: Patterns transfer across model upgrades and other agents. Compound effect over time.
π References
Primary Sources
- Longform Guide - Full detailed guide
- Global CLAUDE.md - Active instructions and patterns
- 17 Agentic Architectures - Implementation notebooks
External Resources
- Anthropic: "Demystifying evals for AI agents"
- YK: "32 Claude Code Tips"
- @omarsar0: Compound Effects Philosophy
- @menhguin: Agent Abstractions Tierlist
- @PerceptualPeak: Sub-Agent Context Negotiation
π Maintenance
Adding New Patterns
- Save pattern to appropriate directory in
patterns/ - Update this INDEX.md with link and summary
- Tag status: Active | Experimental | Deprecated
- Add to relevant workflow section if applicable
Session Logs
- Location:
~/.claude/sessions/ - Format:
YYYY-MM-DD-topic.tmp - Retention: Backup meaningful sessions, prune unnecessary
- Structure: Current state, completed, blockers, decisions, next session
Learned Skills
- Location:
~/.claude/skills/learned/ - Auto-generated via Stop hook
- Manual via
/learncommand - Review quarterly for obsolete patterns
Last Updated: 2026-01-21 Version: 1.0.0 Maintainer: Eddie Belaval (@eddiebelaval)