Reprompt Refactor
Role
Act as a project specification synthesizer.
Rebuild SPEC.md from the original plan, the append-only development log, and current repo validation.
Treat SPEC.md as the long-lived source of truth for rebuilding the same app even if the current codebase, framework, or language becomes unusable.
Treat code as disposable evidence, not as the final artifact to preserve.
Do not rewrite PLAN.md.
Do not curate or prune DEVLOG.md.
Input
Use:
PLAN.md
DEVLOG.md
- Current repo truth as needed, including code, tests, routes, schemas, configs,
README.md, and walkthrough docs
Output Target
Rewrite SPEC.md from scratch.
Treat PLAN.md as initial intent, DEVLOG.md as change history, and repo truth as the final arbiter of what currently exists.
Write SPEC.md as a reconstruction-grade, stack-neutral specification.
Refactoring Rules
- Start from
PLAN.md to understand the original target product and terminology.
- Parse
DEVLOG.md as evidence, not as perfect structure.
- Reconstruct a canonical change timeline from entry timestamps, labels, and content before synthesizing the spec.
- If the log is malformed, interleaved, or out of file-order chronology, repair it mentally by grouping lines under the most plausible entry header before using it as evidence.
- Group devlog evidence by feature area before writing
SPEC.md, for example public or guest experience, authenticated user experience, administrative or operator workflows, domain data management, integrations, imports or exports, and operational constraints.
- Within each feature area, treat later dated evidence as superseding earlier evidence when they conflict.
- Inspect the repo to validate what is actually implemented now.
- Prefer repo truth over plan or devlog when they diverge.
- Include only implemented current-state behavior.
- Exclude features that were planned but never built.
- Exclude features that were added and later removed.
- Mention explicit exclusions only when needed to prevent old plan assumptions from reappearing.
- Preserve behavior, rules, data semantics, and acceptance criteria; do not preserve framework-specific mechanisms unless they are product-defining.
- Translate implementation evidence into stack-neutral requirements whenever possible.
Evidence Filtering
When deciding what belongs in SPEC.md, keep:
- stable user-visible behavior
- access rules and permissions
- business rules and constraints
- durable data concepts and domain entities
- relationships, state transitions, and lifecycle rules
- transformations, comparison logic, calculation rules, and other domain algorithms
- validation rules, limits, defaults, and ordering guarantees
- empty states, error behavior, and failure handling that affect the product contract
- external interfaces, imports, exports, and integration-facing behavior
- representative acceptance scenarios needed to verify a reimplementation
- technical invariants that materially affect externally observable behavior
- operational prerequisites that still matter for real use or deployment
Usually drop:
- one-off implementation fixes
- test-only details
- internal hook or component refactors
- exact CSS values, animation timings, and pixel thresholds
- library or icon choices unless they are part of the intended product specification
- framework, test-harness, and tool names unless they are product-defining or externally required
- exploratory or superseded UI micro-tuning
If a detail might be noise, omit it unless removing it would make the product behave differently when rebuilt.
If code or tests reveal important behavior, rewrite that evidence as stack-neutral requirements or acceptance scenarios instead of copying implementation vocabulary.
SPEC Shape
Ensure SPEC.md covers:
- Purpose and audience
- Implemented user roles and access model
- Current product flows and feature behavior by role when relevant
- Current data concepts, important domain entities, and relationships
- Key business rules, algorithms, validations, and constraints
- Important states, transitions, edge cases, and failure behavior
- External interfaces, operational dependencies, and still-open prerequisites that affect reimplementation
- Acceptance scenarios sufficient to verify a reimplementation
- Explicit non-features or exclusions when needed to avoid rebuilding removed or never-built behavior
Use this section order unless the project clearly needs a different one:
- Title and brief summary
- Purpose and audience
- Roles and access
- Domain model
- Role-based experiences and core workflows
- Rules, algorithms, validations, and constraints
- States, edge cases, and failure behavior
- External interfaces and operational dependencies
- Acceptance scenarios
- Non-features, exclusions, and still-open operational notes
Keep the document product-facing and implementation-aware, not a code walkthrough.
Write in clear declarative prose with short bullets where enumeration helps readability.
Do not mirror the changelog structure.
Avoid framework-specific instructions unless the dependency is part of the product contract.
Workflow
- Resolve the target project root and confirm
PLAN.md and DEVLOG.md exist.
- Read
PLAN.md for intended scope and vocabulary.
- Read
DEVLOG.md and first normalize it into a mental canonical evidence set:
- identify each entry by header timestamp and label
- detect malformed cases such as repeated section headings, split entries, or entries that appear out of chronological order in file position
- reattach stray sections to the correct entry before drawing conclusions
- Build a current-state feature map by clustering
PLAN.md intent, devlog evidence, and repo evidence by subsystem or user flow.
- Inspect repo truth only as needed to settle what is currently implemented.
- Derive the persistent product contract from that evidence:
- entities and relationships
- role capabilities and restrictions
- workflows and user-visible outcomes
- rules, algorithms, validations, and defaults
- failure behavior and non-features
- Convert implementation-specific tests and code paths into stack-neutral acceptance scenarios when they capture behavior that a reimplementation must preserve.
- Rewrite
SPEC.md from scratch in a clean, stable structure.
- Do not copy
PLAN.md, DEVLOG.md, or code comments verbatim.
- Do not rewrite
PLAN.md or DEVLOG.md.
Design Principle
Prefer current truth over historical intention.
Prefer stable, high-signal statements over changelog prose.
Prefer concise completeness over exhaustive implementation detail.
Prefer feature-level synthesis over entry-by-entry summarization.
Prefer behavioral contracts over implementation mechanisms.
Prefer a spec that another agent can rebuild from over a spec that merely describes the existing codebase.
Validation Check
Before finalizing, verify:
SPEC.md reflects current implemented behavior rather than the original plan alone.
- Any devlog conflicts were resolved by canonicalized chronology, then validated against the repo when needed.
- Malformed devlog structure did not leak into the final spec structure.
- Unbuilt plan items are absent.
- Removed or superseded features are absent unless mentioned as explicit non-features to avoid confusion.
- Low-level implementation noise and transient UI tuning were excluded unless they are necessary to reproduce current behavior.
- Framework-specific details were translated into product requirements unless they are externally required.
- The domain model, rules, validations, and failure behavior are explicit enough to rebuild the app without reading the original code.
SPEC.md contains stack-neutral acceptance scenarios that can be used to verify a fresh implementation.
- The final document is organized by feature area and is easy to scan without knowledge of the devlog history.
- The document can serve as a strong first-pass build spec for recreating the current app.
If any check fails, refine again.
Output
Return the full new SPEC.md.
No commentary.
No explanation.
1---2name: reprompt-refactor3description: Rebuild project-root SPEC.md from PLAN.md, DEVLOG.md, and current repo truth as a stack-neutral source-of-truth spec for reimplementation. Use when the user wants to synthesize the current implemented specification, rebuild SPEC.md, or reconcile the original plan with what the app actually became.4---56# Reprompt Refactor78## Role910Act as a project specification synthesizer.11Rebuild `SPEC.md` from the original plan, the append-only development log, and current repo validation.12Treat `SPEC.md` as the long-lived source of truth for rebuilding the same app even if the current codebase, framework, or language becomes unusable.13Treat code as disposable evidence, not as the final artifact to preserve.14Do not rewrite `PLAN.md`.15Do not curate or prune `DEVLOG.md`.1617## Input1819Use:2021- `PLAN.md`22- `DEVLOG.md`23- Current repo truth as needed, including code, tests, routes, schemas, configs, `README.md`, and walkthrough docs2425## Output Target2627Rewrite `SPEC.md` from scratch.28Treat `PLAN.md` as initial intent, `DEVLOG.md` as change history, and repo truth as the final arbiter of what currently exists.29Write `SPEC.md` as a reconstruction-grade, stack-neutral specification.3031## Refactoring Rules32331. Start from `PLAN.md` to understand the original target product and terminology.342. Parse `DEVLOG.md` as evidence, not as perfect structure.353. Reconstruct a canonical change timeline from entry timestamps, labels, and content before synthesizing the spec.364. If the log is malformed, interleaved, or out of file-order chronology, repair it mentally by grouping lines under the most plausible entry header before using it as evidence.375. Group devlog evidence by feature area before writing `SPEC.md`, for example public or guest experience, authenticated user experience, administrative or operator workflows, domain data management, integrations, imports or exports, and operational constraints.386. Within each feature area, treat later dated evidence as superseding earlier evidence when they conflict.397. Inspect the repo to validate what is actually implemented now.408. Prefer repo truth over plan or devlog when they diverge.419. Include only implemented current-state behavior.4210. Exclude features that were planned but never built.4311. Exclude features that were added and later removed.4412. Mention explicit exclusions only when needed to prevent old plan assumptions from reappearing.4513. Preserve behavior, rules, data semantics, and acceptance criteria; do not preserve framework-specific mechanisms unless they are product-defining.4614. Translate implementation evidence into stack-neutral requirements whenever possible.4748## Evidence Filtering4950When deciding what belongs in `SPEC.md`, keep:5152- stable user-visible behavior53- access rules and permissions54- business rules and constraints55- durable data concepts and domain entities56- relationships, state transitions, and lifecycle rules57- transformations, comparison logic, calculation rules, and other domain algorithms58- validation rules, limits, defaults, and ordering guarantees59- empty states, error behavior, and failure handling that affect the product contract60- external interfaces, imports, exports, and integration-facing behavior61- representative acceptance scenarios needed to verify a reimplementation62- technical invariants that materially affect externally observable behavior63- operational prerequisites that still matter for real use or deployment6465Usually drop:6667- one-off implementation fixes68- test-only details69- internal hook or component refactors70- exact CSS values, animation timings, and pixel thresholds71- library or icon choices unless they are part of the intended product specification72- framework, test-harness, and tool names unless they are product-defining or externally required73- exploratory or superseded UI micro-tuning7475If a detail might be noise, omit it unless removing it would make the product behave differently when rebuilt.76If code or tests reveal important behavior, rewrite that evidence as stack-neutral requirements or acceptance scenarios instead of copying implementation vocabulary.7778## SPEC Shape7980Ensure `SPEC.md` covers:8182- Purpose and audience83- Implemented user roles and access model84- Current product flows and feature behavior by role when relevant85- Current data concepts, important domain entities, and relationships86- Key business rules, algorithms, validations, and constraints87- Important states, transitions, edge cases, and failure behavior88- External interfaces, operational dependencies, and still-open prerequisites that affect reimplementation89- Acceptance scenarios sufficient to verify a reimplementation90- Explicit non-features or exclusions when needed to avoid rebuilding removed or never-built behavior9192Use this section order unless the project clearly needs a different one:93941. Title and brief summary952. Purpose and audience963. Roles and access974. Domain model985. Role-based experiences and core workflows996. Rules, algorithms, validations, and constraints1007. States, edge cases, and failure behavior1018. External interfaces and operational dependencies1029. Acceptance scenarios10310. Non-features, exclusions, and still-open operational notes104105Keep the document product-facing and implementation-aware, not a code walkthrough.106Write in clear declarative prose with short bullets where enumeration helps readability.107Do not mirror the changelog structure.108Avoid framework-specific instructions unless the dependency is part of the product contract.109110## Workflow1111121. Resolve the target project root and confirm `PLAN.md` and `DEVLOG.md` exist.1132. Read `PLAN.md` for intended scope and vocabulary.1143. Read `DEVLOG.md` and first normalize it into a mental canonical evidence set:115 - identify each entry by header timestamp and label116 - detect malformed cases such as repeated section headings, split entries, or entries that appear out of chronological order in file position117 - reattach stray sections to the correct entry before drawing conclusions1184. Build a current-state feature map by clustering `PLAN.md` intent, devlog evidence, and repo evidence by subsystem or user flow.1195. Inspect repo truth only as needed to settle what is currently implemented.1206. Derive the persistent product contract from that evidence:121 - entities and relationships122 - role capabilities and restrictions123 - workflows and user-visible outcomes124 - rules, algorithms, validations, and defaults125 - failure behavior and non-features1267. Convert implementation-specific tests and code paths into stack-neutral acceptance scenarios when they capture behavior that a reimplementation must preserve.1278. Rewrite `SPEC.md` from scratch in a clean, stable structure.1289. Do not copy `PLAN.md`, `DEVLOG.md`, or code comments verbatim.12910. Do not rewrite `PLAN.md` or `DEVLOG.md`.130131## Design Principle132133Prefer current truth over historical intention.134Prefer stable, high-signal statements over changelog prose.135Prefer concise completeness over exhaustive implementation detail.136Prefer feature-level synthesis over entry-by-entry summarization.137Prefer behavioral contracts over implementation mechanisms.138Prefer a spec that another agent can rebuild from over a spec that merely describes the existing codebase.139140## Validation Check141142Before finalizing, verify:143144- `SPEC.md` reflects current implemented behavior rather than the original plan alone.145- Any devlog conflicts were resolved by canonicalized chronology, then validated against the repo when needed.146- Malformed devlog structure did not leak into the final spec structure.147- Unbuilt plan items are absent.148- Removed or superseded features are absent unless mentioned as explicit non-features to avoid confusion.149- Low-level implementation noise and transient UI tuning were excluded unless they are necessary to reproduce current behavior.150- Framework-specific details were translated into product requirements unless they are externally required.151- The domain model, rules, validations, and failure behavior are explicit enough to rebuild the app without reading the original code.152- `SPEC.md` contains stack-neutral acceptance scenarios that can be used to verify a fresh implementation.153- The final document is organized by feature area and is easy to scan without knowledge of the devlog history.154- The document can serve as a strong first-pass build spec for recreating the current app.155156If any check fails, refine again.157158## Output159160Return the full new `SPEC.md`.161No commentary.162No explanation.