Skip to content

feat: default tool-discipline prompt + honest --allow semantics (#103) - #105

Merged
ajianaz merged 1 commit into
developfrom
feat/tool-discipline-prompt
Sep 19, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/tool-discipline-prompt

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

What

Default system prompt for fresh CLI sessions + honest --allow help:

  • default_system_prompt() (tole-cli host, applied only when neither --system nor TOLE_SYSTEM_PROMPT is set): a short tool-discipline block — prefer the dedicated file tools (read_file/write_file/edit_file) over run_command for file operations; run_command only for what those cannot do. Two cfg variants: with shell-tools the guidance mentions run_command as the guarded fallback; without it (mobile/embedder profile) the prompt never advertises the unregistered tool.
  • --allow help now states the real semantics: patterns match tool names only — an equivalent-effect tool such as run_command stays separately gated, and Destructive is never auto-allowed.
  • Both fresh-session creation sites (run, chat) resolve: explicit flag → env → built-in default. Resumed sessions re-apply their header-pinned prompt exactly as before (no behavior change on resume).

Why

Issue #103, from a live E2E in the 2026-09-19 UX audit: asked to write_file, glm-5.3-flash bypassed to run_command with a bash -c heredoc. The bypass (a) dodges the file tools' workspace jail + hash-anchored editing, and (b) makes --allow 'write_*' a false promise — the user pre-approved writes yet still gets a second prompt (or believes writes are gated when they run through the generic lane). Core stays prompt-agnostic: this changes only the CLI host's default, and the evals Tier-1 golden wire (which pins an explicit prompt) is untouched.

Changes

  • tole-cli/src/main.rs: default_system_prompt() (2 cfg variants) + .or_else fallback at both fresh-session sites + expanded --allow doc-comment + default_prompt_tests (content + length guard)

Testing

  • cargo fmt --all / cargo clippy --workspace --all-targets -- -D warnings ✅
  • cargo test --workspace ✅ (exit 0, 12 suites ok) AND cargo test -p tole-core --no-default-features ✅ (exit 0, 7 suites ok — both feature profiles per repo rule)
  • cora review --staged ✅ No issues found
  • Live E2E of the bypass itself (evidence for the issue): v0.3.0 + glm-5.3-flash routed a write to run_command bash -c — the new default prompt instructs the dedicated lane; full acceptance check runs with the release binary after merge

Closes #103

@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit cb2e244 into develop Sep 19, 2026
16 checks passed
@ajianaz
ajianaz deleted the feat/tool-discipline-prompt branch September 19, 2026 05:49
@ajianaz

ajianaz commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

Acceptance evidence (post-merge, develop cb2e244 debug build, glm-5.3-flash via Bifrost)

Scenario A — --allow 'write_*': zero approval prompts, exit 0, hello.txt created (5 bytes, content hello), session intents = write_file ×2, no run_command.
Scenario B — no flags: exactly one approval prompt, for write_file (what: write file hi.txt) — not a run_command bypass; EOF ⇒ deny, hi.txt not created (fail-closed held).

Session header proves the new default is pinned:

"systemPrompt":"You are tole, a careful personal assistant. Tool discipline: for anything involving files, prefer the dedicated tools…

All three acceptance criteria from #103 verified live. Closing note only — the PR is already merged.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UX: default tool-discipline prompt + honest --allow semantics in help

1 participant