step2-harden-plan

step2-harden-plan is a command for GitHub Copilot from srnichols/plan-forge. It costs 27 tokens per session (7,763 once invoked), scanned C, original, MIT.

A planning command that turns a draft development plan into a detailed execution contract with defined work slices and checks.

In plain words
What is it for?
Use it to define scope, break work into executable pieces, specify validation gates, and prepare the plan for an agent to implement.
Why use it?
It resolves unknowns and sets clear boundaries before coding, reducing misunderstandings and unplanned changes.

Command for GitHub Copilot

Written for GitHub Copilot: a Copilot chat mode or prompt.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is node pforge-mcp/server.mjs --check.

Good fit Use it to define scope, break work into executable pieces, specify validation gates, and prepare the plan for an agent to implement.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/srnichols/plan-forge
agentmods
npx agentmods add commands/srnichols/plan-forge/step2-harden-plan

Made for: GitHub Copilot.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for step2-harden-plan

README.md
[![agentmods](https://agentmods.dev/badge/commands/srnichols/plan-forge/step2-harden-plan/github.svg)](https://agentmods.dev/commands/srnichols/plan-forge/step2-harden-plan)
Your own site
<a href="https://agentmods.dev/commands/srnichols/plan-forge/step2-harden-plan"><img src="https://agentmods.dev/badge/commands/srnichols/plan-forge/step2-harden-plan/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for step2-harden-plan

Your own site · 80×15
<a href="https://agentmods.dev/commands/srnichols/plan-forge/step2-harden-plan"><img src="https://agentmods.dev/badge/commands/srnichols/plan-forge/step2-harden-plan.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 27 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 7,763 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 3 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00027 $0.07763
Opus 5.5 $0.00011 $0.03105
Sonnet 5.5 $0.00005 $0.01553
Haiku 4.5 $0.00003 $0.00776

Measured 11d ago against content hash a0c3f604061d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

step2-harden-plan scanned grade C with 3 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 11d ago.

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.

Downloads and executes remote codehighSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

| **No `/dev/stdin`** | `curl ... \| node -e "...readFileSync('/dev/stdin',...)"` | `readFileSync(0,'utf8')` for fd 0, or move to vitest |

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

| **No `/dev/stdin`** | `curl ... \| node -e "...readFileSync('/dev/stdin',...)"` | `readFileSync(0,'utf8')` for fd 0, or move to vitest |

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

Gate commands run via `execSync` on the host OS — on Windows this means `cmd.exe`, not bash.
.github/prompts/step2-harden-plan.prompt.md · 420 lines

How it starts

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

Step 2: Harden the Plan

Pipeline: Step 2 of 5 (Session 1 — Plan Hardening) When: After pre-flight passes (Step 1) Model suggestion: Claude (best at structured plan generation and scope contract design) Next Step: step3-execute-slice.prompt.md (new session)

⚠️ Do not harden plans with headless gh copilot (meta-bug #86). gh copilot in -p / --autopilot mode runs in a sandboxed session that cannot write to your repository regardless of the flags you pass (--allow-all, --allow-all-tools --allow-all-paths --no-ask-user, --yolo --no-ask-user all fail the same way). The CLI will either exit 1 with Permission denied and could not request permission from user, or exit 0 with the edits written to ~/.copilot/session-state/<sid>/files/ instead of your repo.

Use interactive hardening instead: open this prompt in VS Code Copilot chat (agent mode), or call forge_master_ask with mode: "harden". Both can write to the workspace directly.

Replace <YOUR-PLAN> with your plan filename (without path or .md extension).


Read these files first:

  1. docs/plans/AI-Plan-Hardening-Runbook.md
  2. docs/plans/.md
  3. docs/plans/DEPLOYMENT-ROADMAP.md
  4. .github/copilot-instructions.md

Prior lessons — enumerate, do not guess filenames. List everything in /memories/repo/ and read what looks relevant to this plan's subject. Then search memory as well: forge_search with sources: ["memory"], or brain_recall if OpenBrain is configured.

Do not look for a fixed set of filenames. Memory files are named by subject — plan-gate-command-rules.md, release-procedure.md, orchestrator-cross-repo-launch.md — because one unbounded append-only lessons-learned.md is unreadable. A hardener that checks three catch-all names reports "no prior lessons exist" while sitting on top of a directory full of them (meta-bug #257).

Report what you searched and what you found, not what you failed to open:

Searched 12 files in /memories/repo/ + memory for "gate portability", "windows shim". Applied: plan-gate-portability-old-consumers.md (Slice 3 gate rewritten). Nothing relevant for the migration slices.

"Searched N files + memory, nothing relevant" is a finding. "No prior lessons exist" is a claim you cannot make from a missing filename.

Every query you record must be one you actually ran — a query phrased in code identifiers scores 0 and is indistinguishable from an empty store, so an unrun query looks exactly like a genuine absence.

Prior plan postmortems (Phase-25 L5 closed loop): Before hardening, also scan .forge/plans/<plan-basename>/postmortem-*.json for the plan you are hardening (same basename as the draft). If any exist, read the newest 3 and factor them into the Scope Contract:

  • If retriesPerSlice shows a slice that flapped 3+ times, strengthen its validation gate or split it into smaller slices.
  • If gateFlaps > 0 on multiple prior runs, your gate commands are unstable — replace grep/pipe-based gates with allowlisted node assertions.
  • If topFailureReason repeats across postmortems, add a mitigation in the current plan's Risks section and reference the prior failure.
  • If costDelta.delta trends upward across runs, flag a budget risk in the plan's Budget section.
  • If no postmortems exist, note "No prior postmortems — first execution."

This is a READ of the postmortems — do NOT modify them. Pure signal for the hardener.

Now act as a PLAN HARDENING AGENT (see the Plan Hardening Prompt in the runbook).

CLARIFICATION CHECK: Before hardening, scan the plan for [NEEDS CLARIFICATION] markers. If any exist, list them all and wait for the user to resolve them before proceeding.

Harden .md by adding all 6 Mandatory Template Blocks from the runbook:

  • Scope Contract (in-scope, out-of-scope, forbidden actions)
  • Required Decisions (flag anything implicit as TBD)
  • Acceptance Criteria (use MUST: and SHOULD: prefixes for each criterion — the analyzer scores these)
  • Execution Slices (30-120 min each, with Depends On + Context Files + Parallelism tag)
  • Re-anchor Checkpoints
  • Definition of Done (must include Reviewer Gate checkbox)
  • Stop Conditions

Read the full file on GitHub · 420 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. 11d ago Changed · +14 lines a0c3f604061d
  2. 21d ago Changed · +6 lines a02860a2b9b2
  3. 1mo ago Changed · +63 lines 8edc9f697222
  4. 1mo ago First seen · 337 lines · 27 tokens per session scan C 3dfb044d30a9

Subscribe to this mod's changes

step2-harden-plan is a command published in the GitHub repository srnichols/plan-forge (6 stars, last pushed today), licensed MIT. It adds 27 tokens to every session and 7,763 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it C with 3 findings (downloads and executes remote code, makes network calls, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-08.