feat: add systemPromptFile config key for system prompt replacement#57
feat: add systemPromptFile config key for system prompt replacement#57rock-solid-sites wants to merge 2 commits into
Conversation
Add a new optional config key 'systemPromptFile' to settings.json that replaces the built-in SYSTEM_PROMPT_BASE with custom content. Tool docs, runtime context, AGENTS.md, and matched skills continue to load after the replacement — only the content of the first system message changes. - src/settings.ts: Add systemPromptFile to DeepcodingSettings and ResolvedDeepcodingSettings types. Resolve with standard precedence (system env > project settings > user settings). - src/prompt.ts: Extend getSystemPrompt() with a systemPromptFile parameter. When set, reads the file at the resolved path and uses it as the base prompt. Fails loud if the file can't be read. - src/session.ts: Plumb systemPromptFile through SessionManager via getResolvedSettings callback into createSession().
Add the new systemPromptFile field to the settings table and a dedicated section explaining path resolution, behavior, and the fail-loud error handling (no silent fallback to default).
e8023c4 to
c07dda5
Compare
|
@rock-solid-sites Thanks for the contribution! However, Deep Code already loads |
|
AGENTS.md is project-scoped and lives in the workspace, while behavioral presets are session-scoped and live in the user's config. They serve different purposes. AGENTS.md says "here's what's true about this project" — paths, conventions, gotchas. A behavioral preset says "act this way regardless of what project you're in" — posture, autonomy level, communication style. A user wants to switch between "safe-and-collaborative" and "autonomous-and-fast" without editing every project's AGENTS.md. And the prior investigation confirmed AGENTS.md is additive, wrapped in <project_instructions> and placed after the mode prompt — so even using it for behavioral tuning runs into the same dilution problem skills have. |
Adds a new optional config key
systemPromptFilethat, when set,replaces SYSTEM_PROMPT_BASE with the contents of the file at the
given path. Tool docs, runtime context, AGENTS.md, and matched
skills continue to load additively after the replacement prompt.
Motivation: This enables operators to use deepcode-cli with
custom behavioral prompts (e.g., for specialized workflows, team
conventions, or experimental prompt designs) without modifying
source. Tool calling and existing additive layers are preserved.
Implementation:
systemPromptFile?: stringfield inDeepcodingSettings and ResolvedDeepcodingSettings
override user settings, env vars override both
getSystemPrompt()in src/prompt.ts reads the file and uses itscontent in place of SYSTEM_PROMPT_BASE; tool docs and runtime
context still append after
and OS error) — silent fallback to default would hide
configuration bugs
Testing:
failures unrelated to this change)
responses with TACOS", confirmed the model produces TACOS-
prefixed responses and tool calls still work; with a nonexistent
path, confirmed the fail-loud error fires
Open to feedback on naming, fallback behavior, or whether a CLI
flag (
--system-prompt-file) should accompany the config key.