Claude Skill

forge

Forge an issue, ticket, or PR into a shipped fix: propose a plan, get it approved, then implement, review, and refactor. Use when the user runs /forge or asks to investigate, fix, resolve, triage, or solve one. See Parameters for modifier flags.

LLM Mart · 0 points · 21 views 2 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download radimsem-forge-skills-skills_forge-2e1b70d.zip · 56 KB
Part of radimsem/forge-skills — 3 skills

Install

skills CLI npx skills add https://github.com/radimsem/forge-skills/tree/main/skills/forge
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install radimsem-forge-skills@llmmart
Git git clone https://github.com/radimsem/forge-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole radimsem/forge-skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

Forge

Forge an issue into a shipped fix: heat it (implement), hammer it (review loop), then temper it (refactor).

Overview

Turn an issue or ticket reference into a verified, branch-correct, user-approved plan. Then, only after the user confirms (or immediately under automode), run the implementation lifecycle.

One numbered workflow (Steps 1–12), split by a single gate:

Part 1 — Gate (Steps 1–6):   classify → fetch → branch → context → propose → [GATE] approve
Part 2 — Lifecycle (7–12):   implement → review-loop → refactor → spin-off → self-evolve → close

  gate held: nothing touches the codebase until "yes, implement"  (automode = only sanctioned bypass)
  • Part 1 — The gate. The contract; do not weaken it.
  • Part 2 — Lifecycle. Runs autonomously after approval, stopping only at substantive gates (the Autonomy section).

"The agent" means whatever agent runs this skill. Adapt every reference (config directory, agent guide, interview UI) to your runtime. Nothing is hardcoded to one assistant.

Parameters

