tachibot-mcp 2.32.0 → 2.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +42 -16
  3. package/dist/src/cli/init.js +1 -1
  4. package/dist/src/config/model-constants.js +47 -26
  5. package/dist/src/config/model-defaults.js +3 -3
  6. package/dist/src/optimization/model-router.js +4 -1
  7. package/dist/src/orchestrators/collaborative/services/visualization/VisualizationService.js +10 -6
  8. package/dist/src/profiles/balanced.js +3 -1
  9. package/dist/src/profiles/code_focus.js +2 -0
  10. package/dist/src/profiles/full.js +3 -1
  11. package/dist/src/profiles/heavy_coding.js +2 -0
  12. package/dist/src/profiles/minimal.js +2 -0
  13. package/dist/src/profiles/research_power.js +3 -1
  14. package/dist/src/prompt-engineer-lite.js +82 -0
  15. package/dist/src/tools/blog-writer-tool.js +55 -0
  16. package/dist/src/tools/diff-review-tool.js +1 -1
  17. package/dist/src/tools/doctor-tool.js +1 -1
  18. package/dist/src/tools/grok-enhanced.js +23 -13
  19. package/dist/src/tools/openai-tools.js +77 -33
  20. package/dist/src/tools/openrouter-tools.js +8 -5
  21. package/dist/src/tools/plan-critique-tool.js +1 -1
  22. package/dist/src/tools/prompt-technique-tools.js +40 -1
  23. package/dist/src/tools/provider-catalog.js +1 -0
  24. package/dist/src/tools/registry.js +4 -1
  25. package/dist/src/utils/ansi-styles.js +12 -0
  26. package/dist/src/workflows/tool-mapper.js +23 -22
  27. package/docs/TOOLS_REFERENCE.md +31 -6
  28. package/docs/TOOL_PROFILES.md +15 -15
  29. package/docs/superpowers/plans/2026-08-17-writing-techniques.md +637 -0
  30. package/docs/superpowers/plans/2026-08-25-file-grounded-deliberation.md +855 -0
  31. package/docs/superpowers/plans/2026-08-29-planner-split-waves.md +317 -0
  32. package/package.json +2 -2
  33. package/profiles/balanced.json +2 -1
  34. package/profiles/code_focus.json +1 -0
  35. package/profiles/full.json +2 -1
  36. package/profiles/heavy_coding.json +1 -0
  37. package/profiles/minimal.json +1 -0
  38. package/profiles/research_power.json +2 -1
  39. package/skills/council/SKILL.md +336 -0
  40. package/skills/jury/SKILL.md +149 -0
  41. package/skills/prompt/SKILL.md +4 -3
  42. package/skills/review/SKILL.md +1 -1
  43. package/skills/setup/SKILL.md +1 -1
  44. package/skills/write/SKILL.md +210 -0
  45. package/smithery.yaml +1 -1
  46. package/tools.config.json +2 -1
