step2-harden-plan

step2-harden-plan is a command for GitHub Copilot from srnichols/plan-forge. It costs 27 tokens per session (5,817 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 5,817 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.05817
Opus 5 $0.00014 $0.02908
Sonnet 5 $0.00005 $0.01163
Haiku 4.5 $0.00003 $0.00582

Measured today against content hash 3dfb044d30a9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, 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 today.

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 · 337 lines

How it starts

The opening of the file, as written. The whole thing — 337 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

Also check for prior phase lessons (if they exist — skip if not found):

  • /memories/repo/conventions.md — patterns and conventions from earlier phases
  • /memories/repo/lessons-learned.md — past mistakes to avoid
  • /memories/repo/forbidden-patterns.md — patterns that caused regressions

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

IMPORTANT: Format Acceptance Criteria as:

- **MUST**: Description of required criterion
- **SHOULD**: Description of recommended criterion

Do NOT use - [ ] checkbox format — the analyzer cannot score checkboxes as effectively.

For each Execution Slice:

  • Tag as [parallel-safe] (with Parallel Group) or [sequential]
  • Include relevant .github/instructions/*.instructions.md files in Context Files
  • List only instruction files whose domain matches the slice (not all 17 — each consumes context budget)
  • Add a Parallel Merge Checkpoint after each parallel group
  • Validation gates MUST be executable commands, not prose descriptions:
    • Good: **Validation Gate**:\n\``bash\ndotnet test\n````
    • Good: **Validation Gate**: \dotnet build``
    • Bad: **Validation Gate**: Files compile, DTOs have correct properties
    • For manual checks that can't be automated, prefix with [manual]: **Validation Gate**: [manual] UI layout matches mockup

Read the full file on GitHub · 337 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. today 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 (5 stars, last pushed today), licensed MIT. It adds 27 tokens to every session and 5,817 once invoked, about $0.0001 per session on Opus 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.