@easbot/llm 0.3.28 → 0.3.32

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 (66) hide show
  1. package/README.en.md +723 -23
  2. package/README.md +750 -22
  3. package/dist/assets/txt/agent/generate.txt +75 -0
  4. package/dist/assets/txt/agent/prompt/explore.txt +37 -0
  5. package/dist/assets/txt/agent/prompt/summary.txt +12 -0
  6. package/dist/assets/txt/agent/prompt/title.txt +24 -0
  7. package/dist/assets/txt/model/evaluation/templates/completeness.txt +53 -0
  8. package/dist/assets/txt/model/evaluation/templates/consistency.txt +52 -0
  9. package/dist/assets/txt/model/evaluation/templates/content-quality.txt +72 -0
  10. package/dist/assets/txt/model/evaluation/templates/context-relevancy.txt +45 -0
  11. package/dist/assets/txt/model/evaluation/templates/correctness.txt +43 -0
  12. package/dist/assets/txt/model/evaluation/templates/fact-checking.txt +43 -0
  13. package/dist/assets/txt/model/evaluation/templates/faithfulness.txt +53 -0
  14. package/dist/assets/txt/model/evaluation/templates/goal-completion.txt +70 -0
  15. package/dist/assets/txt/model/evaluation/templates/moderation.txt +80 -0
  16. package/dist/assets/txt/model/evaluation/templates/readability.txt +52 -0
  17. package/dist/assets/txt/model/evaluation/templates/relevancy.txt +56 -0
  18. package/dist/assets/txt/model/graph-summary.txt +5 -0
  19. package/dist/assets/txt/model/knowledge-summary.txt +127 -66
  20. package/dist/assets/txt/model/memory-summary.txt +136 -65
  21. package/dist/assets/txt/tool/buildin/edit.txt +10 -0
  22. package/dist/assets/txt/tool/buildin/glob.txt +42 -0
  23. package/dist/assets/txt/tool/buildin/grep.txt +42 -0
  24. package/dist/assets/txt/tool/buildin/read.txt +14 -0
  25. package/dist/assets/txt/tool/buildin/todo.txt +117 -0
  26. package/dist/assets/txt/tool/buildin/webfetch.txt +13 -0
  27. package/dist/assets/txt/tool/buildin/websearch.txt +14 -0
  28. package/dist/assets/txt/tool/buildin/write.txt +9 -0
  29. package/dist/chunks/chunk-A6QGPYPS.mjs +10 -0
  30. package/dist/chunks/chunk-IDJUGUEI.cjs +11 -0
  31. package/dist/chunks/chunk-JIETUZVR.mjs +2 -0
  32. package/dist/chunks/chunk-K4ES4MUO.cjs +1 -0
  33. package/dist/chunks/chunk-KNR62LEG.cjs +1 -0
  34. package/dist/chunks/chunk-M7AHHCVC.cjs +10 -0
  35. package/dist/chunks/chunk-NX2YVB72.mjs +1 -0
  36. package/dist/chunks/chunk-QMTIXJ7U.mjs +1 -0
  37. package/dist/chunks/chunk-R2HXV27D.mjs +2 -0
  38. package/dist/chunks/chunk-UJYQQ347.cjs +2 -0
  39. package/dist/chunks/chunk-XDYRNUT7.cjs +2 -0
  40. package/dist/chunks/chunk-YUX6P6YF.mjs +11 -0
  41. package/dist/chunks/{copilot-TJATIV2S.mjs → copilot-7CO2EO6N.mjs} +1 -1
  42. package/dist/chunks/copilot-PO46XRII.cjs +1 -0
  43. package/dist/chunks/index.min-DHJMPYRN.mjs +4 -0
  44. package/dist/chunks/index.min-SKM4353Q.cjs +4 -0
  45. package/dist/chunks/interfaces-H2WJRP6U.cjs +1 -0
  46. package/dist/chunks/interfaces-U2BBKCET.mjs +1 -0
  47. package/dist/chunks/loader-ON5XTSUI.cjs +1 -0
  48. package/dist/chunks/loader-WKTUO2AN.mjs +1 -0
  49. package/dist/chunks/localagent-PNWC6EGM.mjs +1 -0
  50. package/dist/chunks/localagent-QBKNVXRX.cjs +1 -0
  51. package/dist/chunks/models-snapshot-CNQITMJ7.cjs +2 -0
  52. package/dist/chunks/models-snapshot-XYP5QXSS.mjs +2 -0
  53. package/dist/chunks/subagent-K4THD4HO.cjs +1 -0
  54. package/dist/chunks/subagent-OVNTI7J4.mjs +1 -0
  55. package/dist/index.cjs +144 -31
  56. package/dist/index.d.cts +8871 -527
  57. package/dist/index.d.ts +8871 -527
  58. package/dist/index.mjs +144 -31
  59. package/package.json +10 -7
  60. package/dist/chunks/chunk-3BANRW36.mjs +0 -2
  61. package/dist/chunks/chunk-KFESJR3T.cjs +0 -1
  62. package/dist/chunks/chunk-S4DPVKMV.mjs +0 -1
  63. package/dist/chunks/chunk-UIFIYRZK.cjs +0 -2
  64. package/dist/chunks/copilot-R22QW5MH.cjs +0 -1
  65. package/dist/chunks/models-snapshot-3EXCDFMS.mjs +0 -2
  66. package/dist/chunks/models-snapshot-L4WLMITS.cjs +0 -2
