#5022 15-Point Teardown + IdeaPRISM Refactored to Design Software Applications
#5022 15-Point Teardown + IdeaPRISM Refactored to Design Software Applications
Continue from https://learningfromchatgpt.blogspot.com/2026/11/5021-using-httpstrizikcom-and.html
#5022 New direction, but continue from where we left off. Reframe this combine application to design software applications
Reframing TRIZIK Studio for software application design keeps the exact same 4-stage closed-loop engine, zero-build ES2022+ architecture, and deterministic scoring math—while shifting the domain from physical teardowns to software architecture, refactoring, and greenfield app design.
| Pipeline Element | Physical Product Version | Software Application Version |
| Target Input | Everyday physical object (25 presets) | Existing app, legacy system, or new app concept (25 software archetypes) |
| Path A Verdict | Upgrade (incremental optimization) | Refactor / Evolve (modularize, optimize, harden existing stack) |
| Path B Verdict | Replacement (clean-sheet disruption) | Clean-Sheet Rewrite (new architecture, paradigm, or AI-native model) |
| Primary Kill Risk | Mechanical, thermal, or manufacturing failure | Security flaw, state-sync corruption, latency ceiling, or adoption friction |
| Loopback Output | Stress-tested physical redesign | Stress-tested software architecture ready for a Phase 0 SPEC.md |
How the 4 Stages Translate to Software Design
Stage 1: 15-Point Software Teardown & Deterministic Scoring
Instead of physical wear and BOM cost, the 15 diagnostic questions audit data models, state lifecycle, coupling, UX friction, security boundaries, and operational overhead. Client-side deterministic math still enforces the verdict:
Path A — Refactor Score
(3×U1 + 3×U2 + 2×U3 + 2×U4):U1Core Value & Workflow Fit |U2Modularity & Incremental Fixability |U3Performance / UX Headroom |U4Migration & Adoption Safety
Path B — Rewrite Score
(3×R1 + 3×R2 + 2×R3 + 2×R4):R1Architectural Dead-End / Coupling Lock |R2Paradigm Shift (e.g., local-first, AI-native) |R3Security / Compliance Ceiling |R4Stack & Maintenance Bloat
Stage 2: Software-Adapted Deep-Dive Lenses
Each of the three cached per-card deep-dives maps directly to a software engineering discipline:
AFD Subversion → Adversarial Failure & Threat Subversion: Asks "How could I intentionally break state, trigger race conditions, corrupt data, or exploit trust boundaries using the app's own APIs and workflows?"
TRIZ Nine-Screen → Stack & Ecosystem Evolution: Maps Subsystem (schemas, components, APIs), System (the application), and Supersystem (browser/OS, cloud, AI agents, user ecosystem) across Past → Present → Future to spot when an ecosystem shift obsoletes the current architecture.
TRIZ Trimming → Architectural & Dependency Trimming: Targets heavy frameworks, redundant microservices, middleware, or multi-step UI flows for deletion—reassigning their job to native browser APIs, simpler data contracts, or zero-build patterns.
Stage 3: Curated Handoff into IdeaPrism
The Handoff Drawer distills a single architectural bottleneck into IdeaPrism:
Problem Statement: Populated from the Best Refactor Concept, Best Rewrite Concept, or a specific Deep-Dive failure mode.
Constraints & Context: Automatically injects the Primary Kill Risk plus any Trimmed Dependencies (e.g., "Must operate without a backend database or build step").
Auto-Tuned Temperature:
0.5for Path A (Refactor / Contract Hardening) and0.8for Path B (Clean-Sheet Architecture).Output: Multi-method Thinking Cards (First Principles, Contradiction Matrix, Inversion, Systems Leverage) converging into Synthesized Architecture Strategies.
Stage 4: Loopback Stress-Testing & Spec Export
Clicking "Stress-Test in Teardown" on any Synthesized Strategy spawns an immutable child session with the proposed architecture as the new target. Once the child teardown completes, the Delta Banner verifies whether the new design actually reduced the original Primary Kill Risk and improved the Refactor/Rewrite scores.
What Changes in Your Phase 0–4 Codebase
Because the Phase 0 architecture separates contracts from domain prompts, ~85% of the codebase stays identical:
Unchanged:
gemini-client.js(including?mock=1),session-store.js,handoff-drawer.js,prism-runner.js,delta-comparator.js, andpipeline-stepper.js.Updated:
Schema field rename (Phase 0):
targetObject→targetApplication(plus optionalstackContextstring).Prompt & Preset pack (Phase 1): Replace the 25 physical objects with 25 software archetypes (e.g., Local-First Knowledge Base, Multi-Agent Workflow Orchestrator, SaaS Billing Dashboard, Real-Time Collaborative Editor) and swap in the 15 software diagnostic questions.
Export target (Phase 3–4): Add a "Export as Phase 0 SPEC.md" button alongside
.jsonand.mdexports so a stress-tested software design flows straight into Google Antigravity.
Write the 15 first-principles software diagnostic questions, U1-U4 / R1-R4 scoring rubric, and 25 preset software archetypes for the software-design version of TRIZIK Studio.
Below is the complete domain pack for the software-design version of TRIZIK Studio, structured to drop directly into js/teardown/teardown-engine.js while preserving the exact Phase 0 deterministic scoring formulas.
1. The 15 First-Principles Software Diagnostic Questions
Grouped into Parts 1–5 (3 questions each). Every question emits a signal (IMPROVE, REPLACE, or BOTH) and maps to a primary Stage 2 deep-dive lens.
Part 1: Core Purpose & Workflow Friction
Q01 — Job-to-Be-Done Purity: What is the irreducible core transformation this software performs (input → output), and how much of the current UI/workflow is ceremony that delays that outcome? (Lens: TRIZ Trimming)
Q02 — Cognitive & Interaction Bottleneck: Where do users spend the most clicks, context switches, or manual copy-pasting to accomplish a single primary task? (Lens: TRIZ Trimming)
Q03 — Paradigm Mismatch: Does the application force users into an outdated interaction model (e.g., manual form-filling or static polling) when modern capabilities (e.g., local-first sync, streaming, or AI-assisted synthesis) could collapse the workflow? (Lens: TRIZ Nine-Screen)
Part 2: Data Model & State Integrity
Q04 — Single Source of Truth: Where is state duplicated across UI components, caches, local storage, or backend tables in ways that invite drift or desynchronization? (Lens: AFD Subversion)
Q05 — Schema Rigidity & Contract Churn: Which core data entities are too tightly coupled to current UI views, making additive features require breaking migrations? (Lens: TRIZ Trimming)
Q06 — Edge-Case & Concurrency Fragility: What happens during offline intervals, mid-flight cancellations, duplicate submissions, or partial failures? (Lens: AFD Subversion)
Part 3: Architecture, Coupling & Dependencies
Q07 — Dependency & Framework Bloat: Which third-party libraries, build steps, or microservices exist only to solve problems that native platform APIs or simpler contracts could handle directly? (Lens: TRIZ Trimming)
Q08 — Blast Radius of Change: If a core requirement or external API changes tomorrow, how many modules must be edited simultaneously to keep the app working? (Lens: TRIZ Nine-Screen)
Q09 — Latency & Resource Ceiling: Where do network round-trips, serialization overhead, or client-side memory limits create a hard ceiling on responsiveness or scale? (Lens: AFD Subversion)
Part 4: Failure Modes, Security & Trust Boundaries
Q10 — Trust Boundary & Secret Exposure: Where do credentials, user data, or untrusted inputs (including LLM outputs) cross trust boundaries without deterministic validation or sanitization? (Lens: AFD Subversion)
Q11 — Silent Failure & Observability Gap: How can the system fail, corrupt data, or return plausible-looking wrong answers without immediately alerting the user or operator? (Lens: AFD Subversion)
Q12 — Vendor & Platform Lock-In: Which proprietary APIs, cloud services, or closed data formats hold the application hostage if pricing, terms, or availability change? (Lens: TRIZ Nine-Screen)
Part 5: Ecosystem Evolution & Operational Overhead
Q13 — Supersystem Shift: How are the surrounding OS, browser, hardware, or AI agent ecosystems evolving in ways that could absorb or obsolete this standalone app within 3 years? (Lens: TRIZ Nine-Screen)
Q14 — Deployment & Maintenance Tax: How much ongoing DevOps, CI/CD, database administration, or dependency patching is required just to keep the app alive? (Lens: TRIZ Trimming)
Q15 — Composability & Interoperability: Can this application cleanly import, export, and pipe structured data into adjacent tools, or is it a closed dead-end? (Lens: TRIZ Nine-Screen)
2. Deterministic Scoring Rubric (U1–U4 and R1–R4)
The LLM assigns raw integer scores (0–10) for each factor. Client-side code deterministically computes both totals (0–100) and routes the verdict.
Path A — Refactor / Evolve Score
Upgrade (Refactor) Score = (3 × U1) + (3 × U2) + (2 × U3) + (2 × U4)
| Factor | Weight | Name | 0 (Low) | 5 (Moderate) | 10 (High) |
| U1 | ×3 | Core Workflow Fit | Solves the wrong problem; users work around it | Solves the core job with noticeable friction | Strong core utility; users rely on the current mental model |
| U2 | ×3 | Incremental Fixability | Monolithic spaghetti; every fix breaks unrelated code | Mixed coupling; key bottlenecks can be isolated | Clean boundaries; targeted refactoring yields fast gains |
| U3 | ×2 | Performance & UX Headroom | Already at hard architectural ceiling | Moderate room for caching, pruning, and UI polish | Major speed/UX gains available without changing stack |
| U4 | ×2 | Migration & Adoption Safety | High risk of breaking existing users or data | Requires careful phased rollout | Safe, non-breaking additive improvements |
Path B — Clean-Sheet Rewrite Score
Replacement (Rewrite) Score = (3 × R1) + (3 × R2) + (2 × R3) + (2 × R4)
| Factor | Weight | Name | 0 (Low) | 5 (Moderate) | 10 (High) |
| R1 | ×3 | Architectural Dead-End | Current architecture scales cleanly | Growing tech debt slowing down new features | Fundamental coupling or data-model lock blocks progress |
| R2 | ×3 | Paradigm Shift Opportunity | No meaningful new tech or UX paradigm applies | Partial benefit from modernizing stack or AI assist | New paradigm (local-first, AI-native, zero-build) delivers 10× simplicity |
| R3 | ×2 | Security & Reliability Ceiling | Solid trust boundaries and deterministic guards | Patchable flaws with moderate effort | Structural trust, privacy, or state-corruption risks require redesign |
| R4 | ×2 | Stack & Maintenance Bloat | Lean, low-maintenance footprint | Moderate framework/infra tax | Crushing dependency, build, or cloud-ops overhead |
Deterministic Verdict Routing
PATH_A_UPGRADE(Refactor):upgradeTotal - replacementTotal >= 10→ IdeaPrism default temperature 0.5.PATH_B_REPLACEMENT(Rewrite):replacementTotal - upgradeTotal >= 10→ IdeaPrism default temperature 0.8.HYBRID(Strangler-Fig / Modular Rewrite): Difference is less than10points → IdeaPrism default temperature 0.65.
3. The 25 Preset Software Archetypes
Ready to populate the Quick-Pick dropdown in teardown-engine.js, organized into 5 categories:
| Category | Preset Software Archetypes (1–25) |
| 1. Productivity & Knowledge | 1. Local-First Personal Knowledge Base (PKM) 2. Collaborative Real-Time Document Editor 3. Personal Task & Habit Tracker 4. Meeting Notes & Action-Item Extractor 5. Bookmark & Research Clipper |
| 2. AI & Agentic Systems | 6. Multi-Agent Workflow Orchestrator 7. Local RAG Document Q&A Workbench 8. BYOK Prompt & Ideation Studio 9. Automated Compliance & Audit Checker 10. AI-Assisted Code Review Dashboard |
| 3. Developer & Engineering | 11. API Testing & Schema Validator Client 12. Visual State-Machine & Flowchart Editor 13. Log Aggregator & Incident Triage Console 14. Interactive Data Visualization Sandbox 15. Local-First CSV / JSON Data Wrangler |
| 4. Business, SaaS & Ops | 16. Small-Business Invoicing & Expense Tracker 17. Customer Support Ticketing Portal 18. Inventory & Supply-Chain Alert Dashboard 19. Appointment Booking & Calendar Scheduler 20. Lightweight CRM & Deal Pipeline |
| 5. Consumer, Media & Real-Time | 21. Browser-Based Audio / Synth Workstation 22. Offline-First Field Inspection Mobile Web App 23. Personal Finance & Budget Forecaster 24. Real-Time Telemetry & Sensor Monitor 25. Interactive Learning & Spaced-Repetition App |
Rewrite About.html to present TRIZIK Studio as a closed-loop software application design, teardown, and architecture stress-testing workspace.
Save this updated About.html in the root of your trizik-studio/ directory alongside index.html.
Rewrite SPEC.md for the software-application design version of TRIZIK Studio, incorporating the 15 software diagnostic questions, U1-U4/R1-R4 rubric, 25 presets, and Phase 0 SPEC.md export.
Save this updated SPEC.md in the root of your trizik-studio/ repository. It locks the software-architecture domain schemas, deterministic Refactor vs. Rewrite rubric, 15 software diagnostics, 25 software archetypes, and the Phase 0 SPEC.md exporter.
# Revised Software Application Specification: TRIZIK Studio (Software Architecture & Teardown)
## 1. System Vision and Explicit Non-Goals
- **Vision**: Combine a **15-Point Software Architecture Teardown & Scoring Engine** with **IdeaPrism** (`Method_Cards.html`) into a single, zero-build client-side web application. Software engineers and solo builders audit existing apps or greenfield concepts, run targeted TRIZ/AFD deep-dives, synthesize architectural strategies, stress-test proposed designs in a closed loop, and export a contract-first Phase 0 `SPEC.md` ready for implementation.
- **Target Platform and Stack**: Zero-build vanilla HTML5, CSS3, and native ES2022+ JavaScript modules (`<script type="module">`, no bundler, no backend). Client-side persistence via `localStorage` (with `.json`, `.md`, and `SPEC.md` export), and direct browser-to-API calls using Gemini BYOK (Bring Your Own Key).
- **User Roles**:
- `Software Architect / Builder`: Single-user local operator who enters the memory-only Gemini API key, audits target applications, runs deep-dives, curates IdeaPrism handoffs, stress-tests child designs, and exports specifications.
- **Explicit Non-Goals (Out of Scope)**:
- **Server-side backend or user accounts**: All state remains local in the browser; no authentication, cloud database, or telemetry server.
- **Direct code generation or IDE execution**: TRIZIK Studio outputs stress-tested architectural specs (`SPEC.md`), not full application source repositories.
- **Uncurated prompt dumping**: The app will never blindly paste all 15 diagnostic questions into IdeaPrism; handoffs must pass through an editable, distilled Handoff Drawer.
---
## 2. Architectural Overview and Future Capabilities Roadmap
- **System Topology**: A 4-stage horizontal pipeline (`1. Software Teardown` -> `2. Deep-Dive` -> `3. IdeaPrism` -> `4. Stress-Test & Spec Export`) backed by a single reactive `SessionStore` and a shared `GeminiClient`. Each stage reads immutable outputs from the prior stage and writes typed artifacts to the active `InnovationSession`.
- **Future Capabilities Roadmap (Anticipated Extension Points)**:
- **Custom Method Packs & Presets (Phase 3)**: Pluggable registry for additional thinking methods and Problem-Type Presets via `MethodRegistryHook`.
- **Iteration Delta Comparator & Spec Compiler (Phase 4)**: Side-by-side parent/child score comparison via `SessionLineageHook` and deterministic Phase 0 `SPEC.md` export via `SpecExporterHook`.
- **Local / Offline LLM Adapter (Post-v1)**: Swappable inference provider interface (`InferenceProviderHook`) to support local endpoints (e.g., Ollama) without modifying UI or pipeline contracts.
---
## 3. Phase 0: Core Contracts, Data Schemas, and Extension Hooks
> **Phase 0 Rule**: Contains only structural definitions, data schemas, state machines, pure validators, and stubbed extension hooks. Zero DOM manipulation, `fetch` calls, `localStorage` access, or feature business logic.
### 3.1 Core Data Schemas and Primary Keys
```text
InnovationSession {
sessionId: string (UUID, PK)
parentSessionId: string | null (FK -> InnovationSession.sessionId, for loopback stress-tests)
createdAt: string (ISO-8601)
updatedAt: string (ISO-8601)
stage: PipelineStage
targetApplication: string (non-empty; existing app, legacy system, or greenfield concept)
stackContext: string (optional; e.g., "Zero-build vanilla JS, localStorage, Gemini BYOK")
teardown: TeardownResult | null
deepDives: Record<string, DeepDiveArtifact> (Key: "${questionId}:${methodType}")
handoffs: IdeationHandoffPayload[]
ideationRuns: IdeaPrismRun[]
}
TeardownResult {
model: string
scores: {
u1: number (0..10, Core Workflow Fit)
u2: number (0..10, Incremental Fixability)
u3: number (0..10, Performance & UX Headroom)
u4: number (0..10, Migration & Adoption Safety)
upgradeTotal: number (0..100, Refactor Score)
r1: number (0..10, Architectural Dead-End)
r2: number (0..10, Paradigm Shift Opportunity)
r3: number (0..10, Security & Reliability Ceiling)
r4: number (0..10, Stack & Maintenance Bloat)
replacementTotal: number (0..100, Rewrite Score)
}
verdict: "PATH_A_UPGRADE" | "PATH_B_REPLACEMENT" | "HYBRID"
signalTally: { improve: number; replace: number; both: number }
bestImprovementConcept: string (Best Refactor Concept)
bestReplacementConcept: string (Best Clean-Sheet Rewrite Concept)
primaryKillRisk: string
diagnostics: DiagnosticItem[] (length === 15)
}
DiagnosticItem {
id: string ("Q01".."Q15")
part: 1 | 2 | 3 | 4 | 5
question: string
finding: string
signal: "IMPROVE" | "REPLACE" | "BOTH"
recommendedLens: "AFD_SUBVERSION" | "NINE_SCREEN" | "TRIZ_TRIMMING"
triggeredRecommendation: string
}
DeepDiveArtifact {
id: string (PK, "${questionId}:${methodType}")
questionId: string (FK -> DiagnosticItem.id)
methodType: "AFD_SUBVERSION" | "NINE_SCREEN" | "TRIZ_TRIMMING"
markdownContent: string
extractedConstraints: string[] (e.g., trimmed frameworks, trust-boundary guards)
createdAt: string (ISO-8601)
}
IdeationHandoffPayload {
handoffId: string (UUID, PK)
sourceType: "TEARDOWN_VERDICT" | "DEEP_DIVE_CARD"
sourceRefId: string (sessionId or DeepDiveArtifact.id)
problemStatement: string
constraintsContext: string
recommendedTemp: number (0.0..1.0)
recommendedMethodIds: string[]
}
IdeaPrismRun {
runId: string (UUID, PK)
handoffId: string (FK -> IdeationHandoffPayload.handoffId)
model: string
temperature: number
maxOutputTokens: number
cards: MethodCardResult[]
synthesizedStrategies: SynthesizedStrategy[]
createdAt: string (ISO-8601)
}
MethodCardResult {
methodId: string
methodName: string
status: "IDLE" | "RUNNING" | "DONE" | "ERROR" | "CANCELLED"
markdownContent: string
}
SynthesizedStrategy {
strategyId: string (UUID, PK)
title: string
summary: string
sourceMethodIds: string[]
}
3.2 Deterministic Scoring & Verdict Invariants
Refactor Score (Path A):
upgradeTotal === (3 * u1) + (3 * u2) + (2 * u3) + (2 * u4)Rewrite Score (Path B):
replacementTotal === (3 * r1) + (3 * r2) + (2 * r3) + (2 * r4)Verdict Routing:
PATH_A_UPGRADE(Refactor):upgradeTotal - replacementTotal >= 10-> IdeaPrism default temp0.5PATH_B_REPLACEMENT(Rewrite):replacementTotal - upgradeTotal >= 10-> IdeaPrism default temp0.8HYBRID(Strangler-Fig / Modular Rewrite):Math.abs(upgradeTotal - replacementTotal) < 10-> IdeaPrism default temp0.65
3.3 State Machines and Lifecycle Transitions
PipelineStageStates:DRAFT->TEARDOWN_READY->DEEP_DIVE_ACTIVE->IDEATION_ACTIVE->LOOPBACK_SPAWNEDAllowed Transitions and Guards:
DRAFT -> TEARDOWN_READY: Requires validTeardownResultpassing deterministic score validation anddiagnostics.length === 15.TEARDOWN_READY -> DEEP_DIVE_ACTIVE: Triggered when at least oneDeepDiveArtifactis cached.TEARDOWN_READY | DEEP_DIVE_ACTIVE -> IDEATION_ACTIVE: Triggered when anIdeationHandoffPayloadis emitted to IdeaPrism.IDEATION_ACTIVE -> LOOPBACK_SPAWNED: Triggered when aSynthesizedStrategyspawns a childInnovationSessionwithparentSessionIdset.
3.4 Interface Boundaries and Extension Hooks
InferenceProviderHook:
generate({ apiKey, model, systemPrompt, userPrompt, temperature, maxOutputTokens, signal }) => Promise<{ text: string; usage?: object }>
HandoffMapperHook:
mapToIdeation(session: InnovationSession, sourceType, sourceRefId) => IdeationHandoffPayload
MethodRegistryHook:
registerMethod(methodDef)/getMethodsByPreset(presetKey)
SessionLineageHook:
computeDelta(parentSession, childSession) => { upgradeDelta, replacementDelta, killRiskChanged }
SpecExporterHook:
compilePhase0Spec(session: InnovationSession, parentSession?: InnovationSession) => string(returns ready-to-save Phase 0SPEC.mdMarkdown)
3.5 Phase 0 Verification Gate
[ ] All core schemas and JSDoc typedefs load with zero circular dependencies.
[ ] Deterministic score validator recomputes mismatched LLM totals and enforces
PATH_A_UPGRADE/PATH_B_REPLACEMENT/HYBRIDrouting.[ ]
InnovationSessionJSON serialization/deserialization round-trip tests pass.[ ] All five extension hooks resolve cleanly with no-op default stubs.
4. Phased Additive Build Plan
Phase 1: Shared Core, Persistence & Software Teardown Engine
New Files / Modules:
js/core/gemini-client.js(implementsInferenceProviderHook, memory-only API key closure,AbortSignalsupport, and?mock=1fixture adapter)js/core/session-store.js(localStorageCRUD, reactive events,.json/.mdexporters; never persists API key)js/teardown/software-presets.js(the 15 first-principles software diagnostic questions across Parts 1–5,U1–U4/R1–R4rubric constants, and 25 preset software archetypes across 5 categories)js/teardown/teardown-engine.js(15-point software teardown runner + deterministic score validator)js/teardown/deep-dive-engine.js(AFD Failure & Threat Subversion, TRIZ Nine-Screen Stack Evolution, and TRIZ Architectural Trimming runners + constraint extractor)index.html,css/styles.css(shared API Config bar + Stage 1–2 UI)
Touched Phase 0 Extension Hooks:
InferenceProviderHookPhase 1 Verification Gate:
[ ] All 25 software archetypes populate the Quick-Pick selector and run against the 15 software diagnostic questions.
[ ] Deterministic math validator rejects/recomputes mismatched LLM totals.
[ ] Deep-dive outputs cache under
session.deepDives["Q07:TRIZ_TRIMMING"]and persist across page reloads.[ ] Zero modifications to Phase 0 files; no API key written to
localStorage.
Phase 2: Automated Handoff Bridge (Teardown -> IdeaPrism)
New Files / Modules:
js/bridge/handoff-mapper.js(implementsHandoffMapperHook)js/bridge/handoff-drawer.js(editable preview modal before launching IdeaPrism)
Additive Capabilities:
"Send to IdeaPrism" button on the Teardown Verdict card and every Deep-Dive card.
Auto-populates
Problem Statementand injectsprimaryKillRisk+extractedConstraints(e.g., trimmed frameworks or trust-boundary guards) intoConstraints & Context.Auto-tunes temperature (
0.5Refactor,0.65Hybrid,0.8Rewrite) and selects matching Problem-Type Presets.
Touched Phase 0 Extension Hooks:
HandoffMapperHookPhase 2 Verification Gate:
[ ] Path A teardown handoff sets
recommendedTemp === 0.5and injectsprimaryKillRisk.[ ] TRIZ Architectural Trimming handoff appends trimmed-dependency constraints without overwriting user-entered context.
[ ] All Phase 0 and Phase 1 gates pass unchanged.
Phase 3: Integrated IdeaPrism Studio & Method Registry
New Files / Modules:
js/ideaprism/method-registry.js(implementsMethodRegistryHook+ Problem-Type Presets)js/ideaprism/prism-runner.js(concurrent method card execution,AbortControllerCancel All, andSynthesizedStrategygenerator)js/ideaprism/prism-view.js(Stage 3 workspace hydrated from activeIdeationHandoffPayload, collapsible cards, multi-run support per teardown)
Touched Phase 0 Extension Hooks:
MethodRegistryHook,InferenceProviderHookPhase 3 Verification Gate:
[ ]
Cancel Allcleanly aborts in-flight requests and transitions active cards toCANCELLED.[ ] Completed
IdeaPrismRunrecords link tohandoffIdand export cleanly in.jsonand.md.[ ] All Phase 0–2 gates pass unchanged.
Phase 4: Loopback Stress-Testing, Lineage Delta & Phase 0 SPEC.md Export
New Files / Modules:
js/lineage/delta-comparator.js(implementsSessionLineageHook)js/export/spec-exporter.js(implementsSpecExporterHookto compile the active session's target app, constraints, kill-risk mitigations, and synthesized architecture into a downloadable Phase 0SPEC.md)js/ui/pipeline-stepper.js(top-level 4-stage navigation bar + parent/child lineage switcher)
Additive Capabilities:
"Stress-Test in Teardown" action on every
SynthesizedStrategycard spawning an immutable child session (parentSessionIdlinked,targetApplicationpre-filled).Side-by-side Delta Banner displaying Refactor/Rewrite score shifts and kill-risk resolution status.
"Export Phase 0 SPEC.md" button generating a structured specification ready for Google Antigravity.
Touched Phase 0 Extension Hooks:
SessionLineageHook,SpecExporterHookPhase 4 Verification Gate:
[ ] Loopback session preserves parent session immutably and links
child.parentSessionId === parent.sessionId.[ ] Delta Banner renders accurate score deltas and kill-risk status once the child teardown completes.
[ ] Export Phase 0 SPEC.md downloads a valid Markdown spec containing Vision, Constraints, Kill-Risk Mitigations, and Candidate Schemas.
[ ] All Phase 0–3 gates pass unchanged.
5. Decision Log Summary
| ID | Status | Decision / Requirement | Rationale |
| D-01 | [ACCEPTED] | Memory-only Gemini BYOK key shared across all 4 stages | Prevents credential leakage to localStorage while eliminating duplicate key entry. |
| D-02 | [ACCEPTED] | Deterministic client-side Refactor vs. Rewrite scoring (3×U1+3×U2+2×U3+2×U4) | Prevents LLM arithmetic drift from corrupting verdict routing and IdeaPrism temperature presets. |
| D-03 | [ACCEPTED] | Curated, editable Handoff Drawer between Teardown and IdeaPrism | Prevents prompt dilution from dumping all 15 diagnostics into IdeaPrism. |
| D-04 | [ACCEPTED] | Immutable parent-child lineage + Phase 0 SPEC.md exporter | Proves whether a redesign actually reduces kill risk and hands a clean contract spec straight into Google Antigravity. |
| D-05 | [REJECTED] | Direct full-codebase generation inside TRIZIK Studio | Keeps the tool focused on high-leverage architectural diagnostics and contract-first specification. |
Update the Phase 0 through Phase 4 Google Antigravity /plan prompts to match the software-design SPEC.md including SpecExporterHook and software-presets.js.
Start a new conversation in Google Antigravity for each phase below, and commit to Git after each phase's verify-phase Walkthrough passes.
Phase 0: Core Contracts, Validators & Extension Hooks
/plan Read @SPEC.md and @AGENTS.md. Implement ONLY Phase 0:
1. Create `js/core/contracts.js` (JSDoc typedefs, schema factories for `InnovationSession` with `targetApplication` and `stackContext`, `TeardownResult`, `DiagnosticItem` with `part` and `recommendedLens`, `DeepDiveArtifact`, `IdeationHandoffPayload`, `IdeaPrismRun`, `MethodCardResult`, `SynthesizedStrategy`, and `PipelineStage` state-transition guards).
2. Create `js/core/validators.js` (deterministic Refactor vs. Rewrite scoring validator enforcing `3*u1 + 3*u2 + 2*u3 + 2*u4` and `3*r1 + 3*r2 + 2*r3 + 2*r4`, verdict routing for `PATH_A_UPGRADE` / `PATH_B_REPLACEMENT` / `HYBRID`, `diagnostics.length === 15`, and `InnovationSession` JSON round-trip validation).
3. Create `js/core/hooks.js` (stubbed no-op contracts for all five extension hooks: `InferenceProviderHook`, `HandoffMapperHook`, `MethodRegistryHook`, `SessionLineageHook`, and `SpecExporterHook`).
4. Create `tests/phase0.test.js` using Node's built-in `node:test` runner to verify zero circular imports, deterministic score recomputation, verdict routing, and JSON round-trip integrity.
Constraints: Zero UI, zero `fetch` calls, zero `localStorage`, and zero feature business logic. Run the `verify-phase` skill (Steps 2 and 4) before finishing.
Phase 1: Shared Core, Persistence & Software Teardown Engine
/plan Read @SPEC.md and @AGENTS.md. Implement ONLY Phase 1 without modifying any Phase 0 files:
1. Create `js/core/gemini-client.js` implementing `InferenceProviderHook` with a memory-only API key closure, `AbortSignal` support, and a deterministic mock fixture mode triggered by `?mock=1` (with optional simulated latency for testing cancellation).
2. Create `js/core/session-store.js` (`localStorage` CRUD, reactive change events, and `.json`/`.md` session export; never persist the API key).
3. Create `js/teardown/software-presets.js` containing the 15 first-principles software diagnostic questions (Parts 1–5), `U1–U4`/`R1–R4` rubric constants, and all 25 preset software archetypes across 5 categories.
4. Create `js/teardown/teardown-engine.js` (15-point software teardown runner + deterministic score validation) and `js/teardown/deep-dive-engine.js` (AFD Failure & Threat Subversion, TRIZ Nine-Screen Stack Evolution, and TRIZ Architectural Trimming runners + constraint extraction).
5. Create `index.html` and `css/styles.css` with the shared API Config bar and the Stage 1–2 Software Teardown & Deep-Dive views.
Verification: Run the `verify-phase` skill. Start a local static server on port 8080 and use `/browser` on `http://localhost:8080/?mock=1` to:
- Verify zero console or ES module import errors.
- Confirm all 25 software archetypes populate the Quick-Pick selector and run a mock 15-point software teardown with deterministic Refactor/Rewrite scores.
- Run and cache one Deep-Dive card (`Q07:TRIZ_TRIMMING`), reload the page, and confirm it persists.
- Inspect `localStorage` and confirm no API key is stored.
Attach screenshots and a Browser Recording to the Walkthrough artifact.
Phase 2: Automated Handoff Bridge (Teardown → IdeaPrism)
/plan Read @SPEC.md and @AGENTS.md. Implement ONLY Phase 2 without modifying any Phase 0 files:
1. Create `js/bridge/handoff-mapper.js` implementing `HandoffMapperHook` to map either a Teardown Verdict or a Deep-Dive card into an `IdeationHandoffPayload` (auto-setting `recommendedTemp` to `0.5` for `PATH_A_UPGRADE` Refactor, `0.65` for `HYBRID`, and `0.8` for `PATH_B_REPLACEMENT` Rewrite; injecting `primaryKillRisk` and `extractedConstraints` into `constraintsContext`; and selecting matching Problem-Type Presets).
2. Create `js/bridge/handoff-drawer.js` as an editable preview modal triggered by a "Send to IdeaPrism" button on the Teardown Verdict card and every Deep-Dive card.
3. Add unit tests in `tests/phase2.test.js` covering Refactor/Hybrid/Rewrite temperature mapping and non-destructive constraint appending.
Verification: Run the `verify-phase` skill. Use `/browser` on `http://localhost:8080/?mock=1` to:
- Trigger "Send to IdeaPrism" from a Path A (Refactor) teardown and verify the drawer pre-fills Problem Statement, injects `primaryKillRisk` into Constraints, and sets Temperature to `0.5`.
- Trigger "Send to IdeaPrism" from a TRIZ Architectural Trimming deep-dive card and verify trimmed-dependency constraints append without overwriting existing user text.
Attach screenshots to the Walkthrough artifact.
Phase 3: Integrated IdeaPrism Studio & Method Registry
/plan Read @SPEC.md and @AGENTS.md. Implement ONLY Phase 3 without modifying any Phase 0 files:
1. Create `js/ideaprism/method-registry.js` implementing `MethodRegistryHook` with the thinking methods catalog and Problem-Type Presets.
2. Create `js/ideaprism/prism-runner.js` for concurrent method card execution via `InferenceProviderHook`, `AbortController`-backed `Cancel All`, and `SynthesizedStrategy` generation.
3. Create `js/ideaprism/prism-view.js` rendering Stage 3 (hydrated from the active `IdeationHandoffPayload`, collapsible Thinking Method Cards, Synthesized Strategies panel, and support for multiple ideation runs per teardown).
4. Wire `IdeaPrismRun` records into `session-store.js` exports (`.json` and `.md`).
Verification: Run the `verify-phase` skill. Use `/browser` on `http://localhost:8080/?mock=1` to:
- Complete a handoff from Phase 2 into Stage 3 and verify Problem Statement, Constraints, Temperature, and Preset methods hydrate automatically.
- Launch multiple Method Cards, click "Cancel All" mid-run, and confirm active cards transition cleanly to `CANCELLED`.
- Run a full mock ideation pass to completion, confirm `SynthesizedStrategies` render, and verify the exported `.json` contains linked `handoffId` and `IdeaPrismRun` data.
Attach screenshots and a Browser Recording to the Walkthrough artifact.
Phase 4: Loopback Stress-Testing, Lineage Delta & Phase 0 SPEC.md Export
/plan Read @SPEC.md and @AGENTS.md. Implement ONLY Phase 4 without modifying any Phase 0 files:
1. Create `js/lineage/delta-comparator.js` implementing `SessionLineageHook` to compute `upgradeDelta`, `replacementDelta`, and `killRiskChanged` between parent and child sessions.
2. Create `js/export/spec-exporter.js` implementing `SpecExporterHook` (`compilePhase0Spec`) to compile the active session's target application, stack context, constraints, kill-risk mitigations, and synthesized architecture into a downloadable Phase 0 `SPEC.md` ready for Google Antigravity.
3. Create `js/ui/pipeline-stepper.js` rendering the top-level 4-stage navigation bar (`1. Software Teardown` -> `2. Deep-Dive` -> `3. IdeaPrism` -> `4. Stress-Test & Spec Export`) and a parent/child session lineage switcher.
4. Add a "Stress-Test in Teardown" button to every `SynthesizedStrategy` card that spawns an immutable child `InnovationSession` (`parentSessionId` linked, `targetApplication` pre-filled), render the side-by-side Delta Banner once the child teardown completes, and wire the "Export Phase 0 SPEC.md" button.
Verification: Run the `verify-phase` skill. Use `/browser` on `http://localhost:8080/?mock=1` to:
- Click "Stress-Test in Teardown" on a Synthesized Strategy card and confirm a new child session opens with `targetApplication` pre-filled.
- Run the child teardown and confirm the Delta Banner renders accurate Refactor/Rewrite score deltas and kill-risk status.
- Switch back to the parent session via the lineage switcher and confirm the parent teardown data is completely unchanged.
- Click "Export Phase 0 SPEC.md" and verify the generated Markdown contains Vision, Constraints, Kill-Risk Mitigations, and Candidate Schemas.
Attach screenshots and a Browser Recording to the Walkthrough artifact..agents/rules/phase0-contracts.md and .agents/skills/verify-phase/SKILL.md with these updated versions aligned to the software-architecture SPEC.md.1. .agents/rules/phase0-contracts.md
---
trigger: glob
globs: "js/core/contracts.js, js/core/validators.js, js/core/hooks.js"
description: "Protects Phase 0 software-architecture schemas, deterministic Refactor/Rewrite scoring math, and all five extension hook signatures."
---
# Phase 0 Contract Lock
1. **Schema Immutability**: Do not rename, remove, or change types on existing keys in `InnovationSession` (including `targetApplication` and `stackContext`), `TeardownResult`, `DiagnosticItem` (including `part` and `recommendedLens`), `DeepDiveArtifact`, `IdeationHandoffPayload`, `IdeaPrismRun`, `MethodCardResult`, or `SynthesizedStrategy`.
2. **Deterministic Scoring & Verdict Invariants**:
- Refactor Score (Path A): `upgradeTotal === (3 * u1) + (3 * u2) + (2 * u3) + (2 * u4)`
- Rewrite Score (Path B): `replacementTotal === (3 * r1) + (3 * r2) + (2 * r3) + (2 * r4)`
- Verdict routing: `PATH_A_UPGRADE` (`upgradeTotal - replacementTotal >= 10`), `PATH_B_REPLACEMENT` (`replacementTotal - upgradeTotal >= 10`), or `HYBRID` (`Math.abs(upgradeTotal - replacementTotal) < 10`).
- Reject or recompute any LLM payload that violates these formulas or returns `diagnostics.length !== 15`.
3. **Locked Extension Hooks**: Preserve the exact signatures for all five Phase 0 hooks:
- `InferenceProviderHook`
- `HandoffMapperHook`
- `MethodRegistryHook`
- `SessionLineageHook`
- `SpecExporterHook` (`compilePhase0Spec`)
4. **Zero Business Logic**: Keep Phase 0 files limited to JSDoc typedefs, schema factories, pure validators, state-transition guards, and no-op extension hook stubs. No DOM manipulation, `fetch` calls, or `localStorage` access.
5. **No Circular Dependencies**: Phase 0 modules may only import from other Phase 0 modules in a strict acyclic order (`contracts.js` -> `validators.js` -> `hooks.js`).
2. .agents/skills/verify-phase/SKILL.md
---
name: verify-phase
description: Run the TRIZIK Studio phase verification gate, check Phase 0 contract immutability, execute automated schema/math tests, and run /browser smoke tests.
---
# Verify Phase Gate
Run these checks in order before marking any phase complete. Do not skip steps.
## 1. Check Phase 0 Immutability (Phases 1–4 Only)
Run `git diff --name-only` in the terminal.
- Verify that `js/core/contracts.js`, `js/core/validators.js`, and `js/core/hooks.js` have **zero modifications**.
- If any Phase 0 file was modified without explicit user approval, halt and report the diff.
## 2. Run Pure JS Contract & Validator Tests
Execute the test suite via Node (`node --test tests/*.test.js`):
- Confirm zero circular import errors across Phase 0 modules.
- Confirm deterministic Refactor/Rewrite scoring math (`3*u1 + 3*u2 + 2*u3 + 2*u4` and `3*r1 + 3*r2 + 2*r3 + 2*r4`) and `PATH_A_UPGRADE` / `PATH_B_REPLACEMENT` / `HYBRID` routing pass and correct mismatched LLM totals.
- Confirm `InnovationSession` (with `targetApplication` and `stackContext`) JSON serialization/deserialization round-trip passes.
- Confirm all five extension hooks (`InferenceProviderHook`, `HandoffMapperHook`, `MethodRegistryHook`, `SessionLineageHook`, `SpecExporterHook`) resolve cleanly.
## 3. Run `/browser` Smoke Test (Phases 1–4)
Start a local static server (`python -m http.server 8080` or `npx serve . -l 8080`) and open `http://localhost:8080/?mock=1` with the `/browser` subagent:
- **Zero Console Errors**: Verify no uncaught exceptions or failed ES module imports in DevTools console.
- **Phase-Specific Checks**:
- **Phase 1**: Confirm all 25 software archetypes populate the Quick-Pick selector, run a mock 15-point software teardown, verify deterministic Refactor/Rewrite scores render, cache a deep-dive card (`Q07:TRIZ_TRIMMING`), reload the page, and confirm persistence.
- **Phase 2**: Click **Send to IdeaPrism** on a Path A (Refactor) teardown; confirm `recommendedTemp === 0.5` and `primaryKillRisk` is injected into Constraints. Trigger from a TRIZ Architectural Trimming card and confirm trimmed-dependency constraints append non-destructively.
- **Phase 3**: Launch multiple Method Cards, click **Cancel All** mid-run, and confirm active cards transition to `CANCELLED`. Run a full pass and confirm `SynthesizedStrategies` render and export in `.json`.
- **Phase 4**: Click **Stress-Test in Teardown** on a Synthesized Strategy; confirm a child session spawns with `parentSessionId` linked and `targetApplication` pre-filled, renders the score **Delta Banner**, and leaves the parent session immutable. Click **Export Phase 0 SPEC.md** and confirm the downloaded Markdown contains Vision, Constraints, Kill-Risk Mitigations, and Candidate Schemas.
- Confirm `localStorage` does **not** contain any API key string.
## 4. Produce Walkthrough Artifact
Summarize:
- Files added/modified
- Test pass/fail results
- Screenshots or Browser Recording link from `/browser`
- Explicit sign-off against every checkbox in the current phase's Verification Gate in `SPEC.md`From <https://gemini.google.com/app/9feb0e300e077a91> Google Gemini (4 Neon)


Comments
Post a Comment