Skip to content

feat(ai): add Ideation Agent (灵光) for creative tasks#260

Merged
hrygo merged 4 commits into
mainfrom
feat/235-ideation-agent
Feb 18, 2026
Merged

feat(ai): add Ideation Agent (灵光) for creative tasks#260
hrygo merged 4 commits into
mainfrom
feat/235-ideation-agent

Conversation

@hrygo

@hrygo hrygo commented Feb 18, 2026

Copy link
Copy Markdown
Owner

Summary

新增 Ideation Agent (灵光) - 创意生成专家,用于头脑风暴、写作辅助和创意激发。

变更内容

  • 新增 config/parrots/ideation.yaml: Ideation Agent 配置
  • 新增 ai/agents/tools/memo_write.go: 保存创意到笔记的工具
  • 更新 server/router/api/v1/ai/factory.go: 注册 memo_write 工具工厂

关键设计决策

决策 选择 原因
中文名 灵光 灵光一现,创意激发
与 General 区分 完全分离 Ideation 只做创意,翻译归 General
memo_search 不需要 Ideation 是纯 LLM 能力
memo_write 需要 支持保存创意到笔记
路由优先级 1(高) Ideation 优先于 General
策略 direct 简单直接,无需 ReAct

能力边界

Agent 负责领域 排除项
Ideation (灵光) 头脑风暴、写作辅助、创意生成、灵感激发 翻译、润色、总结
General (通才) 总结、翻译、改写、问答、分析推理 创意生成

路由关键词示例

  • ✅ 匹配: "头脑风暴"、"想个创意"、"营销文案"、"故事构思"
  • ❌ 排除: "翻译"、"润色"、"总结"、"搜索笔记"、"创建日程"

Resolves #235

Changes

  • config/parrots/ideation.yaml: 新增 Ideation Agent 配置
  • ai/agents/tools/memo_write.go: 新增 memo_write 工具
  • server/router/api/v1/ai/factory.go: 注册 memo_write 工厂

Test plan

  • go build ./... 通过
  • go test ./... 通过
  • golangci-lint 通过
  • make check-all 通过
  • 启动服务测试 Ideation Agent 路由
  • 测试 memo_write 工具保存功能

Add a new expert agent for brainstorming, writing assistance, and creative ideation.

Changes:
- Add config/parrots/ideation.yaml: Ideation Agent configuration
- Add ai/agents/tools/memo_write.go: Tool to save creative ideas to memos
- Update factory.go: Register memo_write tool factory

Key design decisions:
- Chinese name: 灵光 (inspired by "灵光一现")
- Strategy: direct (simple, no ReAct needed)
- Tools: memo_write, report_inability
- Routing priority: 1 (higher than General)
- Clear boundary: Ideation handles creativity, General handles translation/polish

Resolves #235

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hrygo

hrygo commented Feb 18, 2026

Copy link
Copy Markdown
Owner Author

Code review

Found 2 issues:

  1. Priority configuration comment contradicts implementation - ideation.yaml states "Priority 1 means Ideation has higher priority than General (priority 2)" but the code at capability_map.go:428-430 uses return prioI > prioJ, meaning higher numeric value = higher priority. This causes General (priority=2) to actually be selected before Ideation (priority=1), opposite to the documented intent.

config/parrots/ideation.yaml#L177-L179

  1. CLAUDE.md not updated - Issue [feat] Ideation Agent - 创意生成专家 #235 acceptance criteria requires "已更新 CLAUDE.md 中的 Agent 列表". The expert agent table at CLAUDE.md:104-109 is missing IdeationParrot (灵光), and the architecture diagram at CLAUDE.md:83-101 does not include the Ideation Agent.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

hotplex-ai and others added 3 commits February 18, 2026 17:47
Issues fixed:
1. Priority configuration comment contradicted implementation
   - Code uses `prioI > prioJ`, meaning higher value = higher priority
   - But ideation.yaml comment said "Priority 1 means higher than General (priority 2)"
   - Fixed by updating all agent priorities to match intended behavior

