版本: 1.0.0
作者: 小 D
描述: 企业级 AI Agent 框架 - Hook 事件系统、自动记忆抽取、核心 Agent 定义
在关键事件发生时自动触发脚本,实现:
支持的 Hook 事件:
SessionStart - 会话开始SessionEnd - 会话结束PreToolUse - 工具调用前PostToolUse - 工具调用后UserMessage - 用户消息AgentResponse - Agent 回复前从对话中自动学习:
预置 4 个专业 Agent:
clawhub install hai-agent-framework
在 .hai/hooks/ 目录下创建 Hook 配置文件:
{
"name": "load-memory",
"description": "加载用户记忆",
"event": "SessionStart",
"priority": 100,
"enabled": true,
"action": {
"type": "script",
"script": ".hai/scripts/load-memory.py"
}
}
在任务中指定 Agent:
---
agent: code-reviewer
---
请审查这段代码...
自动运行,无需配置。对话记录会自动分析并保存到 memory/ 目录。
python3 .hai/scripts/hook-executor.py SessionStart
python3 .hai/scripts/hook-executor.py PreToolUse \
--context '{"tool":"write","args":{"path":"test.txt"}}'
python3 .hai/scripts/conversation-analyzer.py \
--text "我喜欢用深色模式,不要用浅色"
.hai/
├── agents/ # Agent 定义
│ ├── code-reviewer.md
│ ├── test-generator.md
│ ├── security-scanner.md
│ └── documentation-writer.md
├── hooks/ # Hook 配置
│ ├── SessionStart/
│ ├── SessionEnd/
│ ├── PreToolUse/
│ └── PostToolUse/
├── scripts/ # 执行脚本
│ ├── hook-executor.py
│ ├── load-memory.py
│ ├── save-summary.py
│ ├── validate-params.py
│ └── conversation-analyzer.py
├── rules/ # 用户规则
│ └── *.local.md
└── memory/ # 记忆文件
├── transcript/
├── project/
└── global/
# 测试 Hook 系统
python3 .hai/scripts/hook-executor.py --list
# 测试 SessionStart Hook
python3 .hai/scripts/hook-executor.py SessionStart
# 测试对话分析
python3 .hai/scripts/conversation-analyzer.py --text "测试文本"
欢迎提交 Issue 和 Pull Request!
GitHub: https://github.com/your-repo/hai-agent-framework
MIT
HAI Agent Framework v1.0 · 2026-04-03
共 1 个版本
暂无安全检测报告