Files
document_analyzer/CLAUDE.md
pzhang_zywl 76f51a7d0c
CI / test (pull_request) Successful in 23s
test: Generic Agent 启动代码同步 + 禁止直接改代码 — Closes #122
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-08 14:55:49 +08:00

50 lines
2.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# document_analyzer — PRD-to-IR Pipeline
基于 AI 的车机 PRD 文档解析与结构化 IR 生成 pipeline。通过 Dev-Agent 与 QE-Agent 协同迭代,探索 AI Agent 多智能体协作的软件工程闭环。
## 项目文档(session 启动时读取)
使用 Read 工具加载以下文件(绝对路径,不要用 Glob):
- `C:\Users\peterz\projects\document_analyzer\docs\PROJECT_CHARTER.md` — 项目愿景、目标、架构、约束
- `C:\Users\peterz\projects\document_analyzer\docs\GLOBAL_STATE.md` — 当前阶段目标、已知问题、最近变更
## Gitea 配置
- 配置文件:`~/.gitea/config.yaml`,按 `GITEA_USER` 环境变量选择 profile
- 默认使用人类用户身份(generic session):`export GITEA_USER=pzhangzywl`
- Agent 身份通过各自环境变量设置(Dev: `pzhang_dev_agent_01`QE: `pzhang_qe_agent_01`
- **所有 Gitea API 操作必须通过 `python scripts/agent_poller.py`**,禁止直接 curl 或硬编码 token
## 代码同步
Dev-Agent 和 QE-Agent 持续向 main 提交代码,本地可能落后。Session 启动时必须同步:
- **启动时**:自动执行 `git pull origin main`,确保本地是最新代码
- **运行中**:定期 `git fetch origin` 检查 `HEAD..origin/main`,有新提交则 pull
- **有冲突时**:暂停并报告,不自动解决(人工介入)
## 上下文管理
Context window 有限。当 session 持续较长时间时:
1. 根据对话轮次和消息长度估计 context 使用量
2. **使用量达 ~80% 时主动使用 `/compact` 压缩对话**
3. 压缩时保留:当前 Issue 上下文、`GLOBAL_STATE.md``PROJECT_CHARTER.md`、Agent 角色定义
4. 压缩后从摘要恢复上下文,继续当前任务
## 核心规则
1. 代码改动走完整流程:Issue → 分支 → 开发/UT → pytest → PR → CI → merge → 自行验证 → 关闭 Issue
2. 关闭 Issue 必须包含 4 要素:问题 / 根因 / 修复 / 验证
3. **Label 优先原则**Issue 的 label 反映创建者(尤其是人类)的显式意图,Agent 必须尊重
- `test-code` → QE-Agent 域,`product-code` → Dev-Agent 域
- 即使内容看似不在自身常规范围,只要 label 指定了自己的域,就必须 pick up
- Label 与内容明显冲突时,先 pick up 并评论确认,不直接跳过
4. **禁止直接改代码**:任何对 git 管理内容的修改必须走完整闭环(Issue → 分支 → 开发/UT → pytest → PR → CI → merge → 验证 → 关闭),即使是 trivial 修改也如此。禁止绕过此流程直接编辑文件
## Agent 模式
- **Dev-Agent**: 启动时自动加载 `.claude/agents/dev-agent.md`(功能开发、重构、UT、接口集成测试)
- **QE-Agent**: 启动时自动加载 `.claude/agents/qe-agent.md`(验收测试、质量门禁)
- **Generic session**: 仅加载本文件,使用人类用户身份工作