continuedev / continuedev/continue
System prompt assembly needs holistic refactor
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 36k
- Forks
- 5.4k
- PR merge metrics
- No merged PRs in 30d
Description
Problem
The system prompt is the primary interface between Continue and every model it communicates with. It is currently assembled ad-hoc from hardcoded string literals spread across multiple files, accumulated through incremental changes by 400+ contributors over two years of growth. There is no template system, no per-model awareness, and no separation between base instructions, tool syntax, mode-specific behavior, and rules.
Current state
The system prompt is constructed by concatenating pieces from:
core/llm/defaultSystemMessages.ts— mode-specific base messages (agent/chat/plan), hardcoded string literalsgui/src/redux/util/getBaseSystemMessage.ts— mode selection and a hardcoded all-capsNO_TOOL_WARNINGappended when no tools are activecore/tools/systemMessageTools/toolCodeblocks/index.ts— tool syntax framework with hardcoded prefix, suffix, and example templatescore/tools/systemMessageTools/buildToolsSystemMessage.ts— concatenates tool definitions (two incompatible formats: example-based for built-ins, schema-based for MCP)core/llm/rules/getSystemMessageWithRules.ts— appends workspace rules without budget awareness
There is no central template. No model-size or capability awareness. The only override is model.baseAgentSystemMessage, which replaces the entire base message or nothing.
What the model receives
With tools enabled (agent mode): A brief mode declaration ("You are in agent mode"), codeblock formatting instructions, then tool-use syntax rules and per-tool examples. The actual behavioral guidance is approximately 50 tokens. Everything else is tool syntax documentation.
With no tools enabled (agent mode): The same tool-use rules for tools that don't exist, followed by an all-caps message: "THE USER HAS NOT PROVIDED ANY TOOLS, DO NOT ATTEMPT TO USE ANY TOOLS." The model receives contradictory instructions in a single system message.
For local models with small context windows: No adaptation. The same prompt is sent to a 4-bit quantized 9B model as to GPT-4 or Claude. No output format guidance, no structural constraints, no awareness of context budget.
Documented downstream effects
The following open issues trace back to or are compounded by the system prompt:
- #11072 —
TOOL_NAMEkeyword repeated in every built-in tool example; smaller models echo it as conversational text - #11070 — Parser intercepts quoted tool syntax as real tool calls
- #11074 — Parser assumes tool calls are positionally terminal in model output
- #10783 — Reasoning content leaks into applied edits (no output structure guidance in prompt)
- #10785 — Reasoning content leaks into terminal output display
- #11069 — Vercel stream converter misroutes reasoning-delta to content
- #10781 — System prompt not sent to local LM Studio models in some configurations
An InfoWorld article (https://www.infoworld.com/article/4144487/i-ran-qwen3-5-locally-instead-of-claude-code-heres-what-happened.html) documents end-user failures with local models through Continue that are consistent with these issues: crashes mid-apply, infinite loops, mangled indentation, and erasing entire files.
Files involved
core/llm/defaultSystemMessages.ts— base system messagesgui/src/redux/util/getBaseSystemMessage.ts— message selection and no-tools warningcore/tools/systemMessageTools/toolCodeblocks/index.ts— tool syntax frameworkcore/tools/systemMessageTools/buildToolsSystemMessage.ts— tool message generationcore/llm/rules/getSystemMessageWithRules.ts— rules injectiongui/src/redux/util/constructMessages.ts— final assembly
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing final prompt assembly in gui/src/redux/util/constructMessages.ts, then read the base messages, tool-message builder, codeblock framework, and rules injection files listed in the issue. Map how agent, chat, plan, tools, and rules are combined before defining the refactor boundaries. Done means prompt assembly has a central, model-aware structure without the documented contradictory or duplicated behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, developer-experience, tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100