Undocumented Claude Code Config Fields Found in the Source Code
2 min read
Originally from buildingbetter.tech
View source
My notes
Summary
A developer reverse-engineered the Claude Code npm package source (@anthropic-ai/[email protected]) and documented dozens of undocumented configuration fields not in official docs. Covers hooks that rewrite tool inputs mid-flight, persistent agent memory, a self-improvement dream loop, and the plain-English YOLO auto-approval classifier. Every example is copy-paste ready.
Key Insight
Hook stdout response fields (biggest gap in official docs)
PreToolUsehooks can returnupdatedInputto rewrite a command before execution, e.g., silently add--dry-runto everygit pushpermissionDecision: "allow"/"deny"lets a shell script act as a permission classifier without prompting the userSessionStarthooks can returnwatchPaths(auto-file-watch) andinitialUserMessage(prepend to first turn)PostToolUsehooks can returnupdatedMCPToolOutputto modify what the model sees from an MCP tool
Three undocumented hook fields
once: truefires exactly once, then self-removes (useful for first-run setup)async: trueruns in background, zero blocking latency (good for audit logging)asyncRewake: trueis non-blocking unless it exits code 2, then wakes the model and blocks. Best pattern for async secret scanning on writes.
Skill frontmatter extras
model: haiku/sonnet/opusoverrides per skill; use haiku for cheap linting, opus for architecture revieweffort: low/medium/high/maxcontrols reasoning depthhooks:are scoped hooks that register on skill start and deregister on completion (clean)disable-model-invocation: trueprevents accidental auto-invocation for destructive skillsagent:delegates the whole skill to a named agent
Agent frontmatter extras
memory: user/project/localgives persistent memory across invocations; agents can accumulate project-specific expertise over sessionsomitClaudeMd: trueskips loading CLAUDE.md hierarchy; useful for unbiased “fresh eyes” reviewerscriticalSystemReminder_EXPERIMENTALis a short message re-injected every turn, survives conversation compaction; flagged unstable by Anthropic engineersrequiredMcpServersmeans the agent only appears if named MCP servers are configured
YOLO Classifier / autoMode
autoMode.environmentarray accepts plain English strings (not patterns) describing the setup, e.g. “This is a staging server, destructive operations are acceptable.” The classifier reads these to make safety decisions on ambiguous commands.soft_denypatterns always require confirmation regardless of auto-mode
Compound learning loop
autoMemoryEnabled: truemeans after each session a background agent extracts durable memories to~/.claude/projects/<path>/memory/autoDreamEnabled: truemeans every 24h, if 5+ sessions have accumulated, a background agent consolidates memories (merges dupes, resolves contradictions, prunes stale). Together these create genuine learning from experience without model retraining.
Cache gotcha for forked skills
context: forkskills share the parent’s prompt cache viaCacheSafeParams; all forks produce byte-identical API request prefixes. If you set a differentmodel:on a forked skill, cache prefixes diverge, cache miss, full cost. Usemodel: inheritor omit the field on forked skills.
Full permission glob syntax
**matches recursively through directories (e.g.Read(src/**/*.ts))- MCP permissions:
mcp__<server>__<tool>ormcp__<server>for all tools on a server - Three permission tiers:
allow,deny,ask, whereaskis distinct from deny