@ryuenn3123/agentic-senior-core 4.2.7 → 4.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@ Check `docs/design-intent.json`:
29
29
  4. Record `motionPaletteDecision` before UI code; product categories are heuristics, not style presets.
30
30
  5. Encode `repoEvidence.designEvidenceSummary` when onboarding or detector evidence exists.
31
31
  6. Keep both design docs synchronized after implementation.
32
- 7. Complete the Section 3-5 gates from `research-design.md` before UI implementation: `conceptualAnchor.categoryCodes.candidateEntries`, `conceptualAnchor.morphologicalExploration` (selected and uncomfortable combinations), and `conceptualAnchor.anchorCandidates.candidates` (exactly five, each with the strengthened rename test recorded).
32
+ 7. Complete the Section 3 gate from `research-design.md` before UI implementation: `conceptualAnchor.categoryCodes` (at least three category defaults to avoid with rejection notes), `conceptualAnchor.anchorReference` (one concrete, googleable reference), and four creative commitments (typography, palette, motion, composition) recorded in design docs.
33
33
  8. Set `derivedTokenLogic.tokenContinuityClassification` for each of typography, palette, motion, and spacing. Use `anchor-derived` only when the token choice is causally tied to the anchor's real-world reality. Use `continuity-retained` when the token is kept from a previous design iteration without re-derivation. Use `newly-introduced` when the token is fresh but not anchor-derived. If any token category is `continuity-retained`, the typography, palette, or motion entry in `researchDossier.metadata.antiRepeatLedger` stays as historical record, and the classification declares the retention is intentional with explicit rationale recorded in the matching `derivationSource` field.
34
34
  9. After agent and user select an anchor, set `researchDossier.metadata.researchVerifiedAt` to today's ISO date and flip `status` from any seed value to `active`. This closes the freshness window for additive UI tasks within `freshnessWindowDays`.
35
35
  10. Complete the Live Source Freshness Gate from `research-design.md` before claiming that a visual pattern, library, browser feature, accessibility requirement, or interaction style is current. Record `sourceFreshness` and `evidenceTable[]` in `docs/design-intent.json`.
@@ -11,7 +11,7 @@ Before editing:
11
11
  3. If required project docs are missing, stop and bootstrap or update docs first.
12
12
  4. If the change touches UI, load .agent-context/prompts/bootstrap-design.md and .agent-context/rules/frontend-architecture.md before editing.
13
13
  5. If the change touches a dependency, framework, Docker, runtime, or ecosystem claim, verify current official docs before choosing.
14
- 6. Enforce Universal SOP hard gate: stop implementation if root `README.md` is missing, if `docs/doc-index.md` is missing while `docs/` exists, if `docs/architecture-decision-record.md` is missing, or for UI scope if `docs/DESIGN.md` or `docs/design-intent.json` is missing.
14
+ 6. Enforce Universal SOP hard gate: stop implementation if root `README.md` is missing, if `docs/doc-index.md` is missing while `docs/` exists, if `docs/project-brief.md` is missing, if `docs/architecture-decision-record.md` is missing, if `docs/flow-overview.md` is missing, if `docs/database-schema.md` is missing while the project uses persistent data, if `docs/api-contract.md` is missing while the project exposes API or web application flows, or for UI scope if `docs/DESIGN.md` or `docs/design-intent.json` is missing.
15
15
  7. Enforce backend universal principles: no clever hacks, no premature abstraction, readability over brevity.
16
16
  8. For backend/API scope, enforce layered boundaries, zero-trust input validation, safe centralized error responses, bounded list reads, transaction safety for multi-write mutations, idempotency for sensitive mutations, and behavior-focused API tests.
17
17
  9. Backend/API governance is global and stack-agnostic. Do not create stack-specific adapters or framework-specific rule branches; apply the global rules through the framework already present in the target project.
@@ -120,122 +120,52 @@ Reference material is fuel for variance, not a style source.
120
120
 
121
121
  If references are not provided by the user and web search is unavailable, set `referenceIntakeStatus` to `internal-evidence-only` and constrain Sections 3 to 5 to repo evidence and project docs.
122
122
 
123
- ## Section 3 — Category Code Identification
123
+ ## Section 3 — Creative Direction
124
124
 
125
- Before exploring variance, name the cliches the product category will default to without intervention. These are the patterns reviewers recognize on sight as "the standard look" for the category.
125
+ Before UI code, commit to a specific visual direction. The agent tends to converge toward generic, "on distribution" outputs. In frontend design this creates what users call the "AI slop" aesthetic. This section exists to prevent that.
126
126
 
127
- This list becomes `categoryCodes` in the design-intent.json. Specificity standard: a category code is only valid if someone can recognize the exact cliche from the text description alone, without seeing the UI and without knowing the product name.
127
+ ### 3a. Category defaults to avoid
128
128
 
129
- Fails specificity:
130
- - `clean typography` (too abstract, applies to anything)
131
- - `modern color palette` (not falsifiable)
132
- - `smooth animations` (describes nothing specific)
129
+ Name at least three specific cliches your product category will fall into without intervention. Be specific enough that someone unfamiliar with the project can visualize the exact aesthetic trap from the text alone.
133
130
 
134
- Examples of cliches described with sufficient specificity. Read carefully: these examples illustrate the description format. They are themselves AI-defaultable cliches of their categories. They are NOT target aesthetics. They are not aesthetic candidates for any product. They appear here so you can see what specificity reads like; you are not allowed to ship them.
131
+ Common AI-safe cliches to name and reject when your product sits anywhere near them:
135
132
 
136
- The three example categories below were chosen specifically because they are unlikely to overlap with common software products, to prevent leakage:
137
-
138
- - `children's storybook illustration site: hand-painted gouache textures with irregular hand-lettered titles, off-grid spreads with whitespace gutters, page-turn pacing rather than scroll` (instantly recognizable as kids book category default)
139
- - `luxury car configurator: full-bleed monochrome photography on black, ultra-thin sans-serif tracked wide, slow horizontal scroll with locked vertical alignment, micro-counters that tick instead of slide` (instantly recognizable as luxury auto category default)
140
- - `academic philosophy journal: high-contrast black-on-cream, book-class serif body at 11pt with generous leading, footnote markers with hover panels, numbered table-of-contents navigation, no hero imagery` (instantly recognizable as academic journal category default)
141
-
142
- Anti-leakage rule: listing a cliche is identifying a trap, not endorsing an aesthetic. If your product happens to fall in one of the example categories above, the matching cliche still must appear in your `categoryCodes` AND must carry an explicit rejection note. The same applies to the AI-safe defaults below.
143
-
144
- Common AI-safe cliches you must list and reject if your product is anywhere near them. Software products almost always pattern-match one of these without intervention:
145
-
146
- - `dev-tool default: condensed tabular numerics with minimal chrome and monospace code blocks on dark slate background, sans-serif metadata at 11–12px, monochrome status dots, single-line settings rows`
147
- - `AI-startup landing default: purple-to-pink gradient hero with floating 3D glass cards, sans-serif display type at 700–900 weight, vague hero copy, three-up feature grid below the fold`
148
- - `health/wellness app default: mint accent on white surface with coral status indicators, rounded pill-shaped buttons, friendly sans-serif at high weight, soft drop shadows on cards`
149
- - `SaaS admin default: left-side icon-only nav, top utility bar, three-card KPI row above a single data table, neutral grey-on-white with one accent color, modal-driven detail flows`
133
+ - `dev-tool default: condensed tabular numerics with minimal chrome and monospace code blocks on dark slate background, sans-serif metadata at 11-12px, monochrome status dots`
134
+ - `AI-startup landing default: purple-to-pink gradient hero with floating 3D glass cards, sans-serif display type at 700-900 weight, vague hero copy, three-up feature grid`
135
+ - `SaaS admin default: left-side icon-only nav, top utility bar, three-card KPI row above a single data table, neutral grey-on-white with one accent color`
150
136
  - `marketing site default: hero image with one-line headline plus subhead, three feature tiles below, two pricing tiers, testimonial carousel, footer link grid`
