Skip to content

Claude Code: Visual Reference

Last updated:

All diagrams in one place. Quick visual overview of Claude Code’s key concepts. For detailed docs β†’ Ultimate Guide | Cheatsheet

Interactive Mermaid diagrams available: For 40 interactive diagrams covering model selection, agent lifecycle, memory hierarchy, multi-agent patterns, security threats, and more, see guide/diagrams/. This file contains ASCII versions of key concepts.

20 diagrams: 8 new (this file) + 12 from existing guides, all consolidated here.


These ASCII diagrams cover selected Claude Code concepts. For the harness taxonomy, use the three figures on the Agent Harness Map: strict and broad scope, the four layers, and the selection funnel. Agent Harness Engineering explains the model, runtime harness, repository harness, and orchestrator. Agent Tools: Beyond Claude Code covers frameworks and control planes. Use Agent Evaluation, Session Observability, and Security Hardening to test, inspect, and constrain the chosen design. Definitions are in the glossary.


New diagrams:

  1. Context Management Zones
  2. Permission Modes Cycle
  3. Workflow Pipeline (9 Steps)
  4. Quick Decision Tree

Architecture & Internals: 5. Master Loop 6. Hook Event Flow 7. Data Privacy Flow

Security: 8. MCP Rug Pull Attack 9. Docker Sandbox Architecture

Decision Trees: 10. Search Tool Selection 11. Trust Calibration Flow 12. Adoption Decision Tree 13. Methodology Selection

Workflows: 14. Research β†’ Spec β†’ Code 15. Review Auto-Correction Loop 16. PDF Pipeline Stack

Development & Learning: 17. TDD Red-Green-Refactor Cycle 18. UVAL Protocol Flow

Security (extended): 19. Security 3-Layer Defense 20. Secret Exposure Timeline


How to react based on context window usage (check with /status):

Context Usage
0% 50% 70% 90% 100%
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ GREEN β”‚ YELLOW β”‚ ORANGE β”‚ RED β”‚
β”‚ work β”‚ selective β”‚ /compact β”‚ /clear β”‚
β”‚ freely β”‚ with care β”‚ NOW β”‚ required β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β–² β–²
β”‚ β”‚
Be selective Risk: forgetting
about reads instructions,
and tool use hallucinations

Actions by zone:

  • Green (0-50%): Full speed. Read files, explore freely.
  • Yellow (50-70%): Be selective. Avoid unnecessary file reads.
  • Orange (70-90%): Run /compact immediately. Context is degrading.
  • Red (90%+): Run /clear and restart. Responses are unreliable.

β†’ Source: ultimate-guide.md:1335


Cycle through modes with Shift+Tab:

Shift+Tab Shift+Tab
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” ────────────→ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” ────────────→ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ DEFAULT β”‚ β”‚ AUTO-ACCEPT β”‚ β”‚ PLAN MODE β”‚
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ edit=ask β”‚ β”‚ edit=auto β”‚ β”‚ edit=no β”‚
β”‚ exec=ask β”‚ β”‚ exec=ask β”‚ β”‚ exec=no β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ←──────────── β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ←──────────── β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Shift+Tab Shift+Tab

When to use each mode:

ModeUse when…Risk level
DefaultNormal development: review each changeLow
Auto-acceptTrusted tasks (formatting, refactoring)Medium
Plan modeComplex/risky operations: explore safely firstNone

Shortcuts:

  • Shift+Tab: Cycle to next mode
  • Shift+Tab Γ— 2: Jump to plan mode from default
  • /plan: Enter plan mode directly
  • Exit plan mode: approve the plan Claude presents, or press Shift+Tab (there is no /execute command)

β†’ Source: ultimate-guide.md:760