@@ -0,0 +1,52 @@
1
+ ---
2
+ title: Answer Readability Evaluation
3
+ type: task
4
+ mode: all
5
+ required: response
6
+ optional: maxChars
7
+ ---
8
+
9
+ # Answer Readability Evaluation
10
+
11
+ ## Role
12
+
13
+ You are an evaluation expert who grades the readability and clarity of an answer.
14
+
15
+ ## Task
16
+
17
+ You receive one ANSWER to evaluate.
18
+
19
+ ## Criteria
20
+
21
+ 1. Clarity and fluency of the language.
22
+ 2. Soundness of the structure and organisation.
23
+ 3. Sufficiency of the explanation of technical terms.
24
+ 4. Appropriateness of examples and illustrations.
25
+
26
+ ## Scoring
27
+
28
+ - `score = 1` — the answer is clear, readable, and well structured. This is the best possible score.
29
+ - `score = 0` — the answer is obscure or structurally broken. This is the lowest possible score.
30
+ - Intermediate values are allowed when the answer is partly readable.
31
+
32
+ You MUST name the concrete places where the answer could improve.
33
+
34
+ ## Output Template
35
+
36
+ Output MUST be a single JSON object with no markdown fences and no surrounding prose:
37
+
38
+ ```json
39
+ {
40
+ "score": 0.9,
41
+ "feedback": "The answer is clear overall; it would benefit from one more example for the migration step."
42
+ }
43
+ ```
44
+
45
+ - `score` MUST be a number between 0 and 1.
46
+ - `feedback` MUST be a single short sentence naming the concrete improvement.
47
+
48
+ ## Input
49
+
50
+ ```
51
+ ANSWER: {{response}}
52
+ ```
@@ -0,0 +1,56 @@
1
+ ---
2
+ title: Answer Relevancy Evaluation
3
+ type: task
4
+ mode: all
5
+ required: query, correctAnswer, response
6
+ optional: maxChars
7
+ ---
8
+
9
+ # Answer Relevancy Evaluation
10
+
11
+ ## Role
12
+
13
+ You are an evaluation expert who grades an answer against a ground-truth answer.
14
+
15
+ ## Task
16
+
17
+ You receive a QUESTION, a GROUND TRUTH ANSWER (the correct reference), and a STUDENT ANSWER.
18
+
19
+ ## Criteria
20
+
21
+ 1. Grade the STUDENT ANSWER for factual accuracy, correctness, and relevancy against the GROUND TRUTH ANSWER.
22
+ 2. The STUDENT ANSWER MUST NOT contain any conflicting statement.
23
+ 3. The STUDENT ANSWER MAY contain more information than the GROUND TRUTH ANSWER, as long as it stays factual, accurate, and relevant to the reference.
24
+
25
+ ## Scoring
26
+
27
+ - `score = 1` — the STUDENT ANSWER satisfies every criterion. This is the best possible score.
28
+ - `score = 0` — the STUDENT ANSWER violates at least one criterion. This is the lowest possible score.
29
+ - Intermediate values are allowed when the answer partially satisfies the criteria.
30
+
31
+ You MUST reason step by step before concluding, so that the reasoning and the final verdict agree.
32
+ You MUST NOT restate the correct answer without reasoning.
33
+
34
+ ## Output Template
35
+
36
+ Output MUST be a single JSON object with no markdown fences and no surrounding prose:
37
+
38
+ ```json
39
+ {
40
+ "score": 0.7,
41
+ "feedback": "The STUDENT ANSWER contradicts the GROUND TRUTH ANSWER on the retry policy."
42
+ }
43
+ ```
44
+
45
+ - `score` MUST be a number between 0 and 1.
46
+ - `feedback` MUST be a single short sentence naming the concrete reason.
47
+
48
+ ## Input
49
+
50
+ ```
51
+ QUESTION: {{query}}
52
+
53
+ GROUND TRUTH ANSWER: {{correctAnswer}}
54
+
55
+ STUDENT ANSWER: {{response}}
56
+ ```
@@ -10,6 +10,11 @@ Generate ONE combined summary from MULTIPLE knowledge graph entities.
10
10
  - NEVER guess entity properties
11
11
  - If input has no valuable information: ONLY output "No relevant knowledge found."
12
12
 
13
+ ## Length Cap (HARD CONSTRAINT)
14
+ Your **final output MUST be ≤ {{maxChars}} characters** (including all markdown, punctuation, whitespace, and section headings).
15
+ - This cap is derived from the underlying `maxOutputTokens` limit with a safety buffer — exceeding it will trigger a hard truncation by the SDK that leaves your output incomplete.
16
+ - When in doubt, prioritize fewer entities over partial coverage of all.
17
+
13
18
  ## Input Format
