All skills
Skillintermediate

๐Ÿ’พ Layer 5: State Layer

<div align="center">

Claude Code Knowledge Pack7/10/2026

Overview

<div align="center">

๐Ÿ  Home โ€บ ๐Ÿ”ง Implementation โ€บ ๐Ÿ›๏ธ Architecture โ€บ ๐Ÿ’พ Layer 5: State

โ† โšก Execution Layer โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ—โ”โ”โ”โ”โ”โ”โ”โ”โ” Architecture โ†’

</div>

๐Ÿ’พ Layer 5: State Layer

Persistence, memory, and context management across interactions.


Purpose

The State Layer manages all persistent data and context. It enables sessions to maintain state, resume from interruptions, and share information across components.


Components

ComponentEmojiTypeScope
Memory๐Ÿ’พIn-session contextConversation
Files๐Ÿ“Persistent storageProject
CLAUDE.md๐Ÿ“‹Project instructionsProject
Checkpoints๐Ÿ–ฅ๏ธResume pointsWorkflow

State Flow Diagram

%%{init: {'theme': 'base', 'themeVariables': {'lineColor': '#64748b'}}}%%
flowchart TB
    classDef state fill:#10b981,stroke:#059669,stroke-width:2px,color:#ffffff
    classDef main fill:#8b5cf6,stroke:#7c3aed,stroke-width:2px,color:#ffffff
    classDef tool fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#ffffff

    subgraph StateLayer["๐Ÿ’พ State Layer"]
        MEM["๐Ÿ’พ Session Memory"]:::state
        FILES["๐Ÿ“ File System"]:::state
        CLAUDE["๐Ÿ“‹ CLAUDE.md"]:::state
        CHECK["๐Ÿ–ฅ๏ธ Checkpoints"]:::state
    end

    EXEC["โšก Execution Layer"]:::tool -->|Reads/Writes| FILES
    EXEC -->|Updates| MEM
    EXEC -->|Saves| CHECK
    MA["๐Ÿ” Main Agent"]:::main -->|Loads| CLAUDE
    MA -->|Accesses| MEM
    MA -->|Resumes from| CHECK

    classDef stateBox fill:#ecfdf5,stroke:#10b981,stroke-width:2px,color:#065f46

    StateLayer:::stateBox

๐Ÿ’พ Session Memory

In-session context that persists throughout a conversation.

What It Stores

  • Conversation history
  • Current task state
  • Intermediate results
  • User preferences from session

Scope

  • Lifetime: Single conversation session
  • Access: ๐Ÿ” Main Agent and ๐Ÿฆ Subagents
  • Persistence: Lost when session ends

๐Ÿ“ File System

Persistent storage for project files and outputs.

Operations

OperationToolDescription
Read๐Ÿ”ง๐Ÿ‘€ ReadLoad file contents
Write๐Ÿ”งโœ๏ธ WriteCreate/overwrite files
Edit๐Ÿ”งโœ๏ธ EditModify existing files
Search๐Ÿ”ง๐Ÿ—‚๏ธ GlobFind files by pattern
Search๐Ÿ”ง๐Ÿ” GrepFind content in files

Scope

  • Lifetime: Permanent (until deleted)
  • Access: All layers via tools
  • Persistence: Project-level

๐Ÿ“‹ CLAUDE.md

Project-specific instructions loaded at session start.

Hierarchy

~/.claude/CLAUDE.md           # Global (user-level)
./CLAUDE.md                   # Project root
./src/CLAUDE.md              # Directory-specific

Purpose

  • Define project conventions
  • Specify coding standards
  • Configure tool preferences
  • Set workflow defaults

๐Ÿ–ฅ๏ธ Checkpoints

Resume points for long-running workflows.

%%{init: {'theme': 'base', 'themeVariables': {'lineColor': '#64748b'}}}%%
flowchart LR
    classDef checkpoint fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#ffffff

    subgraph Workflow
        P1["๐Ÿ—๏ธ Phase 1"] --> CP1["๐Ÿ–ฅ๏ธ Checkpoint"]:::checkpoint
        CP1 --> P2["๐Ÿ”— Phase 2"]
        P2 --> CP2["๐Ÿ–ฅ๏ธ Checkpoint"]:::checkpoint
        CP2 --> P3["๐Ÿ“ Phase 3"]
    end

    FAIL["โŒ Failure/Interrupt"] -.->|Resume from| CP2

Checkpoint Data Structure

{
  "workflow_id": "wf_2025_001",
  "current_phase": 2,
  "completed_tasks": ["task_1", "task_2"],
  "pending_tasks": ["task_3", "task_4"],
  "state": {
    "variables": {},
    "context_summary": "..."
  },
  "resume_point": "checkpoint_2",
  "timestamp": "2025-11-28T10:00:00Z"
}

Use Cases

ScenarioWhy Checkpoints?
Large-scale generation1000+ files exceed context limits
Long research tasksDays of research need persistence
Multi-day workflowsCannot complete in single session
Error recoveryResume after failures
Team handoffsDifferent operators continue work

State Interaction Example

%%{init: {'theme': 'base', 'themeVariables': {'lineColor': '#64748b'}}}%%
sequenceDiagram
    participant MA as ๐Ÿ” Main Agent
    participant EL as โšก Execution
    participant SL as ๐Ÿ’พ State Layer

    MA->>SL: Load ๐Ÿ“‹ CLAUDE.md
    SL-->>MA: Project instructions

    MA->>EL: Execute task
    EL->>SL: Read source files
    SL-->>EL: File contents

    EL->>SL: Write output files
    EL->>SL: Update ๐Ÿ’พ memory

    MA->>SL: Save ๐Ÿ–ฅ๏ธ checkpoint
    SL-->>MA: Checkpoint saved

Layer Position

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  โšก LAYER 4: EXECUTION LAYER                        โ”‚
โ”‚  ๐Ÿฆ Subagents, ๐Ÿ”ง Built-in, ๐Ÿ”Œ External, ๐Ÿ’โ€โ™€๏ธ User   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚
                          โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  ๐Ÿ’พ LAYER 5: STATE LAYER  โ—„โ”€โ”€โ”€ YOU ARE HERE        โ”‚
โ”‚  Memory, Files, Context - persistence               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

<div align="center">

โ† โšก Execution Layer โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ—โ”โ”โ”โ”โ”โ”โ”โ”โ” Architecture โ†’

</div>