Skip to content

🌐 日本語

Lifecycle × Configuration Map ​

NOTE

Shows which configuration layers are active at each phase of Claude Code's task flow.
Configuration names are representative examples. Layers from Parts 3–7 are cut across the lifecycle.

Related Issue: #21

Lifecycle Flow ​

Configuration Effective at Each Phase ​

Session Start (SessionStart → CLAUDE.md Load) ​

Configuration LayerWhat HappensRelated Part
CLAUDE.md (all levels)Merged in order: Global → Project → Local, injected as resident contextPart 3
settings.jsonRuntime settings (permissions, environment variables, thinking mode, etc.) applied. Not injected to LLM contextPart 7
MCP tool definitionsTool definitions from connected MCP servers resident-injected to context (index-only when Tool Search enabled)Part 6
Hook: SessionStartEnvironment check, log initialization. stdout added to contextPart 7
Hook: InstructionsLoadedFires when CLAUDE.md / rules files are loaded. Audit log, compliance trackingPart 7

On User Input (UserPromptSubmit) ​

Configuration LayerWhat HappensRelated Part
Hook: UserPromptSubmitInput validation, additional context injection. stdout added to context. Can block prompt with exit 2Part 7
Prompt HookEvaluate input using LLM with type: "prompt"Part 7

Before Tool Execution (PreToolUse) ​

Configuration LayerWhat HappensRelated Part
.claude/rules/Rules matching glob pattern of target file injected to contextPart 4
SkillsTask-specific procedures deployed to context via automatic LLM judgment or / invocationPart 5
settings.json (permissions)allow / deny rules permit/deny tool use. Hook's deny rule takes priority over allowPart 7
Hook: PreToolUseBlock dangerous commands, rewrite input (updatedInput). Control allow / deny / ask with permissionDecisionPart 7
Hook: PermissionRequestFires when permission dialog shown. Auto-approve/deny possiblePart 7

After Tool Execution (PostToolUse / PostToolUseFailure) ​

Configuration LayerWhat HappensRelated Part
Hook: PostToolUseAuto-format (prettier, etc.), lint execution, logging. Tools already executed, cannot be revertedPart 7
Hook: PostToolUseFailureError log on tool failure, retry decisionPart 7

Sub-Agent and Tasks (SubagentStart/Stop, TaskCreated/Completed) ​

Configuration LayerWhat HappensRelated Part
AgentsExecute in independent context window. Distill results back to mainPart 5
Hook: SubagentStartInject context when sub-agent generatedPart 7
Hook: SubagentStopValidate results on sub-agent completion. Can block with exit 2Part 7
Hook: TaskCreatedEnforce naming conventions, validate on task creationPart 7
Hook: TaskCompletedValidate task completion conditionsPart 7

Response Complete (Stop / StopFailure) ​

Configuration LayerWhat HappensRelated Part
Hook: StopQuality gate, continuation decision. Exit 2 or decision: "block" prevents stop and continues workPart 7
Hook: StopFailureError log on API error, send alertsPart 7
Agent HookSub-agent multi-turn verification (test execution, etc.) with type: "agent"Part 7

Context Compression (PreCompact / PostCompact) ​

Configuration LayerWhat HappensRelated Part
Hook: PreCompactValidate before compression. Backup critical information, etc.Part 7
Hook: PostCompactValidate after compressionPart 7
Hook: SessionStart (matcher: compact)After compression, context re-injection possible on session restartPart 7

Async Events (Fire Parallel to Loop) ​

Configuration LayerWhat HappensRelated Part
Hook: CwdChangedReload environment variables on working directory change (direnv, etc.)Part 7
Hook: FileChangedDetect watched file changes. Specify filename with matcherPart 7
Hook: ConfigChangeSecurity audit on config file change. Can block with exit 2Part 7
Hook: NotificationDesktop notification, alert on notification eventPart 7

Configuration Layer Timing Summary ​

Configuration LayerActive TimingContext Consumption
CLAUDE.mdInjected on session start, resident across all turnsAlways
.claude/rules/Injected when glob matches file operationConditional only
SkillsInjected on / invocation or LLM auto-judgmentOn invocation only
AgentsStarted with Agent() / Task(). Independent contextMain doesn't consume
MCP tool definitionsInjected on session start (index-only with Tool Search)Always (or on search)
settings.jsonAlways applied at runtimeNone
HooksFire at each lifecycle eventNone (except Prompt Hook)

TIP

While problem-countermeasure-map.md shows "structural problem → which configuration solves it," this page shows "which phase of the lifecycle → which configuration is active." Reading both together gives a three-dimensional understanding of the configuration landscape.


NOTE

For detailed Hook events (JSON input/output schema, matcher specs, etc.), see the official reference:
Hooks reference | Hooks guide

Released under the CC BY 4.0 License.