151
137
 
152
- If you find yourself describing your selected direction in the same shape as any of these, you have inverted the test. Revise.
153
-
154
- Self-test: read each category code aloud to someone unfamiliar with the project.
155
-
156
- - If they cannot visualize a specific aesthetic direction from the text alone, the code is too abstract. Revise until it passes.
157
- - If they say "yeah that's basically the X cliche", the description is specific enough. The cliche then belongs on your reject list, not on your candidate list.
158
-
159
- Output: at least three category codes per product surface in `categoryCodes`. Each entry must pass the specificity self-test, must include the one-sentence reason that pattern is the default for the category, and must include an explicit one-sentence rejection note ("I will not ship this; here is the trap it sets") so the cliche cannot quietly become the target.
160
-
161
- ### Dimensional split (mandatory)
162
-
163
- Category codes must be broken down by dimension. Do not collapse multiple dimensions into a single category-level cliche. Each cluster lists the patterns that the product category will default to without intervention.
164
-
165
- - `typographyClusters`: font family combinations that are the category default. Be explicit about font families. Name the actual trio or pair that this product's category currently defaults to, derived from live portfolio observation for THIS task. Do not anchor on examples from other categories or other timeframes.
166
- - `paletteClusters`: palette signatures that are the category default.
167
- - `layoutClusters`: layout patterns that are the category default.
168
- - `motionClusters`: motion signatures that are the category default.
169
- - `imageryClusters`: image style or visual treatment that is the category default.
170
-
171
- Self-check before proceeding to Section 4: do the typography choices the agent is about to commit to in `derivedTokenLogic` (or downstream token sections) overlap with any item in `typographyClusters`? If yes, the agent must either:
172
-
173
- 1. Flag the typography as a continuity choice with an explicit rationale, set `derivedTokenLogic.tokenContinuityClassification.typography` to `continuity-retained`, and record the reason that font family swap is deferred. The previous typography ledger entry stays as historical record; the classification declares the retention is intentional. OR
174
- 2. Revise the typography pick to escape the autopilot cluster and set `tokenContinuityClassification.typography` to `anchor-derived` only when the new choice is causally tied to the anchor's real-world reality.
175
-
176
- This self-check applies to every dimension, not only typography. Do not let an output token match a category-code item from the agent's own list without explicit (1) or (2) treatment per dimension. Pretending continuity is derivation is the failure mode this gate exists to prevent.
177
-
178
- ## Section 4 — Morphological Exploration
179
-
180
- A morphological matrix forces the design space to be explored beyond the first idea.
181
-
182
- Choose five or six dimensions that matter for this product. Common dimensions include hierarchy, density, type role contrast, motion language, state vocabulary, material logic, color behavior, composition rhythm, and interaction grammar. Generate four or five values per dimension. Do not include the category code defaults from Section 3 as values; the matrix is for variance, not for ratifying the cliche.
183
-
184
- Output a 5x5 or 6x5 morphological matrix. Then:
185
-
186
- 1. Highlight the combination that becomes the basis for Section 5 candidates.
187
- 2. Highlight at least ONE combination that feels instinctively wrong or uncomfortable but CAN be argued with product logic. This is the uncomfortable combination requirement.
188
-
189
- The uncomfortable combination exists to prove the matrix actually spans the design space. If every combination in the matrix feels safe, shippable, and unobjectionable, the matrix has not explored far enough; it is clustering in the safe-creative zone.
190
-
191
- Rules for the uncomfortable combination:
192
- - It must be genuinely uncomfortable (the agent's first reaction is "this would not work").
193
- - It must be arguable (the agent can construct a two-sentence product-logic justification for why it could work despite discomfort).
194
- - It must not be random noise (uncomfortable plus unjustifiable equals waste, not exploration).
195
- - The user is not required to choose it. Its purpose is to prove the design space was explored beyond the comfort boundary.
196
-
197
- If the agent cannot produce an uncomfortable-but-arguable combination, the dimensions chosen are too narrow. Widen at least one dimension and regenerate the matrix.
138
+ Each category default must include a one-sentence rejection note explaining the trap it sets.
198
139
 
199
- Output: `morphologicalExploration` block with `dimensions[]`, `matrix` (rendered as a Markdown table inside `docs/DESIGN.md` and as a structured array inside `docs/design-intent.json`), `selectedCombination`, `uncomfortableCombination` ({ `combinationLabel`, `discomfortReason`, `productLogicJustification` }).
140
+ Output: `categoryCodes[]` with at least three entries in `docs/design-intent.json`. Each entry has `description`, `categoryDefaultReason`, and `rejectionNote`.
200
141
 
201
- ## Section 5 — Anchor Candidates
142
+ ### 3b. Anchor reference
202
143
 
203
- From the selected morphological combination, generate exactly five anchor candidates. An anchor is a real-world reference whose mechanics, hierarchy, density, type roles, state language, and motion behavior translate into UI grammar without copying its surface.
144
+ Pick one concrete, googleable real-world reference whose mechanics (not surface) translate to your UI. The anchor must be specific enough that renaming the product to a different category breaks coherence.
204
145
 
205
- Hard constraints on anchors:
206
- - The anchor must be concrete and googleable. "Modern", "clean", "premium", "expressive", "minimal", "bold", "futuristic", "elegant" are not anchors.
207
- - Specific premium digital products are valid anchors when the borrowed element is an interaction mechanic, hierarchy pattern, or motion behavior — not a palette or brand. Be specific enough that the reference fails the rename test.
208
- - Do not default to spatial place metaphors such as room, darkroom, control room, counting room, war room, studio, lab, cockpit, command center. Use them only when the product genuinely depends on a physical place model. Prefer artifacts, custody flows, instruments, data behaviors, materials, editorial systems, service rituals, or interaction mechanisms.
209
- - Pass the strengthened rename test: mentally rename the product to three genuinely different categories. Categories must be remote from each other and from the actual product (for example, if the product is a health app, test against fintech dashboard, kids educational game, and industrial equipment monitoring console).
146
+ Hard constraints:
147
+ - Reject generic quality words as anchors: "modern", "clean", "premium", "expressive", "minimal", "bold", "futuristic", "elegant" are not anchors.
148
+ - Specific premium digital products are valid anchors when the borrowed element is an interaction mechanic, hierarchy pattern, or motion behavior -- not a palette or brand.
149
+ - Do not default to spatial place metaphors (room, darkroom, control room, studio, lab, cockpit, command center). Prefer artifacts, workflows, instruments, data behaviors, materials, editorial systems, or interaction mechanisms.
150
+ - Draw from IDE themes, cultural aesthetics, cinematic campaigns, editorial systems, material artifacts, or specific product experiences for inspiration.
210
151
 
211
- Strengthened rename test scoring:
212
- - UI still coherent in zero of three renamed categories: anchor is highly specific. STRONG PASS.
213
- - UI still coherent in one of three: anchor is specific enough. PASS with note.
214
- - UI still coherent in two of three: anchor is too generic. REVISE the anchor to add product-specific constraints until it fails in at least two of three.
215
- - UI still coherent in three of three: anchor is category-agnostic. DISCARD immediately.
152
+ Output: `conceptualAnchor.anchorReference` in `docs/design-intent.json`.
216
153
 
217
- Test-category freshness: do not reuse the same three test categories across every anchor. Pick fresh categories per anchor. Categories used in earlier examples (fintech dashboard, kids educational game, industrial equipment monitoring console) are listed only as illustration of "remote from each other"; they are not a fixed test triple. Reusing the same triple lets the agent memorize the pass condition instead of stress-testing the anchor.
154
+ ### 3c. Four creative commitments (record before coding)
218
155
 
219
- The three test categories must be stated explicitly in the dossier alongside each anchor's rename test result. This makes the test auditable by human reviewers.
156
+ 1. **Typography**: Choose distinctive fonts with meaningful role contrast. Avoid overused families (Inter, Roboto, Arial, Space Grotesk, system fonts). Pick choices that elevate the aesthetic. Record one variable-axis or pairing decision.
157
+ 2. **Color and palette**: Commit to a cohesive product-derived palette. Dominant colors with sharp accents outperform timid, evenly-distributed palettes. Name what product evidence makes the palette fit and one color behavior that would not transfer to another category.
158
+ 3. **Motion and interaction**: Define one signature motion behavior more specific than "smooth." Focus on high-impact moments: one well-orchestrated page load with staggered reveals creates more delight than scattered micro-interactions. Use CSS-only or a modern motion library.
159
+ 4. **Composition**: Make one composition choice that avoids interchangeable card stacks. Create atmosphere and depth rather than defaulting to solid backgrounds.
220
160
 
221
- For EACH of the five candidates, record:
161
+ Avoid generic AI-generated aesthetics:
162
+ - Overused font families and cliched color schemes (particularly purple gradients)
163
+ - Predictable layouts and cookie-cutter component patterns
164
+ - Solid-color backgrounds without atmosphere or depth
222
165
 
223
- - `anchorReference` (concrete, googleable)
224
- - `conceptualFamily`
225
- - `jobFit` (one sentence linking to product)
226
- - `hierarchyImplication`
227
- - `densityImplication`
228
- - `typeImplication` (variable axis or pairing logic, not just family)
229
- - `stateLanguage` (loading, empty, error, partial, stale, optimistic, success using the anchor's own vocabulary)
230
- - `motionImplication` (choreography rule, what state change it serves)
231
- - `whatItRulesOut` (proves variance)
232
- - `renameTest`:
233
- - `testCategories`: three remote categories used for testing
234
- - `results`: coherent or incoherent per category, in order
235
- - `verdict`: STRONG PASS, PASS, REVISE, or DISCARD
236
- - `categoryCodeOverlap` check: list any Section 3 category codes this candidate accidentally inherits, with reasoning
166
+ Interpret creatively and make unexpected choices that feel genuinely designed for the context. Vary between light and dark themes, different fonts, different aesthetics. The agent still tends to converge on common choices across generations; resist this.
237
167
 
238
- Output: `anchorCandidates[]` (length five). Discard any candidate with `verdict: DISCARD` before selection. The selected anchor populates `conceptualAnchor.anchorReference` and `derivedTokenLogic.anchorReference` (they must match exactly).
168
+ Output: Record all four commitments in `docs/design-intent.json` before UI code. The `derivedTokenLogic.tokenContinuityClassification` must classify each of typography, palette, motion, and spacing as `anchor-derived`, `continuity-retained`, or `newly-introduced` with rationale.
239
169
 
240
170
  ## Done Criteria
241
171
 
@@ -243,9 +173,9 @@ The brief is complete when:
243
173
 
244
174
  1. `productReading` is filled with evidence-backed sentences.
245
175
  2. `referenceIntake[]` records the borrowed mechanic and the explicit non-copy boundary per reference (or `referenceIntakeStatus: internal-evidence-only` is set).
246
- 3. `categoryCodes[]` has at least three entries that pass the specificity self-test.
247
- 4. `morphologicalExploration` has a 5x5 or 6x5 matrix, a selected combination, and an uncomfortable combination with the three required fields.
248
- 5. `anchorCandidates[]` has exactly five entries; each has a complete `renameTest`; the selected anchor has `verdict: STRONG PASS` or `verdict: PASS`.
176
+ 3. `categoryCodes[]` has at least three entries with rejection notes.
177
+ 4. One anchor reference is recorded that passes the specificity test (renaming the product to a different category breaks coherence).
178
+ 5. Four creative commitments are recorded with product-derived rationale.
249
179
  6. Generic anchors and spatial-place defaults are rejected with the rejection reason recorded.
250
180
 
251
181
  Only after the brief is complete does the agent move on to `docs/DESIGN.md` and the rest of `docs/design-intent.json` (token logic, motion budget, accessibility policy, review rubric, library decisions, etc., per `bootstrap-design.md`).
@@ -11,7 +11,7 @@ Before reviewing:
11
11
  3. Read .agent-context/review-checklists/architecture-review.md only when architecture or boundaries changed.
12
12
  4. Load only the rules relevant to the changed scope.
13
13
  5. For UI changes, load .agent-context/prompts/bootstrap-design.md, .agent-context/rules/frontend-architecture.md, docs/DESIGN.md, and docs/design-intent.json when present.
14
- 6. Enforce Universal SOP hard gate: block coding flow when required project docs are missing (root `README.md`; `docs/doc-index.md` when `docs/` exists; `docs/architecture-decision-record.md`; and for UI scope `docs/DESIGN.md` plus `docs/design-intent.json`).
14
+ 6. Enforce Universal SOP hard gate: block coding flow when required project docs are missing (root `README.md`; `docs/doc-index.md` when `docs/` exists; `docs/project-brief.md`; `docs/architecture-decision-record.md`; `docs/flow-overview.md`; `docs/database-schema.md` when persistent data exists; `docs/api-contract.md` when API or web application flows exist; and for UI scope `docs/DESIGN.md` plus `docs/design-intent.json`).
15
15
  7. Enforce single-source and lazy-loading policy: canonical rule source must be explicitly enforced, global domain governance must load lazily based on touched scope, and conflicting duplicate rule instructions must not appear during normal flow.
16
16
 
17
17
  Prioritize findings in this order:
@@ -122,9 +122,13 @@ Run this before declaring a task done. Apply only the sections relevant to the c
122
122
 
123
123
  - [ ] `.agent-context/rules/` remains the default guidance source for implementation and review.
124
124
  - [ ] Security and testing requirements remain mandatory after static template purge.
125
+ - [ ] Coding flow is blocked if `docs/project-brief.md` is missing
125
126
  - [ ] Coding flow is blocked if `docs/architecture-decision-record.md` (or `docs/Architecture-Decision-Record.md`) is missing
126
127
  - [ ] Coding flow is blocked if root `README.md` is missing
127
128
  - [ ] Coding flow is blocked if `docs/doc-index.md` is missing while `docs/` exists
129
+ - [ ] Coding flow is blocked if `docs/flow-overview.md` is missing
130
+ - [ ] Coding flow is blocked if `docs/database-schema.md` is missing while the project uses persistent data
131
+ - [ ] Coding flow is blocked if `docs/api-contract.md` is missing while the project exposes API or web application flows
128
132
  - [ ] UI implementation flow is blocked if `docs/DESIGN.md` or `docs/design-intent.json` is missing
129
133
 
130
134
  ## Verdict
@@ -121,3 +121,13 @@ keywords:
121
121
  7. Reject silent acceptance of duplicate side-effect-producing requests without a key. A caller that retried without a key gets a 400-class response that names the missing key, not a second charge.
122
122
  8. Authority for the rules above includes IETF RFC 9110 for HTTP method idempotency semantics and successor specifications for the `Idempotency-Key` request header where the platform standardizes one. Verify the current standardization status at audit time, because the header has been a draft and an RFC at different points in its history.
123
123
  <!-- DURABILITY CHECK: Rule relies exclusively on architectural invariants and relative operational thresholds. Valid beyond standard tooling lifecycles. -->
124
+
125
+ ## API-013: Documentation Diagram Format (Mandatory)
126
+
127
+ 1. Use Mermaid.js as the default diagram format for all project documentation diagrams: flowcharts, sequence diagrams, ER diagrams, architecture diagrams, C4 model diagrams, and state machine diagrams.
128
+ 2. Embed Mermaid diagrams as fenced code blocks with the `mermaid` language tag inside Markdown files.
129
+ 3. Do not use PlantUML, ASCII art diagrams, Graphviz DOT, or Structurizr DSL. These formats lack native rendering in GitHub, GitLab, and VS Code Markdown preview, or have lower LLM generation accuracy.
130
+ 4. D2 is on the watch list. Do not adopt D2 until GitHub ships native rendering support.
131
+ 5. Keep diagrams at macro-architecture and critical-flow level. Do not diagram micro-logic or individual function internals unless the complexity warrants it.
132
+ 6. When updating project behavior, update the matching diagrams in the same change. Stale diagrams are worse than no diagrams.
133
+ 7. When updating an existing doc that contains prose-only flow descriptions, architecture explanations, or data model descriptions without diagrams, convert the relevant sections to Mermaid diagrams in the same change.
package/AGENTS.md CHANGED
@@ -74,8 +74,8 @@ Location: `.agent-context/prompts/`. Load the matching prompt only, plus `compac
74
74
  - `init-project.md` -> create, build, new project, scaffold
75
75
  - `refactor.md` -> refactor, improve, clean up, fix
76
76
  - `review-code.md` -> review, audit, check, analyze
77
- - `bootstrap-design.md` -> ui, ux, layout, screen, tailwind, frontend, redesign (always paired with `research-design.md` for the Section 3-5 dossier gate)
78
- - `research-design.md` -> design research dossier (Section 3 categoryCodes, Section 4 morphologicalExploration, Section 5 anchorCandidates with strengthened rename test). Loads before `bootstrap-design.md` whenever the dossier is missing, the design contract status is a seed, `researchDossier.metadata.researchVerifiedAt` is null or older than `freshnessWindowDays`, or the user explicitly requests a redesign.
77
+ - `bootstrap-design.md` -> ui, ux, layout, screen, tailwind, frontend, redesign (always paired with `research-design.md` for the Section 3 creative direction gate)
78
+ - `research-design.md` -> design research dossier (Section 3 creative direction: category defaults to avoid, anchor reference, four creative commitments). Loads before `bootstrap-design.md` whenever the dossier is missing, the design contract status is a seed, `researchDossier.metadata.researchVerifiedAt` is null or older than `freshnessWindowDays`, or the user explicitly requests a redesign.
79
79
 
80
80
  For UI-only work, load `bootstrap-design.md`, `research-design.md`, and `frontend-architecture.md` first; do not eagerly load unrelated backend-only rules unless the request crosses that boundary. The valid style context is current repo evidence, current brief, and current project docs. External references, prior-chat memory, unrelated-project visuals, and remembered screenshots are tainted unless the user makes them current-task constraints. Treat WCAG 2.2 AA as the hard compliance floor and APCA as advisory perceptual tuning only. Do not require screenshot capture as a baseline dependency.
81
81
 
@@ -103,8 +103,8 @@ Trigger: docs, documentation, dokumen, `docs/*`, architecture docs, flow docs, A
103
103
 
104
104
  1. Load `architecture.md`, `api-docs.md`, and only additional rules required by scope.
105
105
  2. Create or refine required docs first: root `README.md` for every fresh or existing project; `docs/doc-index.md` whenever `docs/` exists; `docs/project-brief.md`; `docs/architecture-decision-record.md`; `docs/flow-overview.md`; `docs/api-contract.md` for APIs, firmware endpoints, CLI commands, or web application flows; `docs/database-schema.md` for persistent data; and `docs/DESIGN.md` plus `docs/design-intent.json` for UI scope.
106
- 3. Use `docs/doc-index.md` as the compact read-routing map. Add PRD, SRS, technical-design, or separate ERD only when project evidence justifies them.
107
- 4. Write formal project docs in English by default unless the user asks otherwise.
106
+ 3. Use Mermaid.js as the default diagram format for all documentation diagrams (flowcharts, sequence, ER, C4, state). Embed as fenced `mermaid` code blocks. Do not use PlantUML, ASCII art diagrams, Graphviz DOT, or Structurizr DSL. When updating existing docs that contain prose-only descriptions, convert relevant sections to Mermaid diagrams in the same change.
107
+ 4. Use `docs/doc-index.md` as the compact read-routing map; add PRD, SRS, technical-design, or separate ERD only when justified. Write formal project docs in English by default.
108
108
  5. Stop after documentation when the user only asked for docs. Do not write application, firmware, or UI code until the user asks or approves implementation; do not write application, firmware, or UI code before approval.
109
109
 
110
110
  ### 2. New Project Planning
@@ -141,7 +141,7 @@ Trigger: ui, ux, layout, screen, tailwind, frontend, redesign.
141
141
  2. Detect user-explicit redesign first ("redesign from zero", "redesain dari 0", "ulang dari 0", "research ulang", any explicit reset). It bypasses the freshness gate; run research-design.md regardless of dossier age and treat existing direction as anti-repeat ledger input only.
142
142
  3. Route by `docs/design-intent.json` state. File missing, status one of `seed-needs-design-synthesis`, `seed-generated-during-init`, `seed-generated-during-upgrade`, OR active with `researchDossier.metadata.researchVerifiedAt` null or older than `freshnessWindowDays` (90): run research-design.md, then bootstrap-design.md, then flip status to active and write today's ISO date to `researchVerifiedAt`. Active and fresh and no explicit redesign: run bootstrap-design.md only for additive UI tasks; do not auto-refresh `researchVerifiedAt`.
143
143
  4. Scenario routing: backend-only init then later UI request (Scenario B) requires `npx @ryuenn3123/agentic-senior-core upgrade` to re-sync UI governance when `bootstrap-design.md` or `research-design.md` is missing; upgrade-migrated metadata (Scenario D) and init on existing project that already had design-intent.json (Scenario E) populate the anti-repeat ledger from previous anchor, palette, and motion. Treat every ledger entry as a hard blocklist when running research-design.md.
144
- 5. Anti-repeat ledger contract: read `researchDossier.metadata.antiRepeatLedger` before producing candidates. The five Section 5 anchor candidates must each differ from every blocklisted entry on at least conceptual family, hierarchy implication, and motion implication. Restating an existing direction with new wording is REVISE.
144
+ 5. Anti-repeat ledger contract: read `researchDossier.metadata.antiRepeatLedger` before producing candidates. The chosen anchor must differ from every blocklisted entry on at least conceptual family, hierarchy implication, and motion implication. Restating an existing direction with new wording is REVISE.
145
145
  6. Include a one-line Motion/Palette Decision before UI code; product categories are heuristics, not style presets. Record one real-world anchor, one signature motion behavior, and one typographic role contrast.
146
146
  7. Ensure `docs/design-intent.json` includes `conceptualAnchor.anchorReference`, top-level `derivedTokenLogic`, `researchDossier.metadata`, `libraryResearchStatus`, `libraryDecisions[]`, and motion/palette decisions. Generate or refine `docs/DESIGN.md` plus `docs/design-intent.json` before UI implementation.
147
147
  8. Keep context isolated; do not eagerly load unrelated backend-only rules. For broad screens or redesigns, treat expressive motion, spatial hierarchy, distinctive composition, and product-specific interaction as the baseline; quiet or static surfaces require a concrete product, performance, accessibility, device, or dependency reason.
@@ -163,7 +163,7 @@ Use valid rule IDs only; do not quote full rule prose, expose hidden chain-of-th
163
163
  Never claim done without:
164
164
  1. Relevant rules applied.
165
165
  2. PR and architecture checklists considered.
166
- 3. Universal SOP gates satisfied: public and developer root `README.md`; `docs/architecture-decision-record.md`; plus `docs/DESIGN.md` and `docs/design-intent.json` for UI scope.
166
+ 3. Universal SOP gates satisfied: public and developer root `README.md`; `docs/doc-index.md` when `docs/` exists; `docs/project-brief.md`; `docs/architecture-decision-record.md`; `docs/flow-overview.md`; `docs/database-schema.md` when persistent data exists; `docs/api-contract.md` when API or web application flows exist; plus `docs/DESIGN.md` and `docs/design-intent.json` for UI scope.
167
167
  4. If `.agent-context/state/active-memory.json` exists and material project progress happened, refresh it while preserving privacy rules and user-owned entries.
168
168
  5. Project validation passed through `npm run validate`.
169
169
 
@@ -55,6 +55,8 @@ export const RULE_FAMILY_CATALOG = [
55
55
  'idempotent',
56
56
  'idempotency',
57
57
  'documented',
58
+ 'diagram',
59
+ 'mermaid',
58
60
  ],
59
61
  },
60
62
  {
@@ -3,11 +3,11 @@
3
3
  * that force agents to commit to a real-world reference, motion, and typography
4
4
  * decision before UI implementation, instead of defaulting to spatial cliches.
5
5
  *
6
- * Carries the Section 3-5 dossier from
6
+ * Carries the Section 3 dossier from
7
7
  * `.agent-context/prompts/research-design.md`:
8
- * - categoryCodes (Section 3)
9
- * - morphologicalExploration (Section 4)
10
- * - anchorCandidates (Section 5)
8
+ * - categoryCodes (Section 3a)
9
+ * - anchorReference (Section 3b)
10
+ * - creativeCommitments (Section 3c)
11
11
  */
12
12
 
13
13
  export function buildConceptualAnchorSection() {
@@ -126,7 +126,6 @@ export function buildConceptualAnchorSection() {
126
126
  selfTestRule: 'Read each category code aloud to someone unfamiliar with the project. If they cannot visualize a specific aesthetic direction from the text alone, the code is too abstract; revise. If they say "that is basically the X cliche", the description is specific enough; the cliche then belongs on the reject list with a rejection note, not as a candidate target.',
127
127
  requiredFieldsPerEntry: [
128
128
  'description',
129
- 'specificityEvidence',
130
129
  'categoryDefaultReason',
131
130
  'rejectionNote',
132
131
  ],
@@ -139,73 +138,7 @@ export function buildConceptualAnchorSection() {
139
138
  ],
140
139
  candidateEntries: [],
141
140
  },
142
- morphologicalExploration: {
143
- mode: 'agent-must-complete-before-ui-implementation',
144
- blockingByDefault: true,
145
- researchBriefSection: 'Section 4',
146
- researchBriefPath: '.agent-context/prompts/research-design.md',
147
- requiredMatrixShape: '5x5-or-6x5',
148
- minimumDimensions: 5,
149
- maximumDimensions: 6,
150
- valuesPerDimension: 5,
151
- forbidCategoryCodeValuesInMatrix: true,
152
- requireSelectedCombination: true,
153
- requireUncomfortableCombination: true,
154
- uncomfortableCombinationRule: 'Highlight at least one combination that feels instinctively wrong or uncomfortable but can be argued with product logic. The uncomfortable combination proves the matrix actually spans the design space; if every combination feels safe, shippable, and unobjectionable, the matrix is clustering in the safe-creative zone.',
155
- uncomfortableCombinationRequiredFields: [
156
- 'combinationLabel',
157
- 'discomfortReason',
158
- 'productLogicJustification',
159
- ],
160
- widenDimensionsWhenUncomfortableCombinationCannotBeProduced: true,
161
- seedDimensions: [],
162
- seedMatrix: [],
163
- selectedCombination: null,
164
- uncomfortableCombination: null,
165
- },
166
- anchorCandidates: {
167
- mode: 'agent-must-complete-before-ui-implementation',
168
- blockingByDefault: true,
169
- researchBriefSection: 'Section 5',
170
- researchBriefPath: '.agent-context/prompts/research-design.md',
171
- requiredCandidateCount: 5,
172
- requiredFieldsPerCandidate: [
173
- 'anchorReference',
174
- 'conceptualFamily',
175
- 'jobFit',
176
- 'hierarchyImplication',
177
- 'densityImplication',
178
- 'typeImplication',
179
- 'stateLanguage',
180
- 'motionImplication',
181
- 'whatItRulesOut',
182
- 'renameTest',
183
- 'categoryCodeOverlap',
184
- ],
185
- renameTest: {
186
- mode: 'strengthened',
187
- requiredTestCategoryCount: 3,
188
- testCategoryDistanceRule: 'The three test categories must be remote from each other and from the actual product (for example, if the product is a health app, test against fintech dashboard, kids educational game, and industrial equipment monitoring console).',
189
- testCategoryFreshnessRule: 'Pick fresh test categories per anchor. Reusing the same triple across every anchor lets the agent memorize the pass condition instead of stress-testing the anchor. The illustrative triple in testCategoryDistanceRule is not a fixed test set.',
190
- verdictScoring: {
191
- 'STRONG PASS': 'UI still coherent in 0 of 3 renamed categories.',
192
- PASS: 'UI still coherent in 1 of 3. Pass with note.',
193
- REVISE: 'UI still coherent in 2 of 3. Anchor is too generic. Revise the anchor to add product-specific constraints until it fails in at least 2 of 3.',
194
- DISCARD: 'UI still coherent in 3 of 3. Anchor is category-agnostic. Discard immediately.',
195
- },
196
- requireTestCategoriesRecordedInDossier: true,
197
- auditableByHumanReviewer: true,
198
- renameTestRequiredFields: [
199
- 'testCategories',
200
- 'results',
201
- 'verdict',
202
- ],
203
- },
204
- categoryCodeOverlapRule: 'List any Section 3 category codes this candidate accidentally inherits, with reasoning.',
205
- forbiddenSelectedVerdicts: ['DISCARD'],
206
- requiredSelectedVerdicts: ['STRONG PASS', 'PASS'],
207
- candidates: [],
208
- },
141
+
209
142
  finalAnchorContract: {
210
143
  requiredFields: [
211
144
  'name',
@@ -213,8 +213,6 @@ export function validateConceptualAnchor(designIntentContract, validationErrors)
213
213
  validateVisualRiskBudgetAndLiteralPolicy(conceptualAnchor, validationErrors);
214
214
  validateFinalAnchorContract(conceptualAnchor, validationErrors);
215
215
  validateCategoryCodes(conceptualAnchor, validationErrors, { isSeedStatus });
216
- validateMorphologicalExploration(conceptualAnchor, validationErrors, { isSeedStatus });
217
- validateAnchorCandidates(conceptualAnchor, validationErrors, { isSeedStatus });
218
216
  return validationErrors;
219
217
  }
220
218
 
@@ -281,11 +279,10 @@ function validateCategoryCodes(conceptualAnchor, validationErrors, options = {})
281
279
  if (
282
280
  !Array.isArray(categoryCodes.requiredFieldsPerEntry)
283
281
  || !categoryCodes.requiredFieldsPerEntry.includes('description')
284
- || !categoryCodes.requiredFieldsPerEntry.includes('specificityEvidence')
285
282
  || !categoryCodes.requiredFieldsPerEntry.includes('categoryDefaultReason')
286
283
  || !categoryCodes.requiredFieldsPerEntry.includes('rejectionNote')
287
284
  ) {
288
- validationErrors.push('designIntent.conceptualAnchor.categoryCodes.requiredFieldsPerEntry must require description, specificityEvidence, categoryDefaultReason, and rejectionNote.');
285
+ validationErrors.push('designIntent.conceptualAnchor.categoryCodes.requiredFieldsPerEntry must require description, categoryDefaultReason, and rejectionNote.');
289
286
  }
290
287
  if (!Array.isArray(categoryCodes.forbiddenPlaceholderPhrases) || categoryCodes.forbiddenPlaceholderPhrases.length === 0) {
291
288
  validationErrors.push('designIntent.conceptualAnchor.categoryCodes.forbiddenPlaceholderPhrases must list the abstract phrases that fail the specificity self-test.');
@@ -295,162 +292,3 @@ function validateCategoryCodes(conceptualAnchor, validationErrors, options = {})
295
292
  }
296
293
  }
297
294
 
298
- function validateMorphologicalExploration(conceptualAnchor, validationErrors, options = {}) {
299
- const { isSeedStatus = false } = options;
300
- const morphologicalExploration = conceptualAnchor.morphologicalExploration;
301
- if (!morphologicalExploration || typeof morphologicalExploration !== 'object') {
302
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration must exist (Section 4 of research-design.md).');
303
- return;
304
- }
305
- if (morphologicalExploration.mode !== 'agent-must-complete-before-ui-implementation') {
306
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.mode must equal "agent-must-complete-before-ui-implementation".');
307
- }
308
- if (morphologicalExploration.blockingByDefault !== true) {
309
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.blockingByDefault must equal true.');
310
- }
311
- if (morphologicalExploration.researchBriefSection !== 'Section 4') {
312
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.researchBriefSection must equal "Section 4".');
313
- }
314
- if (morphologicalExploration.requiredMatrixShape !== '5x5-or-6x5') {
315
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.requiredMatrixShape must equal "5x5-or-6x5".');
316
- }
317
- if (morphologicalExploration.minimumDimensions !== 5) {
318
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.minimumDimensions must equal 5.');
319
- }
320
- if (morphologicalExploration.maximumDimensions !== 6) {
321
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.maximumDimensions must equal 6.');
322
- }
323
- if (morphologicalExploration.valuesPerDimension !== 5) {
324
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.valuesPerDimension must equal 5.');
325
- }
326
- if (morphologicalExploration.forbidCategoryCodeValuesInMatrix !== true) {
327
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.forbidCategoryCodeValuesInMatrix must equal true so Section 3 cliches do not re-enter the matrix as values.');
328
- }
329
- if (morphologicalExploration.requireSelectedCombination !== true) {
330
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.requireSelectedCombination must equal true.');
331
- }
332
- if (morphologicalExploration.requireUncomfortableCombination !== true) {
333
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.requireUncomfortableCombination must equal true.');
334
- }
335
- if (!hasNonEmptyString(morphologicalExploration.uncomfortableCombinationRule)) {
336
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.uncomfortableCombinationRule must be a non-empty string explaining why the uncomfortable combination is required.');
337
- }
338
- if (
339
- !Array.isArray(morphologicalExploration.uncomfortableCombinationRequiredFields)
340
- || !morphologicalExploration.uncomfortableCombinationRequiredFields.includes('combinationLabel')
341
- || !morphologicalExploration.uncomfortableCombinationRequiredFields.includes('discomfortReason')
342
- || !morphologicalExploration.uncomfortableCombinationRequiredFields.includes('productLogicJustification')
343
- ) {
344
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.uncomfortableCombinationRequiredFields must include combinationLabel, discomfortReason, and productLogicJustification.');
345
- }
346
- if (morphologicalExploration.widenDimensionsWhenUncomfortableCombinationCannotBeProduced !== true) {
347
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.widenDimensionsWhenUncomfortableCombinationCannotBeProduced must equal true.');
348
- }
349
-
350
- if (morphologicalExploration.uncomfortableCombination !== null && typeof morphologicalExploration.uncomfortableCombination === 'object') {
351
- const uncomfortableCombination = morphologicalExploration.uncomfortableCombination;
352
- if (!hasNonEmptyString(uncomfortableCombination.combinationLabel)) {
353
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.uncomfortableCombination.combinationLabel must be a non-empty string.');
354
- }
355
- if (!hasNonEmptyString(uncomfortableCombination.discomfortReason)) {
356
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.uncomfortableCombination.discomfortReason must be a non-empty string.');
357
- }
358
- if (!hasNonEmptyString(uncomfortableCombination.productLogicJustification)) {
359
- validationErrors.push('designIntent.conceptualAnchor.morphologicalExploration.uncomfortableCombination.productLogicJustification must be a non-empty string.');
360
- }
361
- }
362
- }
363
-
364
- function validateAnchorCandidates(conceptualAnchor, validationErrors, options = {}) {
365
- const { isSeedStatus = false } = options;
366
- const anchorCandidates = conceptualAnchor.anchorCandidates;
367
- if (!anchorCandidates || typeof anchorCandidates !== 'object') {
368
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates must exist (Section 5 of research-design.md).');
369
- return;
370
- }
371
- if (anchorCandidates.mode !== 'agent-must-complete-before-ui-implementation') {
372
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.mode must equal "agent-must-complete-before-ui-implementation".');
373
- }
374
- if (anchorCandidates.blockingByDefault !== true) {
375
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.blockingByDefault must equal true.');
376
- }
377
- if (anchorCandidates.researchBriefSection !== 'Section 5') {
378
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.researchBriefSection must equal "Section 5".');
379
- }
380
- if (anchorCandidates.requiredCandidateCount !== 5) {
381
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.requiredCandidateCount must equal 5.');
382
- }
383
- if (
384
- !Array.isArray(anchorCandidates.requiredFieldsPerCandidate)
385
- || !anchorCandidates.requiredFieldsPerCandidate.includes('anchorReference')
386
- || !anchorCandidates.requiredFieldsPerCandidate.includes('jobFit')
387
- || !anchorCandidates.requiredFieldsPerCandidate.includes('hierarchyImplication')
388
- || !anchorCandidates.requiredFieldsPerCandidate.includes('densityImplication')
389
- || !anchorCandidates.requiredFieldsPerCandidate.includes('typeImplication')
390
- || !anchorCandidates.requiredFieldsPerCandidate.includes('stateLanguage')
391
- || !anchorCandidates.requiredFieldsPerCandidate.includes('motionImplication')
392
- || !anchorCandidates.requiredFieldsPerCandidate.includes('whatItRulesOut')
393
- || !anchorCandidates.requiredFieldsPerCandidate.includes('renameTest')
394
- || !anchorCandidates.requiredFieldsPerCandidate.includes('categoryCodeOverlap')
395
- ) {
396
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.requiredFieldsPerCandidate must list the full anchor dossier fields including renameTest and categoryCodeOverlap.');
397
- }
398
-
399
- const renameTest = anchorCandidates.renameTest;
400
- if (!renameTest || typeof renameTest !== 'object') {
401
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.renameTest must exist.');
402
- return;
403
- }
404
- if (renameTest.mode !== 'strengthened') {
405
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.renameTest.mode must equal "strengthened".');
406
- }
407
- if (renameTest.requiredTestCategoryCount !== 3) {
408
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.renameTest.requiredTestCategoryCount must equal 3.');
409
- }
410
- if (!hasNonEmptyString(renameTest.testCategoryDistanceRule)) {
411
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.renameTest.testCategoryDistanceRule must be a non-empty string requiring remote categories.');
412
- }
413
- if (!hasNonEmptyString(renameTest.testCategoryFreshnessRule)) {
414
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.renameTest.testCategoryFreshnessRule must be a non-empty string preventing reuse of the same test triple across every anchor.');
415
- }
416
- if (!renameTest.verdictScoring || typeof renameTest.verdictScoring !== 'object') {
417
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.renameTest.verdictScoring must define STRONG PASS, PASS, REVISE, and DISCARD verdicts.');
418
- } else {
419
- for (const verdict of ['STRONG PASS', 'PASS', 'REVISE', 'DISCARD']) {
420
- if (!hasNonEmptyString(renameTest.verdictScoring[verdict])) {
421
- validationErrors.push(`designIntent.conceptualAnchor.anchorCandidates.renameTest.verdictScoring["${verdict}"] must be a non-empty string.`);
422
- }
423
- }
424
- }
425
- if (renameTest.requireTestCategoriesRecordedInDossier !== true) {
426
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.renameTest.requireTestCategoriesRecordedInDossier must equal true.');
427
- }
428
- if (renameTest.auditableByHumanReviewer !== true) {
429
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.renameTest.auditableByHumanReviewer must equal true.');
430
- }
431
- if (
432
- !Array.isArray(renameTest.renameTestRequiredFields)
433
- || !renameTest.renameTestRequiredFields.includes('testCategories')
434
- || !renameTest.renameTestRequiredFields.includes('results')
435
- || !renameTest.renameTestRequiredFields.includes('verdict')
436
- ) {
437
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.renameTest.renameTestRequiredFields must include testCategories, results, and verdict.');
438
- }
439
-
440
- if (!hasNonEmptyString(anchorCandidates.categoryCodeOverlapRule)) {
441
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.categoryCodeOverlapRule must be a non-empty string.');
442
- }
443
- if (!Array.isArray(anchorCandidates.forbiddenSelectedVerdicts) || !anchorCandidates.forbiddenSelectedVerdicts.includes('DISCARD')) {
444
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.forbiddenSelectedVerdicts must include "DISCARD".');
445
- }
446
- if (
447
- !Array.isArray(anchorCandidates.requiredSelectedVerdicts)
448
- || !anchorCandidates.requiredSelectedVerdicts.includes('STRONG PASS')
449
- || !anchorCandidates.requiredSelectedVerdicts.includes('PASS')
450
- ) {
451
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.requiredSelectedVerdicts must include "STRONG PASS" and "PASS".');
452
- }
453
- if (!Array.isArray(anchorCandidates.candidates)) {
454
- validationErrors.push('designIntent.conceptualAnchor.anchorCandidates.candidates must be an array (empty in the seed; populated by the agent).');
455
- }
456
- }
@@ -60,12 +60,10 @@ function buildDesignIntentContractObject({
60
60
  return {
61
61
  _gate: {
62
62
  phase: 'scaffold-only',
63
- instruction: 'DO NOT fill conceptualAnchor, derivedTokenLogic, or any token values until research-design.md Sections 3, 4, and 5 are complete. Do not simplify or rewrite this scaffold. Fill fields in-place after research.',
63
+ instruction: 'DO NOT fill conceptualAnchor, derivedTokenLogic, or any token values until research-design.md Section 3 is complete. Do not simplify or rewrite this scaffold. Fill fields in-place after research.',
64
64
  blockedFields: [
65
65
  'conceptualAnchor.anchorReference',
66
66
  'conceptualAnchor.categoryCodes.candidateEntries',
67
- 'conceptualAnchor.morphologicalExploration.selectedCombination',
68
- 'conceptualAnchor.anchorCandidates.candidates',
69
67
  'derivedTokenLogic.colorDerivationSource',
70
68
  'motionPaletteDecision'
71
69
  ]
@@ -78,10 +78,11 @@ export function buildProjectContextBootstrapPrompt({
78
78
  '11. If runtime or framework setup is unresolved, recommend the latest stable compatible option from the brief, constraints, and live official documentation before coding. If an official setup flow yields newer, better-supported defaults than manual package assembly, use that path after approval.',
79
79
  '12. Treat topology as an agent decision unless the user explicitly constrained it. If monolith fits, explain why. If a service split fits, document the evidence and service boundary logic.',
80
80
  '13. Required docs coverage must include a public and developer README entrypoint, feature plan, architecture rationale, flow, public API or integration contracts when relevant, data model when relevant, UI/design when relevant, security assumptions, testing strategy, runtime/deployment notes, and next validation actions.',
81
- '14. README.md must be public and developer friendly, including for private projects: what it is, who it is for, setup, core workflow, configuration, and links to deeper docs. Do not include secrets, internal agent notes, private reasoning, or governance policy dumps.',
82
- '15. docs/doc-index.md is the low-token routing map for docs/*. Keep it short, list each active doc, and explain when an agent should read it. Do not make it the source of truth for requirements or architecture.',
83
- '16. Keep docs complete but compact. Add extra docs files only for stable, distinct, or long workflows such as hardware setup, deployment, operations, testing validation, or troubleshooting.',
84
- '17. Add SRS, PRD, technical-design, or ERD docs only when project evidence triggers them. Use PRD for product-roadmap/user-story ownership, SRS for contractual or multi-stakeholder acceptance criteria, technical-design for non-trivial architecture decisions, and ERD only as a separate file when the schema is too complex for docs/database-schema.md.',
81
+ '14. Use Mermaid.js as the default diagram format for flow, sequence, ER, architecture, C4, and state diagrams embedded in Markdown docs. Do not use PlantUML, ASCII art diagrams, Graphviz DOT, or Structurizr DSL. When updating existing docs that contain prose-only descriptions, convert relevant sections to Mermaid diagrams in the same change.',
82
+ '15. README.md must be public and developer friendly, including for private projects: what it is, who it is for, setup, core workflow, configuration, and links to deeper docs. Do not include secrets, internal agent notes, private reasoning, or governance policy dumps.',
83
+ '16. docs/doc-index.md is the low-token routing map for docs/*. Keep it short, list each active doc, and explain when an agent should read it. Do not make it the source of truth for requirements or architecture.',
84
+ '17. Keep docs complete but compact. Add extra docs files only for stable, distinct, or long workflows such as hardware setup, deployment, operations, testing validation, or troubleshooting.',
85
+ '18. Add SRS, PRD, technical-design, or ERD docs only when project evidence triggers them. Use PRD for product-roadmap/user-story ownership, SRS for contractual or multi-stakeholder acceptance criteria, technical-design for non-trivial architecture decisions, and ERD only as a separate file when the schema is too complex for docs/database-schema.md.',
85
86
  '',
86
87
  '## Project Inputs',
87
88
  `- Project name: ${discoveryAnswers.projectName}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuenn3123/agentic-senior-core",
3
- "version": "4.2.7",
3
+ "version": "4.2.9",
4
4
  "type": "module",
5
5
  "description": "Change your AI Agent to code like a Staff Engineer, not a Junior.",
6
6
  "bin": {
@@ -218,19 +218,28 @@ export const REQUIRED_UNIVERSAL_SOP_SNIPPETS = [
218
218
  '### 15. Universal SOP Consolidation',
219
219
  'Coding flow is blocked if root `README.md` is missing',
220
220
  'Coding flow is blocked if `docs/architecture-decision-record.md` (or `docs/Architecture-Decision-Record.md`) is missing',
221
+ 'Coding flow is blocked if `docs/flow-overview.md` is missing',
222
+ 'Coding flow is blocked if `docs/database-schema.md` is missing while the project uses persistent data',
223
+ 'Coding flow is blocked if `docs/api-contract.md` is missing while the project exposes API or web application flows',
221
224
  'UI implementation flow is blocked if `docs/DESIGN.md` or `docs/design-intent.json` is missing',
222
225
  ],
223
226
  },
224
227
  {
225
228
  path: '.agent-context/prompts/review-code.md',
226
229
  snippets: [
227
- 'Enforce Universal SOP hard gate: block coding flow when required project docs are missing (root `README.md`; `docs/doc-index.md` when `docs/` exists; `docs/architecture-decision-record.md`; and for UI scope `docs/DESIGN.md` plus `docs/design-intent.json`).',
230
+ 'Enforce Universal SOP hard gate: block coding flow when required project docs are missing',
231
+ 'docs/flow-overview.md',
232
+ 'docs/database-schema.md',
233
+ 'docs/api-contract.md',
228
234
  ],
229
235
  },
230
236
  {
231
237
  path: '.agent-context/prompts/refactor.md',
232
238
  snippets: [
233
- '6. Enforce Universal SOP hard gate: stop implementation if root `README.md` is missing, if `docs/doc-index.md` is missing while `docs/` exists, if `docs/architecture-decision-record.md` is missing, or for UI scope if `docs/DESIGN.md` or `docs/design-intent.json` is missing.',
239
+ 'Enforce Universal SOP hard gate: stop implementation if root `README.md` is missing',
240
+ 'docs/flow-overview.md',
241
+ 'docs/database-schema.md',
242
+ 'docs/api-contract.md',
234
243
  ],
235
244
  },
236
245
  {
@@ -247,6 +256,23 @@ export const REQUIRED_UNIVERSAL_SOP_SNIPPETS = [
247
256
  ],
248
257
  },
249
258
  ];
259
+ export const REQUIRED_DIAGRAM_FORMAT_SNIPPETS = [
260
+ {
261
+ path: '.agent-context/rules/api-docs.md',
262
+ snippets: [
263
+ '## API-013: Documentation Diagram Format (Mandatory)',
264
+ 'Mermaid.js as the default diagram format',
265
+ 'Do not use PlantUML',
266
+ 'convert the relevant sections to Mermaid diagrams in the same change',
267
+ ],
268
+ },
269
+ {
270
+ path: 'lib/cli/project-scaffolder/prompt-builders.mjs',
271
+ snippets: [
272
+ 'Mermaid.js as the default diagram format',
273
+ ],
274
+ },
275
+ ];
250
276
  export const REQUIRED_TEMPLATE_FREE_BOOTSTRAP_SNIPPETS = [
251
277
  {
252
278
  path: 'lib/cli/project-scaffolder/storage.mjs',
@@ -366,20 +392,18 @@ export const REQUIRED_UI_DESIGN_AUTOMATION_SNIPPETS = [
366
392
  'default component-kit styling without product rationale',
367
393
  'genericity findings that cannot name the exact drift signal',
368
394
  'research-design.md',
369
- 'Section 3-5 gates from `research-design.md`',
395
+ 'Section 3 gate from `research-design.md`',
370
396
  ],
371
397
  },
372
398
  {
373
399
  path: '.agent-context/prompts/research-design.md',
374
400
  snippets: [
375
401
  '# Research-Design Brief',
376
- '## Section 3 — Category Code Identification',
377
- '## Section 4 — Morphological Exploration',
378
- '## Section 5 — Anchor Candidates',
379
- 'specificity self-test',
380
- 'uncomfortable combination',
381
- 'STRONG PASS',
382
- 'DISCARD',
402
+ '## Section 3 — Creative Direction',
403
+ '### 3a. Category defaults to avoid',
404
+ '### 3b. Anchor reference',
405
+ '### 3c. Four creative commitments',
406
+ 'AI slop',
383
407
  'Anti-Repeat Ledger Gate',
384
408
  'Live Source Freshness Gate',
385
409
  'rolling-current',
@@ -388,13 +412,8 @@ export const REQUIRED_UI_DESIGN_AUTOMATION_SNIPPETS = [
388
412
  'Research vocabulary is internal-only',
389
413
  'previousAnchors',
390
414
  'previousMotionSignatures',
391
- 'Dimensional split',
392
- 'typographyClusters',
393
- 'paletteClusters',
394
- 'layoutClusters',
395
- 'motionClusters',
396
- 'imageryClusters',
397
415
  'tokenContinuityClassification',
416
+ 'categoryCodes',
398
417
  ],
399
418
  },
400
419
  {
@@ -10,6 +10,7 @@ import {
10
10
  REQUIRED_DETECTION_TRANSPARENCY_SNIPPETS,
11
11
  REQUIRED_DETERMINISTIC_BOUNDARY_ENFORCEMENT_SNIPPETS,
12
12
  REQUIRED_DEVELOPER_FIRST_MENTION_PATTERNS,
13
+ REQUIRED_DIAGRAM_FORMAT_SNIPPETS,
13
14
  REQUIRED_DOCKER_RUNTIME_AUTOMATION_SNIPPETS,
14
15
  REQUIRED_HUMAN_WRITING_SNIPPETS,
15
16
  REQUIRED_STACK_DECISION_BOUNDARY_SNIPPETS,
@@ -170,6 +171,16 @@ export async function validateUniversalSopConsolidationCoverage(context) {
170
171
  });
171
172
  }
172
173
 
174
+ export async function validateDiagramFormatCoverage(context) {
175
+ await validateSnippetCoverage({
176
+ heading: 'Checking documentation diagram format coverage...',
177
+ coverageRules: REQUIRED_DIAGRAM_FORMAT_SNIPPETS,
178
+ missingLabel: 'diagram format source',
179
+ snippetLabel: 'diagram format snippet',
180
+ context,
181
+ });
182
+ }
183
+
173
184
  export async function validateTemplateFreeBootstrapCoverage(context) {
174
185
  const { ROOT_DIR, fileExists, readTextFile, pass, fail } = context;
175
186
 
@@ -29,6 +29,7 @@ import {
29
29
  validateDependencyFreshnessAutomationCoverage,
30
30
  validateDetectionTransparencyCoverage,
31
31
  validateDeterministicBoundaryEnforcementCoverage,
32
+ validateDiagramFormatCoverage,
32
33
  validateDockerRuntimeAutomationCoverage,
33
34
  validateHumanWritingGovernance,
34
35
  validateInstructionAdapters,
@@ -688,6 +689,7 @@ async function main() {
688
689
  await validateDetectionTransparencyCoverage(coverageValidationContext);
689
690
  await validateStackDecisionBoundaryCoverage(coverageValidationContext);
690
691
  await validateUniversalSopConsolidationCoverage(coverageValidationContext);
692
+ await validateDiagramFormatCoverage(coverageValidationContext);
691
693
  await validateTemplateFreeBootstrapCoverage(coverageValidationContext);
692
694
  await validateUpgradeUiContractWarningCoverage(coverageValidationContext);
693
695
  await validateUiDesignAutomationCoverage(coverageValidationContext);