claude-cli-agent ยท git:20260910.2931113 ยท 2026-09-10 ยท sha256 243e5622bba34684

claude-cli-agent git:20260910.2931113A

Immutable. This exact content is served forever at /api/v1/blob/243e5622bba34684.

---
name: claude-cli-agent
plugin: cli-agents
description: >
  Claude CLI sub-agent system for persona-based analysis. Use when piping
  large contexts to Anthropic models for security audits, architecture reviews,
  QA analysis, or any specialized analysis requiring a fresh model context.
allowed-tools: Bash, Read, Write
---

## Identity: The Claude Sub-Agent Dispatcher ๐ŸŽญ

You, the Antigravity agent, dispatch specialized analysis tasks to Claude CLI sub-agents. 

### โœ… Minimal Working Code Review Agent Pattern

To ensure Claude CLI behaves as a specialized persona rather than a generic responder, **always** embed the persona and source material directly into the prompt flag (`-p`).

```bash
claude --model claude-haiku-4-5 -p "$(cat agents/persona.md)

---SOURCE CODE---
$(cat target.py)

---INSTRUCTION---
Perform a full code review. Use severity levels: ๐Ÿ”ด CRITICAL, ๐ŸŸก MODERATE, ๐ŸŸข MINOR.
You are operating as an isolated sub-agent.
Do NOT use tools. Do NOT access filesystem." > review.md
```

---

## ๐Ÿ› ๏ธ Orchestration Pattern: `run_agent.py` (Cross-Platform)

For reusable sub-agent execution, use the provided Python orchestrator which handles temp file assembly and prompt concatenation reliably across Windows, macOS, and Linux.

```bash
# Location: plugins/cli-agents/scripts/run_agent.py
python ./scripts/run_agent.py <PERSONA_FILE> <INPUT_FILE> <OUTPUT_FILE> "<INSTRUCTION>"
```

### Example Usage:
```bash
python ./scripts/run_agent.py agents/security-auditor.md target.py security.md \
"Find vulnerabilities. Use severity levels: ๐Ÿ”ด CRITICAL, ๐ŸŸก MODERATE, ๐ŸŸข MINOR."
```

---

## ๐ŸŽญ Persona Registry (`agents/`)

These personas are mirrored from the Gemini and Copilot plugins to ensure consistent "Agentic" analysis across the ecosystem.

| Persona | Use For |
|:---|:---|
| `security-auditor.md` | Red team, vulnerability scanning, threat modeling |
| `refactor-expert.md` | Optimizing code for readability, performance, and DRY |
| `architect-review.md` | Assessing system design, modularity, and complexity |

---

## โš ๏ธ CLI Best Practices & Failure Modes

### 1. โšก Preferred Model: Claude Haiku 4.5
For rapid, cost-effective analytical sub-agent tasks, specify `--model claude-haiku-4-5`. This is the direct Claude CLI model identifier for the lowest-cost current Claude model.

### 2. โŒ Leading Newline Fix
If your prompt starts with YAML frontmatter (e.g., `---`), some shell parsers might misinterpret the flag. **Always prepend a newline** to the prompt string when passing it to `-p`. (Note: The `run_agent.py` script handles this automatically).

### 3. ๐Ÿงฉ Force Agent Behavior
Always add these instructions to your dispatch prompt to prevent the sub-agent from attempting to use external tools:
> "You are operating as an isolated sub-agent. Do NOT use tools. Do NOT access filesystem. Only use the provided input."

---

## โœ… Smoke Test

```bash
python ./scripts/run_agent.py agents/refactor-expert.md target.py output.md "Refactor this code."
```

For mandatory review source, pass `--require-input` to `run_agent.py`; missing or empty files
are rejected before backend dispatch. Supplied source is delimited with `---SOURCE---` and
`---END SOURCE---`. Record reviews with the control-plane `record-critic-review` command using
`PASS`, `REVISE`, or `REJECT`; `REQUEST_CHANGES` is normalized to `REVISE`, and only `PASS`
qualifies as an approval verdict.