metal-kompanion/docs/claude-code-hard-overrides.md

1.4 KiB
Raw Blame History

Claude Code: Hard Overrides to Stabilize Tool Use

When Claude Code's layered system prompts clash with our tool protocol, force a minimal, deterministic lane.

  • Stop sequences: ````,

` (or whatever the IDE uses to inject formatting).

  • Max output tokens: small (e.g., 512).
  • Temperature: 0.1-0.3.
  • Disable auto-formatting / code fences if possible.
  • Disable auto-tool use; we trigger tools via explicit JSON only.

System message (short)

Use the contents of docs/prompts/qwen_tool_mode_system.txt verbatim as the final system layer closest to the model.

Runtime guardrails

  • Reject any non-JSON output; send a short corrective user message: OUTPUT MUST BE JSON. Please resend.
  • If repeated, send {"final":{"content":{"error":"RESET_REQUIRED"}}} back and restart the session.

Registry injection

  • Provide the tool list and JSON Schemas (kom.memory., kom.local.backup., acf.*).
  • Keep it short; link to full schemas if the UI allows references.

Troubleshooting

  • If model keeps adding prose, tighten stop sequences and lower max tokens.
  • If JSON keys drift, include a 23 line example of a valid action and a valid final.
  • If it calls undefined tools, respond with a single tool error and re-present the allowlist.

Fallback DSL

  • Accept @tool <name> {json-args} and convert to a JSON action behind the scenes when necessary.