Wraps DeepSeek's reasoning model so ruflo callers can get an explicit
chain-of-thought back with the final answer, without having to parse it
out of the message content. Same subprocess-invocation shape as the sibling
deepseek-chat skill.
When to use
- Multi-step reasoning tasks: proofs, plans, root-cause analysis, hard bug triage.
- You want to see the model's thinking (for audit, for training data, or to sanity-check its final answer).
- You can tolerate the higher latency and token cost of a reasoner vs
deepseek-chat.
Algorithm
Implementation: scripts/reason.mjs.
- Read
DEEPSEEK_API_KEYfrom env. Degrade gracefully when missing. - POST to
/v1/chat/completionswith{ model: 'deepseek-reasoner', messages, max_tokens? }. Per DeepSeek's docs,temperature/top_pare ignored for reasoner models — this script does not forward them. - Extract
choices[0].message.contentANDchoices[0].message.reasoning_content. - JSON output always includes
reasoning; table mode omits it unless--show-reasoningis passed. reasoningTokens(fromusage.completion_tokens_details.reasoning_tokens) is surfaced separately so callers can attribute cost.
Example
node plugins/ruflo-deepseek-harness/scripts/reason.mjs \
--prompt "Prove that sqrt(2) is irrational." \
--format table --show-reasoning
Table output shows the reasoning block, then the answer. JSON mode returns:
{
"status": "ok",
"model": "deepseek-reasoner",
"content": "sqrt(2) is irrational because …",
"reasoning": "Assume for contradiction that sqrt(2) = p/q in lowest terms …",
"finishReason": "stop",
"usage": {
"promptTokens": 14,
"completionTokens": 812,
"reasoningTokens": 640,
"totalTokens": 826
}
}