Skip to content

Commit a12f284

Browse files
authored
Enhance tool design and improve fetch_page functionality
Merge pull request #25 from pardnchiu/develop
2 parents 4caa892 + 9e24699 commit a12f284

37 files changed

Lines changed: 740 additions & 269 deletions

configs/jsons/providors/gemini.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,9 @@
3030
"gemini-3.1-pro-preview-customtools": {
3131
"description": "Tool-first variant optimized for agentic workflows and custom tool integration",
3232
"thinking_config": "level"
33+
},
34+
"gemini-3.5-flash": {
35+
"description": "Top-tier Flash with cutting-edge agentic and coding performance at scale",
36+
"thinking_config": "level"
3337
}
3438
}

configs/prompts/discord_format.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ Discord does **not** support HTML, LaTeX, or tables — emitting any of these re
1313

1414
---
1515

16-
## Character Limit
17-
18-
Discord per-message limit is 2000 characters (Nitro 4000). Keep every response strictly within **1600 characters** (hard limit, must not exceed) to leave headroom for prefix/footer.
19-
20-
---
21-
2216
## Markdown Format (Discord rendering — strictly follow)
2317

2418
**Inline**
@@ -73,7 +67,6 @@ go, js, ts, py, rs, java, c, cpp, cs, php, rb, swift, kt, sh, bash, sql, json, y
7367

7468
**Limits**
7569

76-
- Message text: 2000 (Nitro 4000)
7770
- Attachments per message: 10
7871
- Attachment size: 10 MB (Nitro Basic 50 MB / Nitro 500 MB)
7972

configs/prompts/discord_system_prompt.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
- Markdown only — `**bold**`, `*italic*`, `` `code` ``, ```` ```lang\n…\n``` ````, `> quote`, `- bullet`, `# heading` (H1–H3 only). Full list in `discord_format`.
66
- **No HTML** (`<b>`, `<div>`, etc. render as literal characters). **No LaTeX, no tables.**
7-
- Discord per-message limit is 2000 chars (Nitro 4000) — keep replies within **1600 chars**.
87

98
**Before composing the FIRST reply / push / scheduling ack in this session, call `discord_format`** to load the complete markdown reference (special tokens, code block languages, file/voice markers, supported image formats). Cached in context for the rest of the session.
109

@@ -32,7 +31,6 @@ You are replying to user messages in a Discord channel.
3231
- If one sentence suffices, don't use three
3332

3433
### Tool Usage
35-
- Tool usage rules remain unchanged — **never skip a tool call due to the character limit**
3634
- After retrieving data with tools, include only the key points directly relevant to the user's question; omit redundant details
3735

3836
### Disambiguation (mandatory — never loop back-and-forth in text)
@@ -100,13 +98,8 @@ When a user message contains any of the following time-delay intents, **must** g
10098
- Recent messages in the current channel are **already loaded into context** — for queries like 「之前說過什麼」、「聊過什麼」、「上次提到的內容」, **answer directly from context first without calling `search_conversation_history`**
10199
- `search_conversation_history` is only for history beyond what is in context, or when keyword-exact matching is needed
102100

103-
### File Output Tasks (overrides character limit rules)
101+
### File Output Tasks
104102

105103
When the final output of a task is a **local file** (md, json, txt, etc.):
106-
- **The 1600-character limit applies only to the Discord message reply itself**, not to the file content
107-
- File content prioritizes completeness and is not subject to the character limit
108104
- The Discord message only needs to say "現在傳送中,檔案位於 `{path}`" (in-progress tense) and attach `[SEND_FILE:{path}]` if needed
109-
110-
### When Reply Is Incomplete
111-
- If the content cannot be fully presented within the character limit, prioritize the most essential conclusion or answer
112-
- At the end, explicitly tell the user they can ask follow-up questions or that more detail is available
105+
- File content itself prioritizes completeness; do not duplicate the file body into the channel message

