Engel shared a great resource on how Claude Code o...
# proj-agent
m
Engel shared a great resource on how Claude Code organizes its system prompt construction: https://www.markdown.engineering/learn-claude-code/39-system-prompt TL;DR: Claude Code doesn't use a static system prompt — it dynamically assembles one through a 6-layer pipeline: 1. Priority Resolver — Waterfall to determine which prompt mode runs (override → coordinator → agent → custom → default) 2. Content Factory — Splits content into static (cacheable) vs dynamic (session-specific) sections via a boundary marker 3. Dynamic Section Registry — Two caching strategies: memoized (once per session) vs volatile (recomputed every turn, e.g., MCP) 4. CLAUDE.md Loading — Multi-scope file discovery with priority ordering,
@include
directives, and path-based filtering 5. Auto-Memory System — Per-project memory with truncation limits (200 lines / 25KB) 6. Cache Boundary — Explicit split for API prompt caching optimization Interesting details: • Environment info includes CWD, git status, platform, model info, knowledge cutoff • Subagents get a stripped-down prompt focused on task completion •
CLAUDE_CODE_SIMPLE=1
reduces prompt to 3 lines for benchmarking raw model capability For OpenHands SDK — potential discussion points: • Should we also refactor the prompt creation to have multiple layers? Like a chain of responsabilities? • We already have similar logic for some of this (Content Factory, AGENTS.md loading) • Worth exploring: different system prompts for different launch modes (existing issue?) • Auto-memory system could be a roadmap item • Should we keep system prompt minimal and let skills handle most things? • Data-driven system prompt/skills improvements now that we have more data • Specific skills for known weak spots (e.g., math verification via scripts for GAIA) Would love to hear everyone's thoughts on this! If there's interest, I'll take care of creating the relevant issues. cc @calm-artist-7206, @millions-crayon-32880, @chilly-france-44439, @limited-student-10747
m
Seems like a mix of System prompt, planning, agents.md, maybe condesation too.
m
What do you mean?
c
Auto-Memory System — Per-project memory with truncation limits (200 lines / 25KB)
I feel like we should definitely create an issue for this item -- OpenClaw already have a decent memory system and maybe we should just copy that - irrc, they have permissive license 😄
nod 1
> Worth exploring: different system prompts for different launch modes (existing issue?) This is existing issue 🙂 - when we've done this we should mostly have this: "Should we also refactor the prompt creation to have multiple layers? Like a chain of responsabilities?" https://github.com/OpenHands/software-agent-sdk/issues/1317 https://github.com/OpenHands/software-agent-sdk/issues/85
c
IMHO, memory is the big unsolved issue that someone will solve, and it's incredibly important in my view, that Open Source does 🙏 On a completely different note, somehow on topic here, since CC has this kind of tool, we just got this suggestion: https://github.com/OpenHands/software-agent-sdk/issues/2697
👍 1
m