2. CLAUDE.md not updated (Issue #235 acceptance criteria)
   - Added IdeationParrot (灵光) to expert agent table
   - Updated architecture diagram to include Ideation Agent

Priority system (higher = more preferred):
- Ideation: 10 (highest for creative tasks)
- Schedule: 8 (high-frequency operation)
- Memo: 8 (high-frequency operation)
- General: 1 (fallback, lowest)

Refs #235

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace abbreviated English labels (Memo, Sched, Ideation, General) with
Chinese labels (笔记, 日程, 创意, 通用) for better readability.

Refs #235

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use consistent English labels for agents (Memo, Schedule, Ideation, General)
with Chinese annotations for clarity.

Refs #235

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hrygo hrygo merged commit f9531f7 into main Feb 18, 2026
9 checks passed
@hrygo hrygo deleted the feat/235-ideation-agent branch February 18, 2026 09:53
@hrygo hrygo restored the feat/235-ideation-agent branch February 18, 2026 09:59
88lin pushed a commit to 88lin/divinesense that referenced this pull request Feb 18, 2026
* fix(ai): Orchestrator 模式下会话标题生成未触发

在 Orchestrator 模式的 Block 完成后添加 maybeGenerateConversationTitle 调用,
与非 Orchestrator 模式保持一致。

修复:Block 完成后检查是否为首个成功 Block,若是则异步生成会话标题。

Resolves hrygo#257

* fix(ai): 多轮对话上下文丢失 - AssistantTimestamp 未设置

根因:
- Block 完成时未设置 assistant_timestamp 字段
- 导致排序后 assistant 消息时间戳为 0,排在 user 消息之前
- BuildHistory 无法处理 [assistant, user] 顺序,返回空数组

修复:
1. UpdateAIBlock 结构体添加 AssistantTs 字段
2. postgres UpdateAIBlock 函数处理 assistant_timestamp 更新
3. BlockManager.UpdateBlockStatus 设置 AssistantTs

Resolves hrygo#255

* feat(ai): 新增通用智能代理处理纯 LLM 任务

添加 General Parrot 配置,处理总结、翻译、改写、问答等不需要特定工具的任务。

修改:
- config/parrots/general.yaml: General Parrot 配置文件
  - strategy: direct(直接执行,无工具)
  - 路由关键词:总结、翻译、改写、解释等

- ai/agents/chat_router.go:
  - 添加 RouteTypeGeneral 常量
  - 添加 general_task 关键词映射

- ai/agents/orchestrator/expert_registry.go:
  - 添加 general -> general_task 映射
  - 添加 general 默认描述

- ai/routing/interface.go:
  - 添加 IntentGeneralTask 常量

Resolves hrygo#256

* ✨ feat(ai): 简单 LLM 任务使用 SiliconFlow Provider

为标题生成、Memo摘要、标签生成等简单 LLM 任务创建专用的 IntentLLMService:
- 新增 ai/simple_task_llm.go:简单任务 LLM 服务工厂,带回退逻辑
- 修改 ai/config.go:IntentClassifierConfig 添加 Provider 字段
- 修改 ai_service.go:添加 IntentLLMService 字段,enrichment 使用专用服务
- 修改 v1.go:创建并注入 IntentLLMService

配置说明:
- 使用 DIVINESENSE_AI_INTENT_* 配置(默认 siliconflow)
- 未配置 AIIntentAPIKey 时回退到主 LLM
- 简单任务参数:MaxTokens=1024, Temperature=0.3

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(ai): 修复 RouteTypeGeneral 和 IntentGeneralTask 映射缺失

审查发现的问题修复:
- routeTypeToExpertName: 添加 RouteTypeGeneral -> "general" 映射
- mapIntentToRouteType: 添加 AgentTypeGeneral -> RouteTypeGeneral 映射
- ExtractIntent: 添加 RouteTypeGeneral -> "general_task" 映射
- interface.go: 添加 AgentTypeGeneral 常量

这些修复确保 general agent 可以正确路由和 sticky routing。

Refs hrygo#256

* 🐛 fix(ai): 修复审查发现的问题

修复代码审查发现的 3 个问题:
1. simple_task_llm.go: 添加 Profile nil 检查防止 panic
2. simple_task_llm.go: 添加 Timeout 配置 (30秒)
3. config.go: 添加 IntentClassifier 配置验证

同时更新文档说明返回值可能为 nil。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(ai): 意图路由关键词分层配置

- rule_matcher: general expert 映射到 IntentGeneralTask
- general.yaml: 扩展 patterns 匹配规则,priority 设为 8
- memo.yaml: sticky routing 关键词聚焦 follow-up 场景
- schedule.yaml: excludes 排除通用 LLM 任务关键词
- chat_router.go: intentKeywords 与配置文件保持一致

Resolves hrygo#260

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(ai): 调整专家代理路由优先级

priority: general=15, memo=10, schedule=10

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* 🐛 fix(ai): 修复 PR hrygo#258 审查发现的问题

- intent_registry.go: RegisterDefaults() 添加 IntentGeneralTask 注册
- intent_registry.go: actionToIntent() 添加 AgentTypeGeneral 处理
- chat_router.go: general_task 关键词与 general.yaml 对齐
- simple_task_llm.go: Intent 创建失败日志添加 model 字段

Resolves hrygo#258

* fix(ai): 优化启动预热和 UX 反馈

- 添加服务启动时异步预热 Router service (语义索引)
- 添加 Orchestrator decompose_start/end 事件解决 Block 页面卡顿
- 移除 Chat router 日志中误导性的 model 字段

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(ai): 添加 decompose 进度事件和会话标题自动刷新

前端修改:
- 添加 DECOMPOSE_START/END 事件类型和处理逻辑
- 添加 scheduleTitleRefresh 方法延迟获取后端生成的标题
- Block 0 完成后 3 秒刷新会话列表获取自动生成的标题

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: 添加 @ 符号选择专家 Agent 调研报告

- 新增 agent-mention-feature-research.md 调研报告
- CLAUDE.md 添加 GitHub 仓库配置和 gh 命令注意事项
- 更新 research README 索引

Refs hrygo#259

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(scripts): 修复 pre-commit hook 前端 lint 修复文件未暂存问题

- 将 git add 移到 git root 目录执行,确保路径正确匹配
- 添加 xargs -r 避免空输入报错

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: 黄飞虹 <aaronwong1989@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] Ideation Agent - 创意生成专家

2 participants