14
19
  ```
15
20
  [Entity 1]
@@ -1,81 +1,142 @@
1
- # Knowledge Summary Prompt
2
-
3
- ## Task
4
- Synthesize document chunks into a concise summary relevant to the query.
5
-
6
- **CRITICAL RULES:**
7
- - NEVER generate content not present in the input
8
- - NEVER invent relationships or connections
9
- - NEVER elaborate beyond provided information
10
- - NEVER guess or assume user needs
11
- - If input has no valuable information: ONLY output "No relevant knowledge found."
12
-
13
- ## Priority Score
14
- Priority = 0.6 × relevance + 0.4 × recency
15
- - Priority > 0.6: high-priority (include)
16
- - Priority < 0.3: low-priority (skip unless unique value)
17
-
18
- ## Input Format
19
- [Chunk N] Priority: {priority}
20
- Source: [{filename}](./{filename}#{startLine}-{endLine})
21
- {content}
22
- Graph Nodes:
23
- Node: {name} ({type}) | {properties}
24
- → [{relation}] → target={targetType}:{targetName}
25
-
26
- ## Output Format
27
-
28
- ### Content Summary (REQUIRED)
29
- **Length: 1-3 sentences maximum**
30
- - Lead with highest-priority chunks ONLY
31
- - Skip chunks Priority < 0.3
32
- - Include lower-priority chunks only if they add unique value
33
- - Cite sources: [{filename}](./{filename}#{startLine})
34
-
35
- ### Entity & Relation Map (CONDITIONAL)
36
- Only include if:
37
- 1. Graph nodes are present AND
38
- 2. They add meaningful connections not in Content Summary
1
+ # Knowledge Summary Prompt (Note knowledge-base summarization)
39
2
 
40
- Format:
41
- **{EntityName}** ({type})
42
- → [{relation}] → {TargetEntity} ({targetType})
3
+ ## Role
4
+
5
+ You are compressing knowledge-base search results **for a coding assistant**. The assistant consumes your output to answer questions about a codebase, or to decide its next action.
6
+
7
+ Your output is **not** prose for humans to read. It is an **evidence digest that can be cited directly**.
8
+
9
+ **Output language**: mirror the language of the input chunks. If the chunks are Chinese, write Chinese; if English, write English. Never translate.
10
+
11
+ ---
12
+
13
+ ## Step 1 — Select (decides *what* to say)
14
+
15
+ The input is a set of document chunks. Each carries a `Priority` (0-1) already computed by the retrieval layer — **you do not need to and cannot meaningfully re-score it**.
16
+
17
+ Work in this order. **Do not** walk the chunks one by one:
18
+
19
+ 1. Scan from highest to lowest `Priority`; take chunks with **Priority ≥ 0.45** as core evidence.
20
+ 2. Add a lower-priority chunk only if it contributes something the core set is **missing entirely** (a new file path, a new symbol name, a counter-example). At most 2 such chunks.
21
+ 3. When several chunks come from the **same file**, keep only the minimum number needed to support your conclusion (never show the same file three times).
22
+ 4. Before writing, sanity-check yourself: *"For the user's question, is this evidence set enough to answer directly?"* If not, go back to step 1 and relax the threshold.
23
+
24
+ Selection preference, highest first:
25
+ - Chunks containing **concrete identifiers** (class names, function signatures, config keys, commands) > generic descriptive prose
26
+ - Chunks containing **constraints and contracts** ("must", "never", "only when…") > background narrative
27
+ - Chunks with an explicit path + line range > chunks without
28
+
29
+ ---
30
+
31
+ ## Step 2 — Extract (decides *how* to phrase it)
32
+
33
+ For each selected chunk, keep only the part directly relevant to the user's query. **Drop**: transitional sentences, self-evaluation, "this document will introduce…", neighbouring code that does not bear on the query.
34
+
35
+ ### Must be preserved verbatim (no rewriting)
36
+
37
+ | Element | Rule |
38
+ | ---------------------- | ------------------------------------------------------------------- |
39
+ | Identifiers | Class / function / variable names, file paths, config keys, CLI commands — copy character-for-character |
40
+ | Versions & paths | Precise literals such as `v0.4.1` or `packages/llm/src/...` must not be simplified |
41
+ | Negation & qualifiers | "only when…", "never… unless…", "unless…" — dropping these changes the meaning |
42
+ | Numbers & units | Timeouts, thresholds, quotas — keep exact, do not round |
43
+
44
+ Rewriting is permitted **only** in explanatory prose. Identifiers and constraints stay verbatim.
45
+
46
+ ---
47
+
48
+ ## Step 3 — Organize (decides *what shape* the output takes)
49
+
50
+ ### 3.1 Content Summary (required)
51
+
52
+ 3-6 sentences. Structure:
53
+
54
+ 1. **Sentence 1 is the conclusion** — conclusion-first, not background-first.
55
+ 2. Following sentences supply **supporting evidence**, each tied to one concrete source.
56
+ 3. When a sentence draws on a source, attach the citation inline:
57
+
58
+ ```
59
+ <repo-root-relative-path>#L<startLine>-L<endLine>
60
+ ```
61
+
62
+ ### 3.2 Entity & Relation Map (conditional)
43
63
 
44
- ### Key Insights (CONDITIONAL)
45
- Only include if:
46
- 1. Notable patterns exist AND
47
- 2. They are NOT already covered in Content Summary
64
+ Include **only if** the KG nodes express a structural relationship that 3.1 does not already convey — for example "these two modules are coupled through the same table", or "A is an implementation of B, not an alternative to it". Merely repeating names already mentioned in 3.1 does **not** qualify.
48
65
 
49
66
  Format:
50
- - 1-2 bullets maximum
51
67
 
52
- ## Fixed Response
53
- If no chunks have Priority > 0.3 or all chunks are irrelevant:
68
+ ```
69
+ **<EntityName>** (`<type>`)
70
+ → [<relation>] → **<TargetEntity>** (`<targetType>`)
71
+ ```
72
+
73
+ At most 5 entries. Fewer than 3 means the structural information does not deserve its own section — drop the whole section.
74
+
75
+ ### 3.3 Caveats (conditional)
76
+
77
+ Include **only if** the evidence genuinely conflicts, or carries an explicit validity limit:
78
+
79
+ - Two chunks state the same thing differently → name the discrepancy and state which one `Priority` says to trust
80
+ - The document marks something deprecated / valid only for v0.3 / planned for removal → carry that qualifier through verbatim
81
+
82
+ At most 2 entries. If there is no conflict, omit the section entirely — **never** use it to pad the output.
83
+
84
+ ---
85
+
86
+ ## Output budget
87
+
88
+ **Your final output MUST be ≤ {{maxChars}} characters** (counting all markdown, punctuation, whitespace, and headings).
89
+
90
+ The limit is derived from `maxOutputTokens` with a safety factor. Exceeding it causes a hard truncation mid-output, producing incomplete content.
91
+
92
+ When over budget, cut in this order (**drop low-value sections first; touch the core claim last**):
93
+
94
+ 1. Drop the lower-priority entry from 3.3 Caveats
95
+ 2. Drop 3.3 entirely
96
+ 3. Drop 3.2 entirely
97
+ 4. Trim supporting sentences from 3.1, keeping only the conclusion
98
+ 5. Still over? Output **only the conclusion sentence** and discard everything else
99
+
100
+ ---
101
+
102
+ ## Constraints
103
+
104
+ - Use only information present in the input chunks. **Do not** supplement with knowledge you hold about this codebase from training data.
105
+ - Do not guess user intent. If the user asks A, answer A — do not expand with "while you're at it, B is also interesting".
106
+ - No greetings, no lead-ins such as "Here is a summary". Start directly with the content.
107
+ - Every factual sentence must trace back to a source. If it cannot, delete it.
108
+ - If the relevant chunks are insufficient, all are below threshold, or none bear on the query, output **exactly** the following line and nothing else:
109
+
54
110
  ```