Parse the invocation as /forge <ref> [automode] [docs] [tdd] [worktree] [lookup] [secure] [changelog] [ci-watch] [compress] [implement] [codex | codex challenge | codex impl [challenge]] [coderabbit] [code-review], or /forge pr <N> [...], or /forge plan <path>[#<slug>] [...]. The words can appear anywhere in the request. A <ref> resolves to a git-host issue or a Jira ticket per the grammar below, and the pr <N> form selects PR-review entry mode. Flags are orthogonal and compose freely; some modes have their own allowed or ignored flags, listed in references/modes/pr-entry.md for PR mode.

Full flag matrix (effects, composition rules, conflicts): references/flags.md.

Target grammar — <ref>

The target is the first reference-shaped token, or the token right after a ticket or pr keyword. Routing works by keyword or by key-shape:

Form Routes to Examples
bare number, #N, issue N git-host issue (Step 1b) forge 42, fix #123, issue 7
matches [A-Z]+-\d+ Jira ticket OR Linear issue (disambiguate if both configured — see references/trackers/linear.md) forge PROJ-123, solve ENG-42, forge AB12-9
after ticket keyword Jira ticket; number-only → ask project key forge ticket PROJ-123, solve ticket 42
after linear keyword Linear issue (forces Linear routing, skips disambiguation) forge linear ENG-42
after pr keyword PR-review entry mode (skips Steps 4–7; enters at Step 8 against the PR diff) forge pr 47, forge pr #123
after plan keyword plan-entry mode (replaces Steps 1, 2, 4–6 with a single Step P validation pass; Step 3 still runs; enters at Step 7 against the plan slice) forge plan docs/superpowers/plans/x.md#task-3

A bare number routes to a tracker only if ticket or linear precedes it, and PR mode requires the pr keyword. A key-shaped ref is either Jira or Linear: when both trackers are configured, the agent disambiguates per the Jira/Linear disambiguation section in references/trackers/linear.md. Single-tracker setups skip the prompt.

Read references/modes/pr-entry.md for the PR-entry mode step modifications, the allowed and ignored flags, and the PR-specific Step 12 closing menu.

Read references/modes/plan-entry.md for the plan-entry step modifications and slice addressing.

Modifier flags

Each line says what the flag does and where it acts; the linked file owns the details.

  • (none) — interview the user if a required field is missing, propose, then wait at the gate. The review uses the project reviewer agents plus superpowers:requesting-code-review.
  • automode — runs with no user gates and the agent decides Steps 6, 9, and 11. It never auto-commits, auto-pushes, or writes back to Jira; that is a hard floor. See references/autonomy.md.
  • docs — works from documentation: the proposal goes to CONTEXT.md and the plan is sourced from it, and grilling uses /grill-with-docs instead of /grill-me.
  • tdd — Step 7 writes the failing test first, observes it fail, then implements. See references/modes/tdd.md.
  • worktree — Step 3 creates a sibling worktree instead of switching branch in place. See references/modes/worktree.md.
  • lookup — Step 4 fetches current docs for every library the issue names. See references/modes/lookup.md.
  • secure — adds a security-review pass at Step 8 once the regular review converges, before Step 9. See references/modes/secure.md.
  • changelog — Step 12 drafts a changelog entry in the repo's existing format. See references/modes/changelog.md.
  • ci-watch — after a Step 12 push, polls CI; a red result reopens Step 8. See references/modes/ci-watch.md.
  • compress — sources a token-saving output skill for the whole session before Step 1: ponytail if installed, else caveman; if neither is installed, the flag is ignored with a one-line note. See references/modes/compress.md.
  • implement — delegates Step 7 implementation to /implement, scoped to the approved Step 5 plan; its built-in /code-review closeout is skipped because forge's Step 8 owns review. Conflicts with codex impl (two engines for one step — stop and report); makes tdd redundant (accepted with a one-line note, since /implement drives /tdd itself). See references/modes/implement.md.
  • codex / codex challenge — adds Codex as a Step 8 generic reviewer; challenge runs an adversarial review instead. Claude Code only. See references/reviewers/codex.md.
  • codex impl — Codex (GPT-5.6, auto-tiered Sol/Terra/Luna) implements at Step 7 and handles Step 8b rework; the Step 8 generic reviewer reverts to the default for cross-model review, and challenge composes as an extra adversarial engine. Claude Code only. See references/modes/codex-impl.md.
  • coderabbit — adds CodeRabbit as a Step 8 generic reviewer, with rework handled by coderabbit:autofix. Claude Code only; composes with codex (both run, rework routes per finding). See references/reviewers/coderabbit.md.
  • code-review — adds /code-review (two-axis: Standards + Spec) as a Step 8 generic reviewer. A plain skill, so unlike codex and coderabbit it runs on any runtime. See references/reviewers/code-review.md.

The reviewer flags add to the generic-reviewer set; the project reviewer agents always run alongside, and codex, coderabbit, and code-review can all be set in one run. For example, forge ticket PROJ-7 automode docs codex challenge coderabbit is a valid invocation.

  • automode with docs writes CONTEXT.md directly with no interview, then goes straight to Step 7.
  • On a non-Claude-Code runtime, codex, codex challenge, codex impl, and coderabbit are ignored with a one-line warning, and the generic reviewer stays superpowers:requesting-code-review.

When to Use

  • /forge <ref> (arg = issue or Jira-ticket ref).
  • "forge issue 42", "solve issue 42", "fix #123", "look at issue 7".
  • "solve ticket PROJ-123", "forge ticket 42", or a bare Jira key PROJ-123.
  • Asks the agent to act on a specific issue/ticket in the repo.

Don't use when:

  • No issue or ticket ref is given. Ask rather than guess.
  • Asking about an issue/ticket, not to resolve it.

Step 1 — Classify the ref, resolve the repo & tracker

Step 1a — Classify <ref> (see Parameters, Target grammar)

  • If the ref is key-shaped ([A-Z][A-Z0-9]+-\d+) or follows a ticket keyword, treat it as Jira and go to Step 1c.
  • Otherwise (a bare number, #N, or issue N), treat it as a git-host issue and go to Step 1b.
  • If ticket is followed by a number with no key, ask for the project key first. Offer proposed answers when candidates can be inferred from git remote, CONTEXT.md, or branch names; otherwise use a single prompt. Under automode, infer the most likely key and record the assumption.

Always run git remote get-url origin (falling back to upstream) regardless of the ref kind, because Part 2 commits and branches against this repo even for Jira tickets.

Step 1b — git-host issue

Route by host in origin (fallback upstream):

Host in remote URL Reference
github.com / GH Enterprise references/trackers/github.md
gitlab.* (incl. self-hosted) references/trackers/gitlab.md
other (Gitea, Bitbucket, …) that host's CLI's issue-view JSON command if present; else host REST API
any, no CLI / auth error host REST API per the loaded tracker ref (else generic curl)

If neither origin nor upstream resolves to a known issue host: stop, tell the user, do nothing else.

Step 1c — Jira ticket

Read references/trackers/jira.md, which covers resolving the ticket, fetching it, the absent-source fallback, the key-in-branch convention, and write-back. Load it now; the rest of Steps 1 through 3 and Step 12 defer their Jira specifics to it. Git-host issues never read it.

Step 2 — Fetch the issue / ticket

git-host issue

Use the loaded tracker ref for the fetch command and the REST fallback: references/trackers/github.md Step 2 or references/trackers/gitlab.md Step 2. For a host without a dedicated ref, run its CLI's issue-view JSON command if one exists, otherwise curl the host's REST API. Either way, read the body and every comment. If the number is a pull request, not an issue, stop and ask whether they meant /forge pr <N>.

Jira ticket

Follow references/trackers/jira.md Step 2 to pull the fields and comments, and its Jira-absent fallback section when the source is unreachable. The fallback warns the user and offers three choices (paste, authenticate, or abort), and it stops even under automode.

Step 3 — Verify the branch

git branch --show-current

If the repo ships a git or contribution guide, follow it verbatim for branch naming, the base branch, and the PR target. Look in CONTRIBUTING.md, a git section in the project agent guide (AGENTS.md or your runtime's equivalent), .agents/rules/git*, docs/*git*, or the runtime equivalent. The repo's own rules win over everything below.

Only if no such guide exists, fall back to the default <prefix>/<slug>, where <prefix> is one of feat, fix, chore, docs, refactor, test, perf, ci, build, or style.

  • Pick <prefix> from the issue: use fix for a bug, feat for new behavior, docs for documentation, and chore for dependencies, CI, or tooling. When it is ambiguous, ask.
  • Build <slug> from the title: lowercase ASCII kebab-case, drop stop-words, and keep it to 50 characters or fewer. For example, "Parser fails on UTF-16 BOM" becomes fix/parser-fails-utf-16-bom.

For Jira, see references/trackers/jira.md Step 3 for the key-in-branch and key-in-commit conventions. The repo guide still wins; otherwise the branch is <prefix>/<KEY>-<slug>, and the key is not forced into commit subjects.

Compare the chosen branch name to the current branch:

  • If they match, continue.
  • If they differ, show both and ask: "Switch to a new branch <prefix>/<slug> forked off <base>? (y/n)". Pick <base> per the repo guide, otherwise probe dev, then develop, then main, then master.
  • On y, confirm the tree is clean with git status --short. If it is dirty, surface the files and ask before any switch, then run git switch -c <prefix>/<slug> <base>. If the switch fails (branch exists, base missing), surface the git error and ask. Never invent a name or base.

When the worktree flag is set, create a sibling worktree on the chosen branch instead of switching in place. See references/modes/worktree.md; it composes superpowers:using-git-worktrees, and the Step 12 closing appends a cleanup reminder.

Step 4 — Check context sufficiency

Use the context you already have, and do not sweep the codebase. Inventory what is already in the context window first: the agent guide, memory, and rulesets the runtime loaded at startup, such as AGENTS.md, CLAUDE.md, GEMINI.md, CONTEXT.md, or .agents/rules/*. That is usually enough for the design. Only then read further, and no more than this:

  1. the files the issue names;
  2. at most a few top candidates from a targeted search for the definition or callers of the named symbol, never a directory walk or full-tree read.

Stop reading once you can write Step 5. Turn any residual uncertainty into a Risk rather than more reading. A full-codebase sweep before a proposal is a red flag: it wastes the context the runtime already gave you.

Before proposing, the issue must answer:

For a bug For a feature
Steps to reproduce Acceptance criteria
Expected vs actual Affected surface (API, CLI, UI)
Environment (version, OS) Backwards-compat expectations
Suspected component (optional) Out-of-scope clarifications

The acceptance criteria and the expected-versus-actual behavior are the /goal pass-conditions used in Step 7, so capture them precisely. For Jira, mine them from the description, the acceptance-criteria field, and the comments. A missing field is a Step 4 interview gap exactly as it is for a git issue, and the pasted-text fallback from Step 2 is treated the same way.

When a required field is missing, interview the user rather than opening a free-text question. For each gap, offer a small set of proposed answers, mark the most likely one (Recommended), and let the user pick. On a runtime with a selection UI, such as Claude Code's interview TUI, the user highlights an option and presses Enter, and an "Other" free-text choice is always implicitly available.

See references/proposal-template.md Step 4 for the literal question-block format. Never invent the chosen answer: propose the options and let the user select. Never continue past this step while a required gap is unanswered.

The flags change how the interview runs:

  • docs runs the interview through /grill-with-docs, which challenges the plan against the repo's domain model and docs.
  • automode skips the interview and proceeds on the issue as written, picking the (Recommended) answer for each gap and noting the assumption in the proposal.
  • automode with docs runs no interview and goes to the Step 5 CONTEXT.md write.

When the lookup flag is set, fetch current docs for every library, framework, SDK, CLI, or cloud service the issue mentions, querying the context7 MCP (or context7 resources if the MCP is not connected) before writing the proposal. See references/modes/lookup.md for the attribution format, when to skip, and automode behavior.

Step 4a — Optional grilling for risky design forks

The Step 4 interview is about missing facts. When the context is enough to propose but a design or approach fork is genuinely ambiguous and a wrong pick means expensive rework, run a deeper interview before the proposal:

  • by default, run /grill-me;
  • with docs, run /grill-with-docs;
  • under automode, never grill, since both options interview the user; instead record the fork and the chosen branch as an explicit proposal assumption.

Do this only when getting the approach wrong is costly. For a clear, low-risk fix, go straight to Step 5.

Step 5 — Propose the solution

Emit exactly one proposal. The block format is in references/proposal-template.md Step 5 and covers the issue line, the restated problem, the root cause or design, the files to touch, the plan, the pass criteria, the tests, and the risks. Verify that file paths exist with Read or Grep before listing them, and drop the :line suffix if you have not opened the file.

With docs, write the proposal to CONTEXT.md in the repo root, instead of or in addition to chat, since Part 2 sources the plan from CONTEXT.md rather than the chat scrollback. Stamp it with the ref it was written for, so a later run can tell it apart from a stale plan.

End the proposal by stating the user's next-turn choices, using the options in the template Step 5. Saying yes, implement opens the gate and moves to Step 7. Saying interview me on risky questions runs the Step 4a grilling and re-proposes, and is offered only when a risky design fork is still unanswered. Any other adjustment means revise and re-propose.

Under automode, there are no options and no wait: go straight to Step 7, and with docs, do so after writing CONTEXT.md.

Step 6 — The gate

Unless automode is set, do not edit any file until the user explicitly approves.

  • "yes, implement", "go ahead", "do it", or "ship it" moves to Step 7.
  • "interview me on risky questions" goes back to Step 4a, then re-proposes.
  • A requested plan change means revise and re-ask. Silence or questions mean wait.

This is the most important rule of the skill. Skip it (outside automode) and the skill is worthless.


Part 2 — Post-Approval Lifecycle (Steps 7–12)

This part is deliberately terse. Each step delegates to a referenced skill, so read that skill rather than restating it here.

Re-hydrate block

Steps 8 and 9 reference this block. It is two actions, in order:

/compact  →  re-source /karpathy-guidelines

Run it before touching code on every non-converged review pass and before approved refactor work. The point is to shed stale reviewer-transcript tokens and reload clean-code discipline. On a review pass, capture the must-fix and should-fix findings before /compact so they survive it, then fix from that list. Do not restate /goal here; it is set once, in Step 7. With compress, also re-source the compression skill chosen at startup, since /compact can shed its persistence — see references/modes/compress.md.

Step 7 — Implement

Open the step with two actions, in order:

  1. Set /goal to the desired result plus the Step 4 and 5 pass criteria, that is, the exact build, test, or behavior that proves the work is done. Set it once and never restate it.
  2. Re-source /karpathy-guidelines.

When the tdd flag is set, write the failing test first, run it, watch it fail, then implement. See references/modes/tdd.md; it composes /tdd, and the discipline binds under automode.

With docs, load the plan from CONTEXT.md and check its stamp matches this ref; on a mismatch, warn and re-propose rather than implement a stale plan. Implement the approved plan and keep it minimal, surgical, and in scope. Make no edits before the opener is done, and before the observed-red test is done if tdd is set.

When the codex impl flag is set, delegate the implementation to Codex (GPT-5.6, auto-tiered) after the opener — and after the observed-red test if tdd is set — then conformance-check the returned diff against the plan before Step 8. See references/modes/codex-impl.md; on preflight failure it degrades to inline implementation.

When the implement flag is set, delegate the implementation to /implement after the opener, scoped to the approved Step 5 plan, with its own /code-review closeout skipped — forge's Step 8 owns review. See references/modes/implement.md; implement and codex impl together is a conflict (stop and report — two engines cannot own one step).

Step 8 — Review loop

Run the project reviewer subagents (from .agents/agents/ or the runtime equivalent) together with the generic reviewer. The generic reviewer is superpowers:requesting-code-review by default, or Codex under codex or codex challenge, or /code-review under code-review. Under codex impl, the generic reviewer stays the default — the model family that wrote the diff must never be the only reviewer — and codex impl challenge adds Codex adversarial review as an extra engine. The project subagents always run.

Terminate the loop at zero actionable findings; nits do not block. Cap the loop at a fixed number of passes. On each non-converged pass, run the re-hydrate block, fix the findings, then re-review.

See references/review-loop.md for engine-selection details, the /greploop fallback and /diagnosing-bugs sub-pass, pass discipline, the trim-only-cleanup skip rule, and automode behavior.

When the secure flag is set, run a security-review pass once there are zero actionable findings. Must-fix security findings reopen Step 8 with one dedicated security-pass budget. See references/modes/secure.md; security must clear before Step 9.

Step 8a/8b — Generic reviewer swaps

A flag adds an engine to the Step 8 generic-reviewer set, replacing the default superpowers:requesting-code-review when at least one is set. Each engine brings its own Step 8a reviewer pass and Step 8b rework path mirrored to its companion skill. The project subagents always run alongside. The reviewer flags compose: set both and both engines run in the same pass; each finding's rework routes to the engine that raised it.

Flag Step 8a engine Step 8b rework path
(none — default) superpowers:requesting-code-review (no dedicated rework skill; in-pass fixes only)
codex / codex challenge Codex review / adversarial-review via scripts/resolve-codex.py foreground codex:codex-rescue foreground --wait (re-hydrate first, inline karpathy constraints)
codex impl [+ challenge] default reviewer (+ Codex adversarial-review with challenge) companion task --write at the Terra/Luna tier (re-hydrate first) per references/modes/codex-impl.md
coderabbit coderabbit:code-review coderabbit:autofix foreground --wait (re-hydrate first, inline karpathy constraints)
code-review /code-review (two-axis: Standards + Spec, parallel sub-agents where the runtime has them) (no dedicated rework skill; in-pass fixes only, re-hydrate first)

See references/reviewers/codex.md for Codex specifics, references/reviewers/coderabbit.md for CodeRabbit specifics, and references/reviewers/code-review.md for the two-axis skill reviewer.

Both codex and coderabbit are Claude Code only. On other runtimes the flag is ignored with a one-line warning, and the default generic reviewer stays in place. code-review is exempt from that rule: it is a plain skill and runs on any runtime.

Step 9 — Refactor (propose-only)

Run /improve-codebase-architecture.

  • By default, surface the opportunities. If the user approves, run the re-hydrate block and re-enter Step 8 once on the refactor diff. If there are none, or the user does not approve, go to Step 10.
  • Under automode, the agent decides: apply only refactors that are clearly net-positive and in scope. If it applies any, run the re-hydrate block and re-enter Step 8 once; otherwise continue.

Never silently rewrite beyond the issue's scope.

Step 10 — Out-of-scope findings via /to-tickets

For bugs or improvements that belong in a separate issue, draft them via /to-tickets, show the drafts, and post only on an explicit user yes. Under automode, post them directly. If nothing qualifies, skip this step silently.

Step 11 — Self-evolution

If you hit a caveat that could be automated for future agentic sessions, propose /writing-for-agents or an edit to the project agent config (the agent guide, rules, or reviewer-agent directory for the runtime). Also consider recording the caveat in the agent's project memory so a later session does not repeat it. Use whatever memory store the runtime exposes for this project. If the user has installed an external memory provider they favor (a memory plugin or MCP seen earlier in the conversation), write there instead of the built-in store. Show the exact diff and path, and confirm before writing. Under automode, the agent decides on its own and applies the smaller-blast-radius option with no proposal or confirmation. Memory writes are included: it picks the built-in store or the user's preferred external provider and writes directly. It still prefers a rule or guide edit over a new skill unless the pattern is clearly broad. If nothing can be automated, skip this step silently.

Step 12 — Closing

Verify /goal before anything else. Before assembling the proposal, run the Step 7 /goal pass criteria and the repo's standard pre-commit checks (build, test, and lint per the repo guide). Show the exact commands and their output. A command that exits 0 without running tests, such as "no tests collected" or empty output, does not prove /goal; treat it as not done. If anything fails, or you cannot run the checks, you are not done: return to Step 8 with the failure as a finding. Never assemble a commit proposal on an unverified /goal, because an unproven "done" is the one failure mode forge must not ship. automode does not lift this gate; it runs the checks itself and proceeds only on green.

Then assemble the commit or PR proposal. The default is small atomic commits that match the branch's existing granularity and message style, which you can inspect with git log --oneline <base>..HEAD, rather than one squashed mega-commit. The repo's git or contribution guide from Step 3 still wins: if it mandates another shape, such as squash-on-merge, follow it and say why. If landing requires a merge or rebase onto a moved base and it conflicts, resolve through /resolving-merge-conflicts (by intent, finish the operation, never --abort) instead of resolving ad hoc.

When the changelog flag is set, draft a changelog entry in the repo's existing format after /goal verifies green and before assembling the commit list, and include it in the proposed history. See references/modes/changelog.md for the file-detection order and entry conventions.

Then ask one closing question, using the closing menu in references/proposal-template.md Step 12. It follows the Step 4 proposed-answer format: the user selects, the recommended option is marked, and "Other" is implicit. Show the third line only when the target was a Jira ticket.

Act only on the selected option. Option 2 follows the repo guide for the base branch and PR target.

For the Jira write-back in the third option, follow references/trackers/jira.md Step 12. It is opt-in only, posts a comment and a confirmed transition, and never runs on the other options or under automode. Show the third menu line only when the target was a Jira ticket.

Never auto-commit, auto-push, or write back to Jira outside an explicit selection.

When the ci-watch flag is set and a push option (2 or 3) was chosen, poll CI for the pushed HEAD once the push completes. On a red result, re-enter Step 8 with the CI failure as a must-fix finding. See references/modes/ci-watch.md for polling cadence and host CLI selection. The flag is inert if no push option was chosen.

  • With docs, still ask, but pre-mark the /tmp/<name>.md option (Recommended) over option 1.
  • With automode, skip the question. Emit the proposed small-commit history as a plan only, written to /tmp/forge-<ref>.md under docs or inline otherwise, then stop. automode never executes commits, pushes, or Jira write-backs.
  • With worktree, append a cleanup reminder to the closing message: "Worktree at <path>; run git worktree remove <path> when done." Cleanup never auto-runs, even under automode. See references/modes/worktree.md.

Autonomy

By default, once the user says "yes, implement", run autonomously with no "may I continue?" between steps, and stop only at the substantive gates:

  • Step 6, the gate entry;
  • Step 9, the refactor approval;
  • Step 10, the spinoff-issue post;
  • Step 11, self-evolution;
  • Step 12, the commit proposal.

automode lifts those gates but never the hard floors:

  • it never auto-commits, auto-pushes, or writes back to Jira;
  • the Step 12 /goal verify still runs;
  • the Step 2 Jira-absent fallback still triggers.

See references/autonomy.md for the full per-step matrix, the rationale behind each hard floor, and how automode composes with other flags.


Anti-patterns & Red Flags

See references/anti-patterns.md for the common-mistakes table and the red-flag stop list. Both bind under automode too, and that file is the canonical home for new rules learned during a forge session.

Files (forge-skills)
  • references
    • modes
      • changelog.md 3 KB
        # Forge — `changelog` flag
        
        At Step 12, drafts a changelog entry per the repo's existing convention and includes it in the proposed commit list. The entry covers what the implementation diff actually shipped — not the original issue text — so the changelog reflects the merged code.
        
        ## Manual verification recipe
        
        ```
        /forge issue 42 changelog
        ```
        
        Expected: Steps 1–11 run unchanged. Step 12 (after `/goal` verifies green) inspects the repo for an existing changelog file. If found, forge drafts a new entry matching the file's existing format and adds it to the proposed commit list. If no changelog file exists, forge surfaces this once with a one-line note ("No changelog file detected; skipping `changelog`.") and proceeds.
        
        ## When it fires
        
        Step 12, after the `/goal` verification gate passes and before the closing menu is offered. The draft entry is part of the proposed commit list, not a separate commit.
        
        ## What it composes
        
        No external skill. Internal logic only: locate the changelog file, parse its format, draft the entry. Read the file's last 3–5 entries to mirror tone, granularity, and section headers (Keep-a-Changelog, project-specific, conventional commits, etc.).
        
        ## Locating the changelog file
        
        Check in order, stop at the first hit:
        
        | Path / pattern | Notes |
        |---|---|
        | `CHANGELOG.md`, `CHANGELOG`, `HISTORY.md` | The conventional top-level locations |
        | `docs/CHANGELOG.md`, `docs/changelog/` | Docs-prefixed variants |
        | `.changeset/` directory | Changesets convention (one file per change) |
        | `changie.yaml` + `.changes/` | Changie tool |
        | Any file the repo guide names | Repo-specific config wins |
        
        Repo guide (`CONTRIBUTING.md` / agent guide / etc.) wins over this list.
        
        ## Behavior change vs default
        
        | Stage | Default | With `changelog` |
        |---|---|---|
        | Step 12 commit-list assembly | Code changes only | Code changes **+** one new changelog entry matching repo format |
        | Entry placement | (n/a) | Top of the changelog file (Keep-a-Changelog convention) OR a new file in the changesets directory if applicable |
        | Entry wording | (n/a) | Imperative summary of what the diff did, not what the issue asked. Length matches the file's existing entries. |
        | Closing menu | Closing menu as usual | Same menu; option 2 (push + PR) includes the changelog entry in the PR body summary |
        
        ## Composition with other flags
        
        | Combination | Effect |
        |---|---|
        | `changelog` + `automode` | Entry is drafted without prompt. The commit list at Step 12 emits the proposed history as a plan (per `automode` Step 12 behavior); the changelog entry is included in that plan. |
        | `changelog` + `docs` | Entry is included in the `/tmp/forge-<ref>.md` Step 12 plan output. |
        | `changelog` + `secure` | Security-fix entries should follow the repo's security-disclosure convention if one exists (look for SECURITY.md). If unclear, surface the security finding's nature in the entry and let the user adjust. |
        | `changelog` + `ci-watch` | Entry lands in the proposed commits regardless of CI outcome. If CI goes red post-push, the user can pull the entry from the commit. |
        
      • ci-watch.md 3.2 KB
        # Forge — `ci-watch` flag
        
        After Step 12 pushes the branch, polls the repo's CI for the pushed commit's status. On red, re-enters Step 8 with the CI failure as a finding so the loop can fix it. On green, reports the result and exits cleanly.
        
        ## Manual verification recipe
        
        ```
        /forge issue 42 ci-watch
        ```
        Then at the Step 12 closing menu, pick option 2 (push + PR) or option 3 (push + PR + Jira write-back).
        
        Expected: after the push completes, forge polls the CI status for the pushed HEAD. On green, prints a one-line "CI green for `<sha>`" and exits. On red, re-enters Step 8 with the CI output as a must-fix finding; the loop applies the fix, pushes again, re-polls.
        
        ## When it fires
        
        After Step 12 closing-menu actions complete the push. The polling only happens for menu options that actually push (2 and 3). Options 1, 4, 5, 6 silently skip `ci-watch` — polling without a published target is pointless.
        
        If the push is rejected (non-fast-forward, auth), surface the error and stop. Do not force-push, and do not poll a HEAD that never landed.
        
        ## What it composes
        
        No external skill. Uses the repo's host CLI for status checks:
        
        | Host | Command |
        |---|---|
        | GitHub | `gh run list --branch <branch> --limit 5 --json status,conclusion,headSha,url` (poll until `status: completed`); then `gh run view <id>` for failure logs |
        | GitLab | `glab ci status --branch <branch>` |
        | Other | Host's status API or CI-provider CLI; if neither available, surface this once and skip |
        
        If no CLI matches and no API path works, surface "ci-watch: no compatible CI surface detected" and exit cleanly (not a failure).
        
        ## Polling cadence
        
        Initial wait: 30 seconds (give CI time to start). Then poll every 60 seconds. Cap at 30 minutes total wall-clock; past that, surface "ci-watch: timed out at <duration>, status still <pending|in_progress>" and exit. The user can re-check manually.
        
        Confirm a run exists for the pushed SHA before reading status; "no run found" is not green. If none appears, keep polling to the cap, then surface that no run showed up for `<sha>`.
        
        ## Behavior change vs default
        
        | Stage | Default | With `ci-watch` |
        |---|---|---|
        | Step 12 menu option 1, 4, 5, 6 | Execute as chosen | Same; `ci-watch` silently skips (no push to poll) |
        | Step 12 menu option 2 or 3 | Push, open PR, exit | Push, open PR, poll CI; on green report and exit; on red re-enter Step 8 |
        | Step 8 re-entry from CI red | (n/a) | Treat CI failure as a single must-fix finding; the regular pass cap applies to the re-loop |
        
        ## Composition with other flags
        
        | Combination | Effect |
        |---|---|
        | `ci-watch` + `automode` | At Step 12, `automode` skips the closing menu and emits a plan only (no push). With no push, `ci-watch` has nothing to poll — silently skips. Combination is valid but functionally inert under `automode`. |
        | `ci-watch` + `secure` | If CI fails on a security check, the failure re-enters Step 8 as a regular must-fix; `secure`'s dedicated post-pass runs again after the regular loop reconverges. |
        | `ci-watch` + `changelog` | Changelog entry was drafted before the push; if CI fails, the entry is already in the pushed commits. After re-fix, decide whether to update the entry — usually yes if the fix is non-trivial. |
        
      • codex-impl.md 6.4 KB
        # Forge — `codex impl` flag
        
        Loaded on demand by SKILL.md Step 7 **only when the `codex impl` flag is set**. Delegates implementation to Codex running the GPT-5.6 model family (Sol / Terra / Luna), auto-tiered by work class. The agent stays the orchestrator: it sets `/goal`, delegates, checks the returned diff for plan conformance, and runs the Step 8 review loop — GPT writes, the agent reviews.
        
        **Claude Code only** — same constraint as the `codex` reviewer flag ([../reviewers/codex.md](../reviewers/codex.md)). Non-CC runtime: ignore the flag, warn once, implement inline. The rest of forge stays runtime-generic.
        
        ## Manual verification recipe
        
        ```
        /forge issue 42 codex impl
        ```
        
        Expected: Steps 1–6 unchanged. Step 7 opens with the standard ordering (`/goal` set, `/karpathy-guidelines` re-source), resolves the companion script, delegates the approved plan as one foreground `task --write` at the Sol tier, conformance-checks the returned diff, and enters Step 8 with the **default** generic reviewer (`superpowers:requesting-code-review`). Step 8b rework routes back to Codex at the Terra or Luna tier.
        
        ## Grammar & review split
        
        - `codex` — reviewer only, unchanged ([../reviewers/codex.md](../reviewers/codex.md)).
        - `codex impl` — Codex implements Step 7 and handles Step 8b rework. The Step 8 generic reviewer **reverts to the default** `superpowers:requesting-code-review`: the model family that wrote the diff must never be the only one reviewing it (cross-model review). Project reviewer agents always run, as everywhere.
        - `codex impl challenge` — composes: implementation as above **plus** Codex `adversarial-review` added to the Step 8 reviewer set alongside the default reviewer. Self-review is acceptable here because it is an *additional* adversarial engine, never the only reviewer.
        
        ## Step 7 — delegated implementation
        
        1. **Opener unchanged.** Set `/goal` and re-source `/karpathy-guidelines` first — delegation never skips the opener. With `tdd`, write and observe the failing test yourself *before* delegating; quote the red test in the delegation prompt as a pass criterion.
        2. **Preflight once per run** via `<forge-skill-dir>/scripts/resolve-codex.py`, with the same semantics as the reviewer pass ([../reviewers/codex.md](../reviewers/codex.md) Step 8a). Output `UNAVAILABLE` → degrade gracefully: warn once, implement inline, and treat the rest of the run as if `impl` were not set. Never stall.
        3. **Delegate the whole approved plan as one foreground task** with the resolved `<script>`:
           ```bash
           node <script> task --write --model gpt-5.6-sol --effort high "<prompt>"
           ```
           The prompt inlines, in order: (a) the karpathy constraints block — Codex cannot source Claude-side skills, same inlining rule as the Step 8b rescue path; (b) the Step 5 approved proposal verbatim (from `CONTEXT.md` under `docs`, stamp-checked); (c) the `/goal` pass criteria. Foreground, not `--background`: Step 8 needs the diff now.
        4. **Conformance check before Step 8.** Diff the returned work against the plan: the files touched match the proposal's file list, nothing is out of scope, no unrelated rewrites. Revert or flag out-of-scope edits. A plan step Codex skipped or fumbled: finish inline if small, re-delegate once if large. Then enter the normal Step 8 loop.
        5. **Task failure** (companion errors or returns nothing): implement inline, warn, continue — never stall, never retry more than once.
        
        ## Step 8b — tiered rework
        
        When `impl` is set, Codex-delegated rework uses the same direct `task --write` mechanism as Step 7, at the tier the matrix below assigns — not the `codex:codex-rescue` subagent path, which stays the reviewer-only flag's rework route. The Step 8 re-hydrate block still runs before any rework pass, and the existing rule holds: trivial fixes stay inline with the agent and are not delegated at all.
        
        ## Tier matrix
        
        Auto-tiered by work class; there is no user-facing tier syntax. Effort compensates the cheaper tiers.
        
        | Work | Tier | `--model` | `--effort` |
        |---|---|---|---|
        | Step 7 — implement the approved plan | Sol | `gpt-5.6-sol` | `high` |
        | Step 8b — substantive rework of a review finding | Terra | `gpt-5.6-terra` | `xhigh` |
        | Step 8b — mechanical fix (typo, rename, lockstep edit, format) | Luna | `gpt-5.6-luna` | `xhigh` |
        
        - The Step 8b classification is a judgment call. Luna is for mechanical work that is *voluminous* (many files, repetitive), not merely small — small fixes stay inline.
        - If a future companion version adds an `ultra` effort level, Terra upgrades to `--effort ultra`; the mapping above is the ceiling of today's enum (`none…xhigh`).
        - **Model-ID resilience:** if Codex rejects the model ID (older CLI, tier unavailable on the account), retry once with no `--model` flag (Codex's default) and note the downgrade. Verify accepted IDs against the live CLI, not this file.
        
        ## Degradation ladder
        
        1. Non-Claude-Code runtime → ignore the flag, one-line warning (standard).
        2. Preflight `UNAVAILABLE` → warn once; implement the whole run inline.
        3. Model ID rejected → retry once without `--model`; note the downgrade.
        4. Task fails or returns nothing → implement that unit inline, continue.
        
        Each rung falls back to the agent implementing. Never stall the run on a delegation failure.
        
        ## Composition with other flags
        
        | Combination | Effect |
        |---|---|
        | `codex impl` + `automode` | No special casing. Hard floors untouched: Codex writes to the working tree only; it never commits, pushes, or writes back to a tracker. |
        | `codex impl` + `tdd` | The agent writes and observes the red test itself, then delegates; the failing test is a delegation pass criterion. The observe-red discipline stays agent-side and binds under `automode`. |
        | `codex impl` + `docs` | The delegation prompt sources the plan from `CONTEXT.md` (stamp-checked) instead of the chat proposal. |
        | `codex impl` + `worktree` | Composes transparently; the companion task runs in the worktree directory. |
        | `codex impl` + `secure` | Unaffected; the security pass reviews the diff regardless of who wrote it. |
        | `codex impl` + `coderabbit` | CodeRabbit joins the Step 8 reviewer set; CodeRabbit findings route to `coderabbit:autofix`, Codex-delegated rework routes to the tiered Step 8b path above. |
        | `/forge pr <N>` + `codex impl` | Step 7 delegation is inert (PR mode has no Step 7) with a one-line note; the Step 8b rework tiering still applies, since PR mode enters at Step 8. See [pr-entry.md](pr-entry.md). |
        
      • compress.md 4.6 KB
        # Forge — `compress` flag
        
        Runs the whole forge session in a token-saving output mode by sourcing a compression skill
        before Step 1. The point is to keep a long forge run (proposal, implementation, multi-pass
        review) from burning context on verbose prose and over-built code, without changing what the
        lifecycle does.
        
        ## Manual verification recipe
        
        ```
        /forge 42 compress
        ```
        
        Expected: before any Step 1 output, the agent sources `ponytail` (or `caveman` if ponytail is
        absent) and announces it in one line. Every subsequent step runs under that mode. After each
        re-hydrate `/compact`, the mode is re-sourced. If neither skill is installed, one line notes
        the flag is ignored and the run proceeds normally.
        
        ## Skill selection
        
        Check the runtime's available-skills list (for Claude Code, the skills offered to the Skill
        tool) and pick the **first** match, in this order:
        
        1. **`ponytail`** — preferred. It is the newer and more widely adopted of the two, and it
           compresses the bigger token sink: the code itself (minimal diffs, no unrequested
           abstractions), plus the prose around it. Accept either the bare `ponytail` name or a
           plugin-namespaced form such as `ponytail:ponytail`. Source it at its default intensity
           (`full`); do not pass a level unless the user asked for one.
        2. **`caveman`** — fallback. Compresses prose only (~75% on explanation text), leaves code
           untouched.
        3. **Neither installed** — the flag is inert. Say so in one line (mirroring how `codex` is
           ignored on non-Claude-Code runtimes) and run a normal session. Never try to install
           either skill or emulate their behavior from memory; an unsourced imitation drifts.
        
        Source exactly one skill, never both. One compression discipline keeps the output shape
        predictable; ponytail's own docs suggest pairing with caveman, but that is the user's call to
        make explicitly, not this flag's.
        
        ## When it fires
        
        At parameter-parse time, before Step 1 produces any output — the savings compound across the
        whole session, so sourcing late forfeits most of them. Announce the choice in a single line
        ("compress: sourcing ponytail") and move on.
        
        ### Interaction with the re-hydrate block
        
        The Steps 8/9 re-hydrate block runs `/compact`, which can shed the sourced skill's
        persistence along with the stale reviewer transcript. After re-sourcing `/karpathy-guidelines`,
        re-source the compression skill chosen at startup. The re-hydrate block becomes:
        
        ```
        /compact  →  re-source /karpathy-guidelines  →  re-source <compression skill>
        ```
        
        Keep the startup choice; do not re-run selection (the installed-skill set does not change
        mid-session).
        
        ## What compression must never eat
        
        The flag compresses style, not contract. These stay complete regardless of mode:
        
        - The Step 5 proposal block — every field of the proposal template, in full.
        - Step 4 interview question blocks and their proposed answers.
        - The Step 12 `/goal` verification — exact commands and their real output, shown.
        - Safety-relevant text: destructive-action confirmations, security findings, the Step 6 gate
          question. (Caveman's own auto-clarity exception already carves these out; the same rule
          binds under ponytail.)
        - Code correctness: ponytail's "when NOT to be lazy" list (trust-boundary validation, error
          handling, security, accessibility, anything explicitly requested) binds — and the repo's
          own code standards and reviewer agents always outrank the compression skill. A Step 8
          reviewer finding is never waved off as "ponytail said less code".
        
        If compression and a forge gate ever pull in opposite directions, the gate wins.
        
        ## Composition
        
        | Combination | Effect |
        |---|---|
        | `compress` + `automode` | Orthogonal; both simply apply. The autonomous run's assumption notes and the Step 12 plan-only output stay complete per the list above. |
        | `compress` + `docs` | `CONTEXT.md` gets the full proposal template — the file is the plan source for Part 2, so it is contract, not prose. |
        | `compress` + `tdd` | Composes; ponytail's one-runnable-check instinct yields to `/tdd`'s explicit red-green discipline, which the user opted into. |
        | `compress` + reviewer flags (`codex`, `coderabbit`) | Composes; reviewer subagents run in their own context and are unaffected. Rework prompts stay fully specified. |
        | `/forge pr <N>` + `compress` | Applies — it shapes output, not lifecycle, so PR-entry mode honors it (review summaries and comments get terser without dropping findings). |
        
        ## Scope
        
        The mode governs this forge session's output. It does not persist beyond the session, and
        "stop ponytail" / "stop caveman" / "normal mode" from the user lifts it immediately without
        touching the rest of the forge run.
        
      • implement.md 3.3 KB
        # Forge — `implement` flag
        
        Loaded on demand by SKILL.md Step 7 **only when the `implement` flag is set**. Default runs never read this file.
        
        Delegates Step 7 implementation to **`/implement`** (from `mattpocock/skills`): it builds the work described by a spec or ticket set, driving `/tdd` at pre-agreed seams. Forge keeps everything around it — the gate, the review loop, `/goal` verification — and hands the skill only the step it owns.
        
        ## Contract
        
        1. **After the opener.** The Step 7 opener still runs first: `/goal` is set and `/karpathy-guidelines` re-sourced before any delegation, exactly as for inline implementation.
        2. **Scope is the approved plan.** Dispatch `/implement` against the Step 5 approved proposal (or the plan slice under `/forge plan`), plus the Step 2 issue/ticket body. It implements that plan — not the spec it might re-derive on its own. Out-of-scope work it proposes is declined and recorded as a Step 10 candidate.
        3. **Closeout is suppressed.** `/implement` normally closes with `/code-review` before committing. Both halves of that closeout belong to forge: instruct the dispatched run to skip its own review closeout and to stage nothing — forge's Step 8 owns review, and Step 12 owns the commit proposal. If the `code-review` flag is also set, that same engine runs anyway — at Step 8, under forge's pass discipline, per [../reviewers/code-review.md](../reviewers/code-review.md).
        4. **Conformance-check the result.** Before entering Step 8, diff the returned work against the approved plan, exactly as `codex impl` does for a Codex diff. Deviations are findings, not silently accepted improvements.
        
        ## Composition
        
        | Combination | Effect |
        |---|---|
        | `implement` + `codex impl` | **Conflict — stop and report.** Two engines cannot own the same Step 7, and silently applying a precedence would hide which engine actually built the diff. |
        | `implement` + `tdd` | Redundant, accepted with a one-line note: `/implement` already drives `/tdd` at pre-agreed seams, so the discipline is not doubled. The observed-red rule binds either way. |
        | `implement` + `/forge pr <N>` | Inert — PR mode has no Step 7. One-line note, no error; same rule as `codex impl`. |
        | `implement` + `automode` | The delegation runs unprompted. The conformance check is the agent's own, and deviations enter Step 8 as findings without a user prompt. |
        
        ## Degradation
        
        If the `/implement` skill is not installed on this runtime, warn once, ignore the flag, and implement inline — the same graceful degradation every optional engine flag follows. Never stall Step 7 on a missing delegate.
        
        ## Manual verification recipe
        
        1. In a repo with forge installed, run `/forge <ref> implement` on a small issue and approve the Step 5 proposal.
        2. Confirm the Step 7 transcript shows the opener (`/goal` + `/karpathy-guidelines`) **before** the `/implement` dispatch, and that the dispatch names the approved plan as its scope.
        3. Confirm no `/code-review` closeout ran inside the delegated work, and that Step 8 review started only after a conformance check against the plan.
        4. Run `/forge <ref> implement codex impl` and confirm forge stops at Step 1 reporting the engine conflict instead of dispatching either.
        5. Uninstall (or rename) the `implement` skill and re-run: Step 7 must warn once and implement inline.
        
      • lookup.md 3.2 KB
        # Forge — `lookup` flag
        
        Composes the **context7 MCP** at Step 4 so the proposal is grounded in current, fetched library facts instead of training-data recall. When the context7 MCP is not connected, fall back to whatever context7 resources the runtime exposes (e.g. the `ctx7` CLI); if none is available, note the gap as a Risk rather than guessing.
        
        ## Manual verification recipe
        
        ```
        /forge issue 42 lookup
        ```
        
        Expected: Step 4 (context check) detects the flag. For any library, framework, SDK, CLI tool, or cloud service the issue mentions, forge queries context7 — resolve the library id, then fetch its docs — before writing the Step 5 proposal. Cited facts in the proposal carry "(per <library> docs, fetched <date>)" attribution.
        
        ## When it fires
        
        Step 4, after the existing-context inventory and the issue-named-file reads. Library lookups happen before the gap interview, so the proposal can use fresh facts when answering the user's interview gaps.
        
        ## What it composes
        
        | Source | Used for | Required? |
        |---|---|---|
        | context7 MCP | Resolve library names → ids, fetch API references, configuration syntax, migration notes. The canonical doc source for `lookup`. | Preferred when the MCP server is connected |
        | context7 resources / `ctx7` CLI | Same coverage when the MCP is not connected | Fallback only; no error if missing — record a Risk instead |
        
        No skill is bundled for this flag: `lookup` rides on the context7 MCP/resources the runtime already provides.
        
        ## Behavior change vs default
        
        | Stage | Default | With `lookup` |
        |---|---|---|
        | Step 4 library mentions | Use training-data recall for library facts | Fetch current docs via context7 for every mentioned library/framework/SDK/CLI/cloud service |
        | Step 5 proposal | API references stated from memory | Each library-specific claim attributed: "(per <library> docs, fetched <date>)" |
        | Interview gaps about library behavior | Agent guesses or asks user | Agent fetches docs first, then proposes informed answers in the gap interview |
        
        ## When the lookup is the wrong tool
        
        Not for refactoring, writing scripts from scratch, debugging business logic, code review, or general programming concepts. The `lookup` flag adds value only when a proposal hinges on library-version-specific facts. If the issue is "refactor the parser to use the visitor pattern", `lookup` adds nothing — skip it.
        
        ## Composition with other flags
        
        | Combination | Effect |
        |---|---|
        | `lookup` + `automode` | Fetches happen without prompts. If a fetch fails (rate limit, network, MCP absent), the agent records the failure as a Risk in the proposal and continues — does not block under `automode`. |
        | `lookup` + `docs` | `CONTEXT.md` includes fetched-doc attributions. The plan in `CONTEXT.md` cites versions, not just library names. |
        | `lookup` + `tdd` | Tests are written against the current API surface fetched by `lookup`, not the training-data API (which may be a release behind). |
        | `lookup` + `worktree` | Compose freely. |
        
        ## Cost reminder
        
        Doc fetches consume tokens. Use `lookup` when the proposal accuracy depends on library-version-specific behavior. Skip when the issue is about your own code. Per-fetch token cost is small; the value compounds when the lookup catches an API change that would otherwise produce a broken proposal.
        
      • plan-entry.md 6.7 KB
        # Forge — plan-entry mode
        
        Loaded on demand when the invocation is `/forge plan <path>`.
        
        ## Manual verification recipe
        
        ```
        /forge plan docs/superpowers/plans/2026-08-21-auth.md#task-3
        ```
        
        Expected: Steps 1, 2, 4, 5 and 6 collapse into a single Step P validation pass; Step 3 still resolves the branch; implementation begins at Step 7 with `/goal` derived from the slice's own `Run:`/`Expected:` lines and stated deliverable.
        
        ## The not-dispatch-ready fallback
        
        **A slice that fails any Step P check other than anchor resolution is not dispatch-ready. When that happens, fall back to normal forge Part 1 (Steps 4–6: check context, propose, gate) instead of implementing.** Implementing on a check that failed is exactly the failure each check exists to catch; falling back costs one extra interview-and-propose pass, which is cheap next to shipping the wrong thing. The individual failure cases below all resolve to this rule; none of them repeat it.
        
        The one exception is an unresolvable slice anchor (see Slice addressing) — that case stops and asks instead, because Part 1 needs to know *which* task to propose against, and forge cannot guess that.
        
        ## Step P — plan validation
        
        Replaces Steps 1, 2, 4, 5 and 6. In order:
        
        1. **Resolve the plan slice and confirm its stamp matches this invocation.** The stamp is whatever ties the plan to what it was written against, checked in this order: a `Spec:` line in the plan file naming the design doc it implements; failing that, a recorded base SHA (a `Base:` line or equivalent); failing both, the plan file's own last commit compared against current `HEAD` for the paths the slice names. On mismatch, warn, name what changed (the stale field or the diverged paths), and fall back per the rule above. Implementing a stale slice — one written against a codebase state that has since moved — is precisely the failure this check exists to prevent; proceeding anyway would silently implement against assumptions that no longer hold.
        
           **When none of the three stamps can be determined at all** — no `Spec:` line, no `Base:` line, and the plan file itself has no commit yet — this is not a mismatch, it is the *most common* case: the natural workflow is brainstorm → write plan → `/forge plan` in a single session, before the plan file is ever committed. There is nothing to compare, so this is not treated as stale. Fall back to check 2 (path-existence) alone, state the gap in the Step 5 proposal as `freshness unverified: plan not yet committed`, and continue — blocking an uncommitted plan would break the exact workflow this entry verb exists to serve, and an uncommitted plan is almost always one just written, so the risk the stamp check guards against barely applies.
        2. **Confirm every path the slice names exists.** On any missing path, warn, name the missing paths, and fall back per the rule above. Do not stop dead — a plan written before a refactor is a normal, recoverable case, and Part 1's interview can re-ground the slice against the current tree.
        3. **Resolve the slice anchor and derive `/goal` from the slice's stated pass criteria.** See Slice addressing for anchor resolution. Derive `/goal` from the slice's own `Run:` / `Expected:` lines and its stated deliverable — the structural shape plan files in this repo actually use, not a paraphrase of the task title. If the slice carries neither `Run:`/`Expected:` lines nor a stated deliverable, it is not dispatch-ready: fall back per the rule above to establish pass criteria through the normal Step 4/5 interview. `/goal` itself never degrades once set — it is a hard floor, and Step 12 refuses to assemble a commit until it verifies green, so a vaguely-derived `/goal` is worse than falling back to get a precise one.
        4. **Treat the slice as the approved Step 5 proposal.** Only once checks 1–3 have passed (or item 3's automode single-heading exception applied) does the slice's own approval satisfy the gate — Step 6 is not re-run.
        
        Step 3 still runs: branch naming, base selection and the clean-tree check are not optional because a plan exists.
        
        Where the slice links an issue and lacks pass criteria, Step 2's fetch is permitted to fill that gap before falling back — a linked issue with acceptance criteria can make the slice dispatch-ready without a full Part 1 pass.
        
        ## Slice addressing
        
        `<path>#<task-heading-slug>` addresses one task within a multi-task plan file. Omit the fragment to address the whole file when the plan describes a single task.
        
        If `<task-heading-slug>` matches no heading in the file, the anchor is unresolvable. This does not fall back to Part 1 — Part 1 still needs to know which task to propose against, and forge cannot guess that from an unresolvable fragment. Instead: stop, list the task headings found in the file, and ask the user which was meant. Under `automode`: if the file contains exactly one task heading, use it and record the assumption in the proposal; otherwise abort and report the mismatch, since guessing among multiple candidates risks implementing the wrong task unattended.
        
        ## Behavior change vs default
        
        | Stage | Default forge | `/forge plan <path>` |
        |---|---|---|
        | Steps 1–2 | Classify `<ref>`, resolve repo/tracker, fetch issue body + comments | Skipped — Step P resolves the plan slice directly, no tracker fetch unless the slice links an issue lacking pass criteria |
        | Step 3 | Branch off base, optional in-place switch | Unchanged — still runs; branch naming, base selection and the clean-tree check are not optional |
        | Steps 4–6 | Check context sufficiency, propose the solution, gate on user approval | Skipped when the slice is dispatch-ready — Step P confirms stamp, paths and pass criteria and treats the slice's own approval as satisfying the gate. Otherwise Step P falls back to this range unchanged (see The not-dispatch-ready fallback) |
        | Step 7 | Implement against the interviewed/proposed plan | Implements against the plan slice; `/goal` is derived from the slice's stated `Run:`/`Expected:` lines and deliverable |
        | Step 12 | Closing menu per default forge | Unchanged — closing menu and `/goal` verification run as in default forge |
        
        ## Composition with other flags
        
        | Flag | Effect under plan-entry |
        |---|---|
        | `docs` | Redundant — the plan slice *is* the sourced plan. Accepted with a one-line note; no separate `CONTEXT.md` sourcing occurs. |
        | `tdd` | Composes normally — Step 7 still writes and observes the failing test before implementing. |
        | `automode` | Unaffected — the gate is already satisfied by the plan's own approval, so `automode` changes nothing about Step P. The one place `automode` does change behavior is the anchor-resolution exception in Slice addressing. |
        | `codex impl` | Delegates the plan slice to Codex at Step 7 exactly as it would delegate a chat-approved proposal. |
        
      • pr-entry.md 5.4 KB
        # Forge — `/forge pr <N>` entry mode
        
        A new top-level entry verb. `/forge pr <N>` enters the lifecycle at Step 8 against an existing pull request's diff instead of starting from an issue. Used when the user wants to review someone else's PR (or their own pre-merge) with the full forge reviewer pipeline.
        
        ## Manual verification recipe
        
        ```
        /forge pr 47
        ```
        
        Expected: Step 1 resolves PR #47 via the repo's host CLI (`gh pr view`, `glab mr view`, …). Step 2 fetches the PR body, comments, and diff. Step 3 checks out the PR's head ref locally (in-place switch by default, or worktree with the `worktree` flag). Steps 4–7 are **skipped**. Step 8 runs the full review loop against the PR's diff. Steps 9–11 follow as appropriate. Step 12 closing offers PR-review-specific options (leave-comment-only, push-fixup-commits, request changes, approve).
        
        ## Grammar
        
        ```
        /forge pr <N>            # the canonical form
        /forge pr #N             # also accepted (the # is decorative)
        forge pr 47              # without leading slash, same as above
        ```
        
        The `pr` keyword between `forge` and the number distinguishes this mode from `/forge <N>` (issue mode). A trailing number without the `pr` keyword still routes to issue mode per the existing grammar.
        
        ## When it fires
        
        Step 1 routing detects the `pr` keyword first, before the issue/Jira-key shape match. PR-entry mode replaces Steps 4–7 with PR-context steps.
        
        ## Step modifications
        
        | Step | Default forge | `/forge pr <N>` |
        |---|---|---|
        | Step 1 | Resolve issue/ticket ref via tracker | Resolve PR via host CLI (`gh pr view <N>`, `glab mr view <N>`, …) |
        | Step 2 | Fetch issue body + comments | Fetch PR title + body + comments + diff |
        | Step 3 | Branch off base, optional in-place switch | Check out the PR's head ref; worktree if `worktree` set |
        | Steps 4-7 | Interview, propose, gate, implement | **Skipped** — there is no implementation; the diff already exists |
        | Step 8 | Review loop against in-progress implementation | Review loop against the PR's existing diff |
        | Step 9 | Refactor opportunities | Refactor opportunities surfaced as PR comments (not direct commits without user approval) |
        | Step 10 | Spinoff issues | Same; spinoff items become PR comments or new issues per user choice |
        | Step 11 | Self-evolution | Same |
        | Step 12 | Closing menu (commit/push/Jira-write-back/etc.) | Closing menu shifts (see below) |
        
        ## Step 12 closing menu (PR-review mode)
        
        Different options than issue mode:
        
        ```
        PR-review done — how should the findings land?
          - Leave the findings as PR comments only, no fixup commits (Recommended)
          - Push fixup commits for the must-fix findings to the PR's head ref + leave comments for the rest
          - Approve the PR (requires zero remaining must-fix from Step 8)
          - Request changes on the PR with the Step 8 finding summary
          - Write the full review (findings + suggested commits) to /tmp/forge-pr-<N>.md and stop
          - Hold — leave the working tree as-is for manual review
        ```
        
        The `ci-watch` flag is meaningful here too: if the user picked option 2 (push fixup commits), `ci-watch` polls the PR's CI for the new HEAD.
        
        If landing fixup commits requires bringing the PR's head ref up to date with its base and that merge or rebase conflicts, resolve through **`/resolving-merge-conflicts`** — hunk by hunk, by intent traced to each side's primary source, finishing the operation rather than `--abort`ing — instead of resolving ad hoc.
        
        ## Allowed and ignored flags
        
        Flags that operate **at Step 8 or later** apply in PR-entry mode:
        
        - `automode` — applies (no user gates)
        - `codex` / `codex challenge` — applies (swaps generic reviewer)
        - `secure` — applies (post-Step-8 security pass)
        - `changelog` — applies (drafts entry for the fixup commits if option 2)
        - `ci-watch` — applies (polls CI after option 2 push)
        - `coderabbit` — applies
        - `code-review` — applies (adds the two-axis skill reviewer; see [../reviewers/code-review.md](../reviewers/code-review.md))
        - `codex impl` — partially applies: Step 7 delegation is inert (no Step 7), the Step 8b rework tiering applies; see [codex-impl.md](codex-impl.md)
        - `implement` — inert: PR mode has no Step 7. One-line note, no error; see [implement.md](implement.md)
        - `compress` — applies (session-wide output mode, sourced before Step 1; see [compress.md](compress.md))
        
        Flags that operate **before Step 8** are ignored with a one-line warning:
        
        - `docs` — no plan to source from
        - `tdd` — no implementation step
        - `worktree` — actually composes: use worktree for the PR head checkout. Not ignored — see composition table below.
        - `lookup` — no proposal to ground
        
        ## Composition with other flags
        
        | Combination | Effect |
        |---|---|
        | `/forge pr <N>` + `automode` | Skip closing menu; emit review summary to `/tmp/forge-pr-<N>.md`; no auto-push of fixup commits. |
        | `/forge pr <N>` + `codex challenge` | Codex `adversarial-review` runs against the PR diff; arguably the highest-leverage combination for design critique on a peer PR. |
        | `/forge pr <N>` + `secure` | Security pass runs after the regular reviewer loop converges. Must-fix → can be addressed via option 2 fixup commits. |
        | `/forge pr <N>` + `worktree` | The PR head checkout happens in a sibling worktree, not in-place. Useful when the user has uncommitted work in the original tree. |
        | `/forge pr <N>` + `ci-watch` + option 2 | Push fixup commits, poll the PR's CI; on red, re-enter Step 8 against the now-failing state. |
        
      • secure.md 2.9 KB
        # Forge — `secure` flag
        
        Composes the `security-review` skill after Step 8 converges (zero actionable findings from the regular reviewers). Security findings re-enter Step 8 as must-fix; the loop reopens until they're addressed.
        
        ## Manual verification recipe
        
        ```
        /forge issue 42 secure
        ```
        
        Expected: Step 8 runs to convergence as usual. On zero actionable findings, forge composes `security-review` against the same diff. Each finding is classified must-fix or should-fix. Must-fix → loop reopens with the security finding as the new pass-1 input. Zero security findings → proceed to Step 9.
        
        ## When it fires
        
        Step 8, after the standard reviewer loop terminates at zero actionable findings, before Step 9 (refactor). The security pass is a separate, post-convergence gate — not a parallel engine within the regular pass.
        
        ## What it composes
        
        `security-review` skill. Read that skill's contract for the categories it surfaces (injection, secrets handling, authn/authz, etc.) — the `secure` flag routes one Step 8 post-pass through it.
        
        ## Behavior change vs default
        
        | Stage | Default | With `secure` |
        |---|---|---|
        | Step 8 termination | Zero actionable findings → Step 9 | Zero actionable findings → `security-review` pass → re-evaluate |
        | Security must-fix found | (security-review never runs) | Pass cap resets by one (security gets a dedicated pass budget of 1); apply the fix, re-run security-review, advance only on green |
        | Security should-fix found | (n/a) | Treated as a should-fix in the regular Step 8 sense: apply if cheap, else surface in the Step 12 proposal Risks section |
        | Step 9 entry | After Step 8 zero actionable | After both Step 8 zero actionable AND security-review zero must-fix |
        
        ## Where the pass-budget comes from
        
        The Step 8 pass cap (see [review-loop.md](../review-loop.md)) covers regular reviewers. `secure` adds **one dedicated security pass** on top — security findings do not exhaust the regular cap, but a single security pass also does not become a free re-litigation budget. If the security pass surfaces must-fix and the fix in turn triggers regular reviewer findings, those count against the regular cap.
        
        ## Composition with other flags
        
        | Combination | Effect |
        |---|---|
        | `secure` + `automode` | Security pass runs without prompts. Must-fix findings are applied automatically per the regular `automode` Step 8 path (pick safest finding, continue). The pass-budget rule still binds. |
        | `secure` + `codex` / `codex challenge` | Codex runs in the regular Step 8 passes; `security-review` runs after Codex converges. The two reviewers have different angles (Codex: correctness/design; security-review: vulnerability classes). Both must converge before Step 9. |
        | `secure` + `tdd` | Compose freely. Security findings may require new tests; if so, those tests follow TDD discipline (red first). |
        | `secure` + `coderabbit` | Same composition pattern as with `codex`. CodeRabbit handles regular Step 8; security-review handles the security pass. |
        
      • tdd.md 2 KB
        # Forge — `tdd` flag
        
        Composes the `/tdd` skill at Step 7. Implementation must follow an observed-red test, not precede it.
        
        ## Manual verification recipe
        
        ```
        /forge issue 42 tdd
        ```
        
        Expected: Step 6 gate opens normally. Step 7 (implement) opens with the standard ordering (`/goal` set, `/karpathy-guidelines` re-source), then composes the TDD skill, writes the failing test, runs it, surfaces red output, and only then writes implementation code. Step 8 review loop runs as usual against the implementation diff.
        
        ## When it fires
        
        Step 7, after `/goal` is set and `/karpathy-guidelines` is sourced, before any implementation edit.
        
        ## What it composes
        
        `/tdd`. Read that skill's contract before using `tdd` — this flag does not duplicate the discipline, it routes Step 7 through it.
        
        ## Behavior change vs default
        
        | Stage | Default | With `tdd` |
        |---|---|---|
        | Step 7 first edit | Implementation code per the approved plan | Failing test for the new behavior |
        | Pre-implementation observation | None required | Run the test; confirm red output before any implementation edit |
        | Implementation | Edit until plan is delivered | Edit until the test passes; stop |
        | Step 8 entry | Triggered by completed implementation | Triggered by green test plus implementation |
        
        ## Composition with other flags
        
        | Combination | Effect |
        |---|---|
        | `tdd` + `automode` | Discipline still binds. The agent writes the test, runs it, and confirms red itself before writing implementation. No user prompt; the failing-test observation is the agent's own. |
        | `tdd` + `docs` | TDD discipline applies to the `CONTEXT.md`-sourced plan. Tests for each plan section are written first. |
        | `tdd` + `codex` / `codex challenge` | Step 8 reviewer engines unchanged. Codex reviews the implementation diff plus the test diff; adversarial review may challenge the test design as well as the implementation. |
        | `tdd` + `worktree` | Compose freely. Tests run inside the worktree. |
        | `tdd` + `lookup` | Compose freely. Library lookups inform the test, not just the implementation. |
        
      • worktree.md 2.5 KB
        # Forge — `worktree` flag
        
        Composes the `superpowers:using-git-worktrees` skill at Step 3. The branch is created in a sibling worktree directory rather than switched in-place, so your editor can keep the original working tree open while forge works.
        
        ## Manual verification recipe
        
        ```
        /forge issue 42 worktree
        ```
        
        Expected: Step 3 detects the flag, creates a sibling worktree (e.g. `../<repo>-<slug>/`) on the chosen branch instead of switching in-place. Subsequent edits and commits target that worktree path. Step 12 closing reminds the user to remove the worktree once the changes land or are discarded.
        
        ## When it fires
        
        Step 3, after the branch name is resolved (per repo guide or the default `<prefix>/<slug>` fallback) and before the `git switch -c` decision.
        
        ## What it composes
        
        `superpowers:using-git-worktrees`. Read that skill for the worktree creation, layout, and cleanup conventions — this flag routes Step 3 through it.
        
        ## Behavior change vs default
        
        | Stage | Default | With `worktree` |
        |---|---|---|
        | Step 3 branch creation | `git switch -c <prefix>/<slug> <base>` in the current tree | `git worktree add <path> -b <prefix>/<slug> <base>` (path per the worktree skill's convention) |
        | Edits | Apply to the current working tree | Apply to the worktree directory; the original tree is untouched |
        | Step 12 | Commit and (optionally) push from the current branch | Commit and (optionally) push from the worktree; closing menu adds a cleanup reminder |
        | Cleanup | Switch back to base branch when done | Run `git worktree remove <path>` (or accept the closing-menu reminder to do so) |
        
        ## Composition with other flags
        
        | Combination | Effect |
        |---|---|
        | `worktree` + `automode` | Worktree is created without prompting. Cleanup at Step 12 stays opt-in even under `automode` — the worktree lives until the user removes it (`automode` never deletes user state). |
        | `worktree` + `tdd` | Compose freely. Tests run inside the worktree; the original tree is unaffected by red/green output. |
        | `worktree` + `docs` | `CONTEXT.md` is written inside the worktree, not the original tree. |
        
        ## Step 12 closing addendum
        
        When `worktree` was set, the Step 12 closing message appends one line:
        
        > Worktree at `<path>` — run `git worktree remove <path>` (or `git worktree prune` if the branch was deleted) when you're done.
        
        This addendum is informational. It does NOT auto-remove the worktree, even under `automode` — losing in-progress state because a flag inferred you were "done" is the wrong default.
        
    • reviewers
      • code-review.md 2.4 KB
        # Forge — `/code-review` reviewer reference
        
        Loaded on demand by SKILL.md Step 8 **only when the `code-review` flag is set**. Default (no flag) runs never read this file.
        
        **Any runtime** — unlike `codex` and `coderabbit`, this engine is a plain skill (`code-review` from `mattpocock/skills`), so it carries no Claude-Code-only degradation rule. If the skill is not installed, warn once, fall back to `superpowers:requesting-code-review` for this run, and continue the loop. Never stall.
        
        ## Step 8a — Two-axis generic reviewer
        
        `/code-review` reviews the diff since a fixed point along two independent axes, each run as a parallel sub-agent where the runtime has them, sequentially where it does not:
        
        - **Standards** — does the diff follow the repo's coding standards, plus a Fowler smell baseline?
        - **Spec** — does the diff faithfully implement the originating issue, ticket, or spec?
        
        Drive it with forge's own context so it does not re-derive what forge already holds:
        
        1. **Fixed point**: the Step 3 base branch (or the worktree's fork point under `worktree`). Pass it explicitly; the skill's "diff since a fixed point" must match the diff Step 8 is reviewing, not the whole branch history.
        2. **Originating spec**: the Step 5 approved proposal plus the Step 2 issue/ticket body. The Spec axis is only as good as the spec it is handed — hand it the same artifacts the gate approved.
        3. Run the review; treat its findings verbatim as this pass's generic-reviewer findings. Merge with the project reviewer agents' findings; same must-fix/should-fix termination as Step 8.
        
        ## Step 8b — Rework
        
        There is no dedicated rework skill for this engine. Findings are fixed in-pass: run the re-hydrate block (`/compact` → re-source `/karpathy-guidelines`), fix, then re-review. If `codex` or `coderabbit` is also set, their findings still route to their own rework paths; only `code-review`-raised findings stay inline.
        
        ## Composition and `automode`
        
        | Combination | Effect |
        |---|---|
        | `code-review` + `codex` / `coderabbit` | All set engines run in the same Step 8 pass; each finding's rework routes to the engine that raised it (in-pass for this one). |
        | `code-review` + `codex impl` | Valid — and useful: a non-Codex reviewer over a Codex-written diff satisfies the cross-model-review rule with a second independent axis pair. |
        | `automode` | The review runs unprompted; non-convergence follows the regular `automode` Step 8 pick-safest path. The pass cap binds unchanged. |
        
      • coderabbit.md 4.3 KB
        # Forge — `coderabbit` flag (and `coderabbit:autofix` rework path)
        
        Composes the `coderabbit:code-review` skill as a Step 8 generic reviewer, replacing the default `superpowers:requesting-code-review`. Composes with the `codex` flag — set both and both engines run in the same pass.
        
        The companion `coderabbit:autofix` skill is invoked from Step 8b as the rework delegation path when `coderabbit` is the active reviewer — symmetric to how the `codex` flag uses `codex:codex-rescue` in Step 8b.
        
        ## Manual verification recipe
        
        ```
        /forge issue 42 coderabbit
        ```
        
        Expected: Step 8 dispatches project reviewer subagents in parallel with `coderabbit:code-review`. Project subagents still run; `coderabbit` adds to the generic-reviewer set. On findings, Step 8 fix-and-rerun cycle applies as usual. If the rework needed is too large for inline application, Step 8b delegates to `coderabbit:autofix` foreground.
        
        ## Claude Code only
        
        The CodeRabbit plugin is Claude Code-exclusive. Non-Claude-Code runtimes: forge ignores `coderabbit` with a one-line warning and stays on the default `superpowers:requesting-code-review`. Same degradation pattern as the `codex` flag.
        
        ## Composing with `codex`
        
        Both flags add an engine to the Step 8 generic-reviewer set. Set both and both run in the same pass, each contributing findings to the shared pass budget. Step 8b rework routes per finding: codex findings to `codex:codex-rescue`, coderabbit findings to `coderabbit:autofix`. Inline or ambiguous fixes stay agent-discretion.
        
        ## Step 8a — Generic CodeRabbit reviewer
        
        Engine selection at Step 8 (when `coderabbit` is set):
        
        | Slot | Engine |
        |---|---|
        | Project reviewer subagents (`.agents/agents/` matched to diff) | Always run (unchanged by `coderabbit`) |
        | Generic reviewer | `coderabbit:code-review` |
        | Sub-pass (suspected bug / perf regression) | `/diagnosing-bugs` (unchanged) |
        | Fallback (no project reviewers, PR exists) | `/greploop` (unchanged) |
        
        Dispatch the CodeRabbit reviewer in parallel with the project subagents where possible. Collect findings; apply Step 8 termination (zero actionable) and pass-cap rules unchanged.
        
        ## Step 8b — Rework delegation (`coderabbit:autofix`)
        
        When Step 8 surfaces findings that require non-trivial implementation work — multiple files, cross-cutting refactors, or a category of fix the regular pass cannot complete inline — delegate the rework to `coderabbit:autofix`, mirroring the existing `codex:codex-rescue` path.
        
        Before delegating, run the re-hydrate block (per the standard pass discipline) and inline the karpathy constraints in the rework prompt. `coderabbit:autofix` runs as a foreground subagent dispatch with `--wait` semantics so the next Step 8 re-review has the rework diff available.
        
        After delegation returns: re-enter Step 8 with the rework diff as a new pass input. Apply the pass cap to subsequent passes. If `coderabbit:autofix` itself fails or returns no usable diff, surface the failure and pause (or pick safest finding under `automode`).
        
        ## Behavior change vs default
        
        | Stage | Default | With `coderabbit` |
        |---|---|---|
        | Step 8 generic reviewer | `superpowers:requesting-code-review` | `coderabbit:code-review` |
        | Step 8b rework delegation | (n/a or codex-rescue if `codex` set) | `coderabbit:autofix` |
        | Findings format | Per the reviewer's contract | Per CodeRabbit's contract; map severity → must-fix/should-fix/nit per the file in coderabbit:code-review |
        
        ## Composition with other flags
        
        | Combination | Effect |
        |---|---|
        | `coderabbit` + `automode` | Reviewer runs unprompted. Step 8b rework delegates without user confirmation; failures pick safest path. |
        | `coderabbit` + `secure` | After CodeRabbit converges, `security-review` runs as the post-Step-8 gate (per the `secure` contract). Both must clear before Step 9. |
        | `coderabbit` + project subagents | Project subagents always run; `coderabbit` is the generic-reviewer companion. Both engines contribute findings to the same pass budget. |
        | `coderabbit` + `/forge pr <N>` | PR-review mode uses CodeRabbit as the engine for the existing PR's diff. The reviewer's PR-specific features (line comments, summaries) compose naturally. |
        | `coderabbit` + `codex` | Both engines run in the same Step 8 pass; rework routes per finding (codex → `codex:codex-rescue`, coderabbit → `coderabbit:autofix`). |
        
      • codex.md 3.8 KB
        # Forge — Codex reviewer reference
        
        Loaded on demand by SKILL.md Step 8 **only when the `codex` or `codex challenge` flag is set**. Default (no flag) runs never read this file.
        
        **Claude Code only** — the `codex` plugin is CC-exclusive. Non-CC runtime: ignore the flag, warn once, use `superpowers:requesting-code-review`, do not read further. The rest of forge stays runtime-generic.
        
        This file is reviewer-only. Implementation delegation (the `codex impl` flag) is owned by [../modes/codex-impl.md](../modes/codex-impl.md); when `impl` is set, Step 8b rework routes through that file's tiered `task` path instead of the subagent path below.
        
        ## Step 8a — Codex generic reviewer
        
        `/codex:review` / `/codex:adversarial-review` are `disable-model-invocation: true` — unreachable via the Skill/command tool inside an autonomous loop. Drive the companion script over Bash:
        
        1. **Resolve + pre-flight** (once/run) via the bundled helper. Run it by its absolute path — `<forge-skill-dir>/scripts/resolve-codex.py`, where `<forge-skill-dir>` is the base directory announced when this skill loaded (the dir containing `SKILL.md`):
           ```bash
           python3 <forge-skill-dir>/scripts/resolve-codex.py
           ```
           It `JSON.parse`s `codex-companion.mjs setup --json` and prints the newest companion's absolute path **iff** `ready && codex.available && auth.loggedIn`; otherwise prints `UNAVAILABLE` and exits non-zero (covers: plugin/node/Codex missing or not authenticated). Capture stdout as `<script>`.
        2. Output `UNAVAILABLE` (plugin absent, Codex missing, or unauthenticated) → **degrade gracefully**: warn the Codex reviewer is unavailable, fall back to `superpowers:requesting-code-review` this run, continue the loop. Never stall.
        3. **Run foreground/synchronous** (the loop needs findings now) with the resolved `<script>`:
           - `codex` → `node <script> review --wait`
           - `codex challenge` → `node <script> adversarial-review --wait` (challenges approach/design/assumptions). Implies `codex`; **never both passes**.
        4. Verbatim Codex output = this pass's generic-reviewer findings; merge with the project reviewer agents' findings; same must-fix/should-fix termination as Step 8.
        
        ## Step 8b — Optional: delegate rework to Codex (agent discretion)
        
        Codex-suited findings (mechanical refactors, a self-contained fix Codex itself proposed) → forge **may** hand rework to the `codex:codex-rescue` subagent instead of fixing inline. Judgment call; small fixes stay inline. `automode`: auto-decide — delegate only if net-positive + clearly Codex-suited. If `coderabbit` is also set, this path handles only codex-raised findings; coderabbit findings route to `coderabbit:autofix`.
        
        Delegation **follows the re-hydration**:
        
        1. **Re-hydrate** (`/compact` → re-source `/karpathy-guidelines`) Claude-side first — forge still reviews Codex's returned diff with fresh discipline.
        2. Dispatch via the **Agent tool**, `subagent_type: "codex:codex-rescue"` (subagent, *not* a skill — never `Skill(codex:rescue)`; re-enters the command, hangs). Codex is a different runtime, **cannot source the `/karpathy-guidelines` skill** — inline its substance as task-prompt constraints:
           ```
           Constraints (follow strictly before touching code):
           <karpathy-guidelines principles — surgical/minimal changes,
            no overcomplication, surface assumptions, verifiable success criteria>
        
           Task: <specific rework, scoped to the finding>
           ```
        3. **Foreground (`--wait`)** — loop blocks until rework returns, then re-enter Step 8 on the new diff. Background + lifecycle polling (`node <script> status|result|cancel`, or `/codex:status|result|cancel` for the user) only for a rare long rescue.
        4. The subagent only *forwards* to Codex; doesn't poll/cancel itself. Returns nothing (Codex failed) → fix inline, continue — never stall the loop on a failed delegation.
        
    • trackers
      • github.md 993 B
        # Forge — GitHub issue reference
        
        Loaded on demand by SKILL.md **only when `git remote get-url origin` (fallback `upstream`) host is `github.com` or a GitHub Enterprise hostname**. Other git hosts and Atlassian Jira / Linear never touch this file.
        
        ## Step 1b — Fetch source (resolve)
        
        `gh` is the primary CLI.
        
        ## Step 2 — Pull the issue
        
        ```bash
        gh issue view <N> --json number,title,body,state,labels,comments,author,url
        ```
        
        Read **body + every comment** — latest comments often carry the missing repro / decision.
        
        If `<N>` is a pull request, `gh issue view` says so — stop and ask whether they meant `/forge pr <N>`.
        
        ### GitHub-absent fallback
        
        `gh` missing or unauthenticated → host REST API:
        
        ```bash
        curl -sH "Accept: application/vnd.github+json" \
             ${GITHUB_TOKEN:+-H "Authorization: Bearer $GITHUB_TOKEN"} \
             "https://api.github.com/repos/owner/repo/issues/<N>"   # comments: same URL + "/comments"
        ```
        
        Unauth REST is rate-limited — say so if you fall back.
        
      • gitlab.md 824 B
        # Forge — GitLab issue reference
        
        Loaded on demand by SKILL.md **only when `git remote get-url origin` (fallback `upstream`) host matches `gitlab.*` (including self-hosted)**. Other git hosts and Atlassian Jira / Linear never touch this file.
        
        ## Step 1b — Fetch source (resolve)
        
        `glab` is the primary CLI.
        
        ## Step 2 — Pull the issue
        
        ```bash
        glab issue view <N> -F json   # confirm flag via `glab issue view --help`
        ```
        
        Read **body + every comment** — latest comments often carry the missing repro / decision.
        
        If `<N>` is a merge request, not an issue, stop and ask whether they meant `/forge pr <N>`.
        
        ### GitLab-absent fallback
        
        `glab` missing or unauthenticated → host REST API: `GET /projects/:id/issues/:iid` + `/notes`, token in `PRIVATE-TOKEN`. Unauth REST is rate-limited — say so if you fall back.
        
      • jira.md 2.8 KB
        # Forge — Jira ticket reference
        
        Loaded on demand by SKILL.md **only when `<ref>` resolves to a Jira ticket** (key-shape `[A-Z][A-Z0-9]+-\d+` or the `ticket` keyword — see Parameters → Target grammar). Git-host issues never touch this file.
        
        "The runtime's Jira tool" = whatever Atlassian/Jira MCP read/write tools the runtime advertises. Never hardcode a tool name.
        
        ## Step 1c — Fetch source (resolve)
        
        Fetch via the **connected Atlassian/Jira MCP tools** the runtime exposes (issue-fetch + comments; usually a Jira "get issue" tool, often needs a cloud-id from an "accessible resources" tool first). No Jira MCP connected, or auth/permission error → **Jira-absent fallback** below.
        
        ## Step 2 — Pull the ticket
        
        Pull via the runtime's Jira read tool: summary, description, issue type, status, priority, labels/components, acceptance-criteria field if present, **and every comment**. Issue type = bug-vs-feature signal for Step 4 table + Step 3 prefix.
        
        Read **body + every comment**. Latest comments often carry the missing repro / decision.
        
        ### Jira-absent fallback
        
        No Jira MCP connected, or auth/permission error: **warn explicitly that Jira sourcing is unavailable**, then offer exactly three choices (proposed-answer; `automode` still stops here — it suppresses *gates*, not a missing data source):
        
        ```
        Warning: Atlassian/Jira MCP not connected (or unauthorized) — can't fetch <ref>.
          - Paste the ticket title + description (+ acceptance criteria) here (Recommended)
          - I'll authenticate the Atlassian MCP, then retry the fetch
          - Abort
        ```
        
        *Paste* → treat text as issue body, → Step 3. *Authenticate* → run the runtime's Atlassian auth/connect tool, retry Step 1c once. *Abort* → stop, do nothing.
        
        ## Step 3 — Key in branch & commits
        
        Repo guide still wins (documented Jira convention / smart-commit / subject-line rule overrides everything). Guide silent → branch `<prefix>/<KEY>-<slug>` (e.g. `fix/PROJ-123-parser-utf16-bom`); commit subjects keep repo style — do **not** force `PROJ-123` into the subject unless the guide asks (breaks e.g. subject-only repos capped at 72 chars). Key always in the Step 5 proposal text regardless.
        
        ## Step 12 — Write-back
        
        The Step 12 closing menu shows a Jira write-back option **only when the target was a Jira ticket**:
        
        ```
          - Lay down that history, push, open the PR, and comment + transition <KEY> on Jira
        ```
        
        Jira write-back — **opt-in, never automatic**. On selection: comment on `<KEY>` (branch/PR link + one-line summary), then transition — but first read the ticket's *available* transitions via the runtime's Jira tool and confirm the target state (names are project-specific; ambiguous → ask, proposed-answer). Never invent a transition id. **Never** Jira-write-back on any other menu option, without an explicit pick here, or under `automode`.
        
      • linear.md 4 KB
        # Forge — Linear ticket reference
        
        Loaded on demand by SKILL.md **only when `<ref>` resolves to a Linear issue** (key-shape `[A-Z]+-\d+` after Jira disambiguation, or the `linear` keyword — see Parameters → Target grammar). Git-host issues and Jira tickets never touch this file.
        
        "The runtime's Linear tool" = whatever Linear MCP read/write tools the runtime advertises. Never hardcode a tool name; common surfaces are the Linear MCP server, the `linear` CLI, and the Linear REST/GraphQL API. The skill picks whichever is connected.
        
        ## Jira / Linear disambiguation
        
        Both trackers use the same key shape (`[A-Z]+-\d+`). When the user invokes `/forge ENG-42` with both trackers configured, ask which:
        
        ```
        Warning: Both Jira and Linear are connected, and `ENG-42` matches both key shapes.
          - Linear (issue ENG-42 in <team-name>) (Recommended if Linear is the primary tracker)
          - Jira (project ENG, issue 42)
          - Abort
        ```
        
        Single-tracker setups skip this prompt — only one match is possible. `automode` cannot answer this question (it interviews the user); under `automode`, attempt Linear first if both are connected, record the assumption in the proposal, abort if Linear lookup 404s.
        
        The `linear` keyword (e.g. `/forge linear ENG-42`) forces Linear routing without the disambiguation prompt. Symmetric to the `ticket` keyword that exists for Jira.
        
        ## Step 1 — Fetch source (resolve)
        
        Fetch via the connected Linear MCP tools the runtime exposes (issue-fetch + comments; usually a Linear "get issue" tool, often needs a team-id or workspace-id prefix). No Linear MCP connected, or auth/permission error → **Linear-absent fallback** below.
        
        ## Step 2 — Pull the issue
        
        Pull via the runtime's Linear read tool: title, description, state (Triage / Backlog / Todo / In Progress / In Review / Done / Canceled / Duplicate), priority (Urgent / High / Medium / Low / No priority), labels, assignee, estimate, parent issue (if sub-issue), **and every comment**. State + labels = bug-vs-feature signal for Step 4 table + Step 3 prefix.
        
        Read **body + every comment**. Linear's comment surface is heavily used for inline implementation discussion; comments often carry the actual spec.
        
        ### Linear-absent fallback
        
        No Linear MCP connected, or auth/permission error: warn explicitly that Linear sourcing is unavailable, then offer the three-choice fallback (proposed-answer; `automode` still stops here — missing data source, not a gate):
        
        ```
        Warning: Linear MCP not connected (or unauthorized) — can't fetch <ref>.
          - Paste the issue title + description (+ acceptance criteria) here (Recommended)
          - I'll authenticate the Linear MCP, then retry the fetch
          - Abort
        ```
        
        *Paste* → treat text as issue body, → Step 3. *Authenticate* → run the runtime's Linear auth/connect tool, retry once. *Abort* → stop, do nothing.
        
        ## Step 3 — Key in branch & commits
        
        Repo guide still wins (documented Linear convention overrides everything). Guide silent → branch `<prefix>/<KEY>-<slug>` (e.g. `fix/ENG-123-parser-utf16-bom`). Linear has no smart-commit syntax like Jira; the key in the branch name is enough for Linear's GitHub/GitLab integration to auto-link.
        
        Key always in the Step 5 proposal text regardless.
        
        ## Step 12 — Write-back
        
        The Step 12 closing menu shows a Linear write-back option **only when the target was a Linear issue**:
        
        ```
          - Lay down that history, push, open the PR, and comment + transition <KEY> on Linear
        ```
        
        Linear write-back — **opt-in, never automatic**. On selection: comment on `<KEY>` (branch/PR link + one-line summary), then transition — but first read the issue's *available* states via the runtime's Linear tool and confirm the target state (workflow states are workspace-specific; ambiguous → ask, proposed-answer). Never invent a state id. **Never** Linear-write-back on any other menu option, without an explicit pick here, or under `automode`.
        
        The closing menu in `references/proposal-template.md` Step 12 keeps a single "comment + transition <KEY>" line; the trailing tracker name (`Jira` or `Linear`) is filled in based on which tracker resolved `<ref>`.
        
    • anti-patterns.md 1.4 KB
      # Forge — Anti-patterns
      
      Patterns that cause forge to misbehave or ship the wrong work. Split across two files:
      
      - **[mistakes.md](mistakes.md)** — Common Mistakes table. 34 rows covering pre-implementation discipline, the review loop, Step 12 closing, and per-flag mistakes. Lookup table for "I'm about to do X, is that wrong?"
      - **[red-flags.md](red-flags.md)** — Red Flags STOP list. 12 bullets covering specific phrases that should halt forward motion. Pattern-match against your own reasoning out loud, not against the user's words.
      
      Both bind under `automode` — `automode` lifts user gates, not safety floors.
      
      ## When to add a new entry
      
      Add a row to **mistakes.md** when forge does the wrong thing and a corrective rule generalizes beyond a single session. Format: "What forge did wrong | What it should do instead (with reference link if applicable)".
      
      Add a bullet to **red-flags.md** when there's a *rationalization* the agent should learn to recognize. Format: `"Quoted thought" → terse corrective.` (Quoted thought = first-person agent self-talk; corrective = action, not explanation.)
      
      New rules should also link to the relevant reference file (`modes/<flag>.md`, `reviewers/<name>.md`, `trackers/<name>.md`) so the rule's context is one click away.
      
      Cross-references should point at the leaf file (`mistakes.md` / `red-flags.md`) directly when possible, rather than at this index.
      
    • autonomy.md 6.7 KB
      # Forge — Autonomy & `automode` matrix
      
      `automode` lifts user gates so forge can run end-to-end without prompts. It never lifts the **hard floors** — actions whose blast radius makes silent execution unsafe. Inline `automode:` notes in `SKILL.md` Steps 1–12 stay in place; this file is the single source you cross-check when you need the full picture.
      
      ## Default vs `automode`, step by step
      
      | Step | Default behavior | Under `automode` | Hard floor (never lifts) |
      |---|---|---|---|
      | Step 4 (context check) | Interview user on each missing required field; a small set of proposed answers, `(Recommended)` marked | Skip interview; pick `(Recommended)`; record the assumption in the proposal | — |
      | Step 4a (risky-fork grilling) | `/grill-me` or `/grill-with-docs` if a design fork is ambiguous AND expensive to get wrong | Never grill — grilling interviews the user. Record fork + chosen branch as an explicit proposal assumption | — |
      | Step 5 (propose) | End the proposal with next-turn options; wait for user pick | No options, no wait → straight to Step 7 (with `docs`: after writing `CONTEXT.md`) | — |
      | Step 6 (the gate) | Do not edit any file until explicit approval (`yes, implement` / `go ahead` / `do it` / `ship it`) | Gate skipped — proposal → Step 7 directly | — |
      | Step 7 (implement) | `/goal` set + `/karpathy-guidelines` re-source, then edit the approved plan | Same | — |
      | Step 8 (review loop) | Project reviewers + generic reviewer; terminate at zero actionable findings; cap the review passes; not converged → summarize, ask user | Same engines + cap; not converged → pick safest finding to act on, continue (no user prompt) | pass cap |
      | Step 8 — Jira-absent fallback | Warn + 3-choice prompt (paste / auth / abort) | Same — the fallback **still binds** under `automode` because a missing data source is not a gate | Jira-absent fallback |
      | Step 9 (refactor) | `/improve-codebase-architecture` surfaces opportunities; user approves | Agent decides — apply only clearly net-positive, in-scope refactors; otherwise continue | — |
      | Step 10 (spinoff issues) | Draft via `/to-tickets`, show drafts, post on explicit user yes | Post drafts directly | — |
      | Step 11 (self-evolution) | Propose `/writing-for-agents`, agent-config edit, or memory write; show diff + path; confirm before write | Decide and apply the smaller-blast-radius option with no proposal, incl. memory writes (prefer rule/guide edit over a new skill unless the pattern is clearly broad) | — |
      | Step 12 — verify | Run `/goal` pass criteria + repo standard pre-commit checks; show output; green first | Same — agent runs the checks itself and proceeds only on green | `/goal` verification gate |
      | Step 12 — closing | Ask the closing question (the closing menu) | Skip the question; emit the proposed small-commit history as a plan only (to `/tmp/forge-<ref>.md` under `docs`, else inline); stop | Never auto-commit / auto-push / Jira write-back |
      | Throughout | Stop at substantive gates listed above (Steps 6, 9, 10, 11, 12) | No user gates between Steps 7–11; only hard floors bind | All hard floors above |
      
      ## Why these hard floors do not lift
      
      | Floor | Reason |
      |---|---|
      | No auto-commit / auto-push / Jira write-back | These are externally visible and hard to reverse. The 3rd option in the Step 12 closing menu is the only path that touches Jira; it requires explicit user selection. |
      | Step 12 `/goal` verification gate | An unproven "done" is the one failure mode forge must not ship. Verification is cheap; lying is expensive. |
      | Step 2 Jira-absent fallback | A missing data source means we cannot trust the issue body. Proceeding silently means proposing against the wrong spec. |
      | Step 8 pass cap | Past the cap, reviewer disagreement is the signal — not "try harder." |
      
      ## Composability with other flags
      
      | Combination | Effect |
      |---|---|
      | `automode` + `docs` | No interview; write `CONTEXT.md` directly; Step 12 emits plan to `/tmp/forge-<ref>.md` |
      | `automode` + `codex` (or `codex challenge`) | Codex review/adversarial-review runs without user prompts; Step 8b rescue delegation auto-decides |
      | `automode` + project reviewer subagents missing + no PR | `/greploop` cannot run (needs a PR). Skip to Step 9 with the unmet condition noted. |
      | `automode` + `tdd` | TDD discipline binds. The agent writes the test, runs it, confirms red itself, then implements. No user prompt; the failing-test observation is the agent's own. See [modes/tdd.md](modes/tdd.md). |
      | `automode` + `worktree` | Worktree is created without prompting. Step 12 cleanup never auto-runs — losing in-progress state on inferred completion is the wrong default. See [modes/worktree.md](modes/worktree.md). |
      | `automode` + `lookup` | Fetches happen without prompts. Failures (rate limit, network) become Risks in the proposal, not blockers. See [modes/lookup.md](modes/lookup.md). |
      | `automode` + `secure` | Security pass runs unprompted. Must-fix findings apply via the regular `automode` Step 8 pick-safest path. Pass-budget rule still binds. See [modes/secure.md](modes/secure.md). |
      | `automode` + `changelog` | Entry is drafted without prompt at Step 12. The commit list is emitted as a plan (per `automode` Step 12 behavior); the changelog entry rides along in that plan. See [modes/changelog.md](modes/changelog.md). |
      | `automode` + `ci-watch` | Functionally inert. `automode` skips the closing menu and emits a plan only — no push, so nothing to poll. Combination is valid but no work happens. See [modes/ci-watch.md](modes/ci-watch.md). |
      | `automode` + `/forge pr <N>` | Skip the PR-review closing menu; emit the review summary as a plan to `/tmp/forge-pr-<N>.md` and stop. No auto-push of fixup commits, no auto-approve, no auto-request-changes. See [modes/pr-entry.md](modes/pr-entry.md). |
      | `automode` + Linear (or Jira/Linear ambiguity) | Cannot interview to disambiguate; attempt Linear first if both trackers connected, record assumption, abort if Linear lookup 404s. See [trackers/linear.md](trackers/linear.md). |
      | `automode` + `coderabbit` | Reviewer runs unprompted; Step 8b rework delegation to `coderabbit:autofix` auto-decides. Composes with `codex` — both engines run, rework routes per finding. See [reviewers/coderabbit.md](reviewers/coderabbit.md). |
      | `automode` + `code-review` | The two-axis review runs unprompted; its findings are fixed in-pass under the regular `automode` pick-safest path. See [reviewers/code-review.md](reviewers/code-review.md). |
      | `automode` + `implement` | The `/implement` delegation runs unprompted; the conformance check against the approved plan is the agent's own, and deviations enter Step 8 as findings. See [modes/implement.md](modes/implement.md). |
      
      (This table grows as new flags land. Each flag's reference file states its `automode` behavior in a single row and links here.)
      
    • flags.md 5 KB
      # Forge — Flag matrix
      
      The full set of flags the forge skill understands, with composition rules and conflict handling.
      
      ## Flags
      
      | Flag | Effect | Detail |
      |---|---|---|
      | `automode` | No user gates; auto-decide Steps 6/9/10/11; emit Step 12 as plan only | [autonomy.md](autonomy.md) |
      | `docs` | Source plan from `CONTEXT.md`; Step 12 proposal → `/tmp/forge-<ref>.md` | — |
      | `codex` | Add Codex to the generic-reviewer set (resolve via `scripts/resolve-codex.py`). Claude Code only | [reviewers/codex.md](reviewers/codex.md) |
      | `codex challenge` | Codex `review` → `adversarial-review`. Implies `codex` | [reviewers/codex.md](reviewers/codex.md) |
      | `codex impl` | Codex (GPT-5.6 auto-tiered: Sol/Terra/Luna) implements Step 7 and handles Step 8b rework; the generic reviewer reverts to the default. Claude Code only | [modes/codex-impl.md](modes/codex-impl.md) |
      | `tdd` | Compose `/tdd` at Step 7; observe failing test before implementation | [modes/tdd.md](modes/tdd.md) |
      | `worktree` | Compose `superpowers:using-git-worktrees` at Step 3 instead of in-place branch switch | [modes/worktree.md](modes/worktree.md) |
      | `lookup` | Query the `context7` MCP/resources at Step 4 for library-specific facts | [modes/lookup.md](modes/lookup.md) |
      | `secure` | Compose `security-review` after Step 8 convergence; findings re-enter Step 8 as must-fix | [modes/secure.md](modes/secure.md) |
      | `changelog` | At Step 12, draft a changelog entry per repo convention | [modes/changelog.md](modes/changelog.md) |
      | `ci-watch` | After Step 12 push, poll CI; on red, re-enter Step 8 with the failure as a finding | [modes/ci-watch.md](modes/ci-watch.md) |
      | `compress` | Before Step 1, source a token-saving output skill for the session: `ponytail` if installed, else `caveman`, else ignore the flag with a one-line note | [modes/compress.md](modes/compress.md) |
      | `coderabbit` | Add CodeRabbit to the generic-reviewer set. Step 8b rework path uses `coderabbit:autofix`. Claude Code only | [reviewers/coderabbit.md](reviewers/coderabbit.md) |
      | `code-review` | Add `/code-review` (two-axis: Standards + Spec) to the generic-reviewer set. Plain skill; any runtime | [reviewers/code-review.md](reviewers/code-review.md) |
      | `implement` | `/implement` builds Step 7 scoped to the approved plan, with its own `/code-review` closeout skipped (Step 8 owns review) | [modes/implement.md](modes/implement.md) |
      
      ## Entry verbs
      
      In addition to the flags above, the skill supports an entry-mode verb:
      
      | Verb | Effect | Detail |
      |---|---|---|
      | `/forge pr <N>` | Skip Steps 4–7; enter Step 8 against the existing PR diff. Pre-Step-8 flags are ignored; Step-8-or-later flags apply | [modes/pr-entry.md](modes/pr-entry.md) |
      | `/forge plan <path>` | Replace Steps 1, 2, 4–6 with a single Step P validation pass; enter at Step 7 with the plan slice as the approved proposal. Step 3 still runs | [modes/plan-entry.md](modes/plan-entry.md) |
      
      ## Composition rules
      
      | Rule | Why |
      |---|---|
      | `codex` and `coderabbit` compose | Both run in the same Step 8 pass; each finding's rework routes to the engine that raised it. |
      | `codex challenge` implies `codex` | Challenge mode is a variant of the Codex reviewer pass. |
      | `codex impl` reverts the generic reviewer to the default | The model family that wrote the diff must never be the only reviewer (cross-model review). `codex impl challenge` re-adds Codex adversarial review as an *additional* engine, never the only one. |
      | `codex impl` is inert at Step 7 under `/forge pr <N>` | PR mode has no Step 7; the Step 8b rework tiering still applies. One-line note, no error. |
      | `ci-watch` requires the Step 12 push option | Polling without a published target is pointless. Silently skip if user picked a non-push Step 12 option. |
      | `tdd` discipline binds under `automode` | The "observe failing test before implementing" rule is the point of the flag; under `automode` the agent runs the test itself and confirms red. |
      | `/forge pr <N>` ignores all lifecycle flags except `automode` and reviewer flags | PR-review mode skips Step 7 implementation; only Step 8 reviewer engines and the `automode` no-gates property apply. |
      | `compress` composes with every flag and entry mode, including `pr` | It shapes session output, not the lifecycle; no step depends on it. Inert (one-line note) when neither `ponytail` nor `caveman` is installed. |
      | `code-review` composes with `codex` and `coderabbit` | All set engines run in the same Step 8 pass; a `code-review` finding has no dedicated rework skill, so it is fixed in-pass. |
      | `implement` conflicts with `codex impl` | Two engines cannot own the same Step 7. Stop and report the conflict rather than applying a precedence — silently honouring one would hide which engine actually built the diff. |
      | `implement` makes `tdd` redundant | `/implement` already drives `/tdd` at pre-agreed seams. Accept the combination with a one-line note; the discipline is not doubled. |
      | `implement` is inert at Step 7 under `/forge pr <N>` | PR mode has no Step 7. One-line note, no error — same rule as `codex impl`. |
      
    • mistakes.md 6.7 KB
      # Forge — Common Mistakes
      
      Anti-pattern table: things to avoid, with the fix in the second column. Each row is independent; skim in any order. Both this file and [red-flags.md](red-flags.md) bind under `automode` — `automode` lifts user gates, not safety floors.
      
      | Mistake | Fix |
      |---|---|
      | Editing code before "yes, implement" (no `automode`) | Stop. Re-read Step 6. Revert. |
      | Full-codebase sweep before proposing | Inventory already-loaded context first; read only issue-named + top candidate files (Step 4). |
      | Hardcoding branch prefixes when the repo has a git guide | Repo guide wins (Step 3). |
      | Open free-text interview questions | Propose a small set of answers, mark `(Recommended)`, let the user select. |
      | Sourcing `/grill-me` under `automode` | Forbidden — grilling interviews the user. Record assumptions instead. |
      | Restating `/goal` in the re-hydrate block | `/goal` is set once (Step 7); the re-hydrate block is `/compact` plus karpathy only. |
      | Assuming GitHub / `gh` | Detect the host, pick the CLI (Step 1). |
      | `.claude/` / `CLAUDE.md` as the only config | Use the agent-general guide/dir for your runtime. |
      | One giant squash commit by default | Propose a small atomic history matching the branch (Step 12); repo guide can still override. |
      | Auto-committing under `automode` | `automode` lifts gates but never the no-auto-commit floor. |
      | Reading only the issue body, not comments | Latest comment usually has the real spec. |
      | Bare number → Jira ticket | Bare `N` = git-host; Jira needs key-shape or `ticket` keyword (grammar). |
      | Silent continue when Jira MCP absent | Warn, then the Jira-absent fallback (Step 2). Even under `automode`. |
      | `Skill(codex:review)` / `Skill(codex:rescue)` | `disable-model-invocation` — drive `codex-companion.mjs` over Bash (Step 8a); rescue = **Agent** subagent `codex:codex-rescue` (Step 8b). |
      | Codex flag under non-Claude-Code runtime | Ignore + warn once; generic reviewer stays `superpowers:requesting-code-review` (Parameters, Step 8a). |
      | Telling Codex to "source /karpathy-guidelines" | Codex can't run Claude skills — inline principles as prompt constraints (Step 8b). |
      | `codex` replacing project reviewer agents | `codex` swaps only the *generic* reviewer; project agents always run (Step 8). |
      | Both Codex review + adversarial-review | `codex challenge` implies `codex`, replaces the pass — never both (Step 8a). |
      | Forcing `PROJ-123` into commit subjects | Repo guide wins; default = key in branch only (Step 3). |
      | Proposing commits without running `/goal` | Step 12 verify gate — run pass criteria + repo checks, show output, green first. Binds under `automode` too. |
      | Re-running the full Step 8 loop (the re-hydrate block plus both reviewers) for pure trim cleanup after a clean substantive pass | Apply the trims inline, run the repo verify command, move to Step 9. The pass cap is for non-convergence, not for nit verification. Trim = doc-comment edits, blank-line grouping, naming touch-ups; no logic touched. |
      | Writing implementation code before observing the failing test under the `tdd` flag | Compose `/tdd` per the [modes/tdd.md](modes/tdd.md) contract: write the test first, run it, confirm red, then implement. `automode` does not lift this discipline; the agent runs the test itself and confirms red before any implementation edit. |
      | Leaving the worktree behind after Step 12 closes (`git worktree list` fills with stale entries; disk usage grows) | Read the Step 12 closing addendum; run `git worktree remove <path>` (or `git worktree prune` if the branch was deleted) when the changes are merged or discarded. Cleanup never auto-runs, even under `automode` — losing in-progress state on inferred completion is the wrong default. See [modes/worktree.md](modes/worktree.md). |
      | Relying on training-data recall for library-specific API claims when `lookup` is available | If the issue mentions a library/framework/SDK/CLI/cloud service and the proposal makes specific API claims, set `lookup` so the proposal is grounded in fetched current docs. Training data ages; library APIs do not stand still. Skip `lookup` only when the issue is pure business logic with no library surface. See [modes/lookup.md](modes/lookup.md). |
      | Using the deprecated `with docs` spelling in `/forge` invocations | Update to `docs`. The `with docs` alias no longer parses. See [flags.md](flags.md). |
      | Running `security-review` only as the last check rather than as a Step 8 gate under `secure` | The post-Step-8 placement is deliberate. Security findings must be addressed before Step 9/12, not surfaced after close when re-opening the diff is costly. See [modes/secure.md](modes/secure.md). |
      | Drafting the `changelog` entry before `/goal` verifies green | The entry must reflect what actually shipped. If the verify gate fails and Step 8 reopens, the previous draft is stale; redraft after re-convergence. Never include a changelog entry in a commit list whose verify failed. See [modes/changelog.md](modes/changelog.md). |
      | Setting `ci-watch` without choosing a push option (Step 12 menu options 2 or 3) | Polling has no target; the flag becomes inert. Pick option 2 or 3 deliberately, or unset `ci-watch`. See [modes/ci-watch.md](modes/ci-watch.md). |
      | Using `/forge pr <N>` to "re-review" the PR you just finished with `/forge <issue>` | The forge run already executed Step 8 against the same diff; rerunning burns reviewer budget without new signal. Use `/forge pr <N>` for PRs you did not produce in this session. See [modes/pr-entry.md](modes/pr-entry.md). |
      | Forcing the Jira/Linear disambiguation prompt to repeat for the same key in one session | If both trackers are configured and the user already picked one for `<KEY>-N`, remember the choice for the session. Re-prompt only for a different key prefix. See [trackers/linear.md](trackers/linear.md). |
      | Running `/compact` before recording the review findings | Capture the must-fix / should-fix list first; `/compact` sheds the transcript, not the list. Fix from the list (re-hydrate block). |
      | Implementing a stale `CONTEXT.md` from an earlier run under `docs` | Stamp it with its ref at Step 5; check the stamp matches at Step 7; on mismatch, re-propose. |
      | Delegating Step 7 to Codex under `codex impl` before `/goal` is set (or before the observed-red test under `tdd`) | Run the Step 7 opener first; with `tdd`, write and observe the failing test yourself, then delegate with the red test quoted as a pass criterion. See [modes/codex-impl.md](modes/codex-impl.md). |
      | Accepting a Codex-implemented diff without the plan-conformance check | Diff the returned work against the approved plan (file list, scope, no unrelated rewrites) before entering Step 8; revert or flag out-of-scope edits. See [modes/codex-impl.md](modes/codex-impl.md). |
      
    • proposal-template.md 3.3 KB
      # Forge — Proposal & Interview Templates
      
      The literal block formats forge uses at three user-visible touchpoints. `SKILL.md` Steps 4 / 5 / 12 reference this file for the exact text to emit; the surrounding step prose holds the contract (when to emit, what each slot means, what `automode` does).
      
      ## Step 4 — Interview question format
      
      When a required field (acceptance criteria, repro, affected surface, …) is missing, emit one block per gap. Never open free-text. Mark the most likely answer `(Recommended)`. "Other" is implicitly always available.
      
      ```
      Q1: <gap, one line>
        - <option A> (Recommended)
        - <option B>
        - <option C>
      ```
      
      Rules:
      
      - 2–4 options per gap. Fewer is too rigid; more becomes decision fatigue.
      - One block per question, one question at a time.
      - The user picks; never invent the answer.
      - Runtimes with a selection UI: the user highlights + Enter; the agent does not parse free text against the option set.
      - Never continue past this step on an unanswered required gap.
      
      ## Step 5 — Proposal block
      
      Emit exactly one proposal block per `/forge` invocation. Verify file paths exist (Read/Grep) before listing; drop `:line` if you have not opened the file.
      
      ```
      **Issue #<N>: <title>**
      
      **Restated:** <one sentence>
      
      **Root cause / design:** <2–4 sentences>
      
      **Files to touch:**
      - path/to/file.ext:<lineish> — <what changes>
      
      **Plan:**
      1. <step>
      2. <step>
      
      **Pass criteria (→ /goal):** <exact build/test/behavior that must hold>
      
      **Tests:** <added or updated>
      
      **Risks / open questions:** <unsure points; mark any UNANSWERED risky design fork>
      ```
      
      `docs` mode writes the proposal to `CONTEXT.md` (repo root) instead of / in addition to chat; Part 2 sources the plan from `CONTEXT.md`, not chat scrollback.
      
      ### Step 5 next-turn options
      
      End the proposal stating the user's choices:
      
      - `yes, implement` — open the gate → Step 7.
      - `interview me on risky questions` — only if a risky design fork is still unanswered; runs Step 4a grilling, re-proposes.
      - otherwise: any adjustment → revise, re-propose.
      
      `automode`: no options, no wait — straight to Step 7 (with `docs`: after writing `CONTEXT.md`).
      
      ## Step 12 — Closing menu
      
      Ask one closing question after `/goal` verifies green. Step 4 proposed-answer format: user selects; `(Recommended)` marked; "Other" implicit.
      
      ```
      Forge is done — how should the changes land?
        - Lay down the proposed small-commit history on this branch, push nothing (Recommended)
        - Lay down that history, push to origin, and open a PR to the base branch
        - Lay down that history, push, open the PR, and comment + transition <KEY> on Jira   ← Jira target only
        - Walk me through the implementation at a high level first — run /wait-what, then re-ask
        - Write the whole proposal (commit plan + diff summary) to /tmp/<name>.md and stop
        - Hold — leave the working tree uncommitted for my own manual review
      ```
      
      Rules:
      
      - Show the 3rd line only when the target was a Jira ticket.
      - `docs` mode pre-marks the `/tmp/<name>.md` option `(Recommended)` over option 1.
      - Act only on the selected option. Option 2 follows the repo guide for base branch + PR target.
      - Jira write-back (3rd option) is opt-in only; never on other options, never under `automode`.
      - `automode` skips this question entirely and emits the small-commit plan only — see [autonomy.md](autonomy.md) Step 12 closing.
      
    • red-flags.md 1.9 KB
      # Forge — Red Flags
      
      Phrases that should make you STOP. If a thought matches one of these, the corrective is in the second clause — apply it, do not rationalize.
      
      Both this file and [mistakes.md](mistakes.md) bind under `automode` — `automode` lifts user gates, not safety floors.
      
      - "I'll just start with the obvious change." → propose first (unless `automode`).
      - "User said /forge, that means implement." → it means *propose* (unless `automode`).
      - "Let me read the codebase first to be safe." → use already-sourced context + issue-named files only; unknowns go in Risks (Step 4).
      - "The repo's CONTRIBUTING says X but my default says Y." → the repo wins.
      - "I'll grill the user even though it's `automode`." → no — record the assumption.
      - "Refactor looks good, I'll just commit it." → Step 12 proposes; it never commits.
      - "No Atlassian MCP — I'll guess the ticket from context." → no; warn + the Jira-absent fallback (Step 2).
      - "Codex unavailable, skip the review pass." → no; degrade to `superpowers:requesting-code-review`, keep the loop (Step 8a).
      - "Not Claude Code but I'll run codex anyway." → no; codex plugin is CC-only — ignore flag, warn, generic reviewer.
      - "Codex proposed a fix, commit its diff from the loop." → re-review in Step 8 first; Step 12 proposes, never commits.
      - "Tests probably pass, I'll propose the commits." → no; Step 12 verify gate runs `/goal` + repo checks and shows output before any proposal.
      - "I'll comment on the Jira ticket to keep it updated." → only on the explicit Step 12 write-back pick; never else, never `automode`.
      - "Tests exited 0, we're green." → confirm tests actually ran; "no tests collected" is not a pass (Step 12).
      - "Reviewer returned nothing, converged." → confirm it ran; an errored or empty reviewer is not a clean pass (Step 8).
      - "git switch failed, I'll pick another branch name." → no; surface the error and ask (Step 3).
      
    • review-loop.md 4 KB
      # Forge — Step 8 Review Loop
      
      Disciplined critique cycle. Runs after each implementation pass. Terminates when reviewers agree the diff is shippable; caps iterations to prevent infinite refinement.
      
      ## Engine selection
      
      | Mode | Engines | When it runs |
      |---|---|---|
      | Default | Project reviewer subagents from `.agents/agents/` (or runtime equivalent, e.g. `.claude/agents/`) matched to the diff **+** generic reviewer `superpowers:requesting-code-review` | Every Step 8 pass |
      | `codex` / `codex challenge` | Project subagents **+** Codex (`review` or `adversarial-review`) — see [reviewers/codex.md](reviewers/codex.md) | Step 8 when the flag is set; Claude Code runtime only |
      | `coderabbit` | Project subagents **+** `coderabbit:code-review` — see [reviewers/coderabbit.md](reviewers/coderabbit.md) | Step 8 when the flag is set; Claude Code runtime only |
      | Fallback (no project reviewer agents, PR exists) | `/greploop` against the pushed PR | When no project reviewers configured AND a PR exists. Never auto-push to create one. |
      | Sub-pass (suspected bug or perf regression) | `/diagnosing-bugs` | Surface findings, return to the main loop |
      
      **Project subagents always run.** Reviewer flags (`codex`, `coderabbit`) add to the generic-reviewer set; they never replace project agents. `codex` and `coderabbit` compose — set both and both engines run in the same pass.
      
      ## Rework delegation (Step 8b paths)
      
      Findings that exceed a single in-pass fix can be delegated to a companion rework skill before re-entering Step 8:
      
      | Reviewer flag | Step 8b rework skill | Notes |
      |---|---|---|
      | Default (no flag) | none | In-pass fixes only |
      | `codex` / `codex challenge` | `codex:codex-rescue` | re-hydrate first, inline karpathy constraints, foreground `--wait` |
      | `coderabbit` | `coderabbit:autofix` | Same discipline as codex-rescue |
      
      After the rework returns, re-enter Step 8 with the rework diff as a new pass input. The pass cap applies to subsequent passes.
      
      With both reviewer flags set, route each finding's rework to the engine that raised it — codex findings to `codex:codex-rescue`, coderabbit findings to `coderabbit:autofix`. Inline or ambiguous fixes stay agent-discretion.
      
      ## Termination
      
      Terminate at **zero actionable findings**. Actionable = must-fix **or** should-fix. Nits do not block. Stop the loop and proceed to Step 9.
      
      A reviewer that errored or returned nothing did not converge — re-dispatch that engine once before counting the pass clean.
      
      ## Pass cap
      
      Cap **3 passes**. On each non-converged pass, run the re-hydrate block (defined in SKILL.md), fix the findings, then re-review. If pass 3 still has actionable findings, do not start pass 4 — summarize the remainder and ask the user. Under `automode`, pick the safest finding to act on and continue.
      
      ## Pass discipline
      
      | Pass | Action |
      |---|---|
      | 1 | Implement → dispatch all configured engines in parallel where possible → collect findings |
      | 2+ | re-hydrate first (`/compact` + re-source `/karpathy-guidelines`) → apply fixes → dispatch engines again |
      
      The re-hydrate block exists to shed stale reviewer-transcript tokens and reload clean-code discipline. It does not restate `/goal`; `/goal` is set once at Step 7.
      
      ## Skip-the-rerun rule (trim-only cleanup)
      
      After a clean substantive pass (project reviewers + generic reviewer return 0 must-fix / 0 should-fix on correctness / architecture), if the only remaining should-fixes are pure trims — doc-comment edits, blank-line grouping, naming touch-ups, no logic touched — apply them inline, run the repo verify command, and move to Step 9. Do not consume a pass on nit verification. The matching anti-pattern is in [anti-patterns.md](anti-patterns.md).
      
      ## Reviewer specifics
      
      - [reviewers/codex.md](reviewers/codex.md) — Step 8a Codex reviewer resolution + graceful degrade; Step 8b rework delegation to `codex:codex-rescue`.
      - [reviewers/coderabbit.md](reviewers/coderabbit.md) — Step 8a CodeRabbit reviewer; Step 8b rework delegation to `coderabbit:autofix`; composes with `codex` (per-finding rework routing).
      
  • scripts
    • resolve-codex.py 2.2 KB
      #!/usr/bin/env python3
      """Forge helper: resolve the newest codex-companion.mjs and pre-flight Codex.
      
      Replaces brittle inline globbing + JSON-by-grep in the skill body.
      
      Contract:
          stdout = absolute path to codex-companion.mjs   exit 0  -> usable
          stdout = "UNAVAILABLE"                          exit 1  -> degrade to the superpowers reviewer
      
      "Unavailable" covers: codex plugin not installed, no script found, node or
      Codex CLI missing, or Codex not authenticated. Conservative by design — a
      false UNAVAILABLE only costs a safe fallback, never a wrong review.
      """
      
      import json
      import re
      import shutil
      import subprocess
      import sys
      from pathlib import Path
      
      HOME = Path.home()
      GLOBS = (
          ".claude/plugins/cache/*/codex/*/scripts/codex-companion.mjs",
          ".claude/plugins/marketplaces/*/plugins/codex/scripts/codex-companion.mjs",
      )
      SETUP_TIMEOUT_S = 30
      
      
      def unavailable():
          print("UNAVAILABLE")
          sys.exit(1)
      
      
      def version_key(path: Path) -> tuple:
          """Natural-sort key so 1.10 > 1.9; non-numeric segments compare as text."""
          return tuple(
              (1, int(tok)) if tok.isdigit() else (0, tok)
              for tok in re.split(r"(\d+)", str(path))
          )
      
      
      def newest_companion() -> "Path | None":
          found = [p for g in GLOBS for p in HOME.glob(g) if p.is_file()]
          return max(found, key=version_key) if found else None
      
      
      def codex_ready(script: Path) -> bool:
          """True iff `setup --json` reports node + Codex + authenticated."""
          try:
              proc = subprocess.run(
                  ["node", str(script), "setup", "--json"],
                  capture_output=True,
                  text=True,
                  timeout=SETUP_TIMEOUT_S,
              )
          except (subprocess.TimeoutExpired, OSError):
              return False
          if proc.returncode != 0:
              return False
          try:
              data = json.loads(proc.stdout)
          except (json.JSONDecodeError, ValueError):
              return False
      
          codex = data.get("codex") or {}
          auth = data.get("auth") or {}
          return bool(data.get("ready") and codex.get("available") and auth.get("loggedIn"))
      
      
      def main() -> None:
          if shutil.which("node") is None:
              unavailable()
          script = newest_companion()
          if script is None or not codex_ready(script):
              unavailable()
          print(script)
      
      
      if __name__ == "__main__":
          main()
      
  • SKILL.md 29.5 KB
    ---
    name: forge
    description: "Forge an issue, ticket, or PR into a shipped fix: propose a plan, get it approved, then implement, review, and refactor. Use when the user runs /forge or asks to investigate, fix, resolve, triage, or solve one. See Parameters for modifier flags."
    ---
    
    # Forge
    
    > Forge an issue into a shipped fix: heat it (implement), hammer it (review loop), then temper it (refactor).
    
    ## Overview
    
    Turn an issue or ticket reference into a verified, branch-correct, user-approved plan. Then, only after the user confirms (or immediately under `automode`), run the implementation lifecycle.
    
    One numbered workflow (Steps 1–12), split by a single gate:
    
    ```
    Part 1 — Gate (Steps 1–6):   classify → fetch → branch → context → propose → [GATE] approve
    Part 2 — Lifecycle (7–12):   implement → review-loop → refactor → spin-off → self-evolve → close
    
      gate held: nothing touches the codebase until "yes, implement"  (automode = only sanctioned bypass)
    ```
    
    - **Part 1 — The gate.** The contract; do not weaken it.
    - **Part 2 — Lifecycle.** Runs autonomously after approval, stopping only at substantive gates (the Autonomy section).
    
    "The agent" means whatever agent runs this skill. Adapt every reference (config directory, agent guide, interview UI) to your runtime. Nothing is hardcoded to one assistant.
    
    ## Parameters
    
    Parse the invocation as `/forge <ref> [automode] [docs] [tdd] [worktree] [lookup] [secure] [changelog] [ci-watch] [compress] [implement] [codex | codex challenge | codex impl [challenge]] [coderabbit] [code-review]`, or `/forge pr <N> [...]`, or `/forge plan <path>[#<slug>] [...]`. The words can appear anywhere in the request. A `<ref>` resolves to a git-host issue or a Jira ticket per the grammar below, and the `pr <N>` form selects PR-review entry mode. Flags are orthogonal and compose freely; some modes have their own allowed or ignored flags, listed in [references/modes/pr-entry.md](references/modes/pr-entry.md) for PR mode.
    
    Full flag matrix (effects, composition rules, conflicts): **[references/flags.md](references/flags.md)**.
    
    ### Target grammar — `<ref>`
    
    The target is the first reference-shaped token, or the token right after a `ticket` or `pr` keyword. Routing works by keyword or by key-shape:
    
    | Form | Routes to | Examples |
    |---|---|---|
    | bare number, `#N`, `issue N` | **git-host issue** (Step 1b) | `forge 42`, `fix #123`, `issue 7` |
    | matches `[A-Z]+-\d+` | **Jira ticket** OR **Linear issue** (disambiguate if both configured — see [references/trackers/linear.md](references/trackers/linear.md)) | `forge PROJ-123`, `solve ENG-42`, `forge AB12-9` |
    | after `ticket` keyword | **Jira ticket**; number-only → ask project key | `forge ticket PROJ-123`, `solve ticket 42` |
    | after `linear` keyword | **Linear issue** (forces Linear routing, skips disambiguation) | `forge linear ENG-42` |
    | after `pr` keyword | **PR-review entry mode** (skips Steps 4–7; enters at Step 8 against the PR diff) | `forge pr 47`, `forge pr #123` |
    | after `plan` keyword | **plan-entry mode** (replaces Steps 1, 2, 4–6 with a single Step P validation pass; Step 3 still runs; enters at Step 7 against the plan slice) | `forge plan docs/superpowers/plans/x.md#task-3` |
    
    A bare number routes to a tracker only if `ticket` or `linear` precedes it, and PR mode requires the `pr` keyword. A key-shaped ref is either Jira or Linear: when both trackers are configured, the agent disambiguates per the Jira/Linear disambiguation section in [references/trackers/linear.md](references/trackers/linear.md). Single-tracker setups skip the prompt.
    
    Read **[references/modes/pr-entry.md](references/modes/pr-entry.md)** for the PR-entry mode step modifications, the allowed and ignored flags, and the PR-specific Step 12 closing menu.
    
    Read **[references/modes/plan-entry.md](references/modes/plan-entry.md)** for the plan-entry step modifications and slice addressing.
    
    ### Modifier flags
    
    Each line says what the flag does and where it acts; the linked file owns the details.
    
    - *(none)* — interview the user if a required field is missing, propose, then wait at the gate. The review uses the project reviewer agents plus `superpowers:requesting-code-review`.
    - `automode` — runs with no user gates and the agent decides Steps 6, 9, and 11. It never auto-commits, auto-pushes, or writes back to Jira; that is a hard floor. See [references/autonomy.md](references/autonomy.md).
    - `docs` — works from documentation: the proposal goes to `CONTEXT.md` and the plan is sourced from it, and grilling uses `/grill-with-docs` instead of `/grill-me`.
    - `tdd` — Step 7 writes the failing test first, observes it fail, then implements. See [references/modes/tdd.md](references/modes/tdd.md).
    - `worktree` — Step 3 creates a sibling worktree instead of switching branch in place. See [references/modes/worktree.md](references/modes/worktree.md).
    - `lookup` — Step 4 fetches current docs for every library the issue names. See [references/modes/lookup.md](references/modes/lookup.md).
    - `secure` — adds a `security-review` pass at Step 8 once the regular review converges, before Step 9. See [references/modes/secure.md](references/modes/secure.md).
    - `changelog` — Step 12 drafts a changelog entry in the repo's existing format. See [references/modes/changelog.md](references/modes/changelog.md).
    - `ci-watch` — after a Step 12 push, polls CI; a red result reopens Step 8. See [references/modes/ci-watch.md](references/modes/ci-watch.md).
    - `compress` — sources a token-saving output skill for the whole session before Step 1: `ponytail` if installed, else `caveman`; if neither is installed, the flag is ignored with a one-line note. See [references/modes/compress.md](references/modes/compress.md).
    - `implement` — delegates Step 7 implementation to `/implement`, scoped to the approved Step 5 plan; its built-in `/code-review` closeout is skipped because forge's Step 8 owns review. Conflicts with `codex impl` (two engines for one step — stop and report); makes `tdd` redundant (accepted with a one-line note, since `/implement` drives `/tdd` itself). See [references/modes/implement.md](references/modes/implement.md).
    - `codex` / `codex challenge` — adds Codex as a Step 8 generic reviewer; `challenge` runs an adversarial review instead. Claude Code only. See [references/reviewers/codex.md](references/reviewers/codex.md).
    - `codex impl` — Codex (GPT-5.6, auto-tiered Sol/Terra/Luna) implements at Step 7 and handles Step 8b rework; the Step 8 generic reviewer reverts to the default for cross-model review, and `challenge` composes as an extra adversarial engine. Claude Code only. See [references/modes/codex-impl.md](references/modes/codex-impl.md).
    - `coderabbit` — adds CodeRabbit as a Step 8 generic reviewer, with rework handled by `coderabbit:autofix`. Claude Code only; composes with `codex` (both run, rework routes per finding). See [references/reviewers/coderabbit.md](references/reviewers/coderabbit.md).
    - `code-review` — adds `/code-review` (two-axis: Standards + Spec) as a Step 8 generic reviewer. A plain skill, so unlike `codex` and `coderabbit` it runs on any runtime. See [references/reviewers/code-review.md](references/reviewers/code-review.md).
    
    The reviewer flags add to the generic-reviewer set; the project reviewer agents always run alongside, and `codex`, `coderabbit`, and `code-review` can all be set in one run. For example, `forge ticket PROJ-7 automode docs codex challenge coderabbit` is a valid invocation.
    
    - `automode` with `docs` writes `CONTEXT.md` directly with no interview, then goes straight to Step 7.
    - On a non-Claude-Code runtime, `codex`, `codex challenge`, `codex impl`, and `coderabbit` are ignored with a one-line warning, and the generic reviewer stays `superpowers:requesting-code-review`.
    
    ## When to Use
    
    - `/forge <ref>` (arg = issue or Jira-ticket ref).
    - "forge issue 42", "solve issue 42", "fix #123", "look at issue 7".
    - "solve ticket PROJ-123", "forge ticket 42", or a bare Jira key `PROJ-123`.
    - Asks the agent to act on a specific issue/ticket in the repo.
    
    **Don't use** when:
    - No issue or ticket ref is given. Ask rather than guess.
    - Asking *about* an issue/ticket, not to *resolve* it.
    
    ## Step 1 — Classify the ref, resolve the repo & tracker
    
    ### Step 1a — Classify `<ref>` (see Parameters, Target grammar)
    
    - If the ref is key-shaped (`[A-Z][A-Z0-9]+-\d+`) or follows a `ticket` keyword, treat it as Jira and go to Step 1c.
    - Otherwise (a bare number, `#N`, or `issue N`), treat it as a git-host issue and go to Step 1b.
    - If `ticket` is followed by a number with no key, ask for the project key first. Offer proposed answers when candidates can be inferred from `git remote`, `CONTEXT.md`, or branch names; otherwise use a single prompt. Under `automode`, infer the most likely key and record the assumption.
    
    Always run `git remote get-url origin` (falling back to `upstream`) regardless of the ref kind, because Part 2 commits and branches against this repo even for Jira tickets.
    
    ### Step 1b — git-host issue
    
    Route by host in `origin` (fallback `upstream`):
    
    | Host in remote URL | Reference |
    |---|---|
    | `github.com` / GH Enterprise | [references/trackers/github.md](references/trackers/github.md) |
    | `gitlab.*` (incl. self-hosted) | [references/trackers/gitlab.md](references/trackers/gitlab.md) |
    | other (Gitea, Bitbucket, …) | that host's CLI's issue-view JSON command if present; else host REST API |
    | any, no CLI / auth error | host REST API per the loaded tracker ref (else generic curl) |
    
    If neither `origin` nor `upstream` resolves to a known issue host: stop, tell the user, do nothing else.
    
    ### Step 1c — Jira ticket
    
    Read **[references/trackers/jira.md](references/trackers/jira.md)**, which covers resolving the ticket, fetching it, the absent-source fallback, the key-in-branch convention, and write-back. Load it now; the rest of Steps 1 through 3 and Step 12 defer their Jira specifics to it. Git-host issues never read it.
    
    ## Step 2 — Fetch the issue / ticket
    
    ### git-host issue
    
    Use the loaded tracker ref for the fetch command and the REST fallback: [references/trackers/github.md](references/trackers/github.md) Step 2 or [references/trackers/gitlab.md](references/trackers/gitlab.md) Step 2. For a host without a dedicated ref, run its CLI's issue-view JSON command if one exists, otherwise curl the host's REST API. Either way, read the body and every comment. If the number is a pull request, not an issue, stop and ask whether they meant `/forge pr <N>`.
    
    ### Jira ticket
    
    Follow **[references/trackers/jira.md](references/trackers/jira.md)** Step 2 to pull the fields and comments, and its Jira-absent fallback section when the source is unreachable. The fallback warns the user and offers three choices (paste, authenticate, or abort), and it stops even under `automode`.
    
    ## Step 3 — Verify the branch
    
    ```bash
    git branch --show-current
    ```
    
    If the repo ships a git or contribution guide, follow it verbatim for branch naming, the base branch, and the PR target. Look in `CONTRIBUTING.md`, a git section in the project agent guide (`AGENTS.md` or your runtime's equivalent), `.agents/rules/git*`, `docs/*git*`, or the runtime equivalent. The repo's own rules win over everything below.
    
    Only if no such guide exists, fall back to the default `<prefix>/<slug>`, where `<prefix>` is one of `feat`, `fix`, `chore`, `docs`, `refactor`, `test`, `perf`, `ci`, `build`, or `style`.
    
    - Pick `<prefix>` from the issue: use `fix` for a bug, `feat` for new behavior, `docs` for documentation, and `chore` for dependencies, CI, or tooling. When it is ambiguous, ask.
    - Build `<slug>` from the title: lowercase ASCII kebab-case, drop stop-words, and keep it to 50 characters or fewer. For example, *"Parser fails on UTF-16 BOM"* becomes `fix/parser-fails-utf-16-bom`.
    
    For Jira, see **[references/trackers/jira.md](references/trackers/jira.md)** Step 3 for the key-in-branch and key-in-commit conventions. The repo guide still wins; otherwise the branch is `<prefix>/<KEY>-<slug>`, and the key is not forced into commit subjects.
    
    Compare the chosen branch name to the current branch:
    - If they match, continue.
    - If they differ, show both and ask: **"Switch to a new branch `<prefix>/<slug>` forked off `<base>`? (y/n)"**. Pick `<base>` per the repo guide, otherwise probe `dev`, then `develop`, then `main`, then `master`.
    - On `y`, confirm the tree is clean with `git status --short`. If it is dirty, surface the files and ask before any switch, then run `git switch -c <prefix>/<slug> <base>`. If the switch fails (branch exists, base missing), surface the git error and ask. Never invent a name or base.
    
    When the **`worktree`** flag is set, create a sibling worktree on the chosen branch instead of switching in place. See **[references/modes/worktree.md](references/modes/worktree.md)**; it composes `superpowers:using-git-worktrees`, and the Step 12 closing appends a cleanup reminder.
    
    ## Step 4 — Check context sufficiency
    
    Use the context you already have, and do not sweep the codebase. Inventory what is already in the context window first: the agent guide, memory, and rulesets the runtime loaded at startup, such as `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `CONTEXT.md`, or `.agents/rules/*`. That is usually enough for the design. Only then read further, and no more than this:
    
    1. the files the issue names;
    2. at most a few top candidates from a targeted search for the definition or callers of the named symbol, never a directory walk or full-tree read.
    
    Stop reading once you can write Step 5. Turn any residual uncertainty into a Risk rather than more reading. A full-codebase sweep before a proposal is a red flag: it wastes the context the runtime already gave you.
    
    Before proposing, the issue must answer:
    
    | For a bug | For a feature |
    |---|---|
    | Steps to reproduce | Acceptance criteria |
    | Expected vs actual | Affected surface (API, CLI, UI) |
    | Environment (version, OS) | Backwards-compat expectations |
    | Suspected component (optional) | Out-of-scope clarifications |
    
    The acceptance criteria and the expected-versus-actual behavior are the `/goal` pass-conditions used in Step 7, so capture them precisely. For Jira, mine them from the description, the acceptance-criteria field, and the comments. A missing field is a Step 4 interview gap exactly as it is for a git issue, and the pasted-text fallback from Step 2 is treated the same way.
    
    When a required field is missing, interview the user rather than opening a free-text question. For each gap, offer a small set of proposed answers, mark the most likely one `(Recommended)`, and let the user pick. On a runtime with a selection UI, such as Claude Code's interview TUI, the user highlights an option and presses Enter, and an "Other" free-text choice is always implicitly available.
    
    See **[references/proposal-template.md](references/proposal-template.md)** Step 4 for the literal question-block format. Never invent the chosen answer: propose the options and let the user select. Never continue past this step while a required gap is unanswered.
    
    The flags change how the interview runs:
    
    - `docs` runs the interview through `/grill-with-docs`, which challenges the plan against the repo's domain model and docs.
    - `automode` skips the interview and proceeds on the issue as written, picking the `(Recommended)` answer for each gap and noting the assumption in the proposal.
    - `automode` with `docs` runs no interview and goes to the Step 5 `CONTEXT.md` write.
    
    When the **`lookup`** flag is set, fetch current docs for every library, framework, SDK, CLI, or cloud service the issue mentions, querying the `context7` MCP (or context7 resources if the MCP is not connected) before writing the proposal. See **[references/modes/lookup.md](references/modes/lookup.md)** for the attribution format, when to skip, and `automode` behavior.
    
    ### Step 4a — Optional grilling for risky design forks
    
    The Step 4 interview is about missing facts. When the context is enough to propose but a design or approach fork is genuinely ambiguous and a wrong pick means expensive rework, run a deeper interview before the proposal:
    
    - by default, run **`/grill-me`**;
    - with `docs`, run **`/grill-with-docs`**;
    - under `automode`, never grill, since both options interview the user; instead record the fork and the chosen branch as an explicit proposal assumption.
    
    Do this only when getting the approach wrong is costly. For a clear, low-risk fix, go straight to Step 5.
    
    ## Step 5 — Propose the solution
    
    Emit exactly one proposal. The block format is in **[references/proposal-template.md](references/proposal-template.md)** Step 5 and covers the issue line, the restated problem, the root cause or design, the files to touch, the plan, the pass criteria, the tests, and the risks. Verify that file paths exist with Read or Grep before listing them, and drop the `:line` suffix if you have not opened the file.
    
    With **`docs`**, write the proposal to `CONTEXT.md` in the repo root, instead of or in addition to chat, since Part 2 sources the plan from `CONTEXT.md` rather than the chat scrollback. Stamp it with the ref it was written for, so a later run can tell it apart from a stale plan.
    
    End the proposal by stating the user's next-turn choices, using the options in the template Step 5. Saying `yes, implement` opens the gate and moves to Step 7. Saying `interview me on risky questions` runs the Step 4a grilling and re-proposes, and is offered only when a risky design fork is still unanswered. Any other adjustment means revise and re-propose.
    
    Under **`automode`**, there are no options and no wait: go straight to Step 7, and with `docs`, do so after writing `CONTEXT.md`.
    
    ## Step 6 — The gate
    
    Unless `automode` is set, **do not edit any file** until the user explicitly approves.
    
    - "yes, implement", "go ahead", "do it", or "ship it" moves to Step 7.
    - "interview me on risky questions" goes back to Step 4a, then re-proposes.
    - A requested plan change means revise and re-ask. Silence or questions mean wait.
    
    This is the most important rule of the skill. Skip it (outside `automode`) and the skill is worthless.
    
    ---
    
    # Part 2 — Post-Approval Lifecycle (Steps 7–12)
    
    This part is deliberately terse. Each step delegates to a referenced skill, so read that skill rather than restating it here.
    
    ### Re-hydrate block
    
    Steps 8 and 9 reference this block. It is two actions, in order:
    
    ```
    /compact  →  re-source /karpathy-guidelines
    ```
    
    Run it before touching code on every non-converged review pass and before approved refactor work. The point is to shed stale reviewer-transcript tokens and reload clean-code discipline. On a review pass, capture the must-fix and should-fix findings before `/compact` so they survive it, then fix from that list. Do not restate `/goal` here; it is set once, in Step 7. With `compress`, also re-source the compression skill chosen at startup, since `/compact` can shed its persistence — see [references/modes/compress.md](references/modes/compress.md).
    
    ## Step 7 — Implement
    
    Open the step with two actions, in order:
    
    1. Set **`/goal`** to the desired result plus the Step 4 and 5 pass criteria, that is, the exact build, test, or behavior that proves the work is done. Set it once and never restate it.
    2. Re-source **`/karpathy-guidelines`**.
    
    When the **`tdd`** flag is set, write the failing test first, run it, watch it fail, then implement. See **[references/modes/tdd.md](references/modes/tdd.md)**; it composes `/tdd`, and the discipline binds under `automode`.
    
    With `docs`, load the plan from `CONTEXT.md` and check its stamp matches this ref; on a mismatch, warn and re-propose rather than implement a stale plan. Implement the approved plan and keep it minimal, surgical, and in scope. Make no edits before the opener is done, and before the observed-red test is done if `tdd` is set.
    
    When the **`codex impl`** flag is set, delegate the implementation to Codex (GPT-5.6, auto-tiered) after the opener — and after the observed-red test if `tdd` is set — then conformance-check the returned diff against the plan before Step 8. See **[references/modes/codex-impl.md](references/modes/codex-impl.md)**; on preflight failure it degrades to inline implementation.
    
    When the **`implement`** flag is set, delegate the implementation to `/implement` after the opener, scoped to the approved Step 5 plan, with its own `/code-review` closeout skipped — forge's Step 8 owns review. See **[references/modes/implement.md](references/modes/implement.md)**; `implement` and `codex impl` together is a conflict (stop and report — two engines cannot own one step).
    
    ## Step 8 — Review loop
    
    Run the project reviewer subagents (from `.agents/agents/` or the runtime equivalent) together with the generic reviewer. The generic reviewer is `superpowers:requesting-code-review` by default, or Codex under `codex` or `codex challenge`, or `/code-review` under `code-review`. Under `codex impl`, the generic reviewer stays the default — the model family that wrote the diff must never be the only reviewer — and `codex impl challenge` adds Codex adversarial review as an extra engine. The project subagents always run.
    
    Terminate the loop at zero actionable findings; nits do not block. Cap the loop at a fixed number of passes. On each non-converged pass, run the re-hydrate block, fix the findings, then re-review.
    
    See **[references/review-loop.md](references/review-loop.md)** for engine-selection details, the `/greploop` fallback and `/diagnosing-bugs` sub-pass, pass discipline, the trim-only-cleanup skip rule, and `automode` behavior.
    
    When the **`secure`** flag is set, run a `security-review` pass once there are zero actionable findings. Must-fix security findings reopen Step 8 with one dedicated security-pass budget. See **[references/modes/secure.md](references/modes/secure.md)**; security must clear before Step 9.
    
    ### Step 8a/8b — Generic reviewer swaps
    
    A flag adds an engine to the Step 8 generic-reviewer set, replacing the default `superpowers:requesting-code-review` when at least one is set. Each engine brings its own Step 8a reviewer pass and Step 8b rework path mirrored to its companion skill. The project subagents always run alongside. The reviewer flags compose: set both and both engines run in the same pass; each finding's rework routes to the engine that raised it.
    
    | Flag | Step 8a engine | Step 8b rework path |
    |---|---|---|
    | *(none — default)* | `superpowers:requesting-code-review` | (no dedicated rework skill; in-pass fixes only) |
    | `codex` / `codex challenge` | Codex `review` / `adversarial-review` via `scripts/resolve-codex.py` foreground | `codex:codex-rescue` foreground `--wait` (re-hydrate first, inline karpathy constraints) |
    | `codex impl` [+ `challenge`] | default reviewer (+ Codex `adversarial-review` with `challenge`) | companion `task --write` at the Terra/Luna tier (re-hydrate first) per [references/modes/codex-impl.md](references/modes/codex-impl.md) |
    | `coderabbit` | `coderabbit:code-review` | `coderabbit:autofix` foreground `--wait` (re-hydrate first, inline karpathy constraints) |
    | `code-review` | `/code-review` (two-axis: Standards + Spec, parallel sub-agents where the runtime has them) | (no dedicated rework skill; in-pass fixes only, re-hydrate first) |
    
    See **[references/reviewers/codex.md](references/reviewers/codex.md)** for Codex specifics, **[references/reviewers/coderabbit.md](references/reviewers/coderabbit.md)** for CodeRabbit specifics, and **[references/reviewers/code-review.md](references/reviewers/code-review.md)** for the two-axis skill reviewer.
    
    Both `codex` and `coderabbit` are Claude Code only. On other runtimes the flag is ignored with a one-line warning, and the default generic reviewer stays in place. `code-review` is exempt from that rule: it is a plain skill and runs on any runtime.
    
    ## Step 9 — Refactor (propose-only)
    
    Run **`/improve-codebase-architecture`**.
    
    - By default, surface the opportunities. If the user approves, run the re-hydrate block and re-enter Step 8 once on the refactor diff. If there are none, or the user does not approve, go to Step 10.
    - Under `automode`, the agent decides: apply only refactors that are clearly net-positive and in scope. If it applies any, run the re-hydrate block and re-enter Step 8 once; otherwise continue.
    
    Never silently rewrite beyond the issue's scope.
    
    ## Step 10 — Out-of-scope findings via `/to-tickets`
    
    For bugs or improvements that belong in a separate issue, draft them via **`/to-tickets`**, show the drafts, and post only on an explicit user yes. Under `automode`, post them directly. If nothing qualifies, skip this step silently.
    
    ## Step 11 — Self-evolution
    
    If you hit a caveat that could be automated for future agentic sessions, propose **`/writing-for-agents`** or an edit to the project agent config (the agent guide, rules, or reviewer-agent directory for the runtime). Also consider recording the caveat in the agent's project memory so a later session does not repeat it. Use whatever memory store the runtime exposes for this project. If the user has installed an external memory provider they favor (a memory plugin or MCP seen earlier in the conversation), write there instead of the built-in store. Show the exact diff and path, and confirm before writing. Under `automode`, the agent decides on its own and applies the smaller-blast-radius option with no proposal or confirmation. Memory writes are included: it picks the built-in store or the user's preferred external provider and writes directly. It still prefers a rule or guide edit over a new skill unless the pattern is clearly broad. If nothing can be automated, skip this step silently.
    
    ## Step 12 — Closing
    
    Verify `/goal` before anything else. Before assembling the proposal, run the Step 7 `/goal` pass criteria and the repo's standard pre-commit checks (build, test, and lint per the repo guide). Show the exact commands and their output. A command that exits 0 without running tests, such as "no tests collected" or empty output, does not prove `/goal`; treat it as not done. If anything fails, or you cannot run the checks, you are not done: return to Step 8 with the failure as a finding. Never assemble a commit proposal on an unverified `/goal`, because an unproven "done" is the one failure mode forge must not ship. `automode` does not lift this gate; it runs the checks itself and proceeds only on green.
    
    Then assemble the commit or PR proposal. The default is small atomic commits that match the branch's existing granularity and message style, which you can inspect with `git log --oneline <base>..HEAD`, rather than one squashed mega-commit. The repo's git or contribution guide from Step 3 still wins: if it mandates another shape, such as squash-on-merge, follow it and say why. If landing requires a merge or rebase onto a moved base and it conflicts, resolve through **`/resolving-merge-conflicts`** (by intent, finish the operation, never `--abort`) instead of resolving ad hoc.
    
    When the **`changelog`** flag is set, draft a changelog entry in the repo's existing format after `/goal` verifies green and before assembling the commit list, and include it in the proposed history. See **[references/modes/changelog.md](references/modes/changelog.md)** for the file-detection order and entry conventions.
    
    Then ask one closing question, using the closing menu in **[references/proposal-template.md](references/proposal-template.md)** Step 12. It follows the Step 4 proposed-answer format: the user selects, the recommended option is marked, and "Other" is implicit. Show the third line only when the target was a Jira ticket.
    
    Act only on the selected option. Option 2 follows the repo guide for the base branch and PR target.
    
    For the Jira write-back in the third option, follow **[references/trackers/jira.md](references/trackers/jira.md)** Step 12. It is opt-in only, posts a comment and a confirmed transition, and never runs on the other options or under `automode`. Show the third menu line only when the target was a Jira ticket.
    
    **Never auto-commit, auto-push, or write back to Jira** outside an explicit selection.
    
    When the **`ci-watch`** flag is set and a push option (2 or 3) was chosen, poll CI for the pushed HEAD once the push completes. On a red result, re-enter Step 8 with the CI failure as a must-fix finding. See **[references/modes/ci-watch.md](references/modes/ci-watch.md)** for polling cadence and host CLI selection. The flag is inert if no push option was chosen.
    
    - With `docs`, still ask, but pre-mark the `/tmp/<name>.md` option `(Recommended)` over option 1.
    - With `automode`, skip the question. Emit the proposed small-commit history as a plan only, written to `/tmp/forge-<ref>.md` under `docs` or inline otherwise, then stop. `automode` never executes commits, pushes, or Jira write-backs.
    - With `worktree`, append a cleanup reminder to the closing message: "Worktree at `<path>`; run `git worktree remove <path>` when done." Cleanup never auto-runs, even under `automode`. See [references/modes/worktree.md](references/modes/worktree.md).
    
    ### Autonomy
    
    By default, once the user says "yes, implement", run autonomously with no "may I continue?" between steps, and stop only at the substantive gates:
    
    - Step 6, the gate entry;
    - Step 9, the refactor approval;
    - Step 10, the spinoff-issue post;
    - Step 11, self-evolution;
    - Step 12, the commit proposal.
    
    `automode` lifts those gates but never the hard floors:
    
    - it never auto-commits, auto-pushes, or writes back to Jira;
    - the Step 12 `/goal` verify still runs;
    - the Step 2 Jira-absent fallback still triggers.
    
    See **[references/autonomy.md](references/autonomy.md)** for the full per-step matrix, the rationale behind each hard floor, and how `automode` composes with other flags.
    
    ---
    
    ## Anti-patterns & Red Flags
    
    See **[references/anti-patterns.md](references/anti-patterns.md)** for the common-mistakes table and the red-flag stop list. Both bind under `automode` too, and that file is the canonical home for new rules learned during a forge session.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related