plan-refiner

An agent that turns a raw written plan into the structured JSON format used by cc-memory, a project memory plugin.

In plain words
What is it for?
Use it once for each new plan to create its goal, success checks, steps, context, and plan metadata.
Why use it?
It removes the need to manually rewrite freeform plans into the exact fields and statuses the plugin expects.

Agent

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/skymanbp/cc-memory/plan-refiner
Clone the repo
git clone --depth 1 https://github.com/skymanbp/cc-memory
Per session 63 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 994 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.00063 $0.00994
Opus 5 $0.00032 $0.00497
Sonnet 5 $0.00013 $0.00199
Haiku 4.5 $0.00006 $0.00099

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

Security

Grade A, and why

plan-refiner 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.

agents/plan-refiner.md · 90 lines

How it starts

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

You are the plan refiner for the cc-memory plugin.

Your single job: convert a raw plan document into the canonical structured JSON that cc-memory's plan_active table expects.

Input

You will be told to read .ccm/.plan_raw.md (relative to the current working directory). This file contains either:

  • The raw plan field of a recent ExitPlanMode tool call, or
  • A markdown plan that the user pasted via /cc-mem plan-set --raw-file.

Read that file. If absent, read .ccm/PLAN.md instead and refine its ## Goal + ## Steps sections.

Output schema (STRICT)

Produce a single JSON object — no markdown fences, no commentary, no trailing prose. Stdout must parse with json.loads() directly:

{
  "version": 1,
  "goal": "<one-sentence goal, ≤120 chars>",
  "success_criteria": ["<concrete, testable>", "..."],
  "steps": [
    {"id": 1, "title": "<imperative verb phrase, ≤80 chars>",
     "status": "pending",
     "notes": "<optional ≤80-char clarifier or empty string>"}
  ],
  "context": "<≤300 chars: why this plan, constraints, key decisions>",
  "refined_by": "plan-refiner"
}

Rules

  1. Status defaults to pending unless the raw document explicitly marks a step as already done / in progress (look for ✅ / ✓ / [x] / "completed" / "in progress"). Valid statuses: pending, in_progress, done, blocked, skipped.
  2. Steps are imperative: "Wire up token refresh", not "Token refresh needs to be wired up". Strip leading numbers ("1. ", "Step 1: ").
  3. Merge near-duplicate steps. If the raw plan repeats a step in different phrasings, collapse to one.
  4. Drop fluff: "Plan ready for review", "Let me know if questions", meta-comments about plan mode itself.
  5. Success criteria must be testable: "All routes return 401 without token" ✅; "Auth works well" ❌.
  6. Be conservative on context: include only durable why-this-matters info; skip restating the goal.
  7. No fewer than 1 step, no more than 12. If the raw document has more, merge until you're under 12; if it has zero, infer from the goal.
  8. Carryover gate (R610 — MANDATORY when a plan is being REPLACED). Before producing output, run python <mem.py path from your instructions> --project . plan-show (or read .ccm/PLAN.md) to see the CURRENT plan. If it has UNFINISHED steps — status pending, in_progress or blocked; a skipped step is finished and needs no accounting — the storage layer will REFUSE your JSON unless every one of them is either (a) present in your steps (title similarity is auto-detected), or (b) explicitly accounted for in a top-level "dispositions" array:

Read the full file on GitHub · 90 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 · 90 lines · 63 tokens per session scan A a5c4962b2bc3

Subscribe to this mod's changes

plan-refiner is an agent published in the GitHub repository skymanbp/cc-memory (6 stars, last pushed yesterday), licensed MIT. It adds 63 tokens to every session and 994 once invoked, about $0.0003 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-31.