configs/prompts/telegram_format.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ If a single character of markdown (`**`, `__`, `` ` ``, leading `-` / `*` / `#`)
1515

1616
---
1717

18-
## Character Limit
19-
20-
Telegram message text limit is 4096 characters — keep every response strictly within **3500 characters** (hard limit; reserves headroom for escape expansion).
21-
22-
---
23-
2418
## HTML Format (Telegram rendering — strictly follow)
2519

2620
**Allowed inline tags**

configs/prompts/telegram_system_prompt.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
- HTML only — `<b>`, `<i>`, `<code>`, `<pre>`, `<a href>`, `<blockquote>` (full list in `telegram_format`).
66
- **Forbidden markdown — any of these leaks renders as literal characters and breaks the message:** `**bold**`, `__underline__`, `` `code` ``, leading `#`, leading `-` / `*` bullets, `[text](url)`, ``` ```lang ``` ``` fences.
77
- **Self-check before every send:** scan the message for `**`, `__`, `~~`, `` ` ``, `#`, `- ` / `* ` at line start, `[..](..)`. If present, rewrite using HTML tags (e.g. `**x**``<b>x</b>`; `` `x` ```<code>x</code>`; `- x``• x`).
8-
- Telegram message limit is 4096 chars — keep replies within **3500 chars**.
98

109
**Before composing the FIRST reply / push / scheduling ack in this session, call `telegram_format`** to load the complete HTML reference (allowed tags, escape rules, file/voice markers, concrete rewrite table). Cached in context for the rest of the session.
1110

@@ -33,7 +32,6 @@ You are replying to user messages in a Telegram chat.
3332
- If one sentence suffices, don't use three
3433

3534
### Tool Usage
36-
- Tool usage rules remain unchanged — **never skip a tool call due to the character limit**
3735
- After retrieving data with tools, include only the key points directly relevant to the user's question; omit redundant details
3836

3937
### Disambiguation (mandatory — never loop back-and-forth in text)
@@ -101,13 +99,8 @@ When a user message contains any of the following time-delay intents, **must** g
10199
- Recent messages in the current chat are **already loaded into context** — for queries like 「之前說過什麼」、「聊過什麼」、「上次提到的內容」, **answer directly from context first without calling `search_conversation_history`**
102100
- `search_conversation_history` is only for history beyond what is in context, or when keyword-exact matching is needed
103101

104-
### File Output Tasks (overrides character limit rules)
102+
### File Output Tasks
105103

106104
When the final output of a task is a **local file** (md, json, txt, etc.):
107-
- **The 3500-character limit applies only to the Telegram message reply itself**, not to the file content
108-
- File content prioritizes completeness and is not subject to the character limit
109105
- The Telegram message only needs to say "現在傳送中,檔案位於 <code>{path}</code>" (in-progress tense) and attach `[SEND_FILE:{path}]` if needed
110-
111-
### When Reply Is Incomplete
112-
- If the content cannot be fully presented within the character limit, prioritize the most essential conclusion or answer
113-
- At the end, explicitly tell the user they can ask follow-up questions or that more detail is available
106+
- File content itself prioritizes completeness; do not duplicate the file body into the chat message

extensions/apis/themealdb.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "themealdb_search",
3-
"description": "[system-default] Search recipes from TheMealDB by name.",
3+
"description": "[system-default] Search TheMealDB recipes by meal name. Returns ingredients, instructions, image, YouTube link. Use when the user names a specific recipe.",
44
"always_allow": true,
55
"endpoint": {
66
"url": "https://www.themealdb.com/api/json/v1/1/search.php",

extensions/skills/api-tool-add/SKILL.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ multiSelect: false
246246

247247
```json
248248
{
249-
"name": "get_user",
250-
"description": "Retrieve user profile by ID.",
249+
"name": "fetch_user_profile",
250+
"description": "Retrieve a user's full profile (name, email, role, audit timestamps) from the example.com user directory. Use when the user mentions a user ID or asks 'who is X', 'what's user 42's role', or before any operation that needs to verify a user exists. Prefer over list_users when you already know the exact user_id — list_users is paginated and slower for single-record lookups.",
251251
"endpoint": {
252252
"url": "https://api.example.com/users/{user_id}",
253253
"method": "GET",
@@ -267,12 +267,12 @@ multiSelect: false
267267
"parameters": {
268268
"user_id": {
269269
"type": "string",
270-
"description": "User identifier, matches {user_id} in URL path.",
270+
"description": "Numeric user identifier as a string (e.g. \"42\", \"10293\"). Matches {user_id} placeholder in the URL path. Must be the canonical ID, not username or email — use search_users first if you only have name/email.",
271271
"required": true
272272
},
273273
"include_deleted": {
274274
"type": "boolean",
275-
"description": "Include soft-deleted users when true.",
275+
"description": "When true, includes users with deleted_at != null (soft-deleted). Default false returns 404 for soft-deleted users. Set true only for audit / compliance use cases where deletion history matters.",
276276
"required": false,
277277
"default": false
278278
}
@@ -302,8 +302,8 @@ multiSelect: false
302302

303303
| 欄位 | 必填 | 規則 |
304304
|---|---|---|
305-
| `name` || snake_case,不加 `api_` 前綴(runtime 自動補) |
306-
| `description` || 一句動詞開頭,描述用途;英文優先 |
305+
| `name` || snake_case,動詞+名詞,直白具體(`fetch_user_profile``user_get`),不加 `api_` 前綴(runtime 自動補) |
306+
| `description` || 英文。**只描述使用情境**(何時呼叫/與相似 tool 的取捨),**極致精簡精準**:一兩句寫清觸發信號即停。lazy-schema 下這是 LLM 召喚 tool 的唯一依據,但冗詞稀釋訊號;禁填充語、禁實作八卦、禁呼叫合約細節(型別/enum/邊界丟 `parameters`)。純「執行什麼」一句話 trigger coverage 不足必失敗;超過兩三句通常代表夾雜了該住 schema 的內容。長度建議 60-200 chars |
307307
| `always_allow` | optional | `true` = `agen cli` 跳過 confirm;缺省/`false` = 每次 confirm。僅讀取/無副作用 endpoint 可設 `true`,由 Gate 6 決定 |
308308
| `endpoint.url` || 完整 URL,path 變數用 `{var_name}` |
309309
| `endpoint.method` || `GET``POST``PUT``PATCH``DELETE` |
@@ -315,10 +315,10 @@ multiSelect: false
315315
| `auth.header` | conditional |`apikey` 可用;省略時預設 `X-API-Key` |
316316
| `auth.env` | ✅(若有 auth) | keychain key 名(SCREAMING_SNAKE_CASE);runtime 走 `keychain.Get`****讀 shell env |
317317
| `parameters.<name>.type` || `string``integer``number``boolean``array``object` |
318-
| `parameters.<name>.description` || 用途 + 範例值 |
318+
| `parameters.<name>.description` || 英文。完整呼叫合約:用途 + 型別與單位(秒/毫秒、bytes/MiB)+ 接受值(enum 含每值意涵、regex、值域)+ 至少一個範例值(非平凡型別必給)+ 與其他參數互動(`required when X=Y`)+ 邊界/失敗模式。非平凡型別(`object``array`/含 `enum`)短於 20 chars 視為不完整 |
319319
| `parameters.<name>.required` || `true``false`(明確標示,勿省略) |
320-
| `parameters.<name>.default` | optional | 非必填參數建議給;型別需匹配 `type` |
321-
| `parameters.<name>.enum` | optional | 限制可選值 |
320+
| `parameters.<name>.default` | optional | 非必填參數**必給**;型別需匹配 `type`;缺 default LLM 不知道省略此參數的語意 |
321+
| `parameters.<name>.enum` | optional | 限制可選值;每個 enum value 在 description 內解釋其意涵(不只列字串) |
322322
| `response.format` || 一律填 `json`(目前 adapter 僅支援 JSON 回應) |
323323

324324
### Path 變數與 parameters 對應
@@ -389,6 +389,8 @@ Wrote N tool(s) to ~/.config/agenvoy/tools/api/
389389
6. **Host 已確認**:intranet/localhost host 已通過 Gate 3 確認或替換。
390390
7. **試打通過**:Gate 5 對該 endpoint 取得 2xx(或使用者明確允許的 4xx/5xx)。未試打或 unreachable → **拒絕寫入**
391391
8. **always_allow 確認**:Gate 6 已決定;`always_allow=true` 的 endpoint 必須為純讀取/無外部副作用(寫入類、刪除類、發送類即使使用者批量選 true 也須個別二次確認)。
392+
9. **Description 極致精簡精準**:只描述使用情境(何時用/與相似 tool 的取捨),一兩句寫清觸發信號即停。純「執行什麼」一句話必失敗(trigger coverage 不足);夾雜實作細節/呼叫合約/填充語也必失敗(冗詞稀釋訊號)。長度 60-200 chars。
393+
10. **Parameter description 完整**:每個 `parameters.<name>.description` 含型別/單位/接受值/範例/互動關係。非平凡型別(`object``array`/含 `enum`)短於 20 chars 必失敗。
392394

393395
---
394396

extensions/skills/script-tool-add/SKILL.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ Q3 question: "語言偏好?"
6565

6666
#### 命名
6767

68-
`<tool_name>`:snake_case,****`script_` 前綴(runtime 自動補)。動詞_名詞 或 名詞_動詞,例:`rsi_calc``csv_dedupe``reddit_top`
68+
`<tool_name>`:snake_case,****`script_` 前綴(runtime 自動補)。直白具體:動詞+名詞,例:`calculate_rsi``deduplicate_csv``fetch_reddit_top`。避免動詞模糊(`process_*``handle_*`)或名詞前置造成 LLM 選擇困難(`rsi_calc``calculate_rsi`,動詞前置與其他 tool 對齊)。
69+
70+
#### 工具描述(`tool.json` 頂層 `description`
71+
72+
英文。**只描述使用情境**(何時呼叫/與相似 tool 的取捨),**極致精簡精準**——一兩句寫清觸發信號即停。lazy-schema 下這是 LLM 召喚 tool 的唯一依據,但冗詞稀釋訊號;禁填充語、禁實作八卦、禁呼叫合約細節(型別/enum/邊界丟 `parameters`)。長度建議 60-200 chars;超過兩三句通常代表夾雜了該住 schema 的內容。
6973

7074
#### 參數 schema
7175

@@ -82,11 +86,11 @@ Q3 question: "語言偏好?"
8286
| 欄位 | 必填 | 規則 |
8387
|---|---|---|
8488
| `type` || `string``integer``number``boolean``array``object` |
85-
| `description` || 用途 + 範例值 + 邊界(如「integer between 1 and 100」) |
86-
| `default` | optional | 非必填參數**強烈建議**;型別需匹配 `type` |
87-
| `enum` | optional | 限制可選值 |
89+
| `description` || 英文。完整呼叫合約:用途 + 型別與單位(秒/毫秒、bytes/MiB)+ 接受值(enum 含每值意涵、regex、值域)+ 至少一個範例(非平凡型別必給)+ 與其他參數互動 + 邊界。非平凡型別(`object``array`/含 `enum`)短於 20 chars 視為不完整 |
90+
| `default` | optional | 非必填參數**必給**;型別需匹配 `type`;缺 default LLM 不知道省略此參數的語意 |
91+
| `enum` | optional | 限制可選值;每個 enum value 在 description 內解釋其意涵 |
8892

89-
**為何 description 要寫範例與邊界**LLM 看 schema 決定如何呼叫,含範例的 description 命中率顯著高於純抽象描述
93+
**為何 schema description 要這麼完整**schema 按需注入(非 `AlwaysLoad` 的 tool 預設帶 stub schema);一旦注入後 LLM 立即基於 description 決定如何填值。缺範例/單位/互動關係 → trial-and-error → 失敗訊息浪費 token
9094

9195
#### 詢問規則
9296

@@ -352,19 +356,19 @@ multiSelect: false
352356
353357
```json
354358
{
355-
"name": "rsi_calc",
356-
"description": "Compute RSI (Relative Strength Index) for a given ticker over N periods.",
359+
"name": "calculate_rsi",
360+
"description": "Compute the Relative Strength Index (RSI) momentum oscillator for a given ticker over N trading periods. Use when the user asks 'is X overbought/oversold', 'compute RSI for Y', or mentions any momentum / mean-reversion analysis. RSI > 70 typically signals overbought, < 30 oversold — the tool returns the raw number plus a derived signal label. Pair with fetch_yahoo_finance when you need the underlying OHLCV data first.",
357361
"always_allow": true,
358362
"parameters": {
359363
"type": "object",
360364
"properties": {
361365
"symbol": {
362366
"type": "string",
363-
"description": "Ticker symbol such as AAPL, SPY, BTC-USD."
367+
"description": "Ticker symbol in Yahoo Finance format (e.g. \"AAPL\" for stocks, \"BTC-USD\" for crypto, \"^GSPC\" for indices). Case-insensitive but uppercase is preferred. Must be a single ticker — for batch use, call the tool repeatedly."
364368
},
365369
"period": {
366370
"type": "integer",
367-
"description": "RSI period in trading days, integer between 2 and 200.",
371+
"description": "RSI lookback window in trading days. Integer between 2 and 200 (typical: 14 for daily, 9 for short-term, 25 for swing trading). Larger periods smooth the signal but lag price action.",
368372
"default": 14
369373
}
370374
},
@@ -447,6 +451,8 @@ Gate 4 涉及 secret 的 tool,keychain 已於該關卡透過 `store_secret`
447451
9. **Secret 不留明文**:所有 secret 透過 `/v1/key` 取得,不寫死、不收 plaintext 參數
448452
10. **試跑通過**:Gate 6 取得 exit 0 + 合法 JSON stdout(或使用者明確接受的非 JSON 輸出)
449453
11. **always_allow 確認**:Gate 7 已決定;寫入類/發送類 script 即使選 `true` 已二次確認
454+
12. **Description 極致精簡精準**:`tool.json.description` 只描述使用情境(何時用/與相似 tool 的取捨),一兩句寫清觸發信號即停。純「執行什麼」一句話必失敗(trigger coverage 不足);夾雜實作細節/呼叫合約/填充語也必失敗(冗詞稀釋訊號)。長度 60-200 chars。
455+
13. **Parameter description 完整**:每個 `properties[*].description` 含型別/單位/接受值/範例/互動關係。非平凡型別(`object``array`/含 `enum`)短於 20 chars 必失敗。
450456
451457
---
452458

0 commit comments

Comments
 (0)