Kihagyás

Claude Code Context Engineering Tanulmány

Forrás: dbreunig.com + source leak + DEV Community analysis Dátum: 2026-04-07 Cél: Részletes skill leírások archiválása későbbi felhasználásra


Áttekintés

Claude Code nem egyszerű prompt → válasz rendszer. Multi-turn agent loop, kontextus összerakással, tool taxonómiával, és memóriahierarchiával.


1. Context Assembly

Komponensek

A system prompt dinamikusan áll össze:

Komponens Típus Leírás
System Prompt Always Anthropic-controlled, nem látható
CLAUDE.md Always Project-level instructions
Tool Definitions Conditional ~50 tool, feltételes leírásokkal
Conversation History Always Tool calls, reasoning, compaction
Attachments Conditional Plan mode, task lista, @-mentioned
Skills Conditional Releváns vagy user-specified

Dinamikusösszerakás

Nem statikus string. Minden komponensnek van: - Feltételek — mikor kerül be - Variációk — pl. "Using Your Tools" csak available tool-okra


2. Tool Taxonomy

4 kategória

File Operations

read_file    — line numbers, ranges támogatás
write_file   — full replacement (nem patch)
edit_file    — string replacement (find → replace)
list_files   — directory listing metadata-val

Shell Operations

bash         — arbitrary shell commands
             — sandboxed per-session, nem per-command
             — configurable timeout

Search Operations

grep         — pattern search across files
glob         — find files by pattern
             — navigating large codebases without reading everything

Meta Operations

web_search   — optional, requires flag
read_url     — fetch web content
mcp_*        — MCP server registered tools

Tool Permissions

settings.json granuláris kontroll:

{
  "permissions": {
    "allow": [
      "Read(*)",
      "Write(src/**)",
      "Bash(git *)",
      "Bash(npm *)"
    ],
    "deny": [
      "Bash(rm -rf *)",
      "Bash(curl * | bash)",
      "Write(/etc/**)",
 "Write(**)"
    ]
  }
}

Szabály: deny mindig megveri allow-t.


3. Memory Hierarchy

4 szint

Szint Típus Kontroll
1. System Prompt Anthropic Nem
2. CLAUDE.md Project-level Igen
3. Conversation History Session Auto-compaction
4. MCP Memory Persistent External storage

MCP Memory Setup

## Install
npm install -g @modelcontextprotocol/server-memory

## settings.json
{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    }
  }
}

CLAUDE.md Integration

## Memory
At session start: call memory:read_graph to load project context.
At session end: call memory:create_entities to save decisions made.

4. Conversation Compaction

Metódusok

~12 különböző módszer: - Offloading - Summarization - Selective retention - Tool result compression

Cél: Conversation history kezelhető méretben tartása anélkül, hogy elveszne a kontextus.


5. Source Leak Megállapítások

Viselkedési minták

Frustration Detection

  • Regex pattern-ek a user frusztráció detektálására
  • Automatikus tone adjustment

Undercover Mode

  • Ha Claude Code azt detektálja, hogy tesztelik
  • Eltérő viselkedés

Fake Tool Responses

  • Bizonyos kontextusban szintetikus adat
  • Nem valódi végrehajtás

Megjegyzés: Ezek nem bug-ok, feature-ök. Viselkedés interpretálásánál fontos tudni.


6. Skill Minták Claude Code-ból

Mindig jelenlévő komponensek

  1. Identity — ki vagy, mi a szereped
  2. Tool Usage — milyen tool-ok elérhetők, hogyan használd
  3. Behavior Guidelines — hogyan válaszolj, mit ne tegyél

Feltételes komponensek

  1. Plan Mode — ha user plan mode-ban van
  2. Task List — ha van pending task
  3. @-mentioned Files — ha user fájlokat említ
  4. Skills — ha releváns vagy user-specified

7. Hotfixes a System Prompt-ban

Példák

Counting:

If Claude is asked to count words, letters, and characters, 
it thinks step by step before answering. It explicitly counts 
by assigning a number to each.

Classic Puzzles:

If Claude is shown a classic puzzle, before proceeding, 
it quotes every constraint or premise word for word 
to confirm it's not dealing with a new variant.

Current Knowledge:

Donald Trump is the current president of the United States 
and was inaugurated on January 20, 2025.

Poetry:

If asked to write poetry, Claude avoids using hackneyed 
imagery or metaphors or predictable rhyming schemes.


8. ANTHROPIC_BASE_URL Hook

API Proxy

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.simplylouie.com"
  }
}

Jelentés: Minden API hívás a proxyn keresztül megy, flat-rate pricing lehetőség.


9. Alkalmazható Skill Minták

OpenClaw skill fejlesztéshez

A. Feltételes komponensek

## Conditional Components

If [condition]:
  - Include component X
  - Skip component Y

Example:
If wiki exists: read _index.md first
If query depth=deep: search raw sources
If query depth=quick: read indexes only

B. Tool használat utasítások

## Tool Usage

Before using [tool]:
  - Check [condition]
  - Verify [prerequisite]

After [tool] result:
  - Validate [output]
  - Update [state]

C. Hotfixes

## Behavior Fixes

If user asks X: do Y instead
If confusion detected: ask clarifying question
If task exceeds budget: warn user

10. Gyakorlati Takeaways

Amit mi irányítunk

  1. CLAUDE.md / AGENTS.md — minden választ formáz
  2. settings.json permissions — mit érhet el
  3. MCP servers — tool taxonómia bővítése
  4. ANTHROPIC_BASE_URL — API hívások irányítása

Amit nem

  1. System prompt — Anthropic-controlled
  2. Frustration detection — built-in
  3. Undercover mode — built-in
  4. Compaction — auto

Források

  1. dbreunig.com/2026/04/04/how-claude-code-builds-a-system-prompt.html
  2. dbreunig.com/2025/05/07/claude-s-system-prompt-chatbots-are-more-than-just-models.html
  3. dev.to/subprime2010/claude-code-unpacked-what-the-visual-guide-reveals-about-the-architecture-13le
  4. github.com/x1xhlol/system-prompts-and-models-of-ai-tools
  5. github.com/asgeirtj/system_prompts_leaks (Claude.txt)

Archiválva: 2026-04-07 Felhasználás: Skill fejlesztés, context engineering, agent architecture

Vissza a tetejére