Prompt Pipeline

CLI-JAW assembles system prompts through a multi-layer pipeline: static templates (A1/A2), dynamic injection (memory, orchestration, skills), disk caching (B.md/AGENTS.md), and per-CLI spawn adapters.

Assembly Order

The getSystemPrompt() function in src/prompt/builder.ts assembles the prompt in this order:

  1. A-1.md -- System rules (browser control, memory, heartbeat, delegation)
  2. A-2.md -- User settings (identity, vibe, working directory)
  3. Memory injection -- Advanced (profile + soul + task snapshot) or legacy fallback
  4. Orchestration section -- Employee dispatch rules + PABCD guide
  5. Heartbeat jobs -- Scheduled task descriptions from heartbeat.json
  6. Skills section -- Active skills inline + available skill list
  7. Vision-click hint -- Codex-only legacy fallback for desktop automation
  8. Delegation rules -- CLI sub-agents vs jaw employees distinction

Static Templates

A-1.md (System Rules)

Path: ~/.cli-jaw/prompts/A-1.md. Falls back to src/prompt/templates/a1-system.md (305 lines). Contains core system behavior: browser control rules, memory/heartbeat instructions, jaw employee vs CLI sub-agent distinctions, and channel send rules.

A-1.md uses hash-based migration. If you have not customized it, template updates apply automatically. Custom A-1 files are preserved.

A-2.md (User Settings)

Path: ~/.cli-jaw/prompts/A-2.md. Template: a2-default.md (25 lines). Contains identity, user preferences, vibe, and working directory hints. Created only if missing -- never overwritten.

Dynamic Injection

Memory Injection

Two paths depending on index readiness:

Injection is role-aware: boss gets the full snapshot, employee/subagent gets a reduced profile, and flush role gets no memory injection.

Orchestration

If at least one employee is registered, the orchestration.md template is injected with cli-jaw dispatch usage examples. If skills/dev-pabcd/SKILL.md exists, a PABCD Orchestration Guide follows.

Heartbeat

Active heartbeat jobs from ~/.cli-jaw/heartbeat.json are rendered with their enabled state, human-readable schedule, and prompt preview.

Skills

Active skills (~/.cli-jaw/skills/*/SKILL.md) are rendered inline. Reference skills (~/.cli-jaw/skills_ref/registry.json) are listed as available for discovery.

Disk Cache (B.md)

regenerateB() creates a cached version of the system prompt for disk:

OutputPurpose
~/.cli-jaw/prompts/B.mdDebug and cache file
{workDir}/AGENTS.mdAuto-read by Codex, Copilot, OpenCode

Content hash is checked -- files are only rewritten when the prompt actually changes, preserving resume continuity.

Per-CLI Spawn Input

Each CLI runtime receives the prompt differently:

CLISystem PromptUser Input
ClaudebuildArgs(..., sysPrompt)stdin: withHistoryPrompt(prompt, historyBlock)
CodexAGENTS.md auto-loadedstdin: [User Message] block
GeminiGEMINI_SYSTEM_MD tmpfileArgs-level prompt
AGYNo system prompt flagagy -p <prompt>
CursorAGENTS.md / CLAUDE.md auto-loadedArgs-level prompt
GrokCWD instruction files-p <prompt>
CopilotACP + cwd instruction filessession/prompt()

History Block

On new sessions (not resume), buildHistoryBlock() prepends recent conversation context:

[Recent Context]
assistant: Previous response summary...
user: Previous question...

---
[Current Message]
Your new prompt here

Customizing Prompts

Edit ~/.cli-jaw/prompts/A-2.md to customize identity, preferences, and working directory. Use /prompt to preview the current A2 content. The Web UI settings panel also provides a prompt template editor.

Try it:
  • 시스템 프롬프트 보여줘
  • 프롬프트 커스터마이징 하고 싶어