Install
openclaw skills install @myd2002/kb-ingestCompile backend-uploaded source files into Research KB Markdown wiki pages, write them to Gitea, archive sources, and return structured JSON results.
openclaw skills install @myd2002/kb-ingestkb_ingest 只负责把 Java 后端已经上传好的源文件编译成 Research KB 的 Markdown wiki 页面,并写入指定的 Gitea 知识库仓库。它不负责登录、权限判断、本地扫描、重复文件预检查、目标仓库选择、任务创建、会话记录或用户交互。
每个任务表示一次完整的源扫描上传。必须把 payload.files[] 当成同一个快照来理解,保留 relativePath 中的原始目录结构。
只接受满足以下条件的 JSON:
protocol = research_kb_agent_tasktaskType = kb_ingestkbTargets[] 中恰好有一个目标payload.files[] 非空,且每个文件包含后端可读的 uploadedPath不要要求任务 JSON 携带 Gitea token。Gitea 凭据只能从 skill 环境变量读取。
处理任务时按以下顺序执行:
archiveSourceFile 选项归档到 source_files/。package.json、pyproject.toml、requirements.txt、pom.xml、build.gradle、Cargo.toml、go.mod、.sln、.csproj、Makefile、CMakeLists.txt、Dockerfile 等。codebase 页面;如果根目录标记显示这是 monorepo,保持整体编译,不要拆成无意义的小页。paper、survey、project、doc、experiment、meeting 或 note。scripts/summary_templates.py 中的中文结构生成 wiki 页面。sources 数组。代码库页面的 sources 必须覆盖该项目摘要使用到的所有源文件。catalog.json,更新 index.md。imports/ 下写入导入报告。research_kb_agent_result JSON。参考“先把资料编译成持久 wiki,再用于查询”的方式:入库阶段要尽量把原始资料转成可检索、可引用、可追踪的中文知识页,而不是只保存原文摘录。
不同类型页面必须关注对应信息:
paper -> summaries/papers/survey -> summaries/surveys/project -> summaries/projects/doc -> summaries/docs_tech/experiment -> summaries/experiments/meeting -> summaries/meetings/codebase -> summaries/codebases/note -> summaries/notes/团队知识库可以更新 people/ 和 projects/general/。个人知识库不要创建或写入这两个目录。
必须返回如下结构,字段名和层级不能改变:
{
"protocol": "research_kb_agent_result",
"protocolVersion": "1.0",
"taskId": "...",
"taskType": "kb_ingest",
"success": true,
"result": {
"ingestionId": "...",
"kbTarget": {
"kbType": "team",
"repoFullName": "AIFusionBot/aifhku-lab-team-kb",
"branch": "main"
},
"processedFiles": 1,
"createdMarkdownFiles": [],
"updatedMarkdownFiles": [],
"createdExtraPages": [],
"archivedSourceFiles": [],
"skippedFiles": [],
"failedSourceFiles": [],
"catalogUpdated": true,
"indexUpdated": true,
"importReportPath": ""
},
"errors": []
}
单个文件失败时放入 failedSourceFiles。整个任务失败时设置 success=false。
稳定入口是:
python3 scripts/run_task.py --stdin
python3 scripts/run_task.py --task-json <path>
该脚本会校验任务、抽取文本、归档源文件、生成中文 Markdown、写入 Gitea、更新目录和索引,并返回固定 JSON schema。Agent 可以在调用底层脚本前生成更丰富的页面内容,但最终响应必须仍然遵守上面的输出结构。