Skip to content

perf(prompts): shrink Layer 1 to lower 8k-ctx token cost#114

Merged
hqhq1025 merged 1 commit intomainfrom
wt/prompt-layer1-shrink
Apr 19, 2026
Merged

perf(prompts): shrink Layer 1 to lower 8k-ctx token cost#114
hqhq1025 merged 1 commit intomainfrom
wt/prompt-layer1-shrink

Conversation

@hqhq1025
Copy link
Copy Markdown
Collaborator

Summary

Compress the three always-on Layer 1 prompt sections shipped in #109 so small-context models (e.g. minimax-m2.5:free at 8k ctx) get a meaningfully lighter system prompt without losing any rules.

Reopened after #109 squash-merge auto-closed the original (#111). Rebased cleanly onto current main.

Section sizes (.txt source = TS constant, byte-for-byte)

Section Before After Saved
workflow.v1.txt 2,724 B 1,556 B -1,168 B
pre-flight.v1.txt 2,241 B 1,434 B -807 B
anti-slop-digest.v1.txt 1,698 B 1,203 B -495 B
Total Layer 1 saving ~2.5 KB

Composed prompt size (verification script)

Compose mode Before (approx) After
composeSystemPrompt({ mode: 'create' }) (full) ~41.8 KB 39,354
Progressive 做个数据看板 (matched dashboard) ~22.6 KB 20,145
Progressive xyzzy nothing (no-match → Layer 1 + full craft) ~24.5 KB 21,995

What changed

  • Cut explanatory prose, rationale, and framing paragraphs.
  • Kept every actual RULE (self-check items, pre-flight beats, forbidden patterns, output rules).
  • Preserved markdown headings (Pre-flight checklist, Revision workflow, etc.) and pre-flight beat labels (Artifact type, Emotional posture, ...) verbatim — drift / beat-coverage tests still pass.

Test plan

  • pnpm --filter @open-codesign/core test — 160 / 160 pass on rebased main (drift test green)
  • pnpm --filter @open-codesign/core typecheck — clean
  • pnpm exec biome check packages/core/src/prompts/ — clean

PRINCIPLES §5b

  • Compatibility: green (no API change)
  • Upgradeability: green (schema-versioned .v1.txt files unchanged)
  • No bloat: green (this PR removes bytes)
  • Elegance: green (rules preserved, prose trimmed)

…-slop-digest

Compress three always-on Layer 1 prompt sections to lower token cost for
small-context models (e.g. minimax-m2.5:free at 8k ctx):

- workflow.v1.txt:         2724 -> 1556 bytes
- pre-flight.v1.txt:       2241 -> 1434 bytes
- anti-slop-digest.v1.txt: 1698 -> 1203 bytes

All rules preserved; dropped only explanatory prose, rationale paragraphs,
and framing copy. Pre-flight beats and section headings kept verbatim so
the existing drift / beat-coverage tests pass unchanged.

Matched dashboard prompt: ~22.6 KB -> 20.1 KB (about 2.5 KB / 600 token saving
per Layer 1 request).

Signed-off-by: hqhq1025 <1506751656@qq.com>
Copy link
Copy Markdown

@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 actionable issues found in added/modified lines.

Summary

  • Review mode: initial
  • No blocking/major/minor/nit issues were identified in the current diff.
  • Residual risk/testing gap: prompt-behavior drift from compressed wording is not covered by test changes in this PR.
  • docs/VISION.md and docs/PRINCIPLES.md: Not found in repo/docs in this runner.

Testing

  • Not run (automation)

open-codesign Bot

@hqhq1025 hqhq1025 merged commit f56ecad into main Apr 19, 2026
6 checks passed
@hqhq1025 hqhq1025 deleted the wt/prompt-layer1-shrink branch April 19, 2026 17:03
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