Skip to content

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

Closed
hqhq1025 wants to merge 1 commit intowt/progressive-promptfrom
wt/prompt-layer1-shrink
Closed

perf(prompts): shrink Layer 1 to lower 8k-ctx token cost#111
hqhq1025 wants to merge 1 commit intowt/progressive-promptfrom
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.

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 — 158 / 158 pass (drift test green)
  • pnpm --filter @open-codesign/core typecheck — clean
  • pnpm exec biome check packages/core/src/prompts/ — clean
  • Verification script run — sizes recorded above

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).
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

  • None.

Summary

  • Review mode: initial
  • No high-confidence issues found in added/modified lines of this diff.
  • Residual risk/testing gap: prompt behavior quality and token-efficiency impacts were not executable-verified in this environment.

Testing

  • Not run (automation): pnpm is not available in this runner.

open-codesign Bot

@hqhq1025 hqhq1025 deleted the branch wt/progressive-prompt April 19, 2026 13:40
@hqhq1025 hqhq1025 closed this Apr 19, 2026
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