mirror of
https://github.com/bendtherules/ask262.git
synced 2026-08-18 21:31:46 +00:00
Improve prompt
This commit is contained in:
+17
-6
@@ -171,15 +171,13 @@ async function createMcpServer() {
|
|||||||
role: "assistant",
|
role: "assistant",
|
||||||
content: {
|
content: {
|
||||||
type: "text",
|
type: "text",
|
||||||
text: `I'll help you explore this using the ECMAScript specification. Let me orchestrate the ask262 tools to find accurate information.
|
text: `I'll help you understand this from the ECMAScript specification using ask262 tools.
|
||||||
|
|
||||||
Available tools:
|
Available tools:
|
||||||
- ask262_search_spec_sections: Vector search to find relevant spec section ids
|
- ask262_search_spec_sections: Vector search to find relevant spec section ids
|
||||||
- ask262_get_section_content: Retrieve full text from a spec section id
|
- ask262_get_section_content: Retrieve full text from a spec section id
|
||||||
- ask262_evaluate_in_engine262: Execute pure JS and capture which spec section ids are hit. Has 1-second timeout for safety.
|
- ask262_evaluate_in_engine262: Execute pure JS and capture which spec section ids are hit. Has 1-second timeout for safety.
|
||||||
|
|
||||||
Based on your question: "${question}"
|
|
||||||
|
|
||||||
I'll use one of these orchestration patterns:
|
I'll use one of these orchestration patterns:
|
||||||
|
|
||||||
PATTERN 1 - For "What happens when I run this code?" questions:
|
PATTERN 1 - For "What happens when I run this code?" questions:
|
||||||
@@ -188,17 +186,30 @@ PATTERN 1 - For "What happens when I run this code?" questions:
|
|||||||
- STEP 2: ask262_get_section_content(sectionIds: ["sec-1", "sec-2"], recursive: true)
|
- STEP 2: ask262_get_section_content(sectionIds: ["sec-1", "sec-2"], recursive: true)
|
||||||
- Explain which spec sections were hit and why
|
- Explain which spec sections were hit and why
|
||||||
|
|
||||||
PATTERN 2 - For "How does X work?" questions (e.g., "${question}"):
|
PATTERN 2 - For "How does X work?" questions:
|
||||||
- Flow A: Generate a specific code example and follow Pattern 1
|
- Flow A: Generate a specific code example and follow Pattern 1
|
||||||
- Flow B: If no code example possible, search broadly:
|
- Flow B: If no code example possible, search broadly:
|
||||||
* STEP 1: ask262_search_spec_sections(query: relevant keywords from "${question}")
|
* STEP 1: ask262_search_spec_sections(query: "<relevant keywords>")
|
||||||
* STEP 2: ask262_get_section_content(sectionIds: ["sec-1", "sec-2"], recursive: true)
|
* STEP 2: ask262_get_section_content(sectionIds: ["sec-1", "sec-2"], recursive: true)
|
||||||
|
|
||||||
I prefer Pattern 1 when possible as it provides exact spec sections through execution.
|
I prefer Pattern 1 when possible as it provides exact spec sections through execution.
|
||||||
|
|
||||||
|
Example - How pushing to array works?
|
||||||
|
- Maps to Pattern 2, Flow A:
|
||||||
|
- I'll generate this code:
|
||||||
|
let arr = [];
|
||||||
|
ask262Debug.startImportant();
|
||||||
|
arr.push(1);
|
||||||
|
ask262Debug.stopImportant();
|
||||||
|
console.log(arr);
|
||||||
|
console.log(arr.length);
|
||||||
|
- I'll run it through ask262_evaluate_in_engine262 to find important sections
|
||||||
|
- I'll get content for some of those sections with ask262_get_section_content
|
||||||
|
- I'll explain which sections were hit and how they relate to Array.prototype.push and length property
|
||||||
|
|
||||||
Key principles:
|
Key principles:
|
||||||
- Ignore internal knowledge about Javascript/ECMAScript - rely only on spec sections from tools
|
- Ignore internal knowledge about Javascript/ECMAScript - rely only on spec sections from tools
|
||||||
- Reference specific spec sections by section id (sec-array.prototype.map) or number/name (e.g., "23.1.3.21 Array.prototype.map")
|
- Reference specific spec sections either by section id (sec-array.prototype.map) or number+name (e.g., "23.1.3.21 Array.prototype.map")
|
||||||
- If I can't generate a relevant code example, I'll ask you to provide one`,
|
- If I can't generate a relevant code example, I'll ask you to provide one`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user