55
111
  No relevant knowledge found.
56
112
  ```
57
- **DO NOT generate any other content.**
58
113
 
59
- ## Examples
114
+ ---
115
+
116
+ ## Anti-patterns
117
+
118
+ ❌ The following are **unacceptable**:
60
119
 
61
- ### Good Output (relevant chunks)
62
120
  ```
63
- The codebase uses React for frontend (Priority: 0.78).
64
- Source: [frontend/index.tsx](./frontend/index.tsx#L10-L50)
121
+ Sure, here is a summary of the session-management parts of the codebase.
122
+ 1. The session system uses ContextEngine for management
123
+ 2. Prompt building has a static part and a dynamic part
124
+ Hope this helps!
65
125
  ```
66
126
 
67
- ### Bad Output (NEVER generate)
127
+ Why it fails: cites no file path; sentence 2 is an empty generalization; the opening and closing are pure noise.
128
+
129
+ ❌
130
+
131
+ ```
132
+ No relevant knowledge found. By the way, this project uses React and TypeScript.
68
133
  ```
69
- Hello! Based on the documents, I can help you with React setup.
70
- The project structure follows a standard pattern.
71
- You should use TypeScript for type safety.
134
+
135
+ Why it fails: once the fallback fires, nothing else may follow it.
136
+
137
+ ✅ Acceptable:
138
+
72
139
  ```
73
- (These weren't in the input!)
74
-
75
- ## Strict Rules
76
- - Output ONLY content from input chunks
77
- - Skip all sections with no data
78
- - Maximum 3 sentences in Content Summary
79
- - NEVER exceed provided information
80
- - Cite sources when including facts
81
- - If uncertain: "No relevant knowledge found."
140
+ Session state is rebuilt on every turn, and the system prompt is assembled from static templates plus dynamically injected segments (src/session/context.ts#L339-L365).
141
+ Dynamic injection contributes five segments: recall summary, knowledge summary, pending edits, tracked todos, and delegated sub-agent state (src/session/dynamic-prompt.ts#L81-L137).
142
+ ```
@@ -1,80 +1,151 @@
1
- # Memory Summary Prompt
2
-
3
- ## Task
4
- Synthesize memory facts into a concise summary relevant to the query.
5
-
6
- **CRITICAL RULES:**
7
- - NEVER generate facts not present in the input
8
- - NEVER invent content or relationships
9
- - NEVER elaborate beyond provided information
10
- - NEVER guess or assume user intent
11
- - If input has no valuable information: ONLY output "No relevant memory found."
12
-
13
- ## Priority Score
14
- Priority = 0.4 × relevance + 0.3 × recency + 0.3 × importance
15
- - Priority > 0.6: high-priority (include)
16
- - Priority < 0.3: low-priority (skip unless unique value)
17
-
18
- ## Input Format
19
- [Fact N] Priority: {priority}
20
- Category: {category} | Importance: {importance} | Source: {source}
21
- {content}
22
- Graph Nodes:
23
- Node: {name} ({type})
24
- → [{relation}] → target={targetType}:{targetName}
25
-
26
- ## Output Format
27
-
28
- ### Content Summary (REQUIRED)
29
- **Length: 1-3 sentences maximum**
30
- - Lead with highest-priority facts ONLY
31
- - Skip facts Priority < 0.3
32
- - Include low-priority facts only if they add unique value not in high-priority facts
33
- - State contradictions clearly: "High-priority fact X contradicts low-priority fact Y. Current truth: X."
34
-
35
- ### Entity & Relation Map (CONDITIONAL)
36
- Only include if:
37
- 1. Graph nodes are present AND
38
- 2. They add meaningful connections not in Content Summary
1
+ # Memory Summary Prompt (Memory fact-base summarization)
39
2
 
40
- Format:
41
- **{EntityName}** ({type})
42
- → [{relation}] → {TargetEntity} ({targetType})
3
+ ## Role
4
+
5
+ You are compressing long-term memory search results **for a coding assistant**. The memory store holds facts distilled from past sessions: user preferences, agreements, decisions, constraints, and mistakes already made.
6
+
7
+ The assistant consumes your output to **stay behaviourally consistent** — keep honouring coding conventions the user already declared, respect directory structures that were agreed, and avoid repeating mistakes the user already corrected.
8
+
9
+ Your output is **not** a log. It is a **current-state snapshot the assistant can act on directly**.
10
+
11
+ **Output language**: mirror the language of the input facts. If the facts are Chinese, write Chinese; if English, write English. Never translate.
12
+
13
+ ---
14
+
15
+ ## Step 1 — Select (decides *what* to say)
16
+
17
+ The input is a set of memory facts. Each carries a `Priority` (0-1) already computed by the retrieval layer, blending relevance, recency and importance — **you do not need to and cannot meaningfully re-score it**.
18
+
19
+ Work in this order. **Do not** walk the facts one by one:
20
+
21
+ 1. Scan from highest to lowest `Priority`; take facts with **Priority ≥ 0.5** as the current state.
22
+ 2. Add a lower-priority fact only if it contributes something the core set is **missing entirely**. At most 2 such facts.
23
+ 3. When several facts cover the **same topic**, you **must** collapse them into one and keep only the newest still-valid conclusion.
24
+ 4. Before writing, sanity-check yourself: *"For the user's question, is this fact set enough for me to behave consistently with history?"* If not, go back to step 1 and relax the threshold.
25
+
26
+ Selection preference, highest first:
27
+ - **Preferences / agreements / prohibitions the user stated explicitly** > inferences the system recorded automatically
28
+ - **Decisions already in effect** > ideas still under discussion
29
+ - **Facts carrying concrete constraints** ("must use X", "never use Y") > generic statements
30
+
31
+ ---
32
+
33
+ ## Step 2 — Extract (decides *how* to phrase it)
34
+
35
+ ### 2.1 Temporal decay is the core of this task
43
36
 
44
- ### Key Insights (CONDITIONAL)
45
- Only include if:
46
- 1. Meaningful patterns exist AND
47
- 2. They are NOT already covered in Content Summary
37
+ Memory goes stale. While extracting you **must** judge whether each fact still holds:
38
+
39
+ | Fact characteristic | Handling |
40
+ | -------------------------------------------------- | --------------------------------------------------------------- |
41
+ | Describes a **mutable preference** (language, topic, time-of-day) | Record it, but make clear it is a historical preference that may have changed |
42
+ | Describes a **technical constraint** ("this API does not support…") | Record verbatim with no qualifier — unless the fact itself names a version |
43
+ | Describes an **overturned older conclusion** | **Do not** state it as current; move it into Conflicts |
44
+ | Explicitly marked **deprecated / no longer valid** | Carry that qualifier through; do not treat it as an active rule |
45
+
46
+ ### 2.2 Must be preserved verbatim (no rewriting)
47
+
48
+ | Element | Rule |
49
+ | -------------------------- | -------------------------------------------------------------------- |
50
+ | Paths / commands / identifiers | File paths, CLI commands, config keys — copy character-for-character |
51
+ | Negation & prohibitions | "never…", "do not…", "stop doing…" — dropping these causes repeat failures |
52
+ | Numbers & quotas | Timeouts, retry counts, thresholds — keep exact |
53
+ | Strength qualifiers | "must" > "should" > "may" — these are not interchangeable |
54
+
55
+ Rewriting is permitted **only** in explanatory prose. Constraints and identifiers stay verbatim.
56
+
57
+ ---
58
+
59
+ ## Step 3 — Organize (decides *what shape* the output takes)
60
+
61
+ ### 3.1 Current State (required)
62
+
63
+ 2-5 sentences. Structure:
64
+
65
+ 1. **Sentence 1 is the current conclusion** — conclusion-first, not history-first.
66
+ 2. Following sentences supply **supporting detail**: what exactly was agreed, why, and which paths / commands are involved.
67
+ 3. Express facts that carry explicit constraints as imperatives, so the assistant can follow them directly.
68
+
69
+ ### 3.2 Conflicts (conditional)
70
+
71
+ Include **only if** two memories actually contradict each other — this is the part of a memory store the assistant most needs to notice.
48
72
 
49
73
  Format:
50
- - 1-2 bullets maximum
51
74
 
52
- ## Fixed Response
53
- If no facts have Priority > 0.3 or all facts are irrelevant:
75
+ ```
76
+ <topic>: <higher-priority conclusion> conflicts with <older lower-priority conclusion> → currently trust <higher-priority conclusion> (basis: <date / source>)
77
+ ```
78
+
79
+ At most 3 entries, ordered by severity.
80
+
81
+ **If there is no conflict, omit this section.** Stuffing non-conflicting facts into a "Conflicts" section makes the assistant suspicious of unrelated content, which is worse than saying nothing.
82
+
83
+ ### 3.3 Stale Warnings (conditional)
84
+
85
+ Include **only if** a high-priority fact is clearly at risk of being out of date — as a prediction, not a confirmation:
86
+
87
+ ```
88
+ <fact summary> — this preference was formed on <date>; if the user's current behaviour contradicts it, current behaviour wins.
89
+ ```
90
+
91
+ At most 2 entries. **Do not** use this section to express "I am unsure about this" — if you are unsure, down-weight or skip the fact instead of packaging uncertainty into a section.
92
+
93
+ ---
94
+
95
+ ## Output budget
96
+
97
+ **Your final output MUST be ≤ {{maxChars}} characters** (counting all markdown, punctuation, whitespace, and headings).
98
+
99
+ The limit is derived from `maxOutputTokens` with a safety factor. Exceeding it causes a hard truncation mid-output, producing incomplete content.
100
+
101
+ When over budget, cut in this order (**drop low-value sections first; touch the core claim last**):
102
+
103
+ 1. Drop the lower-priority entry from 3.3 Stale Warnings
104
+ 2. Drop 3.3 entirely
105
+ 3. Drop 3.2 Conflicts entirely
106
+ 4. Trim supporting detail from 3.1, keeping only the conclusion
107
+ 5. Still over? Output **only the conclusion sentence** and discard everything else
108
+
109
+ ---
110
+
111
+ ## Constraints
112
+
113
+ - Use only information present in the input facts. **Do not** supplement with knowledge you hold about the user or project from training data.
114
+ - Do not guess user intent. If the user asks A, answer A.
115
+ - **No evaluation, no suggestions, no improvement advice** — your output is a state snapshot, not a review.
116
+ - No greetings, no lead-ins such as "Based on the memories". Start directly with the content.
117
+ - If the relevant facts are insufficient, all are below threshold, or none bear on the query, output **exactly** the following line and nothing else:
118
+
54
119
  ```
55
120
  No relevant memory found.
56
121
  ```
57
- **DO NOT generate any other content.**
58
122
 
59
- ## Examples
123
+ ---
124
+
125
+ ## Anti-patterns
126
+
127
+ ❌ The following are **unacceptable**:
60
128
 
61
- ### Good Output (relevant facts)
62
129
  ```
63
- The user prefers dark mode (Priority: 0.72).
64
- High-priority fact contradicts earlier light mode preference.
130
+ Sure, here are the memories I found:
131
+ 1. The user likes concise answers
132
+ 2. There was a logging library in use before
133
+ Hope this helps!
65
134
  ```
66
135
 
67
- ### Bad Output (NEVER generate)
136
+ Why it fails: fact 1 is too vague to act on; fact 2 does not say whether it is still in use or abandoned; neither carries a date; the opening and closing are noise.
137
+
138
+ ❌
139
+
140
+ ```
141
+ No relevant memory found. By the way, I'd suggest switching package managers since the current one looks slow.
68
142
  ```
69
- Hello! I can help you with dark mode settings.
70
- The user's name is John and they work at Company X.
71
- They like TypeScript and use VSCode daily.
143
+
144
+ Why it fails: once the fallback fires, nothing else may follow it; the memory layer does not give advice.
145
+
146
+ ✅ Acceptable:
147
+
72
148
  ```
73
- (These facts weren't in the input!)
74
-
75
- ## Strict Rules
76
- - Output ONLY facts from input
77
- - Skip all sections with no data
78
- - Maximum 3 sentences in Content Summary
79
- - NEVER exceed provided information
80
- - If uncertain: "No relevant memory found."
149
+ TypeScript strict mode is required and `any` is forbidden, on maintainability grounds — stated explicitly on 2026-09-15, contradicting an older "using `any` is fine" conclusion; currently trust strict mode.
150
+ All packages must be version-bumped together through the workspace-level version script; bumping a single package in isolation is not allowed.
151
+ ```
@@ -0,0 +1,10 @@
1
+ Performs exact string replacements in files.
2
+
3
+ Usage:
4
+ - You must use your `Read` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file.
5
+ - When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: line number + colon + space (e.g., `1: `). Everything after that space is the actual file content to match. Never include any part of the line number prefix in the oldString or newString.
6
+ - ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
7
+ - Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
8
+ - The edit will FAIL if `oldString` is not found in the file with an error "oldString not found in content".
9
+ - The edit will FAIL if `oldString` is found multiple times in the file with an error "Found multiple matches for oldString. Provide more surrounding lines in oldString to identify the correct match." Either provide a larger string with more surrounding context to make it unique or use `replaceAll` to change every instance of `oldString`.
10
+ - Use `replaceAll` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.
@@ -0,0 +1,42 @@
1
+ - Fast file pattern matching tool that works with any codebase size
2
+ - Supports glob patterns like "src/**/*.js" or "src/**/*.ts"
3
+ - Returns matching file paths sorted by modification time (newest first)
4
+ - Use this tool when you need to find files by name patterns
5
+ - When you are doing an open-ended search that may require multiple rounds of globbing and grepping, use the Task tool instead
6
+ - You have the capability to call multiple tool calls in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.
7
+ - To understand how a project is laid out (directory structure), use the list tool instead
8
+
9
+ respectGitignore (default true) — toggles whether to apply project-default ignore rules (DEFAULT_IGNORE_PATTERNS like node_modules/dist/build/.git/.cache + parsed patterns from both `<cwd>/.gitignore` and `<cwd>/.ignore`):
10
+ - true (default): apply DEFAULT_IGNORE_PATTERNS + parsed patterns from both `<cwd>/.gitignore` and `<cwd>/.ignore`, PLUS user `ignore`. Default for performance — `node_modules` / `dist` / `.next` are huge and the ignore list lets the scanner prune them entirely.
11
+ - false: apply ONLY user `ignore` (agent fully self-controlled; no project defaults). Set this when you need to inspect the default-ignored directories.
12
+
13
+ DEFAULT_IGNORE_PATTERNS is deliberately minimal — it excludes only whole directories whose contents have no unique information (third-party dependencies, rebuildable build output, framework caches, VCS internals) plus OS junk files. It does NOT filter by file extension, so `*.log`, `*.min.js`, `*.db`, `coverage/`, `logs/` and `tmp/` ARE searchable — use this tool when you need to inspect logs, coverage reports, minified bundles, or databases.
14
+
15
+ ⚠️ DEFAULT_IGNORE_PATTERNS is enforced **unconditionally when `respectGitignore: true`** — your `pattern` is NOT an override. Patterns like `pattern: "node_modules/**"`, `pattern: "node_modules/pkg/index.js"`, `pattern: "dist/bundle.js"` all return empty results because the default ignore list filters them out. To see ignored paths you MUST set `respectGitignore: false`. When the tool returns no results and the pattern targets a default-ignored directory, it will print a one-line `Tip:` so you know to flip this switch.
16
+
17
+ ignore (default []):
18
+ - Extra patterns to EXCLUDE from the results (string[], e.g. ["fixtures","path/a","*.spec.ts"])
19
+ - Applied on top of respectGitignore, and always effective regardless of that toggle. `ignore` only ADDS exclusions — it never re-includes anything
20
+ - Both gitignore style and glob style are accepted; they are normalized to the same result:
21
+
22
+ | you write | meaning (gitignore) | excludes |
23
+ | ---------------- | ------------------------------ | ----------------------------------------- |
24
+ | `dist` | any dir/file named dist | `dist/`, `src/dist/`, `a/b/dist/` |
25
+ | `path/a` | that exact path from the root | `path/a/` |
26
+ | `fixtures` | any dir named fixtures | `fixtures/`, `src/fixtures/` |
27
+ | `*.spec.ts` | that suffix at any depth | `src/x.spec.ts`, `a/b/y.spec.ts` |
28
+ | `**/fixtures/**` | same thing, glob style | `fixtures/a.json`, `src/fixtures/b.json` |
29
+
30
+ - Do NOT write `!` negation, `#` comments, or a trailing `/` — those are dropped
31
+ - Accepted input forms: a real array `["a","b"]`, or a JSON array string `'["a","b"]'`. A plain comma-separated string `"a,b"` is NOT parsed and will fail validation. Entries are trimmed and empty ones dropped.
32
+ - `respectGitignore: false` plus `ignore` gives you full control of exactly what stays
33
+
34
+ Pattern semantics for `pattern` (npm `glob` package's minimatch — NOT gitignore syntax):
35
+ - `*` does NOT cross `/` — use `**/*.ts` for recursive (matches across directories)
36
+ - `**` matches zero or more directory levels (e.g. `src/**/foo.ts` matches any depth)
37
+ - Brace expansion supported: `*.{ts,tsx}` → `*.ts` or `*.tsx`
38
+ - `?` matches a single char; `[abc]` / `[^abc]` / `[!abc]` character classes
39
+ - NOT supported: negation `!pattern` (gitignore's re-include; use `respectGitignore=false` or a positive allowlist pattern instead)
40
+ - NOT supported: `#` comments (each value is a single pattern, not a gitignore rule)
41
+ - NOT supported: trailing `/` directory suffix (write `dir/**` explicitly)
42
+ - Unlike `ignore`, `pattern` is NOT normalized: `*.ts` matches top-level files only, `**/*.ts` matches at any depth
@@ -0,0 +1,42 @@
1
+ - Fast content search tool that works with any codebase size
2
+ - Searches file CONTENTS using regular expressions
3
+ - Supports full regex syntax (eg. "log.*Error", "function\s+\w+", etc.)
4
+ - Filter which files to search with the include parameter (eg. "*.js", "*.{ts,tsx}")
5
+ - Returns file paths and line numbers with at least one match sorted by modification time
6
+ - Use this tool when you need to find files containing specific patterns
7
+ - If you need to identify/count the number of matches within files, use the Bash tool with `rg` (ripgrep) directly. Do NOT use `grep`.
8
+ - When you are doing an open-ended search that may require multiple rounds of globbing and grepping, use the Task tool instead
9
+ - You have the capability to call multiple tool calls in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.
10
+
11
+ path (default current project directory):
12
+ - The directory to search in; relative paths resolve against the current project directory
13
+ - An absolute path is used as-is; if it resolves OUTSIDE the project directory, an explicit permission request is raised before searching
14
+ - Searches recursively
15
+ - **`.gitignore` lookup follows the search directory, NOT the workspace root**: ripgrep starts from `path` and walks UPWARD, merging `.gitignore` files at every level (`path/.gitignore`, then `path/../.gitignore`, …, up to the nearest enclosing `.git` boundary or root). This means searching `path='packages/agent/src'` honors `packages/agent/src/.gitignore` first, then merges with its ancestors — which can DIFFER from a workspace-root search if a sub-tree has stricter ignore rules. If you want the same rules as a workspace-root search, pass `path='.'` (or omit it).
16
+ - **Dot-directories (e.g. `.easbot/`, `.git/`) are searched by default** unless excluded by an applicable `.gitignore` rule or by `include: '!.<dir>/**'`. To explicitly skip them, pass a glob like `include: '!.easbot/**'` or `include: '!.git/**'`.
17
+
18
+ include (default undefined = all files):
19
+ - Which files to search, as ONE glob pattern (string). Omit it to search every file
20
+ - Gitignore-style semantics, matching ripgrep's `--glob`. The rule that decides scope is whether the pattern contains a `/`:
21
+ - **No `/`** — matched against the file NAME at every depth: `*.ts` finds `top.ts` AND `src/deep/foo.ts`
22
+ - **Has `/`** — anchored to the search root: `src/*.ts` finds only `src/foo.ts`, never `other/src/foo.ts`
23
+ - `**` spans any number of directories: `src/**/*.ts` reaches every depth under src
24
+ - Brace expansion is supported: `*.{ts,tsx}` matches `.ts` and `.tsx`
25
+ - `?` matches a single character; `[a-z]` / `[!a-z]` character classes
26
+ - A leading `!` makes the pattern EXCLUSIVE. `include` takes ONE pattern, so a leading `!` means "search everything EXCEPT these files" (`!*.min.js`). To keep only a subset, pass that subset's pattern instead.
27
+ - Examples:
28
+ - `*.ts` — every TypeScript file, at any depth
29
+ - `src/*.ts` — only .ts files directly under src
30
+ - `src/**/*.ts` — .ts files anywhere under src
31
+ - `**/*.{test,spec}.ts` — every test file, at any depth
32
+ - `!*.min.js` — every file except minified ones
33
+ - `!node_modules/**` — every file except those under node_modules
34
+
35
+ Output notes:
36
+ - Grouped by file path, each match shown as ` Line <n>: <text>`
37
+ - Individual lines longer than 2000 characters are truncated with a trailing "..."
38
+ - At most 100 matches are returned; the output ends with a truncation notice
39
+ - Files are ordered by modification time, newest first
40
+
41
+ Example:
42
+ - pattern: "TODO|FIXME", include: "*.{ts,tsx}"
@@ -0,0 +1,14 @@
1
+ Read a file or directory from the local filesystem. If the path does not exist, an error is returned.
2
+
3
+ Usage:
4
+ - The filePath parameter should be an absolute path.
5
+ - By default, this tool returns up to 2000 lines from the start of the file.
6
+ - The offset parameter is the line number to start from (1-indexed).
7
+ - To read later sections, call this tool again with a larger offset.
8
+ - Use the grep tool to find specific content in large files or files with long lines.
9
+ - If you are unsure of the correct file path, use the glob tool to look up filenames by glob pattern.
10
+ - Contents are returned with each line prefixed by its line number as `<line>: <content>`. For example, if a file has contents "foo\n", you will receive "1: foo\n". For directories, entries are returned one per line (without line numbers) with a trailing `/` for subdirectories.
11
+ - Any line longer than 2000 characters is truncated.
12
+ - Call this tool in parallel when you know there are multiple files you want to read.
13
+ - Avoid tiny repeated slices (30 line chunks). If you need more context, read a larger window.
14
+ - This tool can read image files and PDFs and return them as file attachments.