Skip to content

fix(prompt): simplify system prompts, remove massive duplication (~1795 tokens saved)#8

Closed
ranxianglei wants to merge 2 commits into
masterfrom
fix/prompt-simplification
Closed

fix(prompt): simplify system prompts, remove massive duplication (~1795 tokens saved)#8
ranxianglei wants to merge 2 commits into
masterfrom
fix/prompt-simplification

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Jul 9, 2026

Copy link
Copy Markdown
Owner

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 concise Run 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 tasks section (orphan - on its own line).

Part 2: Per-Model Prompt Configurability

system.ts: options.prompt config override

Added a PROMPT_MAP and config override check at the top of provider(). 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:

  • Protocol-based routing: point OpenAI-compatible models to the GPT prompt
  • Intelligence-based routing: use leaner prompts for smarter models
  • A/B testing: swap prompts per model without code changes

The hardcoded provider() routing remains as the auto-detect fallback.

Verification

  • bun run typecheck — passes (all 18 packages)
  • Pre-push hook (bun turbo typecheck) — 12/12 tasks successful
  • All template variables (${...}) preserved in shell.txt
  • No behavioral change — prompt trimming only removes redundancy; config override is opt-in

e-cigarettes and others added 2 commits June 25, 2026 13:25
…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).
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

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.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants