fix(agent): reduce verbose responses — focus answers on user's question only

Root cause: when planner fails (402 payment), legacy loop dumps all system
context to LLM which outputs everything. Also final response prompt was too
weak — LLM treated all observations as required output.

Changes:
- Strengthen system prompt: "answer ONLY what user asked", no tables/tutorials
  unless requested, no self-intro repeats, no "next step" suggestions
- Add compact observation summary for final response (step summaries only,
  no raw JSON blobs)
- Domain-filtered tool selection in legacy loop to prevent over-fetching
- Fix domain routing: "钱包/wallet" → account domain (not model), with
  exchange configs included for wallet context
- Widen wallet fast-path: no longer requires "claw402" keyword
- Anti-repetition instructions in planner step selector

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shinchan-zhai
2026-05-11 21:12:48 +08:00
parent 9f25bf49bf
commit bf289e8eb3
4 changed files with 93 additions and 38 deletions

View File

@@ -619,16 +619,15 @@ func (a *Agent) buildSystemPromptForStoreUser(lang, storeUserID string) string {
- **你不知道用户持有什么股票/币种,除非工具返回了数据**
- 查股票行情 ≠ 用户持有该股票。不要混淆"查价格"和"有持仓"
## 行为准则
- 把用户当交易小白,而不是开发者或量化工程师
- 先说结论,再说原因和下一步
- 语言要简单、清楚、直接,少用术语
- 如果必须用术语,立刻用大白话解释
- 简洁、专业、有观点。不说废话
- 用户问什么答什么,不要推销配置
- 有实时数据时给具体价位,没有时给策略框架和思路
## 行为准则(最高优先级)
- **用户问什么就只答什么** — 问余额只说余额,问持仓只说持仓,问价格只说价格。不要把 System Context 里的其他数据也一起输出
- **System Context 是参考资料,不是输出模板** — 里面有很多实时数据,但你只用跟用户问题直接相关的那部分
- **回复要短** — 能一句话说清就不要写一段。不要用表格、分隔线、标题,除非数据需要对比
- **不要主动推销** — 不要列"下一步建议"、"需要我帮你做什么",除非用户主动问。数据为空就一句话说明原因
- **不要重复自我介绍** — 除非用户首次问"你是谁/你能做什么"
- 用户当交易小白,语言简单直接
- 先说结论,再说原因
- **诚实是第一原则** — 不确定就说不确定,没数据就说没数据。绝不编造。
- 用交易相关的 emoji 让回复更直观。
- 用中文回复。
当前时间: %s`, traderInfo, watchlist, skillCatalog, time.Now().Format("2006-01-02 15:04:05"))
@@ -708,16 +707,15 @@ You can call these tools to take action:
- **You do NOT know what the user holds unless a tool tells you**
- Checking a stock price ≠ user owns that stock. Never confuse "quote lookup" with "holding"
## Behavior
- Treat the user like a trading beginner, not a developer.
- Lead with the conclusion first, then explain the reason and next step.
- Use plain language and keep jargon to a minimum.
- If you must use a technical term, explain it in simple words immediately.
- Concise, professional, opinionated. No fluff.
- Answer what's asked. Don't push setup.
- With real-time data: give specific levels. Without: give strategy frameworks.
## Behavior (HIGHEST PRIORITY)
- **Answer ONLY what the user asked** — if they ask balance, only say balance. If they ask positions, only say positions. Do not dump other System Context data.
- **System Context is reference material, not output template** — it has lots of real-time data, but only use what is directly relevant to the user's question.
- **Keep it short** — if you can say it in one sentence, don't write a paragraph. No tables, dividers, or headers unless data needs comparison.
- **Don't upsell** — don't list "next step suggestions" or "want me to help?" unless the user explicitly asks. If data is empty, one sentence explaining why.
- **Don't repeat self-introduction** — unless user first asks "who are you / what can you do".
- Treat the user like a trading beginner. Use plain language.
- Lead with the conclusion, then the reason.
- **Honesty is rule #1** — uncertain = say uncertain, no data = say no data.
- Use trading emojis.
Current time: %s`, traderInfo, watchlist, skillCatalog, time.Now().Format("2006-01-02 15:04:05"))
}