The recommended workflow for every task:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1.START │───→│ 2./status│───→│ 3. plan? │───→│ 4. describe β”‚
β”‚ claude β”‚ β”‚ check ctxβ”‚ β”‚ Shift+TabΓ—2β”‚ β”‚ WHAT/WHERE β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ (if risky) β”‚ β”‚ HOW/VERIFY β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 5.review │───→│ 6. y/n │───→│ 7. test │───→│ 8.commit │───→│9./compactβ”‚
β”‚ diff β”‚ β”‚ accept? β”‚ β”‚ run β”‚ β”‚ when doneβ”‚ β”‚ when >70%β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key principles:

  • Step 2: Always check context before starting. If >70%, /compact first.
  • Step 3: Use plan mode for anything risky, complex, or multi-file.
  • Step 4: Be specific. Vague prompts produce vague results.
  • Step 5: Read every diff. Never blindly accept.
  • Step 9: Compact after each task to stay in the green zone.

β†’ Source: ultimate-guide.md:277


What to do based on your situation:

What do you need?
β”‚
β”œβ”€ Simple task ─────────────────→ Just ask Claude
β”‚
β”œβ”€ Complex task
β”‚ β”œβ”€ Single session ───────────→ /plan + Tasks API
β”‚ └─ Multi-session ────────────→ Tasks API + CLAUDE_CODE_TASK_LIST_ID
β”‚
β”œβ”€ Repeating task ──────────────→ Create agent or command
β”‚
β”œβ”€ Context >70% ────────────────→ /compact
β”‚
β”œβ”€ Context >90% ────────────────→ /clear (restart conversation)
β”‚
β”œβ”€ Need library docs ───────────→ Context7 MCP
β”‚
β”œβ”€ Deep debugging ──────────────→ Opus model + Alt+T (thinking)
β”‚
β”œβ”€ UI from design ──────────────→ Figma MCP or screenshot input
β”‚
└─ Team rollout ────────────────→ Read adoption-approaches.md

β†’ Source: reference.yaml (decide section)


The entire architecture is a simple while loop: no DAG, no classifier, no RAG.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ CLAUDE CODE MASTER LOOP β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Your Prompt β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚
β”‚ β–Ό β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ CLAUDE REASONS β”‚ β”‚
β”‚ β”‚ (No classifier, no routing layer) β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚
β”‚ β–Ό β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Tool Call? β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚
β”‚ YES β”‚ NO β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β–Ό β–Ό β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Execute β”‚ β”‚ Text β”‚ β”‚
β”‚ β”‚ Tool β”‚ β”‚ Response β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ (DONE) β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚
β”‚ β–Ό β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Feed Result β”‚ β”‚
β”‚ β”‚ to Claude │──────────────────┐ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚ β”‚ β”‚
β”‚ β–Ό β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ LOOP BACK β”‚ β”‚
β”‚ β”‚ (Next turn) β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β†’ Source: architecture.md:84


How hooks intercept Claude Code’s execution pipeline:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ EVENT FLOW β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β”‚
β”‚ User types message β”‚
β”‚ β”‚ β”‚
β”‚ β–Ό β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ UserPromptSubmit β”‚ ← Add context (git status) β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚
β”‚ β–Ό β”‚
β”‚ Claude decides to run tool (e.g., Edit) β”‚
β”‚ β”‚ β”‚
β”‚ β–Ό β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ PreToolUse β”‚ ← Security check β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚
β”‚ β–Ό (if allowed) β”‚
β”‚ Tool executes β”‚
β”‚ β”‚ β”‚
β”‚ β–Ό β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ PostToolUse β”‚ ← Auto-format β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β†’ Source: ultimate-guide.md:6327


What data leaves your machine when using Claude Code:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ YOUR LOCAL MACHINE β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β€’ Prompts you type β”‚
β”‚ β€’ Files Claude reads (including .env if not excluded!) β”‚
β”‚ β€’ MCP server results (SQL queries, API responses) β”‚
β”‚ β€’ Bash command outputs β”‚
β”‚ β€’ Error messages and stack traces β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό HTTPS
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ANTHROPIC API β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β€’ Processes your request β”‚
β”‚ β€’ Stores conversation based on retention policy β”‚
β”‚ β€’ May use data for model training (if not opted out) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β†’ Source: data-privacy.md:24


