--- name: principle-redesign-from-first-principles description: "Apply when integrating a new requirement into an existing design, or before writing logic: choosing core types and data structures, sequencing scaffold-vs-feature work, asking what concurrent actors share." disable-model-invocation: true --- # Redesign from first principles When integrating a change, don't bolt it onto the existing design. Redesign as if the requirement had been a foundational assumption from the start. - Read all affected files and understand the current design - Ask: "if we were writing this from scratch with this new requirement, what would we build?" - Propagate the change through every reference: types, docs, examples, rationale sections - Think about the whole redesign, then deliver it incrementally This is the method for preserving option value when integrating changes into an existing design. ## Foundations first **Structural decisions** protect option value. **Code-level decisions** protect simplicity. **Data structures first.** Get the data shape right before writing logic. Define core types early, trace every access pattern, and choose structures that match the dominant paths. For a kernel, that means the tile shape, the layout, and the LDS and register footprint. At code level, DRY the structure, not every line. Types and data models should converge. Three similar statements still beat a premature abstraction. Prefer explicit over clever. Test behavior and edge cases, not line counts. **Shared state.** Before sharing state between actors, ask "what happens if another actor modifies this concurrently?" If not "nothing", isolate. **Scaffold first.** If something helps every later phase, do it first. Ask "does every subsequent phase benefit from this existing?" CI, linting, test infrastructure, a reference implementation, and shared types are scaffold. Sequence for option value: setup before features, tests before fixes. Keep commits small and single-purpose. Each increment should land a coherent abstraction or deepen one that exists. Do not spread a new capability across callers as special-case coordination. Subtraction comes before setup work. Remove dead code first, then lay foundations.