Repository navigation
Conversation
Separate the static coder instructions from dynamic prompt sections so the default body can be embedded and injected through prompt data. This preserves existing rendering while creating a clean seam for configurable system prompt overrides.
Add a config option for pointing Crush at a custom coder system prompt file and load it during prompt rendering. This keeps the embedded default as the fallback while surfacing unreadable configured files as render errors.
Add focused tests for default, configured, and runtime system prompt rendering precedence, plus CLI flag and backend workspace override propagation. Fix backend workspace snapshots to include the runtime system prompt override so client/server workspaces preserve the effective override without persisting it.
Document configured and one-off custom system prompt usage so users can discover the new override paths. Add schema coverage to keep options.system_prompt_path exposed in generated configuration docs.
…o override directives like 'no comments'
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for customizing the agent “system prompt” via both config and a CLI runtime override, and threads that value through local and server-backed workspace creation into prompt rendering.
Changes:
- Add
options.system_prompt_path(schema + config) and a runtime override (--sys-prompt/-p) - Plumb
SystemPromptPaththrough proto workspace creation, backend workspace creation, and prompt rendering - Introduce a built-in default system prompt template and tests for schema + prompt + CLI + backend behavior
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/proto/proto.go | Adds SystemPromptPath to workspace proto payloads |
| internal/config/store.go | Adds runtime override storage for system prompt path |
| internal/config/config.go | Adds options.system_prompt_path to config + JSON schema |
| internal/cmd/root.go | Adds --sys-prompt/-p flag and wires it into local/server setup |
| internal/cmd/system_prompt_test.go | New tests for flag presence/inheritance and local override plumbing |
| internal/cmd/schema_test.go | Ensures JSON schema includes system_prompt_path |
| internal/backend/backend.go | Applies system prompt override during workspace creation and exposes it via proto |
| internal/backend/backend_test.go | Tests backend workspace creation carries system prompt override through |
| internal/agent/templates/default_system_prompt.md | Adds embedded default system prompt content |
| internal/agent/templates/coder.md.tpl | Switches coder template to consume .SystemPrompt variable |
| internal/agent/prompts.go | Embeds default system prompt and applies as default option |
| internal/agent/prompt/prompt.go | Implements system prompt selection (default/config/override) + reads file |
| internal/agent/prompt/prompt_test.go | Tests default/config/override precedence for prompt building |
| README.md | Documents config + CLI usage for custom system prompts |
| .gitignore | Ignores .agents/* subdirectories |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use the effective prompt working directory when loading custom system prompt files so runtime working directory overrides behave consistently with rendered prompt context. Refresh prompt tests and glm-5.1 cassettes to cover the behavior and keep agent VCR fixtures aligned with the updated default prompt.
Exercise system prompt CLI override behavior at the config-store boundary instead of initializing a full local workspace. This avoids opening app resources under the test TempDir on Windows while still covering the runtime override path used by workspace setup.
Test system prompt CLI override behavior without initializing config loading or temp workspaces. This avoids Windows cleanup failures from process-global setup while keeping coverage on the runtime override path used by local workspace startup.
Short-circuit pre-cancelled jq invocations before parse/compile work and replace a fixed background-shell sleep with a bounded completion wait so Windows race CI is not dependent on tight scheduler timing. Also refine the default system prompt coding guidance. 💘 Generated with Crush Assisted-by: Crush:[GPT-5.1 Codex Max]
Update all glm-5.1 VCR cassettes to reflect the new coding_style section and "user told you to do so" autonomy directive added to the default system prompt. 💘 Generated with Crush Assisted-by: Crush:[Qwen 3.7 Max]
|
Yes, custom prompt is a must. |
|
This feature is available in my fork which tracks upstream if you need it: https://github.com/taoeffect/crush |
|
Thank you, I'll give it a shot. |
|
@taoeffect @Artyrm That would be a nice small patch. If i recall correctly you can do something similar with Pi https://github.com/earendil-works/pi/tree/main/packages/coding-agent#context-files and Opencode? https://www.reddit.com/r/opencodeCLI/comments/1p13hsz/default_prompts_for_models/ |
|
Thank you for your contribution! This pull request has merge conflicts and has had no activity for over 2 months, so we are closing it to keep the queue manageable. If you would still like to get this merged, please rebase onto the latest main branch and reopen it. |
|
You mean you preferred your solution in #4141 over mine. That's fine but be honest. |
|
That's not mine (look at the commit), and this PR was automatically closed. Does this one has something over the new one by Kieran? |
|
Looking at this PR (and sorry I didn't see this PR earlier) it seems to miss out on:
If you do have any features to add to that PR, please, do say, either I'll pass it on to Kieran, or can apply a patch to the branch. Sorry again for not noticing this PR earlier. Thank you for your work here! |
|
I do see that Kieran's is more inline with Crush's current needs (i.e. the I would request:
|
This PR greatly improves the system prompt handling of Crush.
Adds the ability to override the system prompt:
It does this while preserving all of the custom template logic in
coder.md.tplfor injecting environment status, skills, memory, etc.Users can also now override the default system prompt with their own by modifying
~/.config/crush/crush.jsonor their project-local.crush/crush.json:{ "options": { "system_prompt_path": "/path/to/system-prompt.md" } }Project-local override:
{ "options": { "data_directory": "./.crush", "system_prompt_path": "./.crush/system-prompt.md" } }The existing non-templated system prompt directives have been moved to
default_system_prompt.mdand have been greatly improved.Problems Fixed With Existing System Prompt
The existing system prompt had many problems:
offsetandlimit" vs "Read entire file before editing"So I first ran the original system prompt through Gemini 3.5 Flash, GPT-5.5, and Opus 4.7 to both condense it by fixing DRY violations, and also verifying multiple times that the condensed version preserved all original directives. Then I went manually in and made some adjustments to the original directives to make them less dogmatic and allow users to override the defaults (e.g. "NEVER COMMENT!") with their own directives.
The new default system prompt is now 38.8% shorter while preserving all directives and removing dogmatic language that infringes on reasonable user-choices.
AI Disclosure
GPT-5.5 (xhigh) and Qwen 3.7 Max were used in the coding of this PR with 2 rounds of review (GPT-5.5 and Copilot).
GPT-5.5, Opus 4.7, and Gemini 3.5 Flash were used in the refining, improvement, and verification of the new default system prompt, along with myself.
CONTRIBUTING.md.