DNYoussef/context-cascade

Context Cascade - Nested Plugin Architecture for Claude Code Official Claude Code Plugin | Version 3.1.0 | Last updated: 2026-01-09 (see docs/COMPONENT-COUNTS.json for source counts) Context-saving nested architecture: Playbooks -> Skills -> Agents -> Commands. Load only what you need, saving 90%+ context space.

License:MITLanguage:Python134

Deep Analysis

上下文节省的嵌套插件架构,Playbooks→Skills→Agents→Commands四层按需加载,节省90%+上下文空间

Core Features

Technical Implementation

Highlights
  • 90%+上下文节省 - 传统100k+ tokens→初始~2k tokens
  • 零决策瘫痪 - 路由器从176个技能自动选择
  • 可扩展架构 - 30 Playbooks、176 Skills、260 Agents、249 Commands
  • Byzantine验证 - 检测代理欺骗行为
  • 研究SOP - 3阶段研究标准操作程序
Use Cases
  • 复杂功能开发
  • 基础设施和发布管理
  • 深度研究任务
  • 安全合规审计
  • 大型代码库工作
Limitations
  • 架构复杂需要理解
  • 依赖Claude Flow框架
  • 大量组件可能难以维护
  • Theater检测是实验性功能
  • 文档全英文
Tech Stack
Claude FlowClaude CodeMermaidOODA Loop

Context Cascade - Nested Plugin Architecture for Claude Code

Official Claude Code Plugin | Version 3.1.0 | Last updated: 2026-01-09 (see docs/COMPONENT-COUNTS.json for source counts)

Context-saving nested architecture: Playbooks -> Skills -> Agents -> Commands. Load only what you need, saving 90%+ context space.

The Context Cascade Architecture

PLAYBOOKS (30)     <-- Only these are loaded initially (~2k tokens)
    |
    v
SKILLS (176)       <-- Loaded when playbook invokes them
    |
    v
AGENTS (260)       <-- Loaded when skill needs them
    |
    v
COMMANDS (249)    <-- Embedded in agents, loaded last

Why Context Cascade?

  • Traditional approach: Load everything upfront = 100k+ tokens consumed
  • Context Cascade: Load on demand = ~2k tokens initially, expand as needed
  • Result: 90%+ context savings while maintaining full capability

Built on Claude Flow - Enterprise-grade agent orchestration with memory, hooks, and swarm intelligence.


🧠 How It Works: Intelligent Auto-Routing

The system automatically selects the right skills and agents based on your intent. No manual selection required.

Phase 0: Intent Analysis → Auto-Skill Selection

Every request flows through this intelligent routing system:

User Request
    ↓
🔍 intent-analyzer (Auto-triggered on ambiguous/complex requests)
    ├─ Analyzes explicit and implicit goals
    ├─ Detects constraints and context
    ├─ Maps to probabilistic intent (>80% confidence = proceed)
    └─ Socratic clarification if needed (<80% confidence)
    ↓
🎯 orchestration-router (Auto-triggered for orchestration needs)
    ├─ Keyword extraction (agent count, complexity, patterns)
    ├─ Decision tree routing (Priority 1-4 logic)
    ├─ Skill selection with rationale
    └─ Automatic skill invocation
    ↓
⚡ Selected Skill Executes (e.g., parallel-swarm-implementation)
    ├─ Spawns specialized agents in parallel
    ├─ Coordinates via memory namespaces
    ├─ Theater detection via Byzantine consensus
    └─ Produces validated output

Example Flow:

User: "Build user authentication with JWT tokens"

🔍 intent-analyzer: High confidence (95%) - Feature implementation
🎯 orchestration-router: Routes to parallel-swarm-implementation (Loop 2)
⚡ Loop 2 spawns 6 agents in parallel:
   - researcher: Auth best practices
   - coder: JWT implementation
   - reviewer: Security audit
   - tester: Comprehensive tests
   - documenter: API docs
   - theater-detector: Byzantine validation
✅ Result: Production-ready auth system in 2 hours

The Playbook Decision Tree

After intent analysis and routing, execution follows this workflow:

flowchart TD
    A[🔍 Phase 0: Intent Analyzer] --> B[📋 Phase 1: Prompt Architect]
    B --> C{🎯 Workstream Signal}
    C -->|Feature/Build| D[🚀 Delivery Stack]
    C -->|Infrastructure/Release| E[⚙️ Operations Stack]
    C -->|Research/Discovery| F[🔬 Research Stack]
    C -->|Security/Compliance| G[🔒 Security Stack]
    C -->|Specialist Domain| H[🎨 Specialist Stack]
    D --> I[✅ Quality Gate]
    E --> I
    F --> I
    G --> I
    H --> I
    I --> J{📊 Ready to Close?}
    J -->|No| C
    J -->|Yes| K[🎉 Finalize & Report]

Stack Auto-Selection:

  • Delivery Stackfeature-dev-complete (end-to-end feature shipping)
  • Operations Stackproduction-readiness (deployment gates, security, performance)
  • Research Stackdeep-research-orchestrator (3-phase research SOP with quality gates)
  • Security Stacknetwork-security-setup (lock down environments, layer security SOPs)
  • Specialist Stack → Language/platform specialists (Python, TypeScript, React, etc.)

Key Principles:

  1. Zero Decision Paralysis: Router auto-selects optimal skill from 171 options
  2. Context-Aware: Detects intent from keywords, agent count, complexity signals
  3. Transparent: Provides selection rationale and alternatives
  4. Adaptive: Learns from corrections and adjusts future routing

See complete playbook


