Qwen-Sharp arrow β€” agent chat templates

Jinja chat templates for Qwen3.6-format models, built for agent harnesses (tool use, multi-step work). Plain chat is unchanged from Qwen-Sharp v22.5.0; with tools, arrow turns the model's reasoning into action and keeps long runs on track.

Current version: arrow 4.2.2.

File For
chat_template_sharp-v22.5.0-arrow4.2.2.jinja Qwen3.6-format models
chat_template_sharp-v22.5.0-arrow4.2.2-nex.jinja Nex-N2.5 (Nex reasoning-level opener, see below)
chat_template_sharp-v22.5.0-arrow4.2.2-minicpm.jinja MiniCPM-V 4.7 (openbmb's multimodal content format: bare <|image_pad|>, parts joined by a newline)
llama-server -m <model>.gguf --jinja --chat-template-file chat_template_sharp-v22.5.0-arrow4.2.2.jinja

Older versions (arrow 4.0) are in the repo history.

How it works

Lineage: Qwen official β†’ froggeric/Qwen-Fixed-Chat-Templates (thinking retention, reasoning effort, XML/JSON tool formats, error coaching) β†’ peculiar-ragdoll/Qwen-Sharp v22.5.0 (terse block) β†’ arrow (ours). Both upstreams are Apache-2.0; what arrow changes is stated here.

How the prompt is built β€” one system block, in this order:

  1. Reasoning-effort line (only at low / xhigh; none at the default medium).
  2. # Tools list and tool-call format rules β€” upstream text, verbatim (format-critical).
  3. The harness's own system prompt.
  4. .arrow project-memory rules (only when file or shell tools exist).
  5. Agent rules (tools present) or Sharp's terse answer rules (no tools) β€” last, closest to the conversation.
  • Plain chat is untouched: with no tools, arrow renders byte-identical to Sharp v22.5.0.

  • Agent rules: plan once, short, then one chain per step (last result β†’ next action); think in draft chains, not sentences; scan the tools + skills + MCP list before installing or building anything; plan = route + its weakest belief, test that belief first; on failure, root cause before fix (what changed since it last worked?); smallest change that tests it; stay in scope (project root β€” a mentioned path is context, not a target); live evidence beats memory; long jobs in the background with a log; sanity check before saying done; result-first replies in the user's language.

  • Per tool batch: at most one short note on the result that needs it (repeated call, same error, empty searches, probe loops, timeouts, whole-file rewrites, writes outside scope, skill churn, stalls, repeated failure) plus a status line, e.g. SYSTEM step 7 Β· just edited shop/rules.py Β· read rules.py Β· next test it Β· goal <user words>. Every line the template adds starts with one marker, SYSTEM, in one-token words and β†’ chains.

  • Pressure on inaction: next β†’ overdue β†’ stuck β†’ stop β†’ report now, so long runs end in a delivery instead of more reading.

  • Step back on repeated failure (4.2.2): failed actions since the last working point are counted (shell, code, browser or any non-read tool; failing read-only commands are not). Only a result resets it: a passing check, or the first failing thing working again β€” never the model's words, a side fix or a --version call. Doubt rises with each fail:

    • 2 β†’ name the cause and run the cheapest test that proves or kills it, before the next fix;
    • 3, or an error comes back β†’ the template lists the model's own steps since the last working point; root = first wrong step, check from the first (thinking opens at once);
    • 5 β†’ assume the start was wrong, read the request again, plan from zero;
    • 7 β†’ stop and report: own steps, what the errors say, root-cause guess + evidence.

    The status line shows it (since last ok: 6 steps, 5 fails β†’ start wrong, plan again). A new user message keeps the trail, so "fix it" after a broken install still points back at that install.

  • Tool sweep (4.2.1): a one-line nudge under each new instruction to check the tools, skills and MCP list first, and one note on the first install command of an instruction.

  • Open phase: every new instruction starts open (answer, change, or plan); the model's first change or plan ends it. The template never reads the user's words, so it behaves the same in any language. A message of 8+ words sets the goal; a shorter reply is shown beside it as then.

  • Think cadence: thinking opens at decision points β€” a user message, an error, a corrective note, every 8th turn; other turns open with the think block closed, so the model acts directly. Open think blocks start with β†’ (draft-chain seed), and history replays it. Computed from the history alone, so it also works when the harness drops past reasoning.

  • Hand-back: 36 calls without a change (18 on a question) β†’ the reply is pre-started as a report (done, blocker, options) and control returns to the user.

  • .arrow project memory: .arrow/memory (decisions, commands, traps) and .arrow/plans (goal, - [ ] steps, verify) at the project root β€” created on first contact, ticked as work lands, re-read after a context summary.

  • Prompt cache: every note and status line is computed from earlier messages only, so past renders never change and the prefix cache holds.

Switches (chat_template_kwargs, default in brackets): reasoning_effort [medium] Β· enable_thinking [true] Β· think_cadence [true] Β· act_streak [8] Β· think_seed [true] Β· status_line [true] Β· deliver_at / deliver_at_question [36 / 18, 0 = off] Β· step_back [true] Β· tool_sweep [true] Β· arrow_memory [true; false = off, "always" = also without file tools] Β· decisive [true; false drops the agent rules] Β· terse [true] Β· tool_call_format [xml] Β· Nex only: adaptive_thinking [true].

step_back=false renders 4.2.1 byte for byte; with tool_sweep=false as well, 4.2.

Reasoning level for Nex

Nex was trained on its own chat template, where the reasoning level is set by how the reply opens: a bare <think> means adaptive (medium), <think> + newline means always think (high). The -nex file opens replies the Nex way; the generic file always opens with <think> + newline. Reasoning level passed by the harness β†’ Nex mode:

  • none β†’ no thinking
  • low / minimal β†’ adaptive, with a "keep thinking brief" instruction
  • medium (default) β†’ adaptive: the model decides whether and how much to think
  • high / xhigh / max β†’ always think

The β†’ think seed needs the newline form, so in adaptive mode nothing is seeded and past thoughts are replayed as written. adaptive_thinking=false gives the generic file's behaviour.

Changes since arrow 4.0

4.2.2 β€” step back

  • Failed actions counted since the last working point; rising doubt: test the cause β†’ audit own steps from the first β†’ plan from zero β†’ stop and report with a root-cause guess.
  • New rule: plan = route + its weakest belief; root cause before fix.
  • Status line field: since last ok: N steps, M fails.

4.2.1 β€” tool sweep

  • Rule and nudge: check the tools + skills + MCP list before installing or building; one note on the first install.

4.2 β€” language-independent, leaner, draft-chain thinking

  • No English cue-word lists: the template no longer reads the user's words to tell question from task, plan request or approval; open phase instead, goal anchor by length.
  • One SYSTEM marker; status line as short fields; one-token words and β†’ chains (about 10–14 % fewer tokens in status lines and notes).
  • Think in draft chains, not sentences; open think blocks start with β†’ (think_seed=false to switch off).
  • Sanity rule before saying done; todo calls no longer count as progress; a piped test run that shows failures is no longer reported as "check passed".

Used in

License

Apache-2.0. Derived from froggeric/Qwen-Fixed-Chat-Templates and peculiar-ragdoll/Qwen-Sharp-Chat-Templates, both Apache-2.0.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including gbuzhf/Qwen-Sharp-Arrow-Chat-Templates