Skip to content
Shell
7.1 KB
Raw Blame

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: gh CLI
  • Supabase: supabase CLI
  • Vercel: vercel CLI
  • Railway: railway CLI

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

  1. Modular codebase: Hundreds of lines per file, not thousands
  2. Tool replacement: mgrep instead of grep (~50% token reduction)
  3. Background processes: tmux + summarization for long outputs
  4. 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

  1. Pass objective + query (not just query)
  2. Evaluate every sub-agent return
  3. Ask follow-up questions
  4. Loop max 3 cycles
  5. 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

  1. Instance 1: Scaffolding (structure, configs, conventions)
  2. 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

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

  1. Save pattern to appropriate directory in patterns/
  2. Update this INDEX.md with link and summary
  3. Tag status: Active | Experimental | Deprecated
  4. 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 /learn command
  • Review quarterly for obsolete patterns

Last Updated: 2026-01-21 Version: 1.0.0 Maintainer: Eddie Belaval (@eddiebelaval)