How a malicious MCP server can exploit the one-time approval model:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1. Attacker publishes benign MCP "code-formatter" β”‚
β”‚ ↓ β”‚
β”‚ 2. User adds to ~/.claude.json, approves once β”‚
β”‚ ↓ β”‚
β”‚ 3. MCP works normally for 2 weeks (builds trust) β”‚
β”‚ ↓ β”‚
β”‚ 4. Attacker pushes malicious update (no re-approval!) β”‚
β”‚ ↓ β”‚
β”‚ 5. MCP exfiltrates ~/.ssh/*, .env, credentials β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
MITIGATION: Version pinning + hash verification + monitoring

β†’ Source: security-hardening.md:33


Full isolation for autonomous Claude Code sessions:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ HOST MACHINE β”‚
β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ DOCKER SANDBOX (microVM) β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
β”‚ β”‚ β”‚ Claude Code β”‚ β”‚ Private Docker daemon β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ (--dsp mode) β”‚ β”‚ (isolated from host) β”‚ β”‚ β”‚
β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
β”‚ β”‚ β”‚ Workspace: ~/my-project (synced with host) β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ Same absolute path as host β”‚ β”‚ β”‚
β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ Base: Ubuntu, Node.js, Python 3, Go, Git, β”‚ β”‚
β”‚ β”‚ Docker CLI, GitHub CLI, ripgrep, jq β”‚ β”‚
β”‚ β”‚ User: non-root 'agent' with sudo β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚
β”‚ Host Docker daemon: NOT accessible from sandbox β”‚
β”‚ Host filesystem: NOT accessible (except workspace) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β†’ Source: sandbox-isolation.md:87


3-level decision tree for choosing the right search tool:

Level 1: What Do You Know?

Do you know the EXACT text/pattern?
β”‚
β”œβ”€ YES β†’ Use rg (ripgrep)
β”‚ β”œβ”€ Known function name: rg "createSession"
β”‚ β”œβ”€ Known import: rg "import.*React"
β”‚ └─ Known pattern: rg "async function"
β”‚
└─ NO β†’ Go to Level 2

Level 2: What Are You Looking For?

What's your search intent?
β”‚
β”œβ”€ "Find by MEANING/CONCEPT"
β”‚ β†’ Use grepai
β”‚ └─ Example: grepai search "payment validation logic"
β”‚
β”œβ”€ "Find FUNCTION/CLASS definition"
β”‚ β†’ Use Serena
β”‚ └─ Example: serena find_symbol --name "UserController"
β”‚
β”œβ”€ "Find by CODE STRUCTURE"
β”‚ β†’ Use ast-grep
β”‚ └─ Example: async without error handling
β”‚
└─ "Understand DEPENDENCIES"
β†’ Use grepai trace
└─ Example: grepai trace callers "validatePayment"

Level 3: Optimization

Found too many results?
β”‚
β”œβ”€ rg β†’ Add --type filter or narrow path
β”œβ”€ grepai β†’ Add --path filter or use trace
β”œβ”€ Serena β†’ Filter by symbol type (function/class)
└─ ast-grep β†’ Add constraints to pattern

β†’ Source: search-tools-mastery.md:75


How much to review AI-generated code based on risk level:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ TRUST CALIBRATION FLOW β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β”‚
β”‚ AI generates code β”‚
β”‚ β”‚ β”‚
β”‚ β–Ό β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ What type? β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β–Ό β–Ό β–Ό β”‚
β”‚ Boiler Business Security β”‚
β”‚ -plate logic critical β”‚
β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β–Ό β–Ό β–Ό β”‚
β”‚ Skim Test + Full review β”‚
β”‚ only review + tools β”‚
β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚
β”‚ β–Ό β”‚
β”‚ Tests pass? ──No──► Debug & fix β”‚
β”‚ β”‚ β”‚
β”‚ Yes β”‚
β”‚ β”‚ β”‚
β”‚ β–Ό β”‚
β”‚ Ship it β”‚
β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β†’ Source: ultimate-guide.md:1182


How to choose your Claude Code adoption strategy:

Starting Claude Code?
β”‚
β”œβ”€ Need to ship today?
β”‚ └─ YES β†’ Turnkey Quickstart
β”‚ └─ NO ↓
β”‚
β”œβ”€ Team needs shared conventions?
β”‚ └─ YES β†’ Turnkey + document what matters to you
β”‚ └─ NO ↓
β”‚
β”œβ”€ Want to understand before configuring?
β”‚ └─ YES β†’ Autonomous Learning Path
β”‚ └─ NO β†’ Turnkey, adjust as you go

β†’ Source: adoption-approaches.md:51


Which development methodology to use:

β”Œβ”€ "I want quality code" ────────────→ workflows/tdd-with-claude.md
β”‚
β”œβ”€ "I want to spec before code" ─────→ workflows/spec-first.md
β”‚
β”œβ”€ "I need to plan architecture" ────→ workflows/plan-driven.md
β”‚
β”œβ”€ "I'm iterating on something" ─────→ workflows/iterative-refinement.md
β”‚
└─ "I need methodology theory" ──────→ methodologies.md

β†’ Source: methodologies.md:24


Using Perplexity for research, then Claude Code for implementation:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1. PERPLEXITY (Deep Research) β”‚
β”‚ "Research best practices for JWT refresh tokens β”‚
β”‚ in Next.js 15. Include security considerations, β”‚
β”‚ common pitfalls, and library recommendations." β”‚
β”‚ β”‚
β”‚ β†’ Output: 2000-word spec with sources β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓ Export as spec.md
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 2. CLAUDE CODE β”‚
β”‚ > claude β”‚
β”‚ "Implement JWT refresh tokens following spec.md. β”‚
β”‚ Use the jose library as recommended." β”‚
β”‚ β”‚
β”‚ β†’ Output: Working implementation with tests β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β†’ Source: ai-ecosystem.md:155


Iterative code review pattern where Claude reviews, fixes, and re-reviews:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Review Auto-Correction Loop β”‚
β”‚ β”‚
β”‚ Review (identify issues) β”‚
β”‚ ↓ β”‚
β”‚ Fix (apply corrections) β”‚
β”‚ ↓ β”‚
β”‚ Re-Review (verify fixes) β”‚
β”‚ ↓ β”‚
β”‚ Converge (minimal changes) β†’ Done β”‚
β”‚ ↑ β”‚
β”‚ └──── Repeat (max iterations) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β†’ Source: iterative-refinement.md:354


Quarto + Typst stack for generating professional PDFs:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Your .qmd File β”‚
β”‚ (Markdown + YAML frontmatter) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Quarto β”‚
β”‚ (Document rendering engine) β”‚
β”‚ β€’ Processes YAML metadata β”‚
β”‚ β€’ Handles extensions β”‚
β”‚ β€’ Manages output formats β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β–Ό β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Pandoc β”‚ β”‚ Typst β”‚
β”‚ (MD β†’ AST β†’ ?) β”‚ β”‚ (Typography/PDF) β”‚
β”‚ β€’ Markdown parser β”‚ β”‚ β€’ Modern engine β”‚
β”‚ β€’ AST transforms β”‚ β”‚ β€’ Fast compilation β”‚
β”‚ β€’ Format bridges β”‚ β”‚ β€’ No LaTeX needed β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ document.pdf β”‚
β”‚ (Professional typography output) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β†’ Source: pdf-generation.md:58


The iterative loop at the heart of Test-Driven Development:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚
β–Ό β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ πŸ”΄ RED β”‚ β”‚
β”‚ β”‚ β”‚
β”‚ Write a β”‚ β”‚
β”‚ failing β”‚ β”‚
β”‚ test β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚
β”‚ Tests FAIL β”‚
β”‚ (expected) β”‚
β–Ό β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ 🟒 GREEN β”‚ β”‚
β”‚ β”‚ β”‚
β”‚ Write β”‚ β”‚
β”‚ minimal β”‚ β”‚
β”‚ code to β”‚ β”‚
β”‚ pass β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚
β”‚ Tests PASS β”‚
β”‚ (minimal) β”‚
β–Ό β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ πŸ”΅ REFACTORβ”‚ β”‚
β”‚ β”‚ β”‚
β”‚ Clean up β”‚ β”‚
β”‚ while tests β”‚ β”‚
β”‚ stay green β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚
β”‚ Next feature β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Key rules:
RED β†’ Test must FAIL before writing implementation
GREEN β†’ Write ONLY enough code to pass (no more)
REFACTOR β†’ Improve structure, tests must stay green
REPEAT β†’ One feature at a time, always in this order

Source: workflows/tdd-with-claude.md:78


Systematic framework for learning with AI without losing your edge:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ UVAL PROTOCOL β”‚
β”‚ (Use AI without losing your edge) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ U β”‚ β”‚ V β”‚ β”‚ A β”‚ β”‚ L β”‚
β”‚UNDERSTAND│────→│ VERIFY │────→│ APPLY │────→│ LEARN β”‚
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ 15-min β”‚ β”‚ Can you β”‚ β”‚ Modify β”‚ β”‚ Capture β”‚
β”‚ rule: β”‚ β”‚ explain β”‚ β”‚ the code β”‚ β”‚ insights β”‚
β”‚ β”‚ β”‚ it back? β”‚ β”‚ yourself β”‚ β”‚ for long β”‚
β”‚ 1.State β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ term β”‚
β”‚ problemβ”‚ β”‚ Test: β”‚ β”‚ Tasks: β”‚ β”‚ β”‚
β”‚ 2.Brain- β”‚ β”‚ explain β”‚ β”‚ β€’ Extend β”‚ β”‚ Methods: β”‚
β”‚ storm β”‚ β”‚ to a β”‚ β”‚ β€’ Modify β”‚ β”‚ β€’ Notes β”‚
β”‚ 3.Find β”‚ β”‚ colleagueβ”‚ β”‚ β€’ Debug β”‚ β”‚ β€’ Teach β”‚
β”‚ gaps β”‚ β”‚ without β”‚ β”‚ β€’ Adapt β”‚ β”‚ β€’ Blog β”‚
β”‚ 4.Ask β”‚ β”‚ looking β”‚ β”‚ to new β”‚ β”‚ β€’ Review β”‚
β”‚ smart β”‚ β”‚ at code β”‚ β”‚ contextβ”‚ β”‚ later β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ β”‚
β”‚ ◄── Repeat per concept ──► β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
If VERIFY fails β†’ go back to UNDERSTAND (you copied, didn't learn)
If APPLY fails β†’ go back to VERIFY (you memorized, didn't understand)

Source: learning-with-ai.md:208


The full security document (security-hardening.md) organized as 3 defense layers:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ SECURITY 3-LAYER DEFENSE β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β”‚
β”‚ TIME ──────────────────────────────────────────────────► β”‚
β”‚ Before During After β”‚
β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ LAYER 1 β”‚ β”‚ LAYER 2 β”‚ β”‚ LAYER 3 β”‚ β”‚
β”‚ β”‚ PREVENTION β”‚ β”‚ DETECTION β”‚ β”‚ RESPONSE β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β€’ MCP vetting β”‚ β”‚ β€’ Prompt inject β”‚ β”‚ β€’ Secret β”‚ β”‚
β”‚ β”‚ workflow β”‚ β”‚ detection β”‚ β”‚ rotation β”‚ β”‚
β”‚ β”‚ β€’ Version β”‚ β”‚ β€’ Output β”‚ β”‚ β€’ MCP β”‚ β”‚
β”‚ β”‚ pinning β”‚ β”‚ scanning β”‚ β”‚ isolation β”‚ β”‚
β”‚ β”‚ β€’ .claudeignore β”‚ β”‚ β€’ Anomaly β”‚ β”‚ β€’ History β”‚ β”‚
β”‚ β”‚ β€’ Input hooks β”‚ β”‚ monitoring β”‚ β”‚ rewriting β”‚ β”‚
β”‚ β”‚ β€’ Safe MCP list β”‚ β”‚ β€’ Secret leak β”‚ β”‚ β€’ Incident β”‚ β”‚
β”‚ β”‚ β€’ Permissions β”‚ β”‚ detection β”‚ β”‚ reporting β”‚ β”‚
β”‚ β”‚ β€’ Integrity β”‚ β”‚ β€’ Unicode/ANSI β”‚ β”‚ β€’ Post-mortem β”‚ β”‚
β”‚ β”‚ scanning β”‚ β”‚ filtering β”‚ β”‚ & rotation β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ GOAL: Block β”‚ β”‚ GOAL: Catch β”‚ β”‚ GOAL: Limit β”‚ β”‚
β”‚ β”‚ threats at β”‚ β”‚ attacks in β”‚ β”‚ damage and β”‚ β”‚
β”‚ β”‚ entry points β”‚ β”‚ real-time β”‚ β”‚ recover fast β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚
β”‚ Adoption path: β”‚
β”‚ Solo dev β†’ Layer 1 basics (output scanner) β”‚
β”‚ Team β†’ Layer 1 + 2 (+ injection hooks) β”‚
β”‚ Enterprise β†’ All 3 layers (+ ZDR + verification) β”‚
β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Source: security-hardening.md:24/205/345


Emergency response when a secret (API key, token, password) is exposed:

SECRET EXPOSED β€” Emergency Response Timeline
═══════════════════════════════════════════════════════════
0 min 15 min 1 hour 24 hours
β”‚ β”‚ β”‚ β”‚
β–Ό β–Ό β–Ό β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ⏱️ FIRST 15 MIN β”‚ β”‚ ⏱️ FIRST HOUR β”‚ β”‚ ⏱️ FIRST 24H β”‚
β”‚ Stop the β”‚ β”‚ Assess damage β”‚ β”‚ Remediate β”‚
β”‚ bleeding β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ 3. Audit git β”‚ β”‚ 6. Rotate ALL β”‚
β”‚ 1. REVOKE key β”‚ β”‚ history β”‚ β”‚ related β”‚
β”‚ immediately β”‚ β”‚ (rewrite if β”‚ β”‚ credentials β”‚
β”‚ (AWS/GH/ β”‚ β”‚ pushed) β”‚ β”‚ β”‚
β”‚ Stripe) β”‚ β”‚ β”‚ β”‚ 7. Notify team β”‚
β”‚ β”‚ β”‚ 4. Scan deps β”‚ β”‚ /compliance β”‚
β”‚ 2. Confirm β”‚ β”‚ for leaked β”‚ β”‚ (GDPR/SOC2) β”‚
β”‚ exposure β”‚ β”‚ keys β”‚ β”‚ β”‚
β”‚ scope β”‚ β”‚ β”‚ β”‚ 8. Document β”‚
β”‚ (local or β”‚ β”‚ 5. Check CI/CD β”‚ β”‚ incident β”‚
β”‚ pushed?) β”‚ β”‚ logs β”‚ β”‚ timeline β”‚
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
SEVERITY GUIDE:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Local only (not pushed) β†’ Revoke + rotate (steps 1-2) β”‚
β”‚ Pushed to remote β†’ Full timeline (steps 1-8) β”‚
β”‚ Public repo exposure β†’ Assume compromised, rotate β”‚
β”‚ EVERYTHING, check for abuse β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Source: security-hardening.md:347


Back to Guide README | Cheatsheet | Main README