@@ -36,6 +36,80 @@ export class PromptEngineerLite {
36
36
  ['alt_view', (q) => `Examine "${q}" from five viewpoints in turn: a curious child, a scientist, an artist, a strategist, and a futurist. Give each a short paragraph in its own voice. Then say what their disagreement reveals that no single view catches.`],
37
37
  ['creative_use', (q, c) => `Find creative applications for "${q}"${c ? ' and the findings above' : ''}. Draw deliberately from unrelated fields — biology, games, logistics, art. For each application, say what makes it work and what would have to be true for it to be practical.`],
38
38
  ['innovate', (q) => `Generate creative, unconventional solutions for "${q}". Consider multiple approaches: rethinking existing processes, drawing inspiration from other domains, removing constraints, and combining different methods. Provide 3+ novel, practical approaches.`],
39
+ // Writing
40
+ ['storm', (q) => `Write about "${q}". Do NOT start writing yet — research first.
41
+
42
+ STAGE 1 — PERSPECTIVES. Identify 4 people who would each care about this topic for a
43
+ DIFFERENT reason: a practitioner, a sceptic, a buyer, and someone burned by it before.
44
+ Name what each one actually wants to know.
45
+
46
+ STAGE 2 — INTERVIEW. For each perspective write the 4 questions they would ask,
47
+ including the awkward one that usually gets left out. Answer each, marking it:
48
+ [KNOWN] confident, no source needed
49
+ [SEARCH] needs a real source — say what would settle it
50
+ [OPINION] genuinely contested — say who disagrees and why
51
+
52
+ STAGE 3 — WHAT IS ACTUALLY INTERESTING. Across all 16 answers, which 3 would surprise
53
+ a reader who already knows the basics? Those 3 are the piece; everything else is
54
+ context. If nothing surprises you, say so — the topic may not warrant writing up.
55
+
56
+ STAGE 4 — OUTLINE around those 3, with a WORD BUDGET per section. Budgets must be
57
+ uneven; equal budgets mean you have not decided what matters.`],
58
+ ['re3', (q) => `Produce a long-form piece on "${q}" in four separate passes. Structural
59
+ rewriting and line editing fight each other — asking for both at once gets you neither,
60
+ because the model tidies sentences in a piece whose architecture is wrong.
61
+
62
+ PASS 1 — PLAN. No prose yet. Produce:
63
+ - the ONE thing the reader should take away
64
+ - the promise the opening makes (the piece must pay it off)
65
+ - a section list, each with purpose, word budget, and the specific point it lands
66
+ - the strongest objection a smart reader will have, and where you deal with it
67
+ Budgets must be UNEVEN. If they are all equal, the plan is lazy.
68
+
69
+ PASS 2 — DRAFT. Write to the plan. Do not polish, do not self-edit, do not stop to
70
+ improve a sentence. Hit the budgets.
71
+
72
+ PASS 3 — REWRITE, STRUCTURE ONLY. Ignore sentence quality entirely. Only ask:
73
+ - does each section do its stated job?
74
+ - is anything in the wrong order?
75
+ - what can be CUT wholesale? Name at least one thing — "nothing" is not an
76
+ acceptable answer.
77
+ - does the ending pay off the opening's promise?
78
+ Output the restructured draft, not notes about it.
79
+
80
+ PASS 4 — EDIT, LINE ONLY. Structure is now fixed: do not move or delete sections. Only:
81
+ - cut every word that earns nothing
82
+ - break up any sentence you have to re-read
83
+ - replace abstractions with specifics
84
+ - vary sentence length; read for rhythm
85
+ - delete every hedge that is not load-bearing
86
+
87
+ Report at the end: word count per pass, and what you cut in Pass 3. If the piece never
88
+ got shorter, Pass 3 did not happen.`],
89
+ ['de_generic', (q) => `The following piece is competent and dull. Do NOT "improve" it —
90
+ improving fluency is what made it dull. Attack these three things only.
91
+
92
+ 1. ORIGINALITY — find every sentence a competent writer would produce by default on
93
+ this topic. Quote each one, then replace it with something only someone who
94
+ actually knows this subject would say. If you cannot, mark it CUT.
95
+
96
+ 2. ELABORATION — find every claim that is asserted and then abandoned. Each needs ONE
97
+ of: a concrete example, a number, a named case, or a mechanism explaining why it is
98
+ true. Generic support ("this improves efficiency") counts as abandoned.
99
+
100
+ 3. SPECIFICITY SWEEP — replace every one of these:
101
+ - "many/several/various" → the actual number
102
+ - "significantly/dramatically" → by how much
103
+ - "experts say" → which experts
104
+ - "can be challenging" → the specific failure
105
+ - any noun phrase that would fit an article on a completely different topic
106
+
107
+ Then answer: could a competitor publish this under their name with no changes? If yes,
108
+ say which parts made that possible.
109
+
110
+ Do NOT lengthen it. Trade word for word.
111
+
112
+ PIECE: ${q}`],
39
113
  // Research
40
114
  ['investigate', (q) => `Investigate "${q}" by answering each question in turn: Who is involved? What exactly is it? When did it arise? Where does it apply? Why does it matter? How does it work? Finish with what has changed recently and what is still unsettled.`],
41
115
  ['evidence', (q, _c) => `Gather the evidence on "${q}": what supports it, what contradicts it, concrete cases either way, relevant numbers, and where informed people disagree. Then state what the evidence as a whole actually supports — not what you expected it to.`],
@@ -650,6 +724,10 @@ depends on rows buried in the middle, narrow the table or sort them to an edge f
650
724
  'improve_prompt': 'meta_prompting',
651
725
  'critic': 'adversarial',
652
726
  'debate': 'persona_simulation',
727
+ // Writing aliases
728
+ research_first: 'storm',
729
+ four_pass: 're3',
730
+ fix_boring: 'de_generic',
653
731
  // Judgment aliases
654
732
  'judge': 'council_of_experts',
655
733
  'council': 'council_of_experts',
@@ -788,6 +866,10 @@ depends on rows buried in the middle, narrow the table or sort them to an edge f
788
866
  'alt_view': 'Multi-angle',
789
867
  'creative_use': 'Applications',
790
868
  'innovate': 'Innovation',
869
+ // Writing
870
+ 'storm': 'Research-first',
871
+ 're3': 'Four-pass',
872
+ 'de_generic': 'De-generic',
791
873
  // Research
792
874
  'investigate': '5W1H',
793
875
  'evidence': 'Evidence',
@@ -0,0 +1,55 @@
1
+ /**
2
+ * blog_writer — researched long-form in one call.
3
+ *
4
+ * Composes the `storm` and `re3` techniques rather than copying their text. Those
5
+ * templates live in PromptEngineerLite and are the single source of truth; a private
6
+ * copy here would drift the moment either template is edited, and the drift would be
7
+ * silent because both paths still produce well-formed prose.
8
+ */
9
+ import { z } from "zod";
10
+ import { defineModelTool } from "./factory/define-model-tool.js";
11
+ import { callOpenRouter, OpenRouterModel } from "./openrouter-tools.js";
12
+ import { withHeartbeat } from "../utils/streaming-helper.js";
13
+ import { PromptEngineerLite } from "../prompt-engineer-lite.js";
14
+ const engine = new PromptEngineerLite();
15
+ export function buildBlogWriterPrompt(args) {
16
+ const { topic, wordCount, research = true, audience } = args;
17
+ const parts = [];
18
+ if (research) {
19
+ parts.push(engine.applyTechnique("blog_writer", "storm", topic));
20
+ parts.push("Having completed the research above, now write the piece using the four-pass method below. Use only the 3 surprising answers as the spine, and carry Stage 4's outline and word budgets into Pass 1 rather than re-deriving them.");
21
+ }
22
+ parts.push(engine.applyTechnique("blog_writer", "re3", topic));
23
+ if (wordCount) {
24
+ parts.push(`TOTAL LENGTH: about ${wordCount} words. Distribute this across the sections unevenly — the section that carries the argument gets the most.`);
25
+ }
26
+ if (audience) {
27
+ parts.push(`AUDIENCE: ${audience}. Assume they know the basics; do not explain what they already know.`);
28
+ }
29
+ return parts.join("\n\n---\n\n");
30
+ }
31
+ export const blogWriterTool = defineModelTool({
32
+ name: "blog_writer",
33
+ description: "Write a researched long-form post: interview four personas for the angle, then plan/draft/restructure/line-edit in separate passes. Put the SUBJECT in the 'topic' parameter.",
34
+ parameters: z.object({
35
+ topic: z.string().describe("What the post is about (REQUIRED - put your subject here)"),
36
+ wordCount: z.number().optional().describe("Target length in words"),
37
+ research: z.boolean().optional().default(true).describe("Run the persona-interview research stage first (default true)"),
38
+ audience: z.string().optional().describe("Who it is for, e.g. 'backend engineers'"),
39
+ }),
40
+ execute: async (args, { reportProgress }) => {
41
+ const prompt = buildBlogWriterPrompt(args);
42
+ const reportFn = reportProgress ?? (async () => { });
43
+ // Timeout inherited from getOpenRouterModelTimeout() — Kimi -> 600s, plenty of
44
+ // headroom for the combined research + four-pass write in one call.
45
+ //
46
+ // maxTokens is higher than sibling single-artifact tools (testgen/security_review use
47
+ // 12000) because this tool's OUTPUT is not one artifact — re3 alone asks for a full
48
+ // draft (Pass 2), a full restructured draft (Pass 3: "Output the restructured draft,
49
+ // not notes about it"), and a full line-edited draft (Pass 4), and research:true adds
50
+ // storm's 16 marked answers plus a 4-section outline on top. The budget is per-pass,
51
+ // not per-piece, so it has to be multiplied accordingly or a long wordCount truncates
52
+ // mid-Pass-4 with no error.
53
+ return withHeartbeat(() => callOpenRouter([{ role: "user", content: prompt }], OpenRouterModel.KIMI_K3, 0.7, 16000), reportFn, 10000);
54
+ },
55
+ });
@@ -78,7 +78,7 @@ function buildPanel() {
78
78
  if (hasOpenAIApiKey()) {
79
79
  panel.push({
80
80
  key: "gpt",
81
- label: "GPT-5.6 Sol (intent & API-contract)",
81
+ label: "GPT-6 Astra (intent & API-contract)",
82
82
  call: (q) => callOpenAI([
83
83
  { role: "system", content: `You review diffs for intent mismatches and API-contract breaks (types, error paths, backward compatibility). ${FORMAT_INSTRUCTION}` },
84
84
  { role: "user", content: q },
@@ -63,7 +63,7 @@ function suggestFirstStep() {
63
63
  return ' deepseek_reason query="..." (frontier open-weight reasoning)';
64
64
  }
65
65
  if (openai) {
66
- return ' openai_reason query="..." (GPT-5.5 deep reasoning)';
66
+ return ' openai_reason query="..." (OpenAI deep reasoning)';
67
67
  }
68
68
  if (gemini) {
69
69
  return ' gemini_brainstorm query="..." (fast ideation)';
@@ -66,21 +66,22 @@ export async function callGrokEnhanced(messages, options = {}) {
66
66
  throw new Error(`Grok API error: ${response.statusText} - ${error}`);
67
67
  }
68
68
  const data = await response.json();
69
- // Responses API format: output[] contains web_search_call entries and a message entry
70
- // Structure: { output: [{ type: "web_search_call", ... }, { type: "message", content: [{ type: "output_text", text: "...", annotations: [...] }] }] }
71
- let content = "No response from Grok";
72
- let sources = [];
69
+ // Responses API format: output[] interleaves reasoning, web_search_call and
70
+ // MULTIPLE "message" entries — agentic runs emit a preamble message ("I'll
71
+ // search…"), run the searches, then emit the ANSWER as a later message.
72
+ // .find() took the first message, so any narrated run returned the plan and
73
+ // dropped the answer. Collect text + citations from EVERY message, in order.
74
+ const texts = [];
75
+ const sources = [];
73
76
  if (data.output && Array.isArray(data.output)) {
74
- // Find the message output (skip web_search_call entries)
75
- const messageOutput = data.output.find((o) => o.type === "message");
76
- if (messageOutput?.content && Array.isArray(messageOutput.content)) {
77
- // Extract text from output_text content
78
- content = messageOutput.content
79
- .filter((c) => c.type === "output_text")
80
- .map((c) => c.text)
81
- .join("\n");
82
- // Extract citations from annotations (NOT from top-level data.citations!)
77
+ for (const messageOutput of data.output) {
78
+ if (messageOutput?.type !== "message" || !Array.isArray(messageOutput.content))
79
+ continue;
83
80
  for (const contentItem of messageOutput.content) {
81
+ if (contentItem.type === "output_text" && contentItem.text) {
82
+ texts.push(contentItem.text);
83
+ }
84
+ // Extract citations from annotations (NOT from top-level data.citations!)
84
85
  if (contentItem.annotations && Array.isArray(contentItem.annotations)) {
85
86
  for (const annotation of contentItem.annotations) {
86
87
  if (annotation.type === "url_citation") {
@@ -94,6 +95,15 @@ export async function callGrokEnhanced(messages, options = {}) {
94
95
  }
95
96
  }
96
97
  }
98
+ // No visible text is a FAILURE (e.g. status:"incomplete" when reasoning
99
+ // exhausted max_output_tokens) — throw so the catch surfaces a real error
100
+ // instead of a fake "No response from Grok" success.
101
+ if (texts.length === 0) {
102
+ const reason = data.incomplete_details?.reason;
103
+ throw new Error(`${model} returned no visible text on /v1/responses ` +
104
+ `(status: ${data.status ?? 'unknown'}${reason ? `, reason: ${reason}` : ''})`);
105
+ }
106
+ const content = texts.join("\n\n");
97
107
  return {
98
108
  content,
99
109
  sources,
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * OpenAI Tools Implementation
3
- * Provides GPT-5.5 model capabilities with reasoning_effort control
3
+ * Provides GPT-6 Astra (default) and GPT-5.6 tier capabilities with reasoning_effort control
4
4
  * Uses centralized model constants from model-constants.ts
5
5
  */
6
6
  import { z } from "zod";
@@ -61,6 +61,11 @@ const ResponsesAPISchema = z.object({
61
61
  object: z.literal("response"),
62
62
  created_at: z.number(),
63
63
  status: z.string(),
64
+ // Present when status:"incomplete" — e.g. reason:"max_output_tokens" when
65
+ // reasoning consumed the whole output budget before any visible text.
66
+ incomplete_details: z.object({
67
+ reason: z.string().optional()
68
+ }).nullable().optional(),
64
69
  model: z.string(),
65
70
  output: z.array(ResponsesAPIOutputSchema),
66
71
  reasoning: z.object({
@@ -114,10 +119,10 @@ function extractApiErrorMessage(body) {
114
119
  // Re-export for backward compatibility
115
120
  // "Thinking" mode = the flagship tier with reasoning.effort="high"/"xhigh"
116
121
  export const OpenAIModel5 = {
117
- DEFAULT: OPENAI_MODELS.DEFAULT, // gpt-5.6-sol (use with reasoning.effort)
118
- THINKING: OPENAI_MODELS.DEFAULT, // gpt-5.6-sol + high effort = "thinking"
119
- PRO: OPENAI_MODELS.PRO, // gpt-5.6-sol + xhigh effort (no separate pro model in 5.6)
120
- INSTANT: OPENAI_MODELS.DEFAULT, // gpt-5.6-sol + low effort = fast
122
+ DEFAULT: OPENAI_MODELS.DEFAULT, // gpt-6-astra (use with reasoning.effort)
123
+ THINKING: OPENAI_MODELS.DEFAULT, // gpt-6-astra + high effort = "thinking"
124
+ PRO: OPENAI_MODELS.PRO, // gpt-6-astra + xhigh effort (no separate pro API model)
125
+ INSTANT: OPENAI_MODELS.DEFAULT, // gpt-6-astra + low effort = fast
121
126
  // Legacy aliases
122
127
  FULL: OPENAI_MODELS.DEFAULT,
123
128
  CODEX_MINI: OPENAI_MODELS.DEFAULT,
@@ -126,9 +131,23 @@ export const OpenAIModel5 = {
126
131
  // Backward compatibility aliases
127
132
  export const OpenAI52Model = OpenAIModel5;
128
133
  export const OpenAI51Model = OpenAIModel5;
134
+ // Models served by the Responses API: the GPT-5.x family and GPT-6 (gpt-6-astra).
135
+ // Anything else (legacy gpt-4.x, o-series) stays on Chat Completions.
136
+ function usesResponsesAPI(model) {
137
+ return model.startsWith('gpt-5.') || model.startsWith('gpt-6');
138
+ }
139
+ // gpt-6-astra accepts only low|medium|high|xhigh|max — "none"/"minimal" are a 400.
140
+ // Send the cheapest accepted level instead of failing the attempt; GPT-5.6 tiers
141
+ // still receive the caller's value unchanged (they accept "none").
142
+ function effortForModel(model, effort) {
143
+ if (model.startsWith('gpt-6') && (effort === 'none' || effort === 'minimal')) {
144
+ return 'low';
145
+ }
146
+ return effort;
147
+ }
129
148
  /**
130
149
  * Call OpenAI API with model fallback support
131
- * GPT-5.x uses /v1/responses endpoint
150
+ * GPT-5.x and GPT-6 use the /v1/responses endpoint
132
151
  */
133
152
  export async function callOpenAI(messages, model = OPENAI_MODELS.INSTANT, // Default to fast/cheap model
134
153
  temperature = 0.7, maxTokens = 16384, // Increased default for comprehensive responses
@@ -163,6 +182,9 @@ reasoningEffort = "low", requireConfirmation = false, skipValidation = false) {
163
182
  });
164
183
  // Model fallback chain
165
184
  const modelFallbacks = {
185
+ // gpt-6-astra rolled out to a limited set of orgs first (Sep 2026): an org without
186
+ // access gets 403/404, so degrade to the previous flagship, then terra.
187
+ "gpt-6-astra": ["gpt-5.6-sol", "gpt-5.6-terra"],
166
188
  // gpt-5.6-sol is org-verification gated (403 "insufficient permissions" until verified);
167
189
  // terra matches gpt-5.5 quality at half price, so it's the safe runtime fallback.
168
190
  "gpt-5.6-sol": ["gpt-5.6-terra", "gpt-5.5"],
@@ -183,24 +205,31 @@ reasoningEffort = "low", requireConfirmation = false, skipValidation = false) {
183
205
  for (const currentModel of modelsToTry) {
184
206
  console.error(`🔍 TRACE: Trying model: ${currentModel}`);
185
207
  try {
186
- // GPT-5.x uses Responses API, others use Chat Completions
187
- const isGPT5 = currentModel.startsWith('gpt-5.');
188
- const endpoint = isGPT5 ? OPENAI_RESPONSES_URL : OPENAI_CHAT_URL;
208
+ // GPT-5.x and GPT-6 use the Responses API, others use Chat Completions
209
+ const isResponsesModel = usesResponsesAPI(currentModel);
210
+ const endpoint = isResponsesModel ? OPENAI_RESPONSES_URL : OPENAI_CHAT_URL;
189
211
  let requestBody;
190
- if (isGPT5) {
191
- // Responses API format for GPT-5.2
212
+ if (isResponsesModel) {
213
+ // Responses API format. No temperature: gpt-6-astra rejects anything but the default
192
214
  // Input is array of message objects [{role, content}]
193
215
  const inputMessages = validatedMessages.map(m => ({
194
216
  role: m.role,
195
217
  content: m.content
196
218
  }));
219
+ // max_output_tokens INCLUDES reasoning tokens on the Responses API, and
220
+ // OpenAI recommends reserving at least 25k for reasoning + visible output.
221
+ // Smaller caps get exhausted by reasoning alone → status:"incomplete"
222
+ // with a reasoning-only output array and zero output_text. The cap is an
223
+ // upper bound (only generated tokens bill), so flooring it is free.
224
+ const effort = effortForModel(currentModel, reasoningEffort || 'medium');
225
+ const reasoningBudget = effort !== 'none'
226
+ ? Math.max(maxTokens, 25000)
227
+ : maxTokens;
197
228
  requestBody = {
198
229
  model: currentModel,
199
230
  input: inputMessages,
200
- reasoning: {
201
- effort: reasoningEffort || 'medium'
202
- },
203
- max_output_tokens: maxTokens
231
+ reasoning: { effort },
232
+ max_output_tokens: reasoningBudget
204
233
  };
205
234
  }
206
235
  else {
@@ -213,7 +242,7 @@ reasoningEffort = "low", requireConfirmation = false, skipValidation = false) {
213
242
  stream: false
214
243
  };
215
244
  }
216
- console.error(`🔍 TRACE: Using ${isGPT5 ? '/v1/responses' : '/v1/chat/completions'} endpoint for ${currentModel}`);
245
+ console.error(`🔍 TRACE: Using ${isResponsesModel ? '/v1/responses' : '/v1/chat/completions'} endpoint for ${currentModel}`);
217
246
  // High reasoning effort can take 2+ minutes; "max" is the slowest tier of all, so it
218
247
  // gets the long timeout too — omitting it here would abort max-effort calls at 90s.
219
248
  const timeoutMs = (reasoningEffort === 'high' || reasoningEffort === 'xhigh' || reasoningEffort === 'max')
@@ -247,8 +276,8 @@ reasoningEffort = "low", requireConfirmation = false, skipValidation = false) {
247
276
  const rawData = await response.json();
248
277
  // Parse response based on API type
249
278
  let rawContent;
250
- if (isGPT5) {
251
- // Parse Responses API response for GPT-5.2
279
+ if (isResponsesModel) {
280
+ // Parse Responses API response
252
281
  const parseResult = ResponsesAPISchema.safeParse(rawData);
253
282
  if (parseResult.success) {
254
283
  const responsesData = parseResult.data;
@@ -289,10 +318,23 @@ reasoningEffort = "low", requireConfirmation = false, skipValidation = false) {
289
318
  }
290
319
  }
291
320
  }
292
- // Ensure result is always a string
293
- const result = rawContent || "No response from OpenAI";
294
- console.error(`🔍 TRACE: ${currentModel} SUCCESS - Response length: ${result.length}`);
295
- return stripFormatting(result);
321
+ // Empty visible text is a FAILURE, not a result: the Responses API returns
322
+ // HTTP 200 + status:"incomplete" (incomplete_details.reason:"max_output_tokens")
323
+ // with a reasoning-only output array when the budget runs out before any
324
+ // output_text. Masking that as success hid the error from callers.
325
+ if (!rawContent) {
326
+ const responseStatus = rawData?.status;
327
+ const incompleteReason = rawData?.incomplete_details?.reason;
328
+ const budget = requestBody.max_output_tokens ?? requestBody.max_completion_tokens ?? maxTokens;
329
+ lastError = responseStatus === 'incomplete'
330
+ ? `${currentModel}: incomplete response (${incompleteReason ?? 'unknown reason'}) — output budget ${budget} consumed before any visible text (lower reasoning_effort or raise max_tokens)`
331
+ : `${currentModel}: empty response with status "${responseStatus ?? 'unknown'}"`;
332
+ attemptErrors.push(lastError);
333
+ console.error(`🔍 TRACE: ${currentModel} EMPTY - ${lastError}`);
334
+ continue; // Try next model instead of returning a fake success
335
+ }
336
+ console.error(`🔍 TRACE: ${currentModel} SUCCESS - Response length: ${rawContent.length}`);
337
+ return stripFormatting(rawContent);
296
338
  }
297
339
  catch (error) {
298
340
  // Handle abort/timeout specifically
@@ -401,7 +443,7 @@ export const openaiGpt5ReasonTool = defineModelTool({
401
443
  .default("analytical")
402
444
  .describe("Reasoning mode (e.g., mathematical, scientific, logical, analytical)")
403
445
  }),
404
- execute: async (args, { log, reportProgress }) => {
446
+ execute: async (args, { log, reportProgress, skipValidation }) => {
405
447
  const modePrompts = {
406
448
  mathematical: "Focus on mathematical proofs, calculations, and formal logic",
407
449
  scientific: "Apply scientific method and empirical reasoning",
@@ -426,12 +468,12 @@ ${FORMAT_INSTRUCTION}`
426
468
  }
427
469
  ];
428
470
  // Use heartbeat to prevent MCP timeout during reasoning.
429
- // Effort is xhigh, not high: this is the dedicated deep-reasoning tool and sol supports
430
- // none|low|medium|high|xhigh|max. "max" is deliberately NOT the default here — OpenAI
471
+ // Effort is xhigh, not high: this is the dedicated deep-reasoning tool and Astra supports
472
+ // low|medium|high|xhigh|max. "max" is deliberately NOT the default here — OpenAI
431
473
  // recommends reserving it for the hardest quality-first work and comparing it against
432
474
  // xhigh first, and it costs latency on every call. Both land in the 180s timeout branch.
433
475
  const reportFn = reportProgress ?? (async () => { });
434
- return await withHeartbeat(() => callOpenAI(messages, OPENAI_MODELS.DEFAULT, 0.7, 8000, OPENAI_REASONING.XHIGH), reportFn);
476
+ return await withHeartbeat(() => callOpenAI(messages, OPENAI_MODELS.DEFAULT, 0.7, 8000, OPENAI_REASONING.XHIGH, false, skipValidation || false), reportFn);
435
477
  }
436
478
  });
437
479
  /**
@@ -446,12 +488,12 @@ export const openAIBrainstormTool = defineModelTool({
446
488
  constraints: z.string().optional().describe("Technical constraints: language, framework, performance requirements, team size"),
447
489
  ...filesField,
448
490
  quantity: z.number().optional().describe("Number of approaches to generate (default: 5)"),
449
- model: z.enum(["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna"])
491
+ model: z.enum(["gpt-6-astra", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna"])
450
492
  .optional()
451
- .describe("Model to use - gpt-5.6-sol (default, flagship), gpt-5.6-terra (balanced), gpt-5.6-luna (fast/cheap)"),
493
+ .describe("Model to use - gpt-6-astra (default, flagship), gpt-5.6-sol (previous flagship), gpt-5.6-terra (balanced), gpt-5.6-luna (fast/cheap)"),
452
494
  reasoning_effort: z.enum(["none", "low", "medium", "high", "xhigh", "max"])
453
495
  .optional()
454
- .describe("Reasoning effort level - must be one of: none, low, medium, high, xhigh, max"),
496
+ .describe("Reasoning effort level - must be one of: none, low, medium, high, xhigh, max (gpt-6-astra runs none as low)"),
455
497
  max_tokens: z.number().optional().describe("Maximum tokens for response")
456
498
  }),
457
499
  execute: async (args, options = {}) => {
@@ -517,7 +559,7 @@ export const openaiCodeReviewTool = defineModelTool({
517
559
  .optional()
518
560
  .describe("Focus areas - array of: security, performance, readability, bugs, best-practices")
519
561
  }),
520
- execute: async (args, { log, reportProgress }) => {
562
+ execute: async (args, { log, reportProgress, skipValidation }) => {
521
563
  const focusText = args.focusAreas
522
564
  ? `Focus especially on: ${args.focusAreas.join(', ')}`
523
565
  : "Review all aspects: security, performance, readability, bugs, and best practices";
@@ -541,7 +583,7 @@ ${FORMAT_INSTRUCTION}`
541
583
  ];
542
584
  // Use heartbeat to prevent MCP timeout
543
585
  const reportFn = reportProgress ?? (async () => { });
544
- return await withHeartbeat(() => callOpenAI(messages, OPENAI_MODELS.DEFAULT, 0.3, 6000, "medium"), reportFn);
586
+ return await withHeartbeat(() => callOpenAI(messages, OPENAI_MODELS.DEFAULT, 0.3, 6000, "medium", false, skipValidation || false), reportFn);
545
587
  }
546
588
  });
547
589
  /**
@@ -563,7 +605,7 @@ export const openaiExplainTool = defineModelTool({
563
605
  .describe("Explanation style - must be one of: technical, simple, analogy, visual"),
564
606
  ...filesField,
565
607
  }),
566
- execute: async (args, { log }) => {
608
+ execute: async (args, { log, skipValidation }) => {
567
609
  const levelPrompts = {
568
610
  beginner: "Explain for someone with no prior knowledge",
569
611
  intermediate: "Explain for someone with basic understanding",
@@ -592,7 +634,9 @@ ${FORMAT_INSTRUCTION}`
592
634
  content: `Explain: ${args.topic}` + fileContext
593
635
  }
594
636
  ];
595
- return await callOpenAI(messages, OPENAI_MODELS.DEFAULT, 0.7, 2500, "low");
637
+ // Low-effort explanations don't need the $10/$50 flagship: pinned to sol (the pre-Astra
638
+ // default) so the GPT-6 Astra bump doesn't double this tool's per-call cost.
639
+ return await callOpenAI(messages, OPENAI_MODELS.SOL, 0.7, 2500, "low", false, skipValidation || false);
596
640
  }
597
641
  });
598
642
  /**
@@ -50,6 +50,7 @@ export var OpenRouterModel;
50
50
  OpenRouterModel["QWEN3_30B"] = "qwen/qwen3-30b-a3b-instruct-2507";
51
51
  OpenRouterModel["QWEN3_235B_THINKING"] = "qwen/qwen3-235b-a22b-thinking-2507";
52
52
  OpenRouterModel["QWQ_32B"] = "qwen/qwq-32b";
53
+ OpenRouterModel["QWEN3_8_27B"] = "qwen/qwen3.8-27b";
53
54
  OpenRouterModel["QWEN3_8_MAX"] = "qwen/qwen3.8-max";
54
55
  OpenRouterModel["QWEN3_7_MAX"] = "qwen/qwen3.7-max";
55
56
  OpenRouterModel["QWEN3_MAX_THINKING"] = "qwen/qwen3-235b-a22b-thinking-2507";
@@ -84,6 +85,7 @@ const MODEL_FALLBACKS = {
84
85
  [OpenRouterModel.QWEN3_CODER]: OpenRouterModel.QWEN3_CODER,
85
86
  [OpenRouterModel.QWEN3_8_MAX]: OpenRouterModel.QWEN3_7_MAX, // Fall back to the 3.7 flagship if 3.8 Max is quota-blocked
86
87
  [OpenRouterModel.QWEN3_7_MAX]: OpenRouterModel.QWEN3_MAX_THINKING, // Then to the open-weight 235B thinking model
88
+ [OpenRouterModel.QWEN3_8_27B]: OpenRouterModel.QWEN3_235B_THINKING, // qwq_reason: fall back to the 235B thinking model
87
89
  [OpenRouterModel.KIMI_K3]: OpenRouterModel.KIMI_K2_7_CODE, // Fall back to K2.7-Code if K3 fails (also 4x cheaper)
88
90
  [OpenRouterModel.KIMI_K2_7_CODE]: OpenRouterModel.KIMI_K2_6, // Fall back to K2.6 if K2.7-Code fails
89
91
  [OpenRouterModel.KIMI_K2_6]: OpenRouterModel.KIMI_K2_THINKING, // Fall back to k2-thinking if K2.6 fails (k2.5 retired from OpenRouter)
@@ -222,8 +224,8 @@ ${FORMAT_INSTRUCTION}`;
222
224
  }
223
225
  });
224
226
  /**
225
- * QwQ Reasoning Tool
226
- * Deep reasoning with QwQ-32B model
227
+ * QwQ Reasoning Tool (name kept for compatibility)
228
+ * Multi-perspective deliberation on Qwen3.8-27B — qwen/qwq-32b was retired from OpenRouter
227
229
  */
228
230
  export const qwqReasoningTool = defineModelTool({
229
231
  name: "qwq_reason",
@@ -283,8 +285,9 @@ ${FORMAT_INSTRUCTION}`
283
285
  content: args.problem + fileContext
284
286
  }
285
287
  ];
286
- const model = args.useFree !== false ? OpenRouterModel.QWQ_32B : OpenRouterModel.QWQ_32B;
287
- return await callOpenRouter(messages, model, 0.3, 6000);
288
+ // Effort pinned like the other Qwen 3.8 callers (qwen_algo, qwen_reason). `useFree` stays
289
+ // in the schema for compatibility but never selected a model (both branches were QwQ).
290
+ return await callOpenRouter(messages, OpenRouterModel.QWEN3_8_27B, 0.3, 6000, { reasoning_effort: "medium" });
288
291
  }
289
292
  });
290
293
  /**
@@ -348,7 +351,7 @@ export const openRouterMultiModelTool = defineModelTool({
348
351
  const modelMap = {
349
352
  "qwen-coder": OpenRouterModel.QWEN3_CODER_NEXT,
350
353
  "qwen-coder-plus": OpenRouterModel.QWEN3_CODER_NEXT,
351
- "qwq-32b": OpenRouterModel.QWQ_32B,
354
+ "qwq-32b": OpenRouterModel.QWEN3_8_27B, // qwq-32b retired from OpenRouter — alias kept for existing callers
352
355
  "kimi-k2-thinking": OpenRouterModel.KIMI_K2_THINKING
353
356
  };
354
357
  const messages = [
@@ -76,7 +76,7 @@ function buildCriticPanel() {
76
76
  if (hasOpenAIApiKey()) {
77
77
  panel.push({
78
78
  key: "gpt",
79
- label: "GPT-5.5 (edge cases & scope)",
79
+ label: "GPT-6 Astra (edge cases & scope)",
80
80
  call: (q) => callOpenAI([
81
81
  { role: "system", content: `You red-team plans for edge cases, scope gaps, and missing acceptance criteria. ${FORMAT_INSTRUCTION}` },
82
82
  { role: "user", content: q },
@@ -270,6 +270,33 @@ const TECHNIQUES = {
270
270
  example: "A rate-limit problem 'solved' by adding Redis — before anyone asked whether the caller could just batch. Three options make the default visible as a choice.",
271
271
  },
272
272
  ],
273
+ writing: [
274
+ {
275
+ name: "storm",
276
+ alias: "research_first",
277
+ description: "Interview four different personas about the topic, mark each answer KNOWN/SEARCH/OPINION, then build the piece around only the 3 answers that would surprise a reader who knows the basics. (arXiv:2402.14207)",
278
+ useWhen: "Any researched piece — article, doc, report — where you would otherwise start drafting from what you already know.",
279
+ example: "Generic writing happens because the model answers the obvious questions. The sceptic's awkward question is the one that makes the piece worth reading.",
280
+ tier: 'core',
281
+ kind: 'contract',
282
+ },
283
+ {
284
+ name: "re3",
285
+ alias: "four_pass",
286
+ description: "Plan, draft, restructure, then line-edit — as four separate passes, never combined. (arXiv:2210.06774)",
287
+ useWhen: "Anything past a few hundred words that has to hold together.",
288
+ example: "Ask for structure and sentence polish at once and you get neither: the model tidies prose in a piece whose architecture is wrong. If the draft never got shorter, the restructure pass did not happen.",
289
+ tier: 'core',
290
+ kind: 'contract',
291
+ },
292
+ {
293
+ name: "de_generic",
294
+ alias: "fix_boring",
295
+ description: "Attack originality, elaboration and specificity directly instead of asking for a better draft — fluency is the part that was already fine. (arXiv:2309.14556)",
296
+ useWhen: "A draft that reads competently and says nothing.",
297
+ example: "\"Improve this\" gets you more fluency, which is what made it dull. The test is whether a competitor could publish it unchanged under their own name.",
298
+ },
299
+ ],
273
300
  research: [
274
301
  {
275
302
  name: "investigate",
@@ -776,6 +803,14 @@ const RECOMMEND_RULES = [
776
803
  techniques: ["adversarial", "constitutional"], why: "steelman then attack, and critique against explicit principles" },
777
804
  { match: /\b(idea|brainstorm|creative|novel|alternative|possibilit)\b/i,
778
805
  techniques: ["innovate", "what_if", "alt_view"], why: "generate unconventional options and view from several angles" },
806
+ // Writing intent previously matched nothing here and fell through to
807
+ // CORE_TECHNIQUES.slice(0,3) — chain_of_note/astute_rag/spotlighting, none of
808
+ // which have anything to do with drafting prose. storm researches before the
809
+ // first word is written, re3 keeps structural and line editing as separate
810
+ // passes instead of fighting each other in one, and de_generic attacks
811
+ // competent-but-boring output directly rather than vaguely asking for "better".
812
+ { match: /\b(write|writing|draft|blog|article|essay|post|prose|long[- ]form|revise|rewrite|edit(ing)?|boring|generic|dull)\b/i,
813
+ techniques: ["storm", "re3", "de_generic"], why: "research before drafting, keep structural and line editing in separate passes, and attack originality directly" },
779
814
  { match: /\b(arithmetic|calculat\w*|comput(e|es|ing|ation\w*)|count\w*|how many|sum|total|percentage|math|numeric)\b/i,
780
815
  techniques: ["program_of_thoughts"], why: "compute it in code rather than in prose, where digits drift" },
781
816
  { match: /\b(verif\w*|fact[- ]?check\w*|double[- ]?check|is (this|that) (true|correct|right)|accura\w*|claims?|hallucinat\w*)\b/i,
@@ -875,7 +910,7 @@ export const listPromptTechniquesTool = defineModelTool({
875
910
  description: `Discover prompt engineering techniques. By default shows the ${CORE_COUNT} CORE techniques that still help 2026 reasoning models (output-structure contracts). Pass all=true for all ${TECHNIQUE_COUNT}, or filter by category. Don't know which? preview_prompt_technique with technique="auto".`,
876
911
  parameters: z.object({
877
912
  all: z.boolean().optional().default(false).describe(`Show all ${TECHNIQUE_COUNT} techniques (default false = core only)`),
878
- filter: z.enum(["all", "creative", "research", "analytical", "reflective", "reasoning", "verification", "meta", "debate", "judgment", "engineering", "research_advanced", "decision", "structured_coding", "retrieval", "security", "few_shot", "tabular"])
913
+ filter: z.enum(["all", "creative", "writing", "research", "analytical", "reflective", "reasoning", "verification", "meta", "debate", "judgment", "engineering", "research_advanced", "decision", "structured_coding", "retrieval", "security", "few_shot", "tabular"])
879
914
  .optional()
880
915
  .describe("Show one category in full (implies all techniques in it)")
881
916
  }),
@@ -1183,6 +1218,10 @@ async function executeTargetTool(toolName, prompt, context) {
1183
1218
  const { kimiThinkingTool } = await import('./openrouter-tools.js');
1184
1219
  return kimiThinkingTool.execute({ problem: prompt }, context);
1185
1220
  },
1221
+ 'blog_writer': async () => {
1222
+ const { blogWriterTool } = await import('./blog-writer-tool.js');
1223
+ return blogWriterTool.execute({ topic: prompt }, context);
1224
+ },
1186
1225
  };
1187
1226
  const executor = toolMappings[toolName];
1188
1227
  if (!executor) {
@@ -93,6 +93,7 @@ export const PROVIDER_GROUPS = [
93
93
  "list_plans",
94
94
  "testgen",
95
95
  "security_review",
96
+ "blog_writer",
96
97
  ],
97
98
  },
98
99
  {
@@ -121,7 +121,7 @@ export async function getAllTools(inlineTools = []) {
121
121
  tools.push(...[
122
122
  qwenCoderTool,
123
123
  qwenAlgoTool,
124
- qwqReasoningTool, // QwQ-32B — multi-perspective deliberation (free tier)
124
+ qwqReasoningTool, // Qwen3.8-27B — multi-perspective deliberation (cheap)
125
125
  qwenCompetitiveTool,
126
126
  kimiThinkingTool,
127
127
  kimiCodeTool, // SWE-focused code (Kimi K2.5 - 76.8% SWE-Bench)
@@ -146,6 +146,9 @@ export async function getAllTools(inlineTools = []) {
146
146
  // security_review — dedicated security audit (DeepSeek V4 Pro) — gated on OpenRouter.
147
147
  const { securityReviewTool } = await import("./security-review-tool.js");
148
148
  tools.push(securityReviewTool);
149
+ // blog_writer — researched long-form via Kimi — gated on OpenRouter.
150
+ const { blogWriterTool } = await import("./blog-writer-tool.js");
151
+ tools.push(blogWriterTool);
149
152
  }
150
153
  // 6) Local-model tools (Ollama / LM Studio / llama.cpp / vLLM). Registered
151
154
  // unconditionally; profile membership enforced downstream by