Skip to content

feat(core): system prompt v2 — denser, smarter, artifact-type aware#44

Merged
hqhq1025 merged 4 commits intomainfrom
wt/system-prompt-v2
Apr 18, 2026
Merged

feat(core): system prompt v2 — denser, smarter, artifact-type aware#44
hqhq1025 merged 4 commits intomainfrom
wt/system-prompt-v2

Conversation

@hqhq1025
Copy link
Copy Markdown
Collaborator

Summary

Upgrades the system prompt from sparse/generic to artifact-type aware. Addresses user feedback that generated designs are too sparse, miss before/after comparisons, and lack design density / hierarchy. The trigger was a customer-case-study prompt rendering as four floating metric cards on a flat black background — the canonical sparse-LLM output.

Key changes

  • Artifact type detection — new artifact-types.v1.txt section defines an 8-type taxonomy (landing / case_study / dashboard / pricing / slide / email / one_pager / report) with cue words, primary job, and per-type structural beats.
  • Density floor — minimum section count per type (case_study ≥ 6, landing ≥ 5, dashboard ≥ 5, pricing ≥ 4, etc.) with required beats listed inline. "Minimal" controls ornamentation, not section count.
  • Before/after enforcement — when the brief mentions before/after, 前后, 对比, vs, growth %, "from X to Y", the model MUST render side-by-side or paired visualizations (two-column block, paired sparklines, or stat ladder). A floating +40% no longer satisfies the rule.
  • Pre-flight checklist — new pre-flight.v1.txt adds an internal SCT-style 8-question pass (artifact type · posture · density · comparisons · numbers · palette · type ladder · slop guard) the model must complete silently before generating.
  • Type ladder — required four scale steps (display · h1 · body · caption); skipping a step is forbidden. Fraunces (bundled in feat(ui): Anthropic-inspired warm aesthetic + starter cards + BYOK badge #25) and Geist are now first-class display / sans choices; Fraunces removed from the forbidden font list.
  • Dark-theme density rules — ≥3 surface tones, gradient or radial glow, two accents minimum, oklch borders. The canonical sparse-LLM output (#0E0E10 end-to-end + single accent + four cards) is explicitly named as slop.
  • Logo placeholder rules — constructed monogram, wordmark, or explicit hatched "YOUR LOGO HERE" rectangle. Soft-rounded square + single random letter is forbidden.
  • Anti-pattern guard — no placeholder.com / via.placeholder / unsplash hotlinks, no default Tailwind grays as the only neutral, no decorative emoji unless asked, no "John Doe" / "Acme Corp" filler.
  • Workflow expanded from 6 to 7 steps; new step 2 "Classify" runs the pre-flight checklist; self-check step references the density floor and comparison rule.

What was removed

  • The "default to minimal direction" advice in workflow — minimal was being interpreted as "render less", which produced sparse output. Replaced with explicit "minimal controls ornamentation, not section count".
  • Fraunces from the forbidden font list (it is bundled now via feat(ui): Anthropic-inspired warm aesthetic + starter cards + BYOK badge #25).
  • The vague "does any section look like a template screenshot?" self-check item — replaced with concrete, checkable rules (section count, comparison rendering, big-number blocks, type ladder steps).

Stack hygiene

  • ✅ Compatibility: prompt sections versioned (*.v1.txt); composer signature unchanged; existing callers untouched.
  • ✅ Upgradeability: drift test enforces .txt ↔ TS constant parity, so future edits stay in sync.
  • ✅ No bloat: zero new dependencies; all changes are prompt text + tests.
  • ✅ Elegance: each new constraint is concrete and checkable, no "please make it beautiful" filler.

Test plan

  • vitest: 6 new cases assert artifact-type taxonomy, density floor wording, pre-flight beats, dark-theme rules, type ladder, and font allow-list. All 47 core tests pass.
  • vitest: drift test confirms inlined TS constants match .txt source files byte-for-byte.
  • typecheck: pnpm -r typecheck clean across the workspace.
  • lint: pnpm lint clean (warnings are pre-existing in runModel).
  • manual: customer case study prompt ("做一个一页纸的客户案例… 简洁极简 深色主题") → ≥ 6 sections incl. before/after side-by-side, hero + body + CTA, ≥3 dark surface tones.
  • manual: landing page prompt → hero + value props + social proof + feature deep-dive + CTA.
  • manual: pricing prompt → headline + 3-tier grid + comparison + CTA.
  • manual: dashboard prompt → top bar + 4-tile KPI strip + chart + table + activity panel.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings

  • [Major] picsum.photos allowance conflicts with global no-hotlink rule — this weakens a hard output constraint and can cause generated artifacts to violate existing policy on external image hotlinks. Evidence: packages/core/src/prompts/artifact-types.v1.txt:67 vs packages/core/src/prompts/output-rules.v1.txt:58.
    Suggested fix:
    - - For abstract photography or hero imagery, prefer: inline SVG composition, CSS gradient + grain overlay, or `https://picsum.photos/seed/<deterministic-seed>/<w>/<h>` (deterministic seed only, never random).
    + - For abstract photography or hero imagery, prefer: inline SVG composition or CSS gradient + grain overlay.
    + - If seeded placeholders are ever allowed, update Output rules first to explicitly permit that domain under the external-resource policy.

Summary

  • Review mode: initial
  • 1 issue found in changed lines.
  • docs/VISION.md and docs/PRINCIPLES.md are referenced by process but not present in this checkout (Not found in repo/docs), so only available repo content was used for policy validation.

Testing

  • Not run (automation): pnpm is unavailable in this runner, so Vitest/Playwright could not be executed.

open-codesign Bot

## Imagery rules

- No hotlinked photos from `placeholder.com`, `via.placeholder.com`, `placehold.it`, or `unsplash.com`.
- For abstract photography or hero imagery, prefer: inline SVG composition, CSS gradient + grain overlay, or `https://picsum.photos/seed/<deterministic-seed>/<w>/<h>` (deterministic seed only, never random).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This newly-added picsum.photos allowance conflicts with existing Output rules (output-rules.v1.txt) that prohibit hotlinked photos and require inline SVG/CSS placeholders. Please align these sections to avoid contradictory instructions to the model.

Suggested minimal change:

- - For abstract photography or hero imagery, prefer: inline SVG composition, CSS gradient + grain overlay, or `https://picsum.photos/seed/<deterministic-seed>/<w>/<h>` (deterministic seed only, never random).
+ - For abstract photography or hero imagery, prefer: inline SVG composition or CSS gradient + grain overlay.

hqhq1025 added a commit that referenced this pull request Apr 18, 2026
The artifact-types imagery rules permitted picsum.photos seeded URLs while
output-rules globally banned hotlinked images. Strip the picsum exception
and unify both sections on self-contained imagery (inline SVG, CSS gradient,
or data: URI) per Codex review on PR #44.
@hqhq1025 hqhq1025 force-pushed the wt/system-prompt-v2 branch from c97de91 to 4530224 Compare April 18, 2026 19:12
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings

  • [Major] Density-floor counts contradict required beats in multiple artifact rows — this creates conflicting instructions for the model and can cause under-dense output (or inconsistent self-check behavior) depending on which rule it follows. Evidence: packages/core/src/prompts/artifact-types.v1.txt:31, packages/core/src/prompts/artifact-types.v1.txt:32, packages/core/src/prompts/artifact-types.v1.txt:33.
    Suggested fix:
    -| `email` | 4 | preheader · headline · body with one image or accent · CTA · footer |
    -| `one_pager` | 5 | hero · 3 supporting blocks · evidence (numbers, quote, or chart) · CTA |
    -| `report` | 6 | cover · TL;DR · 3 finding sections · methodology · conclusion |
    +| `email` | 5 | preheader · headline · body with one image or accent · CTA · footer |
    +| `one_pager` | 6 | hero · 3 supporting blocks · evidence (numbers, quote, or chart) · CTA |
    +| `report` | 7 | cover · TL;DR · 3 finding sections · methodology · conclusion |

Summary

  • Review mode: follow-up after new commits
  • 1 issue found in changed lines.
  • docs/VISION.md, docs/PRINCIPLES.md, docs/ARCHITECTURE.md, and docs/RESEARCH_QUEUE.md were requested by process but are not present in this checkout (Not found in repo/docs), so validation was performed against available repo files only.

Testing

  • Not run (automation)

open-codesign Bot

| `slide` | 1 | one rectangle, one idea, hierarchy across at least three type sizes |
| `email` | 4 | preheader · headline · body with one image or accent · CTA · footer |
| `one_pager` | 5 | hero · 3 supporting blocks · evidence (numbers, quote, or chart) · CTA |
| `report` | 6 | cover · TL;DR · 3 finding sections · methodology · conclusion |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Min sections should not be lower than the count implied by Required structural beats. In this table, email (line 31), one_pager (line 32), and report (line 33) currently conflict with their own beat lists, which can produce contradictory model behavior.

Suggested minimal fix:

-| `email` | 4 | preheader · headline · body with one image or accent · CTA · footer |
-| `one_pager` | 5 | hero · 3 supporting blocks · evidence (numbers, quote, or chart) · CTA |
-| `report` | 6 | cover · TL;DR · 3 finding sections · methodology · conclusion |
+| `email` | 5 | preheader · headline · body with one image or accent · CTA · footer |
+| `one_pager` | 6 | hero · 3 supporting blocks · evidence (numbers, quote, or chart) · CTA |
+| `report` | 7 | cover · TL;DR · 3 finding sections · methodology · conclusion |

…fore/after rendering

Addresses user feedback that generated designs are too sparse, miss
before/after comparisons, and lack design density / hierarchy.

- New `artifact-types` section: 8-type taxonomy (landing / case_study /
  dashboard / pricing / slide / email / one_pager / report) with a
  per-type density floor and required structural beats. Case studies now
  require ≥6 sections (hero · before/after · challenge · solution · pull
  quote · CTA), not "4 metric cards plus a quote".
- New `pre-flight` checklist (internal SCT pattern): forces the model to
  classify type, posture, density, comparisons, featured numbers,
  palette, type ladder, and slop guard before writing any HTML.
- Comparison enforcement: when the brief mentions before/after, 前后,
  对比, vs, growth %, the model MUST render side-by-side or paired
  visualizations. A floating `+40%` no longer satisfies the rule.
- Required four-step type ladder (display · h1 · body · caption) with
  Fraunces / Geist (now bundled, removed Fraunces from forbidden list).
- Dark theme density rules: ≥3 surface tones, gradient or glow, two
  accents minimum. The canonical sparse-LLM dark output (#0E0E10 +
  single accent + four cards) is explicitly called out as slop.
- Anti-pattern guard: no placeholder.com / via.placeholder / unsplash
  hotlinks, no default Tailwind grays as the only neutral, no soft-
  rounded square + single letter logo placeholders.
- Workflow expanded from 6 to 7 steps; self-check now references the
  density floor and comparison rule.

Tests: 6 new vitest cases in generate.test.ts cover the taxonomy,
pre-flight beats, dark-theme rules, type ladder, and font rules. All
47 tests pass; .txt-vs-TS drift test confirms the inlined constants
match the source files byte-for-byte.

Signed-off-by: hqhq1025 <1506751656@qq.com>
The artifact-types imagery rules permitted picsum.photos seeded URLs while
output-rules globally banned hotlinked images. Strip the picsum exception
and unify both sections on self-contained imagery (inline SVG, CSS gradient,
or data: URI) per Codex review on PR #44.

Signed-off-by: hqhq1025 <1506751656@qq.com>
Codex Major: email/one_pager/report had floors lower than the count of
listed required beats, creating conflicting instructions for the model.
Raise floors to match the beats so self-check is unambiguous.

Signed-off-by: hqhq1025 <1506751656@qq.com>
Codex Major: density-floor counts still contradicted listed beats —
"3 supporting blocks" and "3 finding sections" hid count behind a
plural noun, so a literal dot-count gave 4/5 items vs floor 6/7.
Expand to explicit numbered items so dot-count matches floor exactly.

Signed-off-by: hqhq1025 <1506751656@qq.com>
@hqhq1025 hqhq1025 force-pushed the wt/system-prompt-v2 branch from 4530224 to fe8bf8c Compare April 18, 2026 20:30
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings

  • No high-confidence issues found in the added/modified lines of this update.

Summary

  • Review mode: follow-up after new commits
  • No issues found in changed lines for this revision.
  • docs/VISION.md and docs/PRINCIPLES.md: Not found in repo/docs.
  • Residual risk/testing gap: new prompt constraints are asserted via string-presence tests, but no behavior-level test verifies model outputs satisfy the new density/comparison rules end-to-end.

Testing

  • Not run (automation)

open-codesign Bot

@hqhq1025 hqhq1025 merged commit b20bb3a into main Apr 18, 2026
6 checks passed
@hqhq1025 hqhq1025 deleted the wt/system-prompt-v2 branch April 18, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant