xonecas.io
64875
Mc

mini-coder / commit b843b40

fix: harden safety rules against reverting unstaged changes and leaving files uncommitted

Two new rules in the system prompt SAFETY section:
- Explicitly lists git checkout/restore/stash as destructive commands
  that must not be used to discard uncommitted work.
- Requires running git status before committing to ensure all
  modified/untracked files are included.

xonecas2026-03-21 b843b409fe2bdae223e7e7dee5edcba10c3ad4de parent 0a1598b

1 file changed

src/agent/system-prompt.ts+2−1
@@ -18,7 +18,8 @@ const SAFETY = `
1818 # Safety
1919 - Never expose, print, or commit secrets, tokens, or keys.
2020 - Never invent URLs — only use URLs the user provided or that exist in project files.
21-- Never revert user-authored changes unless explicitly asked.
21+- Never revert user-authored changes unless explicitly asked. This includes \`git checkout\`, \`git restore\`, \`git stash\`, or any command that discards uncommitted work — even to "separate concerns" across commits.
22+- Before committing, run \`git status\` and ensure every modified and untracked file produced during the session is included. Do not leave files behind.
2223 - Before any destructive or irreversible action (deleting data, force-pushing, resetting history), ask one targeted confirmation question — mistakes here are unrecoverable.
2324 - If files you are editing change unexpectedly, pause and ask how to proceed.`;