@yanzc/claude-pro 0.7.3 → 0.7.5

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.
package/src/prompts.js CHANGED
@@ -44,7 +44,7 @@ function instructionFiles(cwd) {
44
44
  }
45
45
 
46
46
  // `autoCompact`: the conversation is summarized when it grows long (Config.autoCompactEnabled), which the model is told.
47
- export function mainSystemPrompt({ cwd, model, shellName, extra = '', autoMemory = null, selfRestart = false, installedCopy = false, autoCompact = true, snapshot = null }) {
47
+ export function mainSystemPrompt({ cwd, model, shellName, extra = '', autoMemory = null, mcpInstructions = '', selfRestart = false, installedCopy = false, autoCompact = true, snapshot = null }) {
48
48
  const files = instructionFiles(cwd);
49
49
  const memoryText = files
50
50
  ? `\n\n# Memory\nProject and user instructions are shown below: the facts of this project (its environment, mechanisms, commands) and how the user wants to work in it. Where they differ from the defaults above, they win.\n\n${files}`
@@ -96,12 +96,12 @@ You are ${APP_NAME}, installed in ${INSTALL_DIR} (an installed copy, e.g. from n
96
96
  ` : ''}# Code references
97
97
  When referencing specific functions or pieces of code include the pattern \`file_path:line_number\` so the user can navigate to the source.
98
98
 
99
- ${environmentBlock(cwd, { model, shellName, snapshot })}${memoryText}${autoMemory ? `\n\n${autoMemorySection(autoMemory)}` : ''}${extra ? `\n\n${extra}` : ''}`;
99
+ ${environmentBlock(cwd, { model, shellName, snapshot })}${memoryText}${autoMemory ? `\n\n${autoMemorySection(autoMemory)}` : ''}${mcpInstructions ? `\n\n${mcpInstructions}` : ''}${extra ? `\n\n${extra}` : ''}`;
100
100
  }
101
101
 
102
102
  // `readOnly`: an agent whose own prompt forbids changing anything (Explore, Plan) gets neither the boundaries nor
103
103
  // the project's instructions, which only matter to an agent that changes things and cost tokens on every call.
104
- export function subagentSystemPrompt({ cwd, model, shellName, agentPrompt, snapshot = null, readOnly = false }) {
104
+ export function subagentSystemPrompt({ cwd, model, shellName, agentPrompt, snapshot = null, mcpInstructions = '', readOnly = false }) {
105
105
  const files = readOnly ? '' : instructionFiles(cwd);
106
106
  return `${agentPrompt}
107
107
 
@@ -116,11 +116,11 @@ ${readOnly ? '' : `
116
116
  - Do not commit, push or publish unless your task asks for it: the main agent decides that.
117
117
  - Edits made with Write, Edit and NotebookEdit can be undone with /rewind; changes made through Bash cannot.
118
118
  `}
119
- ${environmentBlock(cwd, { model, shellName, snapshot })}${files ? `\n\n# Project instructions\nThe instructions that apply in this project: its environment, commands and conventions. Follow them for how you work here; committing, pushing and publishing stay the main agent's to decide, whatever they say.\n\n${files}` : ''}`;
119
+ ${environmentBlock(cwd, { model, shellName, snapshot })}${files ? `\n\n# Project instructions\nThe instructions that apply in this project: its environment, commands and conventions. Follow them for how you work here; committing, pushing and publishing stay the main agent's to decide, whatever they say.\n\n${files}` : ''}${mcpInstructions ? `\n\n${mcpInstructions}` : ''}`;
120
120
  }
121
121
 
122
122
  // The terminal tab's title follows the topic of the conversation: after each message the user sends, the
123
- // small model says whether it starts a new topic and names it (as the official client does).
123
+ // current model says whether it starts a new topic and names it (as the official client does).
124
124
  export const TOPIC_TITLE_SYSTEM = 'You name the topic of a conversation between a user and a coding assistant, for the title of a terminal tab. Reply with JSON only.';
125
125
 
126
126
  export function topicTitlePrompt(current, message) {
@@ -138,19 +138,25 @@ ${current ? 'Does this message start a new topic (a different task or question),
138
138
  export const SUMMARY_SYSTEM = 'You are a helpful AI assistant tasked with summarizing conversations.';
139
139
 
140
140
  export function compactPrompt(instructions) {
141
- return `CRITICAL: Respond with TEXT ONLY. Do NOT call any tools: the conversation above is complete, and the only thing wanted now is the summary below.
141
+ return `CRITICAL: Respond with TEXT ONLY. Do NOT call any tools: the conversation above is complete, and the only thing wanted now is the structured state and summary below.
142
142
 
143
- Your task is to create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions.
144
- This summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing development work without losing context.
143
+ Your task is to preserve the state needed to continue the work after this conversation is compacted and to create a detailed summary of the conversation. Pay close attention to the user's explicit requests, your previous actions, exact file paths, commands, test results, failures and unresolved questions.
145
144
 
146
- Before providing your final summary, wrap your analysis in <analysis> tags to organize your thoughts. Then write the summary in <summary> tags with these sections:
145
+ First write exactly one <work-state> block containing one valid JSON object. Do not use markdown fences inside the block. Use this schema exactly; use an empty string or [] when a field has no value:
146
+ <work-state>
147
+ {"schema_version":1,"objective":"","constraints":[],"decisions":[],"files":[],"edits":[],"tests":[],"failures":[],"open_questions":[],"next_action":"","tool_artifacts":[]}
148
+ </work-state>
149
+ All array items must be strings. Keep paths, commands, error messages and next actions precise. The state is machine-validated, so do not add prose before or after the JSON inside <work-state>.
147
150
 
151
+ Then wrap your analysis in <analysis> tags to organize your thoughts, and write a detailed narrative in <summary> tags. The narrative should retain technical details, code patterns and architectural decisions that would be useful if the structured state is incomplete.
152
+
153
+ Use these summary sections:
148
154
  1. Primary Request and Intent: Capture all of the user's explicit requests and intents in detail
149
155
  2. Key Technical Concepts: List all important technical concepts, technologies, and frameworks discussed.
150
156
  3. Files and Code Sections: Enumerate specific files and code sections examined, modified, or created. Include full code snippets where applicable and a summary of why each file read or edit is important.
151
157
  4. Errors and fixes: List all errors that you ran into, and how you fixed them. Pay special attention to specific user feedback.
152
158
  5. Problem Solving: Document problems solved and any ongoing troubleshooting efforts.
153
- 6. All user messages: List ALL user messages that are not tool results. These are critical for understanding the users' feedback and changing intent.
159
+ 6. All user messages: List ALL user messages that are not tool results. These are critical for understanding the user's feedback and changing intent.
154
160
  7. Pending Tasks: Outline any pending tasks that you have explicitly been asked to work on.
155
161
  8. Current Work: Describe in detail precisely what was being worked on immediately before this summary request, including file names and code snippets.
156
162
  9. Optional Next Step: The next step directly in line with the user's most recent explicit request. Include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off.
@@ -170,14 +176,17 @@ export function partialCompactPrompt(part, label, instructions = '') {
170
176
  }
171
177
 
172
178
  // The message that stands in the conversation for the part a partial summary replaced.
173
- export function partialSummaryMessage(part, summary) {
179
+ export function partialSummaryMessage(part, summary, workState = null) {
180
+ const state = workState ? `\n\nThe validated structured work state for this summarized section is:\n<work-state>\n${JSON.stringify(workState, null, 2)}\n</work-state>` : '';
174
181
  return part === 'before'
175
- ? `[Summarized conversation] The earlier part of this conversation was summarized at the user's request; the messages after this one are as they were. The summary of the earlier part:\n${summary}`
176
- : `[Summarized conversation] The later part of this conversation, from the user's message where this summary stands to where it was, was summarized at the user's request. The summary of that part:\n${summary}`;
182
+ ? `[Summarized conversation] The earlier part of this conversation was summarized at the user's request; the messages after this one are as they were. The summary of the earlier part:${state}\n${summary}`
183
+ : `[Summarized conversation] The later part of this conversation, from the user's message where this summary stands to where it was, was summarized at the user's request. The summary of that part:${state}\n${summary}`;
177
184
  }
178
185
 
179
- export function continuationMessage(summary, { auto }) {
180
- return `This session is being continued from a previous conversation that ran out of context. The conversation is summarized below:
186
+ export function continuationMessage(summary, { auto, workState = null, workStateWarning = '' }) {
187
+ const state = workState ? `\n\nThe validated structured work state is:\n<work-state>\n${JSON.stringify(workState, null, 2)}\n</work-state>` : '';
188
+ const warning = workStateWarning ? `\n\n<system-reminder>${workStateWarning}</system-reminder>` : '';
189
+ return `This session is being continued from a previous conversation that ran out of context. The conversation is summarized below:${state}${warning}
181
190
  ${summary}${auto ? '\n\nPlease continue the conversation from where we left it off without asking the user any further questions. Continue with the last task that you were asked to work on.' : ''}`;
182
191
  }
183
192
 
package/src/runtime.js CHANGED
@@ -16,9 +16,12 @@ import { BackgroundTasks, taskNotification } from './tasks.js';
16
16
  import { autoMemoryDir, pruneToolResults, pruneCheckpoints, projectDir } from './session.js';
17
17
  import { loadAutoMemoryIndex, takeEnvSnapshot, localDate } from './context.js';
18
18
  import { canRestart } from './restart.js';
19
+ import { RuntimeTrace } from './trace.js';
20
+ import { loadActivePrompt } from './prompt-profiles.js';
19
21
 
20
- export async function createRuntime({ cwd, flags = {}, io }) {
22
+ export async function createRuntime({ cwd, flags = {}, io, sessionId = '' }) {
21
23
  const config = loadConfig({ cwd, flags });
24
+ const trace = new RuntimeTrace({ cwd, sessionId, enabled: config.traceEnabled, dir: config.traceDir, maxBytes: config.traceMaxBytes });
22
25
  applyRememberedChoices(config, flags); // what /model and /effort chose last time
23
26
  if (flags.verify) config.verifyOverride = flags.verify;
24
27
  pruneToolResults(cwd);
@@ -35,7 +38,7 @@ export async function createRuntime({ cwd, flags = {}, io }) {
35
38
  const hooks = new HookRunner(config);
36
39
  const tasks = new BackgroundTasks();
37
40
  const memoryDir = autoMemoryDir(cwd);
38
- const runtime = { config, checkpoints, agents, mcp, shell, io, cwd, hooks, tasks, memoryDir };
41
+ const runtime = { config, checkpoints, agents, mcp, shell, io, cwd, hooks, tasks, memoryDir, trace };
39
42
  runtime.skills = loadSkills(cwd);
40
43
  // The self-check builds the Restart tool too, so that a mistake in it is found before a restart relies on it.
41
44
  const restartable = canRestart() || process.env.CLAUDE_PRO_SELF_CHECK === '1';
@@ -59,9 +62,12 @@ export async function createRuntime({ cwd, flags = {}, io }) {
59
62
  runtime.systemPrompt = () => {
60
63
  if (!promptCache) {
61
64
  const autoMemory = config.autoMemoryEnabled ? { dir: memoryDir, index: loadAutoMemoryIndex(memoryDir) } : null;
65
+ const savedPrompt = flags.systemPrompt === undefined ? loadActivePrompt() : null;
62
66
  promptCache = flags.systemPrompt !== undefined
63
67
  ? flags.systemPrompt
64
- : mainSystemPrompt({ cwd, model: config.mainModel, shellName: shell.name, extra: flags.appendSystemPrompt || '', autoMemory, selfRestart: selfEdit, installedCopy: !SOURCE_CHECKOUT, autoCompact: config.autoCompactEnabled, snapshot: snapshotFor(cwd) });
68
+ : savedPrompt?.text != null
69
+ ? savedPrompt.text
70
+ : mainSystemPrompt({ cwd, model: config.model, shellName: shell.name, extra: flags.appendSystemPrompt || '', autoMemory, mcpInstructions: mcp.promptInstructions(), selfRestart: selfEdit, installedCopy: !SOURCE_CHECKOUT, autoCompact: config.autoCompactEnabled, snapshot: snapshotFor(cwd) });
65
71
  promptStale = false;
66
72
  }
67
73
  return promptCache;
@@ -84,7 +90,7 @@ export async function createRuntime({ cwd, flags = {}, io }) {
84
90
  const extra = flags.appendSystemPrompt || '';
85
91
  if (extra && !saved.endsWith(`\n\n${extra}`)) return false;
86
92
  const modelIn = (text) => /^You are powered by the model (.+)\.$/m.exec(text)?.[1];
87
- if (modelIn(saved) !== config.mainModel.id) return false;
93
+ if (modelIn(saved) !== config.model.id) return false;
88
94
  promptCache = saved;
89
95
  promptStale = false;
90
96
  const then = /^Today's date: (\d{4}-\d{2}-\d{2})$/m.exec(saved)?.[1];
@@ -107,20 +113,20 @@ export async function createRuntime({ cwd, flags = {}, io }) {
107
113
  return true;
108
114
  };
109
115
 
110
- // `model` and `effort`: what the Task call asked for, over the agent definition's own, over the session's.
111
- runtime.spawnSubagent = async ({ def, prompt, description, ctx, model: modelSpec, effort }) => {
112
- const spec = modelSpec || def.model;
113
- const model = spec ? config.resolveModel(spec) : config.subagentModel;
116
+ // Every agent uses the model selected for this session; effort may still be specific to the task.
117
+ runtime.spawnSubagent = async ({ def, prompt, description, ctx, effort }) => {
118
+ const model = config.model;
114
119
  const subIo = io.subagentIo ? io.subagentIo({ def, description, parentCtx: ctx }) : {};
115
120
  // The main agent is depth 0; an agent below the nesting limit may start sub-agents itself.
116
121
  const depth = (ctx.depth ?? ctx.agent?.depth ?? 0) + 1;
122
+ const subTools = toolsForSubagent(runtime.tools, def, { allowTask: depth < config.maxSubagentDepth });
117
123
  const sub = new Agent({
118
124
  config,
119
125
  checkpoints,
120
126
  depth,
121
127
  spawnSubagent: runtime.spawnSubagent,
122
- tools: toolsForSubagent(runtime.tools, def, { allowTask: depth < config.maxSubagentDepth }),
123
- systemPrompt: subagentSystemPrompt({ cwd: ctx.cwd, model, shellName: shell.name, agentPrompt: def.prompt, snapshot: snapshotFor(ctx.cwd), readOnly: Boolean(def.readOnly) }),
128
+ tools: subTools,
129
+ systemPrompt: subagentSystemPrompt({ cwd: ctx.cwd, model, shellName: shell.name, agentPrompt: def.prompt, snapshot: snapshotFor(ctx.cwd), mcpInstructions: subTools.some((tool) => tool.mcp) ? mcp.promptInstructions() : '', readOnly: Boolean(def.readOnly) }),
124
130
  io: subIo,
125
131
  model,
126
132
  isSubagent: true,
@@ -129,6 +135,7 @@ export async function createRuntime({ cwd, flags = {}, io }) {
129
135
  hooks,
130
136
  effort: effort || def.effort,
131
137
  compactWindow: def.autoCompactWindow,
138
+ trace,
132
139
  });
133
140
  let result;
134
141
  try {
@@ -151,13 +158,14 @@ export async function createRuntime({ cwd, flags = {}, io }) {
151
158
  tools: runtime.tools,
152
159
  systemPrompt: runtime.systemPrompt,
153
160
  io,
154
- model: () => config.mainModel,
161
+ model: () => config.model,
155
162
  cwd,
156
163
  spawnSubagent: runtime.spawnSubagent,
157
164
  hooks,
158
165
  tasks,
159
166
  refreshSystemPrompt: () => runtime.invalidateSystemPrompt(), // a compaction starts the conversation over
160
167
  beforeTurn: () => runtime.noteDateChange(),
168
+ trace,
161
169
  });
162
170
 
163
171
  // A finished background agent's report is queued for the main agent; the UI decides
@@ -25,7 +25,7 @@ Do not raise it for routine work, and do not switch back and forth: the prompt c
25
25
  async call(input) {
26
26
  const level = String(input.level || '').trim().toLowerCase();
27
27
  if (!EFFORT_LEVELS.includes(level)) return { isError: true, content: `Unknown effort "${input.level}". Use one of: ${EFFORT_LEVELS.join(', ')}.` };
28
- const shown = () => config.effort || defaultEffort(config.mainModel.id, config) || 'the model default';
28
+ const shown = () => config.effort || defaultEffort(config.model.id, config) || 'the model default';
29
29
  const before = shown();
30
30
  if (level === before) return { content: `The effort is already ${level}.` };
31
31
  config.effortBoost = null;
@@ -15,7 +15,7 @@ import { ListPeersTool, MessagePeerTool } from './peers.js';
15
15
  // `peers`: an interactive session, which can talk to the other sessions on this machine.
16
16
  export function buildTools(config, { agents, skills, mcpTools = [], restart = false, peers = false }) {
17
17
  return [
18
- makeTaskTool(agents, config),
18
+ makeTaskTool(agents),
19
19
  ...(skills?.size ? [makeSkillTool(skills)] : []),
20
20
  TaskOutputTool,
21
21
  TaskStopTool,
package/src/tools/task.js CHANGED
@@ -4,7 +4,6 @@
4
4
 
5
5
  import { taskResultText } from '../tasks.js';
6
6
  import { EFFORTS } from '../agents.js';
7
- import { priceOf } from '../pricing.js';
8
7
 
9
8
  // Wait for `promise`, at most `ms`, or until `signal` aborts. The timer is always cleared so a
10
9
  // finished wait never keeps the process alive.
@@ -21,29 +20,9 @@ function waitFor(promise, ms, signal) {
21
20
  });
22
21
  }
23
22
 
24
- // How to pick a sub-agent's model, where the main agent chooses it (Config.subagentModelChosen): the models the
25
- // aliases stand for, with their prices. Built from the configuration of the moment, so that it follows /model and
26
- // /login (which start a new prompt cache anyway); it holds nothing that changes otherwise.
27
- export function modelChoiceText(config) {
28
- if (!config?.subagentModelChosen) return '';
29
- const main = config.mainModel.id;
30
- const option = (alias) => {
31
- const id = config.resolveModel(alias).id;
32
- const p = priceOf(id);
33
- return `${alias} (${id}${id === main ? ', your own model' : ''}${p ? `, $${p.input}/$${p.output} per million input/output tokens` : ''})`;
34
- };
35
- return `
36
-
37
- Choosing the model: there is no fixed sub-agent model. Choose one for each task by how hard it is and how much you will rely on the report, and give it in \`model\`:
38
- - ${option('haiku')}: mechanical work with a clear target: find where something is defined or used, list files, read files and quote the relevant parts.
39
- - ${option('sonnet')}: searches across a codebase and well-specified subtasks whose steps are clear: gather the call sites of a function and how they use it, run tests and summarize the failures, make a change that is fully described.
40
- - ${option('opus')}: work whose quality your answer depends on and that you will not redo yourself: hard debugging, design and trade-offs, reviewing code for subtle bugs, analysis that spans many files.
41
- A shallow or wrong report that you rely on costs more than the difference in price; a strong model on a lookup only wastes money. Set \`effort\` with it (low suits lookups); without it the agent runs at your session's effort. Without \`model\` an agent runs on its definition's model, else on ${config.subagentModel.id}.`;
42
- }
43
-
44
- export function makeTaskTool(agents, config = null) {
23
+ export function makeTaskTool(agents) {
45
24
  const list = [...agents.values()]
46
- .map((a) => `- ${a.name}: ${a.description} (Tools: ${a.tools === '*' ? 'All tools' : a.tools.join(', ')})${a.model ? ` (model: ${a.model})` : ''}`)
25
+ .map((a) => `- ${a.name}: ${a.description} (Tools: ${a.tools === '*' ? 'All tools' : a.tools.join(', ')})`)
47
26
  .join('\n');
48
27
  return {
49
28
  name: 'Task',
@@ -65,9 +44,9 @@ Usage notes:
65
44
  - When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.
66
45
  - Each agent invocation is stateless. Your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message.
67
46
  - Once you have delegated a search or an investigation, do not also do it yourself: wait for the report, doing other work meanwhile. Never make up or predict the result of an agent that is still running; if the user asks before it is done, say that it is still running.
68
- - A sub-agent may run on a smaller model than yours. Use its report to find your way, but before you build an answer or a change on one of its findings, check that finding yourself (read the lines it cites)
47
+ - Every agent uses the model currently selected for this session. An agent may still use its own effort level when the task needs it. Use the agent's report to find your way, but before you build an answer or a change on one of its findings, check that finding yourself (read the lines it cites).
69
48
  - Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent
70
- - Set run_in_background: true to start the agent and continue working while it runs (e.g. a long investigation, or several independent jobs). You get a task id back immediately, and the agent's final report arrives automatically in a <task-notification> once it finishes; you do not need to poll. Use TaskOutput to check on or wait for it early, and TaskStop to cancel it. Do not start background agents that edit the same files at the same time.${modelChoiceText(config)}`,
49
+ - Set run_in_background: true to start the agent and continue working while it runs (e.g. a long investigation, or several independent jobs). You get a task id back immediately, and the agent's final report arrives automatically in a <task-notification> once it finishes; you do not need to poll. Use TaskOutput to check on or wait for it early, and TaskStop to cancel it. Do not start background agents that edit the same files at the same time.`,
71
50
  input_schema: {
72
51
  type: 'object',
73
52
  properties: {
@@ -75,13 +54,12 @@ Usage notes:
75
54
  prompt: { type: 'string', description: 'The task for the agent to perform' },
76
55
  subagent_type: { type: 'string', description: 'The type of specialized agent to use for this task' },
77
56
  run_in_background: { type: 'boolean', description: 'Run the agent in the background and return immediately with a task id' },
78
- model: { type: 'string', description: 'Model for this agent: haiku, sonnet, opus or a full model id. Pick it by how hard the task is: a smaller model is cheaper and faster for lookups and clear subtasks, a stronger one is right when you rely on the quality of its report. Defaults to the agent definition\'s model, else the sub-agent default.' },
79
57
  effort: { type: 'string', enum: EFFORTS, description: 'Optional effort level for this agent (default: the agent definition\'s, else the session\'s). Low suits quick lookups, high or above hard reasoning.' },
80
58
  },
81
59
  required: ['description', 'prompt', 'subagent_type'],
82
60
  },
83
61
  summarize(input) {
84
- const on = [input.model, input.effort].filter(Boolean).join(' · ');
62
+ const on = input.effort ? `effort ${input.effort}` : '';
85
63
  return `${input.description || ''}${on ? ` (${on})` : ''}${input.run_in_background ? ' (background)' : ''}`;
86
64
  },
87
65
  label(input) { return input.subagent_type && input.subagent_type !== 'general-purpose' ? input.subagent_type : 'Task'; },
@@ -92,7 +70,7 @@ Usage notes:
92
70
  }
93
71
  const effort = input.effort ? String(input.effort).toLowerCase() : undefined;
94
72
  if (effort && !EFFORTS.includes(effort)) return { isError: true, content: `Unknown effort '${input.effort}'. Use one of: ${EFFORTS.join(', ')}.` };
95
- const choice = { model: input.model?.trim() || undefined, effort };
73
+ const choice = { effort };
96
74
  if (input.run_in_background) {
97
75
  if (!ctx.tasks) return { isError: true, content: 'Background agents are not available here; run the task in the foreground.' };
98
76
  // The task outlives this turn, so it gets its own signal and no live progress display.
package/src/tools/web.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // WebFetch (fetch a page, convert to markdown-ish text, answer a prompt about it with the
2
- // small model) and WebSearch (DuckDuckGo HTML endpoint with a Bing fallback).
2
+ // currently selected model) and WebSearch (DuckDuckGo HTML endpoint with a Bing fallback).
3
3
 
4
4
  import { quickQuery } from '../api.js';
5
5
 
@@ -140,7 +140,7 @@ export function makeWebFetchTool(config) {
140
140
  return {
141
141
  name: 'WebFetch',
142
142
  readOnly: true,
143
- description: `- Fetches content from a specified URL (any scheme the network allows, including localhost and private addresses), converts HTML to markdown, and answers a prompt about it using a small, fast model
143
+ description: `- Fetches content from a specified URL (any scheme the network allows, including localhost and private addresses), converts HTML to markdown, and answers a prompt about it using the model currently selected for this session
144
144
  - Takes a URL and a prompt as input
145
145
  - Set raw: true to get the converted page text itself instead of an answer: use it when you need the exact content, code, tables or the whole document (very long pages are saved to a file and previewed; read the file for the rest)
146
146
  - Use this tool when you need to retrieve and analyze web content
@@ -155,7 +155,7 @@ Usage notes:
155
155
  properties: {
156
156
  url: { type: 'string', format: 'uri', description: 'The URL to fetch content from' },
157
157
  prompt: { type: 'string', description: 'The prompt to run on the fetched content' },
158
- raw: { type: 'boolean', description: 'Return the converted page text itself instead of an answer from the small model' },
158
+ raw: { type: 'boolean', description: 'Return the converted page text itself instead of an answer from the selected model' },
159
159
  },
160
160
  required: ['url'],
161
161
  },
@@ -182,7 +182,7 @@ Usage notes:
182
182
  const content = page.text.length > 400_000 ? page.text.slice(0, 400_000) + '\n\n[content truncated]' : page.text;
183
183
  try {
184
184
  const answer = await quickQuery(config, {
185
- model: config.smallModel,
185
+ model: config.model,
186
186
  system: 'You extract information from web pages. Answer only from the provided content. Be complete and precise: include every relevant detail, exact quotes, numbers and code. Keep code blocks intact.',
187
187
  prompt: `Web page content from ${page.finalUrl || url.href}:\n---\n${content}\n---\n\n${input.prompt || 'Summarize this page, keeping all important details, code and numbers.'}\n\nRespond based only on the content above.`,
188
188
  maxTokens: 16_000,