🎉 What's New in v3.0.0

  • Current component counts: 30 playbooks, 196 skills (176 core + 20 supplementary), 260 agents, and 249 commands (see docs/COMPONENT-COUNTS.json).
  • Discovery indexes: discovery/SKILL-INDEX.md, discovery/AGENT-REGISTRY.md, and discovery/COMMAND-INDEX.md map routing across the hierarchy.
  • Modular marketplace: Five installable plugin packages defined in .claude-plugin/marketplace.json.
  • Graphviz library: 41 workflow diagrams live in docs/workflows/graphviz/ with an index and README.
  • MCP templates: .mcp.json documents sample servers (e.g., memory-mcp, connascence-analyzer, fetch, sequential-thinking, filesystem, playwright, ruv-swarm).

Quick Start (3 Steps)

1. Add Marketplace

/plugin marketplace add DNYoussef/context-cascade

2. Install Plugin(s)

Option A - Core Only (Recommended for beginners):

/plugin install 12fa-core

Option B - Full Stack (Everything):

/plugin install 12fa-core 12fa-three-loop 12fa-security 12fa-visual-docs 12fa-swarm

3. Setup MCP Servers

Required (Claude Flow - our foundation):

npm install -g claude-flow@alpha
claude mcp add claude-flow npx claude-flow@alpha mcp start

What This Gives You:

  • 💾 Memory System - Persistent coordination across agents
  • 🔗 Hooks - Lifecycle events (pre-task, post-task, pre-edit, post-edit, session-end)
  • 🐝 Swarm Intelligence - Multi-agent coordination (2.8-4.4x baseline speedup)
  • 📊 AgentDB - 96x-164x performance boost with semantic search
  • 🎯 ReasoningBank - Pattern learning with 46% faster performance

Recommended (for advanced features):

npm install -g ruv-swarm flow-nexus@latest
claude mcp add ruv-swarm npx ruv-swarm mcp start
claude mcp add flow-nexus npx flow-nexus@latest mcp start

Production MCP Systems (code quality & persistent memory):

  1. Install the projects:
# Clone to your preferred location (e.g., ~/Projects or D:/Projects)
git clone https://github.com/DNYoussef/connascence.git
git clone https://github.com/DNYoussef/memory-mcp-triple-system.git

# Install dependencies
cd connascence && pip install -e . && cd ..
cd memory-mcp-triple-system && pip install -e . && cd ..
  1. Configure MCP servers (add to claude_desktop_config.json):
{
  "mcpServers": {
    "connascence-analyzer": {
      "command": "python",
      "args": ["mcp_local/stdio_server.py"],
      "cwd": "/path/to/connascence"
    },
    "memory-mcp": {
      "command": "python",
      "args": ["-m", "src.mcp.stdio_server"],
      "cwd": "/path/to/memory-mcp-triple-system"
    }
  }
}
  1. Optional environment variables (for custom paths):
# Set these if projects are not in standard locations
export CONNASCENCE_PATH=/your/path/to/connascence
export MEMORY_MCP_PATH=/your/path/to/memory-mcp-triple-system

The cognitive architecture will auto-discover project paths from your MCP config.

Done! 🎉 You can now use /sparc, /audit-pipeline, /quick-check, and all other commands.

Learn More: See CLAUDE-FLOW-INTEGRATION.md for how we enhance Claude Flow.


🔗 Integration with Production MCP Systems

Connascence Safety Analyzer - https://github.com/DNYoussef/connascence-safety-analyzer

  • 7+ violation types (God Objects, Parameter Bombs, Complexity, Deep Nesting, etc.)
  • NASA compliance checking (Power of 10 Rules)
  • 0.018s analysis performance
  • Access: 14 code quality agents only (coder, reviewer, tester, etc.)
  • MCP Integration: docs/MCP-INTEGRATION.md

Memory MCP Triple System - https://github.com/DNYoussef/memory-mcp-triple-system

  • Triple-layer retention (24h/7d/30d+)
  • Mode-aware context adaptation (Execution/Planning/Brainstorming)
  • Automatic tagging protocol (WHO/WHEN/PROJECT/WHY)
  • 384-dimensional vector embeddings with HNSW indexing
  • Access: ALL agents (global)
  • MCP Integration: docs/MCP-INTEGRATION.md

Agent Access Control: See hooks/12fa/agent-mcp-access-control.js for agent-specific MCP permissions
Tagging Protocol: See hooks/12fa/memory-mcp-tagging-protocol.js for automatic metadata injection

MCP Marketplace & Ecosystem: See docs/MCP-MARKETPLACE-GUIDE.md for:

  • FREE SERVERS ONLY - No payment, API keys, or accounts required
  • Complete catalog of 11 free MCP servers (4 local + 7 official Anthropic)
  • Agent-to-MCP-server mapping for all 90 agents
  • Installation guide for all free servers
  • Usage examples and best practices

Cognitive Architecture: VeriLingua x VERIX x GlobalMOO

Context Cascade includes a sophisticated cognitive architecture for improved AI reasoning:

VeriLingua: 7 Cognitive Frames

VeriLingua forces explicit cognitive distinctions drawn from natural languages:

Frame Source Language Forces Distinction
Evidential Turkish (-mis/-di) How do you know? (witnessed/reported/inferred/assumed)
Aspectual Russian (perfective/imperfective) Complete or ongoing?
Morphological Arabic (trilateral roots) What are the semantic components?
Compositional German (compounding) Build from primitives
Honorific Japanese (keigo) Who is the audience?
Classifier Chinese (measure words) What type/category?
Spatial Guugu Yimithirr (absolute direction) Absolute position in codebase

VERIX: Epistemic Notation

Every claim encodes its