prompt-assembly-architecturelisted
Install: claude install-skill Beidou1507/code-claw
# Prompt Assembly Architecture
## Overview
Treat prompt construction as a pipeline, not as ad hoc string concatenation. Keep a long-lived static prefix stable, inject volatile sections late, and make cache behavior an explicit design concern.
## Source Anchors
- `src/constants/prompts.ts`
- `SYSTEM_PROMPT_DYNAMIC_BOUNDARY`
- `getSessionSpecificGuidanceSection()`
- `getSystemPrompt()`
## Workflow
1. Inventory every prompt ingredient and classify it as stable across sessions or volatile per turn.
2. Keep identity framing, baseline behavior, safety rules, and universal formatting in the static zone.
3. Move language preference, environment details, skill discovery, MCP instructions, memory, scratchpad, and token budget into the dynamic zone.
4. Add an explicit boundary marker so the cache layer, debugging tools, and API layer all split at the same point.
5. Manage dynamic sections through a registry or resolver rather than scattered string appends.
6. Place any runtime feature gate that can change the prefix hash after the boundary, or resolve it lazily.
7. Return prompt sections as an array and join them only at the end so testing, filtering, and diffing stay simple.
8. Assign stable IDs to sections so you can trace regressions, cache misses, and section-level changes.
## Design Rules
- Keep the static prefix as long and as stable as possible.
- Separate identity framing, behavioral policy, and tool guidance instead of letting them overlap.
- Treat runtime variability a