book-agent 是 AI 小说管线模板。所有贡献通过 agent prompt 和 shell 脚本完成。
mkdir -p 我的小说/{config,truth,prompts,scripts}
cp config/project.json.example 我的小说/config/project.json
cp truth/truth_*.json 我的小说/truth/编辑 project.json 填入书名、类型、章节数。
每个 Agent 在 prompts/<agent>/ 下有 4 个文件:
| 文件 | 说明 |
|---|---|
| agent.json | 角色定义 (ID, 端口, 负责的工序, output_dirs) |
| config.yaml | Hermes Agent 运行时配置 (model, cwd, port) |
| prompt.md | 系统提示词 (角色设定、工作要求、质量约束) |
| flow.md | 工序流程说明 |
修改 prompt.md 即可改变 Agent 行为。修改 agent.json 的 output_dirs 需要同步 pipeline.json 的 flows 字段。
在 genres/ 下创建 <类型>.md,内容含:
- 类型定义与常见子类
- 典型设定元素
- 写作注意事项
参考 genres/genre_xianxia.md 的格式。
在 scripts/ 下创建 .sh 文件。要求:
- shebang
#!/usr/bin/env bash - 第一行代码
set -euo pipefail - 提供 usage() 函数和
-h/--help支持 - 用
bash -n检查语法
bash -n scripts/*.sh # Shell 语法
scripts/validate-yaml.sh # YAML 验证
find . -name '*.json' -exec sh -c 'jq empty "$1"' _ {} \; # JSON 验证book-agent/
├── prompts/ Agent 提示词定义
├── scripts/ 全流程 Shell 脚本
├── config/ 项目级配置
├── flows/ 工序流程文档
├── genres/ 类型创作指南
├── style/ 写作风格规范
├── truth/ 设定事实模板
├── projects/ 项目模板 + 注册表
└── audit/ 审计报告