fix(prompt): simplify system prompts, remove massive duplication (~1795 tokens saved)#8
Closed
ranxianglei wants to merge 2 commits into
Closed
fix(prompt): simplify system prompts, remove massive duplication (~1795 tokens saved)#8ranxianglei wants to merge 2 commits into
ranxianglei wants to merge 2 commits into
Conversation
…ground-agent race' (#4) from fix/run-grace-period-multi-bg into master
…95 tokens saved) default.txt (7638→3038 chars): was a merge artifact — two versions concatenated, 6 sections duplicated, 4/6 examples redundant. Merged into one clean version preserving all unique instructions. shell.txt (6287→5253 chars): parallel-tool-call boilerplate repeated 4x verbatim, commit rule duplicated. Deduplicated, all template variables preserved. anthropic.txt (8212→6672 chars): two verbose Task Management examples (~900 chars each) demonstrating identical TodoWrite usage merged into one. Fixed broken Doing tasks section (orphan dash).
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
Contributor
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two-part change: (1) eliminate massive prompt duplication saving ~1795 tokens, (2) add per-model prompt configurability via
options.prompt.Part 1: Prompt Simplification (~1795 tokens saved)
default.txt(GLM-5.x default prompt): 7638 → 3038 chars (~1150 tok saved)Was a merge artifact — two versions concatenated end-to-end. 6 sections appeared twice (
# Proactiveness,# Following conventions,# Code style,# Doing tasks,# Tool usage,# Code References), and 4 of 6 examples were exact duplicates of the first half. Merged into one clean version, preserving all unique instructions from both halves.shell.txt(Bash tool description): 6287 → 5253 chars (~260 tok saved)The parallel-tool-call instruction (
You can call multiple tools in a single response. When multiple independent pieces...) was repeated 4 times verbatim (commit steps + PR steps). Deduplicated to conciseRun the following ... in parallel:. Removed duplicate commit rule. All${...}template variables preserved.anthropic.txt(Claude prompt): 8212 → 6672 chars (~385 tok saved)Two verbose Task Management examples (~900 chars each) demonstrating identical TodoWrite usage merged into one concise example. Fixed broken
# Doing taskssection (orphan-on its own line).Part 2: Per-Model Prompt Configurability
system.ts:options.promptconfig overrideAdded a
PROMPT_MAPand config override check at the top ofprovider(). Users can now specify which system prompt file a model uses via model config:{ "provider": { "glm": { "models": { "glm-5.2": { "options": { "prompt": "anthropic" } } } } } }Valid values:
default,anthropic,beast,gemini,gpt,kimi,codex,trinity.This enables:
The hardcoded
provider()routing remains as the auto-detect fallback.Verification
bun run typecheck— passes (all 18 packages)bun turbo typecheck) — 12/12 tasks successful${...}) preserved in shell.txt