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.
git clone --depth 1 https://github.com/srnichols/plan-forgenpx agentmods add commands/srnichols/plan-forge/step2-harden-planWrote 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.
[](https://agentmods.dev/commands/srnichols/plan-forge/step2-harden-plan)<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.
<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>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.
| Model | Per session | Once 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 |
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. 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 copilotin-p/--autopilotmode 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-userall fail the same way). The CLI will either exit 1 withPermission 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_askwithmode: "harden". Both can write to the workspace directly.
Replace <YOUR-PLAN> with your plan filename (without path or .md extension).
Read these files first:
- docs/plans/AI-Plan-Hardening-Runbook.md
- docs/plans/.md
- docs/plans/DEPLOYMENT-ROADMAP.md
- .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
retriesPerSliceshows a slice that flapped 3+ times, strengthen its validation gate or split it into smaller slices. - If
gateFlaps > 0on multiple prior runs, your gate commands are unstable — replace grep/pipe-based gates with allowlisted node assertions. - If
topFailureReasonrepeats across postmortems, add a mitigation in the current plan's Risks section and reference the prior failure. - If
costDelta.deltatrends 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
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.
- 11d ago Changed · +14 lines a0c3f604061d
- 21d ago Changed · +6 lines a02860a2b9b2
- 1mo ago Changed · +63 lines 8edc9f697222
- 1mo ago First seen · 337 lines · 27 tokens per session scan C 3dfb044d30a9
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.
Other commands, from other repositories
checklist
Generate a custom checklist for the current feature based on user requirements.
clarify
Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec.
specify
Create or update the feature specification from a natural language feature description.
converge
Assess the current codebase against the feature's spec, plan, and tasks, then append any remaining unbuilt work as new tasks to tasks.md so implement can complete it.
speckit.bug.fix
Apply the remediation from a bug assessment and record what was changed.
speckit.bug.test
Validate that a previously fixed bug is resolved and record the verification report.