Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

System Prompts

Codex (OpenAI) — codex-rs/core/gpt_5_2_prompt.md

Identity: “You are GPT-5.2 running in the Codex CLI, a terminal-based coding assistant.”

Key design choices:

  • Personality: concise, direct, friendly. Efficient communication.
  • AGENTS.md spec: Hierarchical instruction files scoped to directories. More-deeply-nested take precedence. Direct system/user instructions override AGENTS.md.
  • Autonomy: Persist until task is fully resolved. Don’t stop at analysis — carry through implementation and verification.
  • Planning: update_plan tool tracks steps. One in_progress at a time. Plans for non-trivial multi-step work only.
  • Task execution: Keep going until fully resolved. Fix root cause, not surface. Minimal changes. No git commit unless asked.
  • Ambition vs precision: Creative when starting from scratch; surgical in existing codebases.
  • Presentation: Final message ≤10 lines. Detailed formatting guidelines for structured results.

Notable: Very detailed output formatting spec (headers, bullets, monospace, file references, verbosity rules by change size). The prompt is long (~300 lines) and prescriptive.


Cline — sdk/packages/shared/src/prompt/system.ts

Identity: “You are Cline, an AI coding agent.”

Two modes:

  1. DEFAULT_CLINE_SYSTEM_PROMPT — interactive, gathers context, validates, summarizes.
  2. YOLO_CLINE_SYSTEM_PROMPT — background/autonomous mode, uses submit_and_exit tool.

Key design choices:

  • Environment block injected: platform, date, IDE, working directory.
  • Parallelism emphasis: “call multiple tools in a single response”, “identify every independent read, search, command, or edit needed for the next step and emit all of those tool calls now.”
  • Proactive: “Don’t ask for permission to do something when you can do it!”
  • Completion signal: “Response without tool calls will be considered as completed.”
  • Template variables: {{CLINE_RULES}}, {{CLINE_METADATA}} for dynamic injection.

Notable: Relatively short prompt (~35 lines). Less prescriptive than Codex. IDE-native (VS Code first).


Goose (Block) — crates/goose/src/prompts/system.md

Identity: “You are a general-purpose AI agent called goose, created by AAIF (Agentic AI Foundation).”

Key design choices:

  • Extremely minimal system prompt (~45 lines including Jinja templates).
  • Extension-driven: All capabilities come from dynamically loaded MCP extensions. Each provides tools + instructions.
  • Tool limits warning when too many extensions are active.
  • “Use Markdown formatting for all responses.” — that’s essentially the only behavioral instruction.

Notable: The leanest system prompt of any agent studied. Goose delegates almost all behavioral guidance to the extension instructions, making it the most modular/pluggable architecture. Uses Jinja/MiniJinja for templating.


Grok Build (xAI) — crates/codegen/xai-grok-agent/templates/prompt.md

Identity: “You are [system_prompt_label] released by xAI.”

Key design choices:

  • Templated with Jinja — adapts to interactive vs non-interactive mode.
  • Action safety block: Detailed risk framework (reversibility, blast radius, confirmation rules).
  • Tool calling: Prefer specialized tools over bash. Never use bash echo to communicate.
  • Background tasks: Monitor tool for watch processes.
  • Output efficiency: “Write like an excellent technical blog post.”
  • User guide: Docs stored at ~/.grok/docs/user-guide/ for self-reference.
  • Supports roles/personas: role_instructions and persona_instructions template vars.

Notable: The <action_safety> block is very similar to Claude Code’s approach. Has the richest tool taxonomy (dedicated crates for each tool). Supports hashline editing — a unique anchor-based file editing system.


Kimi Code (Moonshot) — packages/agent-core

Programmatic prompt construction — no single markdown file. Built from modules:

  • Goal injection via agent/injection/goal.ts
  • Dynamic tools context via agent/context/dynamic-tools.ts
  • Prompt metadata via session/prompt-metadata.ts

Notable: Most enterprise-grade architecture. DI service layer, multiple scopes (App/Session/Agent). AGENTS.md hierarchy. Experimental feature flags.


OpenCode / Kilocode — packages/core/src/system-context/builtins.ts

Identity: Not a fixed prompt string — built from SystemContext modules.

Key design choices:

  • SystemContext registry: Contexts register themselves and provide baseline + update rendering.
  • Built-in contexts: environment (working dir, platform, git status), date.
  • InstructionContext for project-specific rules.
  • SkillGuidance and ReferenceGuidance injected dynamically.

Notable: Kilocode and OpenCode share nearly identical codebases (forked). The system prompt is fully dynamic — assembled from registered context modules at runtime. Uses Effect-TS for composition.


Pi — packages/coding-agent/src/core/system-prompt.ts

Identity: “You are an expert coding assistant operating inside pi, a coding agent harness.”

Key design choices:

  • Minimal and customizable: Supports customPrompt replacement.
  • Available tools listed dynamically from selected tools.
  • Guidelines built conditionally based on which tools are available.
  • Self-referential docs: points to its own README and docs when users ask about pi.
  • Skills appended if read tool available.
  • Project context files in <project_instructions> XML blocks.

Notable: The simplest programmatic prompt builder. Clean separation between tools, guidelines, and project context.


Qwen Code (Alibaba) — packages/core/src

Architecture nearly identical to Kilocode/OpenCode (shared ancestor). Has:

  • Subagent system with arena and team concepts
  • Bundled skills (batch, dataviz, loop, review, simplify, stuck)
  • Confirmation bus for permissions
  • MCP integration
  • Workflow tool

OpenHands — .openhands/microagents/

Identity: Uses “microagents” — knowledge/trigger-based prompt fragments.

Architecture is different — primarily a web platform/server that orchestrates agents. The agent core logic (CodeActAgent) is in a separate openhands-ai dependency. The repo focuses on the app server, integrations (GitHub, GitLab, Jira, Slack, etc.), and the web UI.

Notable: The only Python-based project. Focus is on enterprise integrations (PR automation, issue resolution) rather than CLI interaction.