@ryuenn3123/agentic-senior-core 4.0.0 → 4.0.2
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.
- package/.agent-context/prompts/bootstrap-design.md +4 -1
- package/.agent-context/prompts/research-design.md +182 -0
- package/AGENTS.md +12 -11
- package/README.md +3 -1
- package/lib/cli/commands/init.mjs +11 -0
- package/lib/cli/commands/upgrade.mjs +11 -0
- package/lib/cli/project-scaffolder/design-contract/research-dossier-migration.mjs +189 -0
- package/lib/cli/project-scaffolder/design-contract/sections/conceptual-anchor.mjs +117 -0
- package/lib/cli/project-scaffolder/design-contract/validation/anchor-validators.mjs +234 -0
- package/lib/cli/project-scaffolder/design-contract/validation/completeness.mjs +38 -0
- package/lib/cli/project-scaffolder/design-contract/validation/research-dossier-validators.mjs +104 -0
- package/lib/cli/project-scaffolder/design-contract/validation.mjs +2 -0
- package/lib/cli/project-scaffolder/design-contract.mjs +13 -0
- package/lib/cli/project-scaffolder/prompt-builders.mjs +9 -0
- package/package.json +2 -2
- package/scripts/audit-caching-scope-hygiene.mjs +4 -4
- package/scripts/build-release-benchmark-bundle.mjs +6 -6
- package/scripts/documentation-boundary-audit.mjs +13 -0
- package/scripts/migrate-rule-format/id-prefix-table.mjs +1 -1
- package/scripts/migrate-rule-format/render-new.mjs +1 -1
- package/scripts/migrate-rule-format.mjs +1 -1
- package/scripts/release-gate/static-checks.mjs +6 -1
- package/scripts/validate/config.mjs +31 -0
- package/scripts/validate.mjs +1 -0
|
@@ -13,12 +13,15 @@ This contract is a decision scaffold, not a style preset. We guide the agent; we
|
|
|
13
13
|
- Keep external references non-copying; extract constraints only.
|
|
14
14
|
- Before choosing a new UI, animation, scroll, 3D, canvas, chart, icon, styling, or component library, research current official docs.
|
|
15
15
|
## Required Order
|
|
16
|
-
1. Read `AGENTS.md`, this prompt, `../rules/frontend-architecture.md`, current UI code, current project docs, and existing design docs.
|
|
16
|
+
1. Read `AGENTS.md`, this prompt, `research-design.md`, `../rules/frontend-architecture.md`, current UI code, current project docs, and existing design docs.
|
|
17
17
|
2. Refine existing `docs/DESIGN.md` and `docs/design-intent.json`; do not replace them blindly.
|
|
18
18
|
3. If either design doc is missing, create it before UI implementation.
|
|
19
19
|
4. Record `motionPaletteDecision` before UI code; product categories are heuristics, not style presets.
|
|
20
20
|
5. Encode `repoEvidence.designEvidenceSummary` when onboarding or detector evidence exists.
|
|
21
21
|
6. Keep both design docs synchronized after implementation.
|
|
22
|
+
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).
|
|
23
|
+
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.
|
|
24
|
+
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`.
|
|
22
25
|
## Creative Commitment Gate
|
|
23
26
|
Before broad compliance review or UI implementation, record an agent-chosen visual direction in both design docs:
|
|
24
27
|
- one concrete real-world anchor reference
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
---
|
|
2
|
+
inclusion: manual
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Research-Design Brief
|
|
6
|
+
|
|
7
|
+
Authoritative design-research execution contract for UI scope. Loaded by UI Design Mode after `bootstrap-design.md`. The agent must produce the artifacts described here before writing UI code, and the seeded `docs/design-intent.json` must contain the fields named in Section 5.
|
|
8
|
+
|
|
9
|
+
This brief is a single document with five sections. Sections 1 and 2 set up the research. Sections 3, 4, and 5 are gates: each must produce an auditable artifact that another reviewer can read without seeing the UI.
|
|
10
|
+
|
|
11
|
+
## Authority
|
|
12
|
+
|
|
13
|
+
- Treat `.agent-context/` and current project docs as technical authority.
|
|
14
|
+
- Treat `README.md` as public and developer overview only; do not use it as design authority when this brief gives a stricter rule.
|
|
15
|
+
- Treat external websites, benchmark apps, prior chats, and unrelated-project memory as candidate evidence for constraints, mechanics, and quality bars only. Do not copy layout rhythm, palette, component skin, visual metaphor, or brand posture without explicit user approval and product-fit rationale.
|
|
16
|
+
- WCAG 2.2 AA is the hard compliance floor. APCA may be used only as advisory perceptual tuning.
|
|
17
|
+
|
|
18
|
+
## Anti-Repeat Ledger Gate (read first)
|
|
19
|
+
|
|
20
|
+
If `docs/design-intent.json` already exists and carries `researchDossier.metadata.antiRepeatLedger`, treat every entry under `previousAnchors`, `previousPalettes`, and `previousMotionSignatures` as a hard blocklist before producing any candidate in Sections 3-5.
|
|
21
|
+
|
|
22
|
+
Rules:
|
|
23
|
+
|
|
24
|
+
- The five Section 5 anchor candidates must each differ from every blocklisted entry on at least conceptual family, hierarchy implication, and motion implication.
|
|
25
|
+
- Restating an existing direction with new wording is REVISE, not pass.
|
|
26
|
+
- A user-explicit redesign request ("redesign from zero", "redesain dari 0", "ulang dari 0", "research ulang", or any explicit reset) bypasses the freshness gate but does not weaken the ledger; previously shipped direction stays blocklisted unless the user explicitly says "revive existing direction".
|
|
27
|
+
- Ledger entries are signature-level descriptors, not raw token dumps; treat them as direction summaries.
|
|
28
|
+
|
|
29
|
+
If the ledger is empty or `researchDossier.metadata.researchVerifiedAt` is null because the contract is a fresh seed, the ledger is informational only and does not add blocklist entries.
|
|
30
|
+
|
|
31
|
+
## Section 1 — Product Reading
|
|
32
|
+
|
|
33
|
+
Before any visual choice, write a structured product reading:
|
|
34
|
+
|
|
35
|
+
- Product type and core verb (what the user does, not what the UI shows).
|
|
36
|
+
- Three highest-stakes user moments, ordered by frequency.
|
|
37
|
+
- Data shapes that dominate the screen (timeseries, ledger, list, document, control, telemetry, conversational, spatial, other).
|
|
38
|
+
- Latency profile (real-time, soft real-time, batch, ambient).
|
|
39
|
+
- Failure modes the UI must absorb visibly (partial, stale, optimistic, conflict, offline, permission, rate-limit, none).
|
|
40
|
+
- Context of use (one-shot, sustained focus, glance-and-go, background monitor, shared display, embedded).
|
|
41
|
+
- Known constraints (device, runtime, accessibility, regulatory, performance budget, brand continuity).
|
|
42
|
+
|
|
43
|
+
Output: `productReading` block. Each field must be one sentence, evidence-backed from repo or brief. Speculation is not allowed; if a field is unknown, name it as such and stop until the user resolves it.
|
|
44
|
+
|
|
45
|
+
## Section 2 — Reference Intake
|
|
46
|
+
|
|
47
|
+
Reference material is fuel for variance, not a style source.
|
|
48
|
+
|
|
49
|
+
- Capture between three and seven references per dimension that needs exploration: hierarchy, density, type system, motion, state language, material logic, color behavior.
|
|
50
|
+
- For each reference, record: source URL or citation, what is borrowed (mechanic, behavior, hierarchy, density, type pairing, motion choreography), and what is explicitly not borrowed (palette, component skin, layout rhythm, brand posture).
|
|
51
|
+
- References live in `referenceIntake[]`. The agent may not select an anchor in Section 5 that copies a reference's surface; only the borrowed mechanic is allowed to flow downstream.
|
|
52
|
+
|
|
53
|
+
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.
|
|
54
|
+
|
|
55
|
+
## Section 3 — Category Code Identification
|
|
56
|
+
|
|
57
|
+
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.
|
|
58
|
+
|
|
59
|
+
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.
|
|
60
|
+
|
|
61
|
+
Fails specificity:
|
|
62
|
+
- `clean typography` (too abstract, applies to anything)
|
|
63
|
+
- `modern color palette` (not falsifiable)
|
|
64
|
+
- `smooth animations` (describes nothing specific)
|
|
65
|
+
|
|
66
|
+
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.
|
|
67
|
+
|
|
68
|
+
The three example categories below were chosen specifically because they are unlikely to overlap with common software products, to prevent leakage:
|
|
69
|
+
|
|
70
|
+
- `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)
|
|
71
|
+
- `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)
|
|
72
|
+
- `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)
|
|
73
|
+
|
|
74
|
+
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.
|
|
75
|
+
|
|
76
|
+
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:
|
|
77
|
+
|
|
78
|
+
- `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`
|
|
79
|
+
- `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`
|
|
80
|
+
- `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`
|
|
81
|
+
- `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`
|
|
82
|
+
- `marketing site default: hero image with one-line headline plus subhead, three feature tiles below, two pricing tiers, testimonial carousel, footer link grid`
|
|
83
|
+
|
|
84
|
+
If you find yourself describing your selected direction in the same shape as any of these, you have inverted the test. Revise.
|
|
85
|
+
|
|
86
|
+
Self-test: read each category code aloud to someone unfamiliar with the project.
|
|
87
|
+
|
|
88
|
+
- If they cannot visualize a specific aesthetic direction from the text alone, the code is too abstract. Revise until it passes.
|
|
89
|
+
- 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.
|
|
90
|
+
|
|
91
|
+
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.
|
|
92
|
+
|
|
93
|
+
### Dimensional split (mandatory)
|
|
94
|
+
|
|
95
|
+
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.
|
|
96
|
+
|
|
97
|
+
- `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.
|
|
98
|
+
- `paletteClusters`: palette signatures that are the category default.
|
|
99
|
+
- `layoutClusters`: layout patterns that are the category default.
|
|
100
|
+
- `motionClusters`: motion signatures that are the category default.
|
|
101
|
+
- `imageryClusters`: image style or visual treatment that is the category default.
|
|
102
|
+
|
|
103
|
+
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:
|
|
104
|
+
|
|
105
|
+
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
|
|
106
|
+
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.
|
|
107
|
+
|
|
108
|
+
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.
|
|
109
|
+
|
|
110
|
+
## Section 4 — Morphological Exploration
|
|
111
|
+
|
|
112
|
+
A morphological matrix forces the design space to be explored beyond the first idea.
|
|
113
|
+
|
|
114
|
+
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.
|
|
115
|
+
|
|
116
|
+
Output a 5x5 or 6x5 morphological matrix. Then:
|
|
117
|
+
|
|
118
|
+
1. Highlight the combination that becomes the basis for Section 5 candidates.
|
|
119
|
+
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.
|
|
120
|
+
|
|
121
|
+
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.
|
|
122
|
+
|
|
123
|
+
Rules for the uncomfortable combination:
|
|
124
|
+
- It must be genuinely uncomfortable (the agent's first reaction is "this would not work").
|
|
125
|
+
- It must be arguable (the agent can construct a two-sentence product-logic justification for why it could work despite discomfort).
|
|
126
|
+
- It must not be random noise (uncomfortable plus unjustifiable equals waste, not exploration).
|
|
127
|
+
- The user is not required to choose it. Its purpose is to prove the design space was explored beyond the comfort boundary.
|
|
128
|
+
|
|
129
|
+
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.
|
|
130
|
+
|
|
131
|
+
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` }).
|
|
132
|
+
|
|
133
|
+
## Section 5 — Anchor Candidates
|
|
134
|
+
|
|
135
|
+
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.
|
|
136
|
+
|
|
137
|
+
Hard constraints on anchors:
|
|
138
|
+
- The anchor must be concrete and googleable. "Modern", "clean", "premium", "expressive", "minimal", "bold", "futuristic", "elegant" are not anchors.
|
|
139
|
+
- 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.
|
|
140
|
+
- 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).
|
|
141
|
+
|
|
142
|
+
Strengthened rename test scoring:
|
|
143
|
+
- UI still coherent in zero of three renamed categories: anchor is highly specific. STRONG PASS.
|
|
144
|
+
- UI still coherent in one of three: anchor is specific enough. PASS with note.
|
|
145
|
+
- 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.
|
|
146
|
+
- UI still coherent in three of three: anchor is category-agnostic. DISCARD immediately.
|
|
147
|
+
|
|
148
|
+
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.
|
|
149
|
+
|
|
150
|
+
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.
|
|
151
|
+
|
|
152
|
+
For EACH of the five candidates, record:
|
|
153
|
+
|
|
154
|
+
- `anchorReference` (concrete, googleable)
|
|
155
|
+
- `conceptualFamily`
|
|
156
|
+
- `jobFit` (one sentence linking to product)
|
|
157
|
+
- `hierarchyImplication`
|
|
158
|
+
- `densityImplication`
|
|
159
|
+
- `typeImplication` (variable axis or pairing logic, not just family)
|
|
160
|
+
- `stateLanguage` (loading, empty, error, partial, stale, optimistic, success using the anchor's own vocabulary)
|
|
161
|
+
- `motionImplication` (choreography rule, what state change it serves)
|
|
162
|
+
- `whatItRulesOut` (proves variance)
|
|
163
|
+
- `renameTest`:
|
|
164
|
+
- `testCategories`: three remote categories used for testing
|
|
165
|
+
- `results`: coherent or incoherent per category, in order
|
|
166
|
+
- `verdict`: STRONG PASS, PASS, REVISE, or DISCARD
|
|
167
|
+
- `categoryCodeOverlap` check: list any Section 3 category codes this candidate accidentally inherits, with reasoning
|
|
168
|
+
|
|
169
|
+
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).
|
|
170
|
+
|
|
171
|
+
## Done Criteria
|
|
172
|
+
|
|
173
|
+
The brief is complete when:
|
|
174
|
+
|
|
175
|
+
1. `productReading` is filled with evidence-backed sentences.
|
|
176
|
+
2. `referenceIntake[]` records the borrowed mechanic and the explicit non-copy boundary per reference (or `referenceIntakeStatus: internal-evidence-only` is set).
|
|
177
|
+
3. `categoryCodes[]` has at least three entries that pass the specificity self-test.
|
|
178
|
+
4. `morphologicalExploration` has a 5x5 or 6x5 matrix, a selected combination, and an uncomfortable combination with the three required fields.
|
|
179
|
+
5. `anchorCandidates[]` has exactly five entries; each has a complete `renameTest`; the selected anchor has `verdict: STRONG PASS` or `verdict: PASS`.
|
|
180
|
+
6. Generic anchors and spatial-place defaults are rejected with the rejection reason recorded.
|
|
181
|
+
|
|
182
|
+
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`).
|
package/AGENTS.md
CHANGED
|
@@ -73,9 +73,10 @@ Load the matching prompt only:
|
|
|
73
73
|
- `init-project.md` -> create, build, new project, scaffold
|
|
74
74
|
- `refactor.md` -> refactor, improve, clean up, fix
|
|
75
75
|
- `review-code.md` -> review, audit, check, analyze
|
|
76
|
-
- `bootstrap-design.md` -> ui, ux, layout, screen, tailwind, frontend, redesign
|
|
76
|
+
- `bootstrap-design.md` -> ui, ux, layout, screen, tailwind, frontend, redesign (always paired with `research-design.md` for the Section 3-5 dossier gate)
|
|
77
|
+
- `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
78
|
|
|
78
|
-
For UI-only work, load `bootstrap-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.
|
|
79
|
+
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.
|
|
79
80
|
|
|
80
81
|
### Layer 6: Governance Modes
|
|
81
82
|
|
|
@@ -135,14 +136,14 @@ Load `pr-checklist.md` and `architecture-review.md`, then report defects, risks,
|
|
|
135
136
|
|
|
136
137
|
Trigger: ui, ux, layout, screen, tailwind, frontend, redesign.
|
|
137
138
|
|
|
138
|
-
1. Read `bootstrap-design.md` and `frontend-architecture.md`.
|
|
139
|
-
2.
|
|
140
|
-
3.
|
|
141
|
-
4.
|
|
142
|
-
5.
|
|
143
|
-
6.
|
|
144
|
-
7.
|
|
145
|
-
8.
|
|
139
|
+
1. Read `bootstrap-design.md`, `research-design.md`, and `frontend-architecture.md`. Read UI-relevant repo evidence from state, current UI code, and `docs/*`.
|
|
140
|
+
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.
|
|
141
|
+
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`.
|
|
142
|
+
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.
|
|
143
|
+
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
|
+
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.
|
|
145
|
+
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.
|
|
146
|
+
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.
|
|
146
147
|
9. Do not let conceptual anchors collapse into room, darkroom, counting room, control room, war room, studio, lab, cockpit, or command center by habit. Prefer artifacts, workflows, custody chains, instruments, data behaviors, material systems, editorial systems, service rituals, or interaction mechanisms unless a physical place model is core to the product.
|
|
147
148
|
10. External websites and benchmark examples are candidate evidence for constraints, mechanics, and quality bars only. Do not copy their layout rhythm, palette, component skin, visual metaphor, or brand posture without explicit user approval and product-fit rationale.
|
|
148
149
|
|
|
@@ -176,4 +177,4 @@ Verify reachability when relevant: Layer 1 Rules, Layer 2 Runtime Decision Signa
|
|
|
176
177
|
- Before PR: run review checklists.
|
|
177
178
|
- Before deploy: check policy thresholds.
|
|
178
179
|
- Before major refactor: read `architecture-map.md`.
|
|
179
|
-
- Before UI implementation: confirm valid style context, design contract, and required docs.
|
|
180
|
+
- Before UI implementation: confirm valid style context, design contract, and required docs.
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Highlights:
|
|
|
27
27
|
The internal `.agent-context/rules/` pack is now numbered Markdown with YAML frontmatter and stable section IDs (e.g. `FE-004`, `ARCH-009`, `API-006`). This is a breaking change for downstream consumers that parse rule headings; the migration guide lives in `CHANGELOG.md` under `4.0.0`. Repository-wide impact:
|
|
28
28
|
|
|
29
29
|
- Rules are now citable by ID, which the new bounded reflection block in `AGENTS.md` and the validation MCP tools (`lookup_rule`, `validate_against_rules`, `audit_compliance`) rely on.
|
|
30
|
-
- A three-layer prompt caching contract (D4 in `docs/
|
|
30
|
+
- A three-layer prompt caching contract (D4 in `docs/architecture/decisions-foundation.md`) is now enforced by `npm run audit:cache-layer-contract`.
|
|
31
31
|
- A provider-free anti-halu benchmark is included (`benchmarks/anti-halu/`); pass rate and citation validity are reproducible locally.
|
|
32
32
|
- Caching numbers are scoped per integration. The 89.31% Anthropic warm-cache effective reduction reported in `benchmarks/results/cache-phase-2-2026-05-16.json` applies to direct provider API and Claude Code SDK programmatic mode only. IDE wrapper integrations (Cursor, Windsurf, Codex CLI, Kiro) receive prefix stability without a measurable per-pack saving. See `docs/integration-playbook.md` for the per-tool matrix and `docs/benchmark-reference.md` for the required reporting JSON shape.
|
|
33
33
|
|
|
@@ -63,6 +63,8 @@ The intended behavior is agent-led, not offline-template-led:
|
|
|
63
63
|
- Modern UI claims: research current-year libraries and patterns when relevant; 2026 work should use 2026 evidence, and future years should update automatically through agent research.
|
|
64
64
|
- Anti-generic rule: avoid safe dashboard shells, admin panels, card grids, scale-only mobile layouts, and static no-motion interfaces unless the product context explicitly justifies them.
|
|
65
65
|
|
|
66
|
+
UI design work runs a research dossier prompt (`.agent-context/prompts/research-design.md`) before the bootstrap prompt. The dossier captures product reading, reference intake, category cliches, a morphological matrix, and five anchor candidates with a strengthened rename test. The contract carries a 90-day `researchVerifiedAt` freshness gate and an anti-repeat ledger seeded from prior anchor, palette, motion, and typography choices on existing projects, so additive UI work within the freshness window skips the research stage while redesigns and stale dossiers re-run it.
|
|
67
|
+
|
|
66
68
|
---
|
|
67
69
|
|
|
68
70
|
## MCP Quick Setup (VS Code)
|
|
@@ -54,6 +54,7 @@ import {
|
|
|
54
54
|
loadProjectConfig,
|
|
55
55
|
normalizeDocsLanguage,
|
|
56
56
|
} from '../project-scaffolder.mjs';
|
|
57
|
+
import { migrateExistingDesignIntentToResearchDossierSchema } from '../project-scaffolder/design-contract/research-dossier-migration.mjs';
|
|
57
58
|
import { performRollback } from '../rollback.mjs';
|
|
58
59
|
import {
|
|
59
60
|
createTokenOptimizationState,
|
|
@@ -483,6 +484,16 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
|
|
|
483
484
|
supplementalMaterializedDocFileNames.push('design-intent.json');
|
|
484
485
|
|
|
485
486
|
console.log('\nExisting UI/frontend scope detected. Seeded docs/design-intent.json so the machine-readable design contract exists before UI implementation work continues.');
|
|
487
|
+
} else if (projectDetection.hasExistingProjectFiles && (await pathExists(designIntentTargetPath))) {
|
|
488
|
+
// Scenario E: existing project being initialized for the first time
|
|
489
|
+
// already has docs/design-intent.json. Migrate it to carry researchDossier.metadata
|
|
490
|
+
// so the anti-repeat ledger and freshness gate become available without
|
|
491
|
+
// touching existing tokens, anchor, or palette.
|
|
492
|
+
const migrationResult = await migrateExistingDesignIntentToResearchDossierSchema(designIntentTargetPath);
|
|
493
|
+
if (migrationResult.migrated) {
|
|
494
|
+
supplementalMaterializedDocFileNames.push('design-intent.json (research-dossier metadata migrated)');
|
|
495
|
+
console.log('\n[MIGRATED] docs/design-intent.json now carries researchDossier.metadata. Run research-design.md before next UI implementation to populate the dossier and refresh researchVerifiedAt.');
|
|
496
|
+
}
|
|
486
497
|
}
|
|
487
498
|
|
|
488
499
|
await writeSelectedPolicy(resolvedTargetDirectoryPath, selectedPolicyProfileName);
|
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
detectProjectDocTemplateStaleness,
|
|
46
46
|
buildDesignIntentSeedFromSignals,
|
|
47
47
|
} from '../project-scaffolder.mjs';
|
|
48
|
+
import { migrateExistingDesignIntentToResearchDossierSchema } from '../project-scaffolder/design-contract/research-dossier-migration.mjs';
|
|
48
49
|
import { ensureActiveMemorySnapshot } from '../memory-continuity.mjs';
|
|
49
50
|
import { buildExistingProjectMajorConstraints } from '../init-detection-flow.mjs';
|
|
50
51
|
|
|
@@ -388,6 +389,16 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
|
|
|
388
389
|
await ensureDirectory(docsDirectoryPath);
|
|
389
390
|
await fs.writeFile(designIntentTargetPath, designIntentSeedContent, 'utf8');
|
|
390
391
|
supplementalCreatedFileNames.push('docs/design-intent.json');
|
|
392
|
+
} else {
|
|
393
|
+
// Scenario D: existing project already has docs/design-intent.json.
|
|
394
|
+
// Inject researchDossier.metadata when absent so the anti-repeat ledger
|
|
395
|
+
// becomes available and active validation can enforce freshness.
|
|
396
|
+
const existingDesignIntentPath = path.join(resolvedTargetDirectoryPath, 'docs', 'design-intent.json');
|
|
397
|
+
const migrationResult = await migrateExistingDesignIntentToResearchDossierSchema(existingDesignIntentPath);
|
|
398
|
+
if (migrationResult.migrated) {
|
|
399
|
+
supplementalCreatedFileNames.push('docs/design-intent.json (research-dossier metadata migrated)');
|
|
400
|
+
console.log('\n[MIGRATED] docs/design-intent.json now carries researchDossier.metadata. Run research-design.md before next UI implementation to populate the dossier and refresh researchVerifiedAt.');
|
|
401
|
+
}
|
|
391
402
|
}
|
|
392
403
|
|
|
393
404
|
if (shouldEnsureActiveMemorySnapshot) {
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Research-dossier migration helper.
|
|
3
|
+
*
|
|
4
|
+
* Adds the `researchDossier.metadata` block to existing `docs/design-intent.json`
|
|
5
|
+
* files when it is absent, populating `antiRepeatLedger` from the existing
|
|
6
|
+
* conceptual anchor, palette, and motion fields so future UI work cannot
|
|
7
|
+
* unknowingly repeat shipped direction.
|
|
8
|
+
*
|
|
9
|
+
* Idempotent: if the metadata block already exists, the file is left untouched.
|
|
10
|
+
* Additive: never overwrites existing fields.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import fs from 'node:fs/promises';
|
|
14
|
+
|
|
15
|
+
import { pathExists } from '../../utils.mjs';
|
|
16
|
+
|
|
17
|
+
const FRESHNESS_WINDOW_DAYS = 90;
|
|
18
|
+
const FRESHNESS_RULE = 'Research dossier is stale when researchVerifiedAt is null or older than freshnessWindowDays. Stale dossiers must run research-design.md before UI implementation. User-explicit redesign requests bypass freshness and force fresh research regardless of age.';
|
|
19
|
+
|
|
20
|
+
function takeFirstNonEmpty(...candidateValues) {
|
|
21
|
+
for (const candidateValue of candidateValues) {
|
|
22
|
+
if (typeof candidateValue === 'string' && candidateValue.trim().length > 0) {
|
|
23
|
+
return candidateValue.trim();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function buildPreviousAnchorEntry(designIntentContract) {
|
|
30
|
+
const conceptualAnchor = designIntentContract?.conceptualAnchor;
|
|
31
|
+
if (!conceptualAnchor || typeof conceptualAnchor !== 'object') {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
const anchorReference = takeFirstNonEmpty(conceptualAnchor.anchorReference);
|
|
35
|
+
if (!anchorReference || anchorReference === 'agent-defined-anchor-reference') {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
const specificReferencePoint = takeFirstNonEmpty(conceptualAnchor.specificReferencePoint);
|
|
39
|
+
const summary = specificReferencePoint
|
|
40
|
+
? `${anchorReference} (${specificReferencePoint})`
|
|
41
|
+
: anchorReference;
|
|
42
|
+
return [{
|
|
43
|
+
summary,
|
|
44
|
+
source: 'migrated-from-existing-design-intent',
|
|
45
|
+
blockedBecause: 'previously-shipped-direction',
|
|
46
|
+
}];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function buildPreviousPaletteEntry(designIntentContract) {
|
|
50
|
+
const derivedTokenLogic = designIntentContract?.derivedTokenLogic;
|
|
51
|
+
const colorTruth = designIntentContract?.colorTruth;
|
|
52
|
+
const colorDerivationSummary = takeFirstNonEmpty(derivedTokenLogic?.colorDerivationSource);
|
|
53
|
+
const colorIntent = takeFirstNonEmpty(colorTruth?.intent);
|
|
54
|
+
const summary = takeFirstNonEmpty(colorIntent, colorDerivationSummary);
|
|
55
|
+
if (!summary) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
return [{
|
|
59
|
+
summary,
|
|
60
|
+
source: 'migrated-from-existing-design-intent',
|
|
61
|
+
blockedBecause: 'previously-shipped-palette-behavior',
|
|
62
|
+
}];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function buildPreviousMotionEntry(designIntentContract) {
|
|
66
|
+
const motionPaletteDecision = designIntentContract?.motionPaletteDecision;
|
|
67
|
+
const motionSystem = designIntentContract?.motionSystem;
|
|
68
|
+
const derivedTokenLogic = designIntentContract?.derivedTokenLogic;
|
|
69
|
+
|
|
70
|
+
const motionSignature = takeFirstNonEmpty(
|
|
71
|
+
motionPaletteDecision?.signatureMotion,
|
|
72
|
+
motionPaletteDecision?.motion,
|
|
73
|
+
motionSystem?.signature,
|
|
74
|
+
motionSystem?.purpose,
|
|
75
|
+
derivedTokenLogic?.motionBudget,
|
|
76
|
+
);
|
|
77
|
+
if (!motionSignature) {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
return [{
|
|
81
|
+
summary: motionSignature,
|
|
82
|
+
source: 'migrated-from-existing-design-intent',
|
|
83
|
+
blockedBecause: 'previously-shipped-motion-signature',
|
|
84
|
+
}];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function buildPreviousTypographyEntry(designIntentContract) {
|
|
88
|
+
if (!designIntentContract || typeof designIntentContract !== 'object') {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
const tokenSystem = designIntentContract?.tokenSystem;
|
|
92
|
+
const typographyTokens = tokenSystem && typeof tokenSystem === 'object' ? tokenSystem.typographyTokens : null;
|
|
93
|
+
if (!typographyTokens || typeof typographyTokens !== 'object') {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
const tokenEntries = Object.entries(typographyTokens)
|
|
97
|
+
.filter(([, value]) => typeof value === 'string' && value.trim().length > 0)
|
|
98
|
+
.map(([role, value]) => `${role}: ${value.trim()}`);
|
|
99
|
+
if (tokenEntries.length === 0) {
|
|
100
|
+
return [];
|
|
101
|
+
}
|
|
102
|
+
return [{
|
|
103
|
+
summary: tokenEntries.join('; '),
|
|
104
|
+
source: 'migrated-from-existing-design-intent',
|
|
105
|
+
blockedBecause: 'previously-shipped-typography-trio',
|
|
106
|
+
}];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function buildResearchDossierMetadata({
|
|
110
|
+
designIntentContract = null,
|
|
111
|
+
populateLedgerFromExistingContract = false,
|
|
112
|
+
} = {}) {
|
|
113
|
+
const metadata = {
|
|
114
|
+
researchVerifiedAt: null,
|
|
115
|
+
freshnessWindowDays: FRESHNESS_WINDOW_DAYS,
|
|
116
|
+
freshnessRule: FRESHNESS_RULE,
|
|
117
|
+
antiRepeatLedger: {
|
|
118
|
+
blocklistFromHistory: true,
|
|
119
|
+
ledgerScope: 'signature-level-descriptors-only',
|
|
120
|
+
ledgerMaxEntriesPerCategory: 3,
|
|
121
|
+
previousAnchors: [],
|
|
122
|
+
previousPalettes: [],
|
|
123
|
+
previousMotionSignatures: [],
|
|
124
|
+
previousTypographyChoices: [],
|
|
125
|
+
},
|
|
126
|
+
userExplicitRedesignBypassesFreshness: true,
|
|
127
|
+
statusAwareValidation: {
|
|
128
|
+
seedStatuses: [
|
|
129
|
+
'seed-needs-design-synthesis',
|
|
130
|
+
'seed-generated-during-init',
|
|
131
|
+
'seed-generated-during-upgrade',
|
|
132
|
+
],
|
|
133
|
+
seedSkipsDossierShape: true,
|
|
134
|
+
activeRequiresFreshOrExplicitRedesign: true,
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
if (populateLedgerFromExistingContract && designIntentContract && typeof designIntentContract === 'object') {
|
|
139
|
+
metadata.antiRepeatLedger.previousAnchors = buildPreviousAnchorEntry(designIntentContract).slice(0, metadata.antiRepeatLedger.ledgerMaxEntriesPerCategory);
|
|
140
|
+
metadata.antiRepeatLedger.previousPalettes = buildPreviousPaletteEntry(designIntentContract).slice(0, metadata.antiRepeatLedger.ledgerMaxEntriesPerCategory);
|
|
141
|
+
metadata.antiRepeatLedger.previousMotionSignatures = buildPreviousMotionEntry(designIntentContract).slice(0, metadata.antiRepeatLedger.ledgerMaxEntriesPerCategory);
|
|
142
|
+
metadata.antiRepeatLedger.previousTypographyChoices = buildPreviousTypographyEntry(designIntentContract).slice(0, metadata.antiRepeatLedger.ledgerMaxEntriesPerCategory);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return metadata;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Migrates an existing design-intent.json file in place by adding
|
|
150
|
+
* `researchDossier.metadata` when absent. Idempotent.
|
|
151
|
+
*
|
|
152
|
+
* @param {string} designIntentFilePath
|
|
153
|
+
* @returns {Promise<{ migrated: boolean, reason: string }>}
|
|
154
|
+
*/
|
|
155
|
+
export async function migrateExistingDesignIntentToResearchDossierSchema(designIntentFilePath) {
|
|
156
|
+
if (!(await pathExists(designIntentFilePath))) {
|
|
157
|
+
return { migrated: false, reason: 'design-intent-file-absent' };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const fileContent = await fs.readFile(designIntentFilePath, 'utf8');
|
|
161
|
+
let designIntentContract;
|
|
162
|
+
try {
|
|
163
|
+
designIntentContract = JSON.parse(fileContent);
|
|
164
|
+
} catch {
|
|
165
|
+
return { migrated: false, reason: 'design-intent-file-not-valid-json' };
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (!designIntentContract || typeof designIntentContract !== 'object') {
|
|
169
|
+
return { migrated: false, reason: 'design-intent-file-not-an-object' };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const existingResearchDossier = designIntentContract.researchDossier;
|
|
173
|
+
if (existingResearchDossier && typeof existingResearchDossier === 'object' && existingResearchDossier.metadata) {
|
|
174
|
+
return { migrated: false, reason: 'research-dossier-metadata-already-present' };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const populatedMetadata = buildResearchDossierMetadata({
|
|
178
|
+
designIntentContract,
|
|
179
|
+
populateLedgerFromExistingContract: true,
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
designIntentContract.researchDossier = {
|
|
183
|
+
...(existingResearchDossier && typeof existingResearchDossier === 'object' ? existingResearchDossier : {}),
|
|
184
|
+
metadata: populatedMetadata,
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
await fs.writeFile(designIntentFilePath, `${JSON.stringify(designIntentContract, null, 2)}\n`, 'utf8');
|
|
188
|
+
return { migrated: true, reason: 'research-dossier-metadata-injected' };
|
|
189
|
+
}
|