- 入库历史遗漏源码/测试:router_system 9 模块(agent/executors/inference/knowledge/ memory/planner/skills/trace)、tests 11 个测试文件、config/knowledge 领域知识 - 入库根目录方案文档(v2/v3/可行性×2)、references 文献(arxiv 14-18/cnki_open/ 参考文献清单)、research 论文素材(routerarena/paper/中文文献 PDF) - 前端构建产物刷新(新 hash);webapp 误写文档删除 - gitignore 增补:deepseek-harness、research/_refs、.mimosa/.zcode、网关日志/pid、 临时调试脚本、tests/e2e/node_modules、AI代理功能开发/prefix - 基线确认:318 passed
98 lines
4.0 KiB
YAML
98 lines
4.0 KiB
YAML
# 代码领域知识规则(专家系统风格:关键词子串匹配 + 优先级)
|
||
# subdomain:子领域细化标注(algorithm/debugging/web/database/devops/...)
|
||
# 规则分类:template 规则 → 触发任务拆解;output 规则 → 前向链直接产出知识章节
|
||
domain: code
|
||
rules:
|
||
# ---- 任务拆解类规则(template)----
|
||
- id: code-sort
|
||
priority: 90
|
||
subdomain: algorithm
|
||
patterns: ["排序", "快速排序", "排序算法", "二分查找", "sort", "quicksort", "binary search"]
|
||
template: code-implement
|
||
|
||
- id: code-debug
|
||
priority: 85
|
||
subdomain: debugging
|
||
patterns: ["报错", "错误", "调试", "bug", "debug", "typeerror", "异常", "报错信息"]
|
||
template: code-debug
|
||
|
||
- id: code-algorithm
|
||
priority: 82
|
||
subdomain: algorithm
|
||
patterns: ["算法", "数据结构", "递归", "动态规划", "回溯", "贪心", "algorithm", "recursion",
|
||
"dp", "bfs", "dfs", "链表", "栈", "队列", "树", "图"]
|
||
template: code-algorithm
|
||
|
||
- id: code-refactor
|
||
priority: 80
|
||
subdomain: refactoring
|
||
patterns: ["重构", "优化代码", "改善", "refactor", "代码质量", "清理代码", "消除重复"]
|
||
template: code-refactor
|
||
|
||
- id: code-database
|
||
priority: 78
|
||
subdomain: database
|
||
patterns: ["数据库", "sql", "索引", "查询", "database"]
|
||
template: code-implement
|
||
|
||
- id: code-explain
|
||
priority: 76
|
||
subdomain: reading
|
||
patterns: ["解释这段代码", "这段代码什么意思", "代码讲解", "逐行解释", "explain this code",
|
||
"理解这段代码", "分析这段代码"]
|
||
template: code-explain
|
||
|
||
- id: code-test
|
||
priority: 74
|
||
subdomain: testing
|
||
patterns: ["单元测试", "测试用例", "写测试", "unittest", "pytest", "单测", "测试代码"]
|
||
template: code-test
|
||
|
||
- id: code-web
|
||
priority: 72
|
||
subdomain: web
|
||
patterns: ["前端", "后端", "接口", "api", "flask", "django", "爬虫", "web", "restful"]
|
||
template: code-implement
|
||
|
||
- id: code-implement-general
|
||
priority: 50
|
||
subdomain: implementation
|
||
patterns: ["实现", "编写", "写一个", "函数", "代码", "编程", "用 python", "用 java",
|
||
"用 javascript", "sql", "接口", "算法"]
|
||
template: code-implement
|
||
|
||
# ---- 知识问答类规则(output:前向链直接产出答案章节)----
|
||
- id: code-git-knowledge
|
||
priority: 60
|
||
subdomain: devops
|
||
patterns: ["git", "版本控制", "提交", "分支", "merge", "rebase", "clone", "commit",
|
||
"push", "pull", "回滚", "冲突"]
|
||
output: |
|
||
(git 知识)关于「{query}」:
|
||
- git 核心概念:工作区 / 暂存区 / 本地仓库 / 远程仓库
|
||
- 常用命令:git add → git commit → git push;git pull 同步远端
|
||
- 回滚:git reset --hard <commit> 丢弃本地修改;git revert 生成反向提交
|
||
- 冲突处理:先 git pull 拉取最新,手动解决冲突标记后 add+commit
|
||
- 分支:git checkout -b <name> 新建并切换;git merge <branch> 合并
|
||
|
||
- id: code-docker-knowledge
|
||
priority: 58
|
||
subdomain: devops
|
||
patterns: ["docker", "容器", "镜像", "k8s", "kubernetes", "部署", "compose"]
|
||
output: |
|
||
(部署知识)关于「{query}」:
|
||
- 镜像 vs 容器:镜像=只读模板,容器=运行实例
|
||
- 常用命令:docker build -t <name> . ; docker run -p 8000:8000 <name>
|
||
- 多服务编排:docker-compose.yml 定义 services/ports/volumes
|
||
- 生产要点:固定镜像版本、非 root 运行、健康检查、日志落盘
|
||
|
||
- id: code-python-knowledge
|
||
priority: 55
|
||
subdomain: environment
|
||
patterns: ["python 语法", "python 技巧", "virtualenv", "pip", "venv", "环境", "安装依赖"]
|
||
output: |
|
||
(python 环境知识)关于「{query}」:
|
||
- 虚拟环境:python -m venv .venv 创建;.venv/Scripts/activate 激活
|
||
- 依赖管理:pip install -r requirements.txt;pip freeze > requirements.txt
|
||
- 常用技巧:列表推导式、with 上下文管理、f-string 格式化
|