Repository source: docs/railspike/RAILSPIKE.md
Railspike
Overview
Planning, documentation, development, bug fixes, test suites, and checklists can use this four-step workflow, with an optional solution assessment upfront. Review and revise the current artifact before approving the next step; a planning handoff can pause before implementation. To keep the instructions inside the context window, the detailed guidance for each step now lives in separate files that you open only when you are ready for that step.
Choose the execution mode
Use the staged workflow below when approaches or scope need review. For explicitly authorized, bounded execution with a clear outcome and proportionate verification, use the one-shot workflow. It preserves comparable development evidence in one evolving record without intermediate step approvals. Ordinary tasks outside Railspike remain possible; size alone does not select a mode or enroll a task in a study.
Before work, read applicable project instructions, including AGENTS.md, and the selected workflow. If required instructions cannot be found or read, resolve that before dependent work. A mode label, plan reference, or implementation question is not execution authorization. Record the user's actual authorization and its boundary; do not manufacture approval from agent-authored scope. Questions leave existing authority unchanged. Clarify unresolved authority before dependent actions while continuing independent authorized work.
Step/phase order, separate step artifacts, Approved Step N gates, and planning/stage commit rules below govern staged cycles. One-shot cycles use the linked lifecycle and commit rules instead. Repository boundaries, instruction summaries, scope protection, attribution, and applicable study/debug policies apply to both modes. Both modes must read and apply the shared implementation standards before dependent work, on resumption, and at closeout. This is an instruction contract, not programmatic enforcement.
Repository Boundary
Instruction files under docs/workflow/ belong to the Railspike repository. If Railspike is included in another repository as a submodule or vendored directory, resolve those paths relative to the Railspike repository root, not the host repository root. Planning artifacts still belong in the host repository under docs/plans/.
When developing Railspike itself, use the separate railspike-dev checkout as the planning workspace and consuming-project root; its plans and debug logs belong there. Product edits belong in railspike, website edits in rlspk.github.io. Keep stage summaries in the development workspace and record paired implementation commits before advancing; do not add Railspike's own development records to the installable product.
How to Use This Chain
Start with the highest-numbered approved step (usually Step 1 unless explicitly skipped).
Read the relevant instruction file in Railspike's
docs/workflow/directory and follow the instruction summary contract before starting work.For Steps 3 and 4, use phase files in order:
*_before.md->*_do.md->*_after.md.Request approval in the format
Approved Step Nwhen required, and do not open the next step's files until approval is received.
Instruction Summaries
After reading the applicable instructions and before acting, briefly summarize the next action, relevant constraints, and any approval gate. Keep the summary focused on the upcoming work rather than compressing the entire file; no separate reading acknowledgment is required.
Summarize again only when the next action, relevant constraints, or approval gate changes. A step/phase transition or resumption alone does not require repetition. On resumption, reread applicable instructions and restore workflow state; omit an unchanged summary when prior context is recoverable, or establish a fresh summary after restoration when it is not.
The original instructions remain authoritative, including exceptions omitted from a summary. Summaries never replace required reading, step/phase order, state restoration, approvals, or commit rules. If required instructions are missing or unreadable, report the blocker and resolve it before proceeding; do not imply they were read.
Do not automatically reprint instruction files. Explicit requests to show them remain supported, as do relevant quotations needed to explain a concrete decision or blocker and useful progress/handoff updates. This contract governs assistant-authored repetition, not ordinary tool-output rendering, and applies with debug enabled or disabled; summaries are not diagnostic reports.
Step Guide
Maintain a concise host-project concept inventory and list concepts touched in plans using concept guidance. Grow it only through the current cycle's work.
Step 1 – Solution Assessment (Optional): compare approaches, combine compatible options, and refine the recommendation before approval.
docs/workflow/step1_solution_assessment.mdStep 2 – Feature Description: capture problem framing, user stories, requirements, and success criteria.
docs/workflow/step2_feature_description.mdStep 3 – Development Plan: break work into atomic stages with dependencies and verification notes. Start with
docs/workflow/step3_development_plan_before.md, then follow thedoandafterfiles.Step 4 – Implementation: execute the approved artifact on a feature branch and maintain the implementation summary. The artifact may be application changes or explicitly scoped documentation-only work. Start with
docs/workflow/step4_implementation_before.md, then follow thedoandafterfiles.
Each phase file ends with instructions for when to proceed so you never overrun the context window.
Experimental Effort Estimation
This is an optional beta capability. A user or host project may select individual cycles or enroll all future cycles in one continuing study. The consuming project's study ledger owns its candidate selection, reference set and acceptance criteria; do not embed project paths or study data in these reusable instructions. Existing approvals, documentation boundaries and commit cadence still apply. A score never authorizes implementation or expands scope.
Activation and recovery
Activate when the user or host study selects the cycle, including standing enrollment of all future cycles; do not ask for selection again under that policy. In its first artifact, record
Effort study: <study/candidate ID>and a relative link to the host ledger below the Plan navigation/debug state; inherit this field into subsequent artifacts. Record the standing enrollment policy when used. Enrollment authorizes collection, not feature implementation.On step entry, resumption and handoff, restore selection, the latest snapshot, scope version and frozen references from the current artifact and ledger. Unselected cycles require no score, extra field or ledger update. An absent field is not opt-out evidence when the ledger already selects the cycle; resolve conflicting selection before rating.
If a reference is missing or its content hash differs, restore the recorded source or explicitly version an accepted replacement before rating. Do not silently reset the unit or manufacture a score. Missing historical checkpoints stay missing; skipped Step 1 is not applicable, not zero. Any later reconstruction is explicitly retrospective.
Recover frozen sources using the host-local reference procedure: resolve ledger-relative paths, verify expected hashes, and retain exact historical bytes with provenance inside the host project. A changed current document is not the frozen source. Once recovered, use the verified local copy without requiring the original external checkout; record recovery now and preserve earlier missing checkpoints.
Score semantics and evidence
Use the study's frozen references with 1.0 = the largest well-scoped, releasable slice we would comfortably approve for one Railspike cycle, including required verification and documentation. Nonnegative decimals are freeform. Scores above 1.0 prompt a split discussion, not an automatic cycle count.
Each whole-cycle projection estimates total work for the scoped cycle from its starting point: inspection, planning, implementation, required verification, documentation and ordinary correction. It is not remaining effort, hours, priority, an approval, measured actual effort or an additive delivery forecast. Do not derive it from lines, stage counts or commit timestamps.
Preserve inherited estimates separately and record prior exposure. Claim independent ratings only when independently collected before discussion; otherwise identify single-rater/exposed judgments honestly. Record active-work measurements only when reliable, separately from scores.
Keep checkpoint snapshots in their step artifacts, with a comparison index in the host ledger. Each snapshot records study/candidate ID, checkpoint, UTC date, rater, score, scope version (including starting revision, outcome and recovery), reference version, exposure and reason for change. Explicitly reaffirm unchanged values. Append revisions and retain original scope/scores and approval context; distinguish new understanding from changed scope.
Extended estimates: Option and stage estimates default to enabled for new enrolled effort-study cycles. Study enrollment remains optional; unselected cycles require no estimates or extra mode question. Resolve the latest explicit user override, then recorded cycle state, then applicable host policy, then the new-cycle enabled default. Record Extended estimates: enabled or Extended estimates: disabled below the study field and inherit it through subsequent artifacts. Preserve existing disabled cycles. For older resumed cycles without a mode field, recover prior requests/policy and prior behavior; do not apply the new-cycle default retroactively. See the guide for legacy recovery and explicit prospective activation. Retain earlier history when changing mode; never backfill missing historical estimates.
When enabled, every Step 1 option gets a complete scoped-cycle estimate; every Step 3 stage gets a separately labeled stage work estimate using the reference yardstick. Step 4 preserves originals, appends material whole-stage revisions and records separate retrospective assessments. Stage work covers only that stage's changes, verification, documentation and ordinary correction, not the cycle's planning again. Keep shared overhead explicit, cycle totals independently judged, and stage annotations separate from cycle snapshots and outcome counts. Never sum stage or alternative estimates, normalize them into fractions, or interpret retrospective ratings as measured effort. This extension leaves the frozen R1 definition and ordinary approval/commit requirements intact.
Visible estimates: Put a standalone bold Estimate: 0.35 line directly beneath each estimated option/stage heading, with at most a short comment. Show Cycle estimate: 0.60 near the top of each enrolled artifact, below its state fields. Use plain numbers without approximation signs; keep drivers, uncertainty and study metadata separate. Tables use a dedicated estimate column. Preserve ranges, unavailable reasons and explicit original/revised/retrospective labels under the presentation rules. Disabled extended mode omits option/stage estimate fields; enrolled cycles still retain whole-cycle checkpoints.
Checkpoints
The table below applies to staged cycles. One-shot cycles use intake, execution-entry, revision and closeout checkpoints in their consolidated record, with the same reference, scope-history and outcome semantics.
| Checkpoint | Required record for selected cycles |
|---|---|
| Intake | Preserve initial scoped estimate in the ledger or first artifact before detailed implementation inspection; disclose earlier inspection instead of pretending it was prospective. |
| Step 1 handoff, if used | Projected total for the recommended scoped approach. |
| Step 2 handoff | Projected total for defined outcome, scope and recovery. |
| Step 3 handoff | Projected total informed by planned implementation and verification. |
| Step 4 entry | Before implementation, preserve or explicitly reaffirm the Step 3 projection in the summary created after verification of the approved planning history or explicit no-commit override. |
| Step 4 discoveries/revisions | Append a revised total when warranted, before dependent work where possible; changed scope still requires renewed approvals. |
| Step 4 closeout | Separately labeled retrospective scope assessment, verification/omissions and maintainer comfortable-fit judgment. Never call this a prospective score or measured actual. |
Before each planning handoff, capture the applicable snapshot and link it from the ledger when that write is authorized. Do not duplicate snapshots merely because a phase resumes. Include a brief projected-total statement in the normal handoff for selected cycles. Keep unapproved snapshots uncommitted. At approval, include only this cycle's authorized checkpoint ledger changes under the approval commit gate; preserve unrelated hunks. Outcome updates belong in the corresponding stage or closeout commit. If ledger edits are outside scope, keep the snapshot in the artifact and record the pending update.
At closeout, retain delivered scope, starting/final revisions, commits/diffs, planned/completed stages, verification and omissions, corrective work versus new requests, splits and the maintainer judgment. If that judgment is unavailable, mark study acceptance pending rather than inventing it; technical cycle completion and study outcome acceptance are distinct. Keep original scope/estimate when splitting and follow the host study's explicit outcome-counting rules; do not silently count child cycles as independent observations. Continue collection beyond review batches; six accepted outcomes are a review checkpoint, not a stopping rule. Version reference changes without erasing old scores.
Continuing collection
Use the bundled R1 references and record template when starting a host study. Keep study data in the consuming project, outside the installed product, regardless of debug mode.
Give each cycle a stable project/cycle ID; preserve legacy candidate IDs and parent/replacement links. Copies in other checkouts and worktrees are the same observation. Distinct follow-up cycles get distinct IDs with their relationship retained.
Enroll at the first artifact and retain paused, abandoned, replaced and incomplete cycles as well as successes. On resumption of older work, collect from the current checkpoint with prior exposure disclosed; never backfill a prospective estimate. Do not require scores for small tasks that do not use Railspike.
The host ledger indexes canonical artifact snapshots. Merge worktree records by cycle ID and checkpoint, retaining conflicting observations for review; do not allocate sequential IDs independently in parallel worktrees. No automatic upload or cross-repository write is implied.
Railspike Debug Mode
Debug mode is optional feedback for improving Railspike's instructions, not application debugging. New workflows default to disabled unless the consuming project opts in. Enable or disable it for a workflow with a plain-language request such as “Enable Railspike debug mode for this workflow” or “Disable Railspike debug mode.”
Precedence, content and recovery rules apply to both execution modes. One-shot records use a cycle/index line instead of Plan navigation and follow one-shot report timing and commit rules instead of the staged handoff/commit cadence below.
Project default:
An optional
.railspike_debug_onfile at the consuming-project root enables debug by default for new workflows. Only file presence matters: do not read or validate its contents. Empty, arbitrary, or “false” contents all enable the default; unreadable contents do not matter when file presence is established. An absent marker leaves the default disabled.Use the consuming-project root established for the workflow and its
docs/plans/, not the current shell directory or an installed Railspike directory. For work on Railspike itself, this is the separaterailspike-devplanning workspace root; for submodule or vendored installations, it is the host project root. Do not search ancestor directories or apply nested-project or user-global inheritance.Consult the marker only for a new workflow without an explicit mode request. If the consuming root or marker's file presence cannot be established, ask for clarification instead of assuming absence. A directory at the marker path is not a marker file; clarify that mismatch when lookup is needed.
Record the resolved mode in the first artifact as a snapshot. Adding or removing the marker affects future workflows only; editing its contents has no effect. Workflow-specific overrides do not create, remove, or edit the marker.
Durable state and recovery:
Record
Debug mode: enabledorDebug mode: disabledimmediately below the current artifact's Plan navigation bar; inherit it into subsequent artifacts, including the Step 4 summary. If no artifact exists, record it when creating the first one.On step entry, resumption after context loss, and before a completed-step handoff, read this contract and the current artifact's field. If the next artifact does not exist, inherit from the latest completed artifact. Historical fields are snapshots, not competing current settings.
Resolve mode in this order: latest explicit user enable/disable request, existing workflow state, project default for a clearly new workflow, then disabled when no marker exists. Update the current field for an explicit request. For resumed work, ask for clarification when available evidence cannot resolve missing or conflicting state; never use the project marker to repair uncertain resumed state or silently reset it.
Mode changes do not approve steps or authorize advancing, branching, or committing. During Step 4, record changes in the summary and include them in the next authorized stage commit; never amend completed commits.
Completed-step report: When enabled, save the complete diagnostic report in the debug log. In each completed Step 1–4 handoff, include exactly one short debug line linking to the saved log, before requesting approval where applicable. Do not repeat findings, group headings, or empty-group markers in the conversation, or narrate diagnostic collection. Phases and implementation stages do not trigger reports. When disabled, emit no diagnostics or debug link and preserve existing logs.
Conversation exceptions: Briefly disclose log-write failures or request clarification when available evidence cannot resolve mode state. Provide findings in the conversation when the user explicitly requests them. Do not dump unsaved diagnostics into the conversation as a fallback for a failed write. Ordinary task updates, blockers, approval requests, and the instruction summary contract remain unchanged.
Full report content (log only):
Always include Necessary/useful instructions and Redundant/unnecessary instructions; use “No supported findings” for an empty group.
Each finding identifies its Railspike source (file and section or short excerpt), observable contribution or overhead in this step, and a justified suggestion to retain, clarify, consolidate, or remove it.
Put relevant Inapplicable instructions and Uncertain assessments in distinct groups. Non-use alone does not establish redundancy. Report selectively, without claiming exhaustive coverage or access to hidden reasoning.
Findings are advisory: continue following required instructions and approval gates. Changing Railspike's instructions requires separately authorized work.
Persistent debug log: Before linking to a new report or presenting explicitly requested findings, append the full report to {feature_name}_debug_log.md beside the planning artifacts. Create it on the first report and reuse it across steps, resumptions, and mode changes. Every entry has a UTC timestamp, a step identifier and one attribution line beneath them in the agent attribution format, so findings can be compared by agent. Add the line to new entries only; do not backfill existing ones. Never overwrite entries: append corrections labeled Revision, identifying the superseded entry; skip unchanged reports and link to the existing log without claiming a new entry was saved. If writing fails, briefly report the failure rather than claiming the diagnostics were saved; resolve the failure before presenting output as logged.
Move the log with the plans into docs/plans/{feature_name}/ at the first planning approval and repair links without altering state or history. Keep pending additions uncommitted until the next approval commit; only this cycle's existing log belongs in that allowance. During Step 4, include additions in the next authorized stage commit, or make a separate log-only handoff commit after the final stage. Do not commit unrelated content or amend completed commits. Explicit no-commit overrides apply.
Planning Artifacts
In staged cycles, each step MUST be a separate file in docs/plans/:
Step 1:
{feature_name}_step1_solution_assessment.mdStep 2:
{feature_name}_step2_feature_description.mdStep 3:
{feature_name}_step3_development_plan.mdStep 4:
{feature_name}_step4_implementation_summary.md
Directory structure and organization rule: At the first planning approval (Step 1, or Step 2 when Step 1 is skipped), create the host feature branch or confirm explicitly requested eligible reuse under Follow-up Cycles Before Merge. Organize this cycle's existing plans and debug log in docs/plans/{feature_name}/ before committing the approved step. Draft later steps directly in that folder. Reuse an existing folder, preserve filenames and approved substantive content, repair relative navigation/references, and update this feature's entry in docs/plans/README.md, creating the index if absent.
Inspect destinations and references before moving files. Resolve collisions or ambiguity without overwriting artifacts. Organization permits link repairs, not substantive plan changes; obtain renewed approval for those changes. Future-step navigation targets may be pending during planning: report them without creating unapproved deliverables.
Approval commit gate
After each explicit Approved Step 1, Approved Step 2 or Approved Step 3, save that approved step before drafting the next deliverable:
Confirm actual approval, cycle identity and the host feature branch. At the first approval, perform the organization above; continue on that branch at later approvals.
Inspect Git status and the staged diff. Include only the approved step, necessary organization/index/link repairs, this cycle's existing debug log, and authorized study records for that checkpoint. Exclude unapproved drafts or revisions, implementation, the Step 4 summary, concept edits and unrelated work. For shared ledger files, stage only authorized cycle/checkpoint hunks. Repairing navigation in an earlier approved plan is allowed; changing its substance requires renewed approval.
Commit and verify the commit exists, contains the intended approved content, and leaves unrelated changes intact. Record its hash in the next authorized artifact update, not by amending it. Only then draft the next step. Step 3 approval and its verified commit authorize Step 4 setup; create the summary afterward.
Keep drafts and substantive revisions uncommitted until approval, except a separate commit labeled "draft, not approved" for a handoff prompt; it never counts as the approval commit. Renewed approval saves the revision in a new commit before dependent work; it does not approve later steps. A failed commit blocks progression until repaired or explicitly waived. An explicit user no-commit request overrides commits: retain the branch, written plans, approvals and disclosed waiver, then continue only within actual authority. Never infer a waiver from urgency or task size.
On resumption, verify the approved content and its recorded commits. Reuse valid commits; do not create empty duplicate commits. For older cycles or missing history, disclose the omission and commit the currently approved plans before advancing. Keep unapproved drafts and implementation out of that recovery commit. Never fabricate, backdate, reorder or amend commits to imply earlier compliance. Recheck approval if the current content differs substantively from what was approved. A recorded no-commit override remains effective until changed.
In separate product/development repositories, save plans in the host repository and establish the product feature branch before product implementation. No empty product planning commit is needed. Same-cycle transitions from one-shot retain their record and branch under the transition rules, while each newly approved staged plan follows this gate.
Plan navigation: Start every staged artifact with this relative-link bar; omit Step 1 only when skipped.
> **Feature plan:** [Step 1](./{feature_name}_step1_solution_assessment.md) · [Step 2](./{feature_name}_step2_feature_description.md) · [Step 3](./{feature_name}_step3_development_plan.md) · [Step 4](./{feature_name}_step4_implementation_summary.md)
Agent attribution
Sign beneath each authored or revised option, stage or other substantive plan section in Steps 1–4 or a one-shot record. Use one short italic attribution line per coherent contribution, not per bullet. A compact single-contribution artifact may use one footer. Attribution applies independently of debug mode and effort-study enrollment.
For Step 3, when one agent generates the entire plan in one pass, use a single attribution footer for the whole plan, regardless of plan length. Use stage-level attribution only for stages subsequently authored or substantively revised separately. Preserve the original plan footer and prior stage attribution when recording revisions.
Use the agent's known name and UTC date. Include the model name/version and relevant settings (for example reasoning effort or temperature) when verified for the session that produced that contribution. Use only explicit, available runtime/session metadata; a configured preference is not proof of the actual runtime model. Omit unknown fields, or mark them unavailable once in shared metadata. Never infer them from the agent name, output style, Git author, another agent or an example. Do not delay work or ask the user merely to fill optional fields. Record only shareable metadata, not credentials, hidden prompts or private configuration.
Minimal form: *— Agent name · YYYY-MM-DD UTC*. With verified metadata: *— Agent name · YYYY-MM-DD UTC · Model: <verified model> · Reasoning effort: <verified setting>*. Include other relevant verified settings as named fields; omit unavailable ones rather than copying placeholders. Examples are formatting illustrations, not evidence of a live model or setting.
Preserve prior attribution when revising another agent's work; append *— Revised by Agent name · YYYY-MM-DD UTC* beneath the changed contribution, with verified model/settings if available. Preserve earlier dated entries for later revisions, including changes of model/settings by the same agent. Attribute only work actually authored or revised; a reviewer or agent merely copying an earlier estimate does not become its original author/rater. Do not backfill unknown historical authorship. These are textual authorship records, not cryptographic signatures, approvals or independent ratings.
Commit discipline (staged cycles):
Keep drafts and unapproved revisions uncommitted. After each planning approval, follow the approval commit gate before drafting the next deliverable.
At Step 4 entry, verify the approved planning commits or explicit no-commit override. Do not require another identical planning commit.
Commit each completed implementation stage with its Step 4 summary update before the next stage, unless an explicit no-commit request applies.
Plan review (staged cycles): The user may revise the current artifact or combine compatible options; recheck scope and tradeoffs. Revision requests do not approve progression. Obtain renewed approval for substantive changes. Step 4 still requires explicit Approved Step 3 and the approval commit gate.
Step 4 commit cadence (mandatory unless explicitly overridden):
Verify this cycle's approved planning history before creating the summary; repair missing history under the recovery rule above.
Make at least one stage-scoped artifact commit per Step 3 stage, with its summary update.
Do not start Stage
N+1until StageNhas applicable verification, an updated summary and a verified commit, or a recorded explicit no-commit override.Do not squash/rebase/amend stage commits during active Step 4 execution.
New cycles normally have three planning approval commits (two when Step 1 is skipped), plus at least one commit per implementation stage. Revisions may add commits; recovery and explicit waivers must be disclosed rather than forced into a fictional minimum.
Documentation-only scope (staged cycles; one-shot boundaries are recorded before execution in its cycle record):
Documentation-only work is permitted only when Step 2 names it as the work type and names the allowed documentation file scope; Step 3 must retain that boundary in its Completion Contract.
Branching and commit cadence always apply. Documentation-only verification is proportional to the approved artifact: document integrity, evidence, links, and authorized-file-scope checks are required; runtime, UI, deployment, migration, and release checks are not applicable unless the approved documents make a claim that requires one.
Do not alter application source, tests, CI, deployment configuration, generated artifacts, or other files outside the approved documentation scope. Return to Step 2/3 for approval if such a change becomes necessary.
Writing style
Write artifacts and handoff messages that a reader understands on first reading:
One idea per sentence, about 25 words at most.
One term for one thing throughout the artifact.
A verb, not a noun made from one: "change the format", not "format evolution".
No noun string longer than three words.
The real name of a file, function or setting when it anchors a decision; code never appears.
Active voice with a concrete subject.
Exempt: the preserved Original Query, quoted sources, and fixed snapshot and attribution formats.
Before: "Extend the shared result contract to retain its probability and companion name through scoring, storage, display, and score transfer." After: "Change FastScoreResult.php so a result carries an author name as well as a probability. Keep the name in the scorer, the SQLite store, the result page and FastmodScoreTransfer.php."
Plan length
Each step's instructions give a length goal for its artifact. Treat it as a soft target that helps the reviewer, not a limit to defend. Required content comes first: never drop evidence, risks or required fields to meet a goal. Navigation, debug state, effort fields and attribution never count toward it.
Key Rules
AI coding agent
Step/phase-specific rules below govern staged cycles; one-shot lifecycle and commit exceptions are defined in its workflow. The shared implementation standards govern substantive implementation in both modes; the step-specific rules below retain staged planning and evidence placement.
Recommend Step 1 for complex features or whenever multiple solutions exist
Stay in the current step; do not draft/edit later deliverables without approval
After delivering each step, explicitly request “Approved Step N” and pause until the user responds with that exact phrase
Create separate files for each step only after receiving the relevant approval
ALWAYS establish a feature branch before Step 4 implementation; reuse only under Follow-up Cycles Before Merge or the explicit same-cycle one-shot transition rule
Enforce Step 4 commit cadence: first verify approved planning commits under the approval commit gate; each completed stage has a stage-scoped commit that includes the Step 4 summary update
Report Step 4 checks as passed, failed, blocked, pending, or inapplicable; a focused pass is never an unqualified full-suite or user-outcome result
Treat documentation-only work as a Step 4 implementation only when its allowed documentation file scope was approved in Steps 2 and 3; use applicable verification and record non-applicable runtime checks in the summary
Apply the shared implementation standards for component reuse, completion, risks, verification, and final review
Apply Enhancement Requests: document every request, incorporate only in-scope refinements, and replan changed scope
Keep work within a day or eight Step 3 stages; otherwise rescope the slice.
Read the current step/phase instructions and apply the instruction summary contract before acting
Add the Plan navigation bar to every Step 1–4 artifact
Step 1 starts with
## Original Query: preserve the request except mechanical grammar, spelling, capitalization, punctuation, and formatting fixes; when needed, follow it with a brief, clearly labeled## Understood Intentthat clarifies inferred goal/context without inventing scopeFor Step 3, prefer
## Stage Nheaders with flat bullet lists for each stage field so plans stay easy to scan and reviewWhen the request names a known user or environment, Step 2 states that user's ordinary entry and recovery condition; evidence from another supported platform never satisfies it
Step 2 risks state impact, early validation, and mitigation; Step 3 begins with
## Key Risks, and unresolved risks block dependentsFor Step 4 summaries, prefer
## Stage N - titleheaders with bullet lists for changes, verification, and notes so stage handoff stays easy to audit
User
Review, revise, and approve explicitly at each step; question assumptions and combine compatible options before settling on a direction
Flag issues early so adjustments happen before implementation
Resist adding scope during Step 4
Prefer solutions that avoid database migrations; rely on existing schema where feasible
Follow-up Cycles Before Merge
Completed Step 4 means the approved cycle is complete, not necessarily ready to merge. Related enhancements for the same intended release may use a distinct follow-up cycle on the same unmerged feature branch when the user requests reuse. Confirm the branch is still unmerged; if eligibility is uncertain, clarify before reuse. Merged branches are ineligible: create a new feature branch.
Give each follow-up its own descriptive feature prefix (for example, search_filters following search) or a unique numbered fallback (search_cycle2), independent of branch name. Check for collisions before writing; never overwrite another cycle's artifacts. In the follow-up's first artifact, link the predecessor and record the intended reused branch; inherit this cycle identity into later artifacts and restore it on resumption. Keep the predecessor's completed content intact; record requests and backlinks separately when necessary.
For a one-shot follow-up, use fresh explicit bounded authorization and its own record/commit rules; branch eligibility and predecessor history requirements above still apply.
For a staged follow-up, use fresh approvals for this cycle (Step 1 optional). At its first planning approval, create a new branch or confirm explicitly requested eligible reuse; organize this cycle's folder and follow the approval commit gate for each approved step. Prior cycle approvals and commits do not satisfy this cycle's gate. After Step 3 approval and commit verification, create the summary; each implementation stage retains its own commit and summary update unless explicitly waived. Branch reuse does not authorize merging, publishing or rewriting completed history.
Handoff prompts
When the user asks for a handoff prompt, "a prompt block" or a prompt to continue in a new chat, commit the cycle's current plans and push its feature branch. The request authorizes that push only, never to main, a PR or a merge. Then give one fenced code block naming the repository, branch, base commit, plan or epic checklist path, cycle, step, mode, and what is and is not approved. It tells the new chat to read AGENTS.md and the plan, check the branch against origin/main, then continue. Repeat only approvals the record shows; the record wins over the prompt.
Enhancement Requests
For one-shot cycles, use the consolidated record instead of a step artifact, record actual implementation commit references when available, and apply one-shot scope-change and transition rules for changed scope. The classification and evidence requirements below apply to both modes.
Record every enhancement request before acting in the current planning artifact or Step 4 summary. Use a concise record: Request / Disposition and reason / Approval status / Outcome or follow-up link. Keep deferred and declined requests visible; conversation and commit messages alone are insufficient. An implemented request must identify changes, verification, and its stage commit. Record the commit after creation without amending it; include the reference in the next authorized summary update.
Classify against approved requirements, file boundaries, dependencies, risks, and completion criteria, not estimated effort:
In-scope refinement: incorporate within the approved current stage and record verification. Adjusting copy in an approved UI stage can qualify; adding an export format does not.
Changed scope: preserve completed work, return to the earliest affected planning step, and obtain renewed approvals before implementing the changed scope. During planning, revise the current artifact; a revision request never approves a step.
Separate work: retain a pending request or follow-up link and continue the original task unless the user asks to stop or switch. Do not silently start deferred work.
Ambiguous: clarify before dependent work; continue independent authorized work when possible.
On resumption, recover pending requests, their approval status, and the active cycle from artifacts. Resolve missing or conflicting state before dependent work. Preserve completed substantive records and commit history; record later dispositions separately rather than rewriting completed scope.
Warning Signs
Step 1: well past its length goal, >4 options, or sentences that break the writing style
Step 2: well past its length goal, code/DB details, mockups, buried risks, or a component-only "feature"
Step 3: stages well past their text budget, stages >2 hours, tangled dependencies, missing Completion Contract/Key Risks, unusable outcome, or incomplete risk details
Step 4: Missing branch/planning commit/stage commit + summary, scope changes, direct-only behavior, or too few commits
Workflows
One-shot: explicit bounded execution authorization → feature branch → write/commit plan → implement/verify → commit implementation and updated plan; see one-shot instructions.
Epic: several cycles coordinated by an epic checklist that approves none of them.
Simple: Step 2 → approval/branch/folder/commit → Step 3 → approval/commit → Step 4 (verify plans → implement stages → test/commit → complete)
Complex: Step 1 → approval/branch/folder/commit → Step 2 → approval/commit → Step 3 → approval/commit → Step 4