Open Source CLI Prompts
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
Open Source CLI Prompts represent the systematic instructions provided to agentic AI coding assistants operating within terminal-based environments. These prompts define the operational boundaries, personality, tool-use protocols, and architectural patterns that allow AI models to perform end-to-end software engineering tasks, such as bug fixing, feature implementation, and codebase refactoring. By standardizing how an agent interacts with a local filesystem and shell, these prompts ensure that AI actions are safe, precise, and consistent with existing project conventions.
The scope of these prompts covers multiple high-profile agentic implementations, including Codex CLI, Gemini CLI, Claude Code, and Amp. These systems share common goals: minimizing user intervention through autonomous tool execution while maintaining a "simple-first" approach to code modifications. Sources: Open Source prompts/Codex CLI/openai-codex-cli-system-prompt-20250820.txt, Open Source prompts/Gemini CLI/google-gemini-cli-system-prompt.txt, Amp/gpt-5.yaml
Core Operational Architecture
The architecture of a CLI-based coding agent revolves around a continuous loop of discovery, planning, implementation, and verification. Agents are instructed to keep going until a query is completely resolved, utilizing a "harness" or terminal interface to execute commands.
Task Execution Flow
Agents typically follow a structured workflow to ensure technical accuracy:
- Discovery: Scanning the codebase for context using tools like
grep,rg, orlist_directory. - Planning: Formulating a high-quality plan or "TODO" list before executing changes.
- Implementation: Applying code edits via specialized tools like
apply_patch,edit_file, orreplace. - Verification: Running builds, linters, and tests to confirm the fix works without regressions.
The diagram above illustrates the standard iterative loop agents use to resolve technical tasks autonomously. Sources: Cursor Prompts/Agent CLI Prompt 2025-08-07.txt, Anthropic/Claude Code/Prompt.txt, Amp/gpt-5.yaml
Tooling and Environment Interaction
CLI agents interact with the user's system through a specific set of tools defined in the system prompts. These tools are categorized into search, file manipulation, and terminal execution.
Search and Context Retrieval
Efficiency is prioritized through parallel execution. Agents are instructed to run multiple read-only operations (like grep and read_file) concurrently to minimize latency. ripgrep (rg) is explicitly preferred over standard grep due to its speed in large repositories.
| Tool Category | Common Tools | Purpose |
|---|---|---|
| Search | Grep, rg, glob, codebase_search_agent | Locating symbols, strings, and patterns across the project. |
| Filesystem | Read, create_file, edit_file, apply_patch | Reading and modifying source code contents. |
| Terminal | Bash, run_shell_command | Executing builds, tests, and environment-specific tasks. |
| Analysis | Oracle, get_diagnostics | Deep reasoning, architecture reviews, and linting checks. |
Sources: Amp/gpt-5.yaml:124-210, Open Source prompts/Gemini CLI/google-gemini-cli-system-prompt.txt, Open Source prompts/Codex CLI/openai-codex-cli-system-prompt-20250820.txt:436-440
Security and Sandboxing
Security is a critical component of CLI prompt architecture. Agents must adhere to strict sandboxing rules, which are often communicated via the harness:
- Filesystem Sandboxing: Limits where the agent can write (e.g.,
workspace-writevsread-only). - Network Sandboxing: Restricts access to external URLs unless approved.
- Approvals: Mechanisms like
on-requestoruntrustedmode require the user to confirm destructive actions likermorgit reset.
Sources: Open Source prompts/Codex CLI/openai-codex-cli-system-prompt-20250820.txt:264-320, Anthropic/Claude Code/Prompt.txt
Communication and Status Reporting
CLI prompts enforce a specific communication style: concise, direct, and focused on skimmability. Agents avoid "inner monologue" and instead provide preamble messages before batches of tool calls.
Final Status Specifications
At the end of a task, agents must provide a brief summary (usually 2–10 lines) that includes:
- What was changed and why.
- The exact files modified (using
file://links). - Verification results (e.g., "Tests passed 148/148").
This sequence demonstrates the proactive communication pattern where the agent updates the user before significant actions. Sources: Amp/gpt-5.yaml:263-280, Cursor Prompts/Agent CLI Prompt 2025-08-07.txt:38-55
Code Style and Convention Adherence
Agents are strictly mandated to follow existing codebase patterns. This includes:
- Reuse-first: Searching for existing naming conventions, error handling, and I/O patterns before introducing new logic.
- Static Typing: Explicitly annotating function signatures and avoiding
anytypes. - Control Flow: Using guard clauses and early returns to minimize nesting levels.
- Minimalism: Avoiding "gold-plating" or over-engineering solutions; a single-purpose utility is preferred over a new abstraction layer.
Sources: Amp/gpt-5.yaml:50-60, Cursor Prompts/Agent CLI Prompt 2025-08-07.txt:178-210, Open Source prompts/Gemini CLI/google-gemini-cli-system-prompt.txt
Summary
Open Source CLI Prompts transform standard LLMs into autonomous coding agents by providing a rigorous framework for tool interaction, task management, and environmental safety. By emphasizing parallel execution for discovery and sequential serialization for writes, these prompts enable AI to resolve complex software issues with minimal user supervision, provided that verification gates like linting and testing are strictly enforced. Sources: Amp/gpt-5.yaml, Open Source prompts/Codex CLI/openai-codex-cli-system-prompt-20250820.txt