C.W.K.
Stream
Lesson 04 of 10 · published

Reasoning vs Output — Separating the Two

~14 min · reasoning, output, structure

Level 0Apprentice
0 XP0/100 lessons0/14 achievements
0/120 XP to next level120 XP to go0% complete

The model thinks; the consumer reads

Reasoning is for the model. The output is for the user (or the next stage of your pipeline). Conflating them produces verbose answers full of hedging and chain-of-thought leaking into JSON fields.

Three patterns

  • Hidden thinking — Extended Thinking, o-series. Reasoning never reaches the consumer.
  • Tagged thinking — <thinking> before <answer>. Operator can read, parser strips before user sees.
  • External thinking — first call generates a plan, second call executes against it. Two prompts, two outputs, one for the audit log and one for the user.

The audit-log win

When something goes wrong in production, the reasoning trace is gold. Hidden thinking models often expose it to the developer even when the user doesn't see it. Log the trace; you'll thank yourself in the next incident.

Code

Strip thinking before returning to user·python
import re

def strip_thinking(text: str) -> tuple[str, str]:
    m = re.search(r"<thinking>(.*?)</thinking>\s*(.*)", text, flags=re.DOTALL)
    if not m:
        return "", text
    return m.group(1).strip(), m.group(2).strip()

thinking, answer = strip_thinking(model_text)
log_trace(thinking)
return answer

External links

Exercise

On a prompt that currently leaks reasoning into outputs, separate them with tagged thinking. Log the thinking. Return only the answer to the user.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.