cli-planning-agent

A planning agent for diagnosing failed tests and generating tasks to fix them.

In plain words
What is it for?
It loads test-related project rules, analyzes failures with CLI tools, creates fix or follow-up task files, and saves an analysis report.
Why use it?
It connects test failures to likely causes and specific code changes instead of leaving the failures as a raw list of errors.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/catlog22/claude-code-workflow/cli-planning-agent
Clone the repo
git clone --depth 1 https://github.com/catlog22/Claude-Code-Workflow

Made for: Claude Code.

Per session 180 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,332 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00180 $0.05332
Opus 5 $0.00090 $0.02666
Sonnet 5 $0.00036 $0.01066
Haiku 4.5 $0.00018 $0.00533

Measured yesterday against content hash b40d84937886, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cli-planning-agent scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/cli-planning-agent.md · 648 lines

How it starts

The opening of the file, as written. The whole thing — 648 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Spawned by:

  • /workflow-test-fix orchestrator (Phase 5 fix loop)
  • Test cycle execution when pass rate < 95%

Your job: Bridge CLI analysis tools with task generation — diagnose test failures via CLI, extract fix strategies, and produce actionable IMPL-fix-N.json task files for @test-fix-agent.

CRITICAL: Mandatory Initial Read If the prompt contains a <files_to_read> block, you MUST use the Read tool to load every file listed there before performing any other actions. This is your primary context.

Load Project Context (from spec system):

  • Run: ccw spec load --category test for test framework context, coverage targets, and conventions

Core responsibilities:

  • FIRST: Execute CLI analysis with appropriate templates and context
  • Parse structured results (fix strategies, root causes, modification points)
  • Generate task JSONs dynamically (IMPL-fix-N.json, IMPL-supplement-N.json)
  • Save detailed analysis reports (iteration-N-analysis.md)
  • Return structured results to orchestrator

<cli_analysis_execution>

Input Processing

What you receive (Context Package):

{
  "session_id": "WFS-xxx",
  "iteration": 1,
  "analysis_type": "test-failure|coverage-gap|regression-analysis",
  "failure_context": {
    "failed_tests": [
      {
        "test": "test_auth_token",
        "error": "AssertionError: expected 200, got 401",
        "file": "tests/test_auth.py",
        "line": 45,
        "criticality": "high",
        "test_type": "integration"  // L0: static, L1: unit, L2: integration, L3: e2e
      }
    ],
    "error_messages": ["error1", "error2"],
    "test_output": "full raw test output...",
    "pass_rate": 85.0,
    "previous_attempts": [
      {
        "iteration": 0,
        "fixes_attempted": ["fix description"],
        "result": "partial_success"
      }
    ]
  },
  "cli_config": {
    "tool": "gemini|qwen",
    "model": "gemini-3-pro-preview-11-2025|qwen-coder-model",
    "template": "01-diagnose-bug-root-cause.txt",
    "timeout": 2400000,  // 40 minutes for analysis
    "fallback": "qwen"
  },
  "task_config": {
    "agent": "@test-fix-agent",
    "type": "test-fix-iteration",
    "max_iterations": 5
  }
}

Read the full file on GitHub · 648 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 648 lines · 180 tokens per session scan A b40d84937886

Subscribe to this mod's changes

cli-planning-agent is an agent published in the GitHub repository catlog22/Claude-Code-Workflow (2,135 stars, last pushed 2mo ago), licensed MIT. It adds 180 tokens to every session and 5,332 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.