diff --git a/.gitignore b/.gitignore index 53711a8..e9de50b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,17 +5,17 @@ secrets.env *.pem # ============ 字体(~140MB,通过 download-fonts.sh 获取)============ -.opencode/templates/fonts/*.otf -.opencode/templates/fonts/*.ttf -.opencode/templates/fonts/*.ttc -.opencode/templates/fonts/*.woff* +*.otf +*.ttf +*.ttc +*.woff* # ============ 研究产出物(大文件)============ -projects/*/phase4/*.pdf -projects/*/phase4/*.docx -projects/*/phase4/figures/*.png -projects/*/phase2/evidence/*.cache -projects/*/**/*.tmp +*/projects/*/phase4/*.pdf +*/projects/*/phase4/*.docx +*/projects/*/phase4/figures/*.png +*/projects/*/phase2/evidence/*.cache +*/projects/*/**/*.tmp # ============ Python ============ __pycache__/ @@ -45,32 +45,28 @@ Thumbs.db .idea/ *.sublime-* -# ============ OpenCode ============ -.opencode/log/ -.opencode/cache/ +# ============ Generated platform environments ============ +/antigravity/ +/codex/ +/opencode/ +/claude-code/ +/gemini-cli/ +/platform_envs/ -# ============ Codex adapter deployment target ============ -# v0.20 keeps Codex templates in codex_adapter_templates/ and deploys usable -# files to $CODEX_HOME or ~/.codex via scripts/deploy_adapters.py. -.codex/ - -# ============ Generated / legacy platform adapter working dirs ============ -# Antigravity native work should use tracked .agent/ only. These directories -# are generated for other tools or kept out of clean Antigravity workspaces. -.agents/ -.opencode/ -.claude/ -.gemini/ - -# Rebuilt local platform workspaces. Generated by scripts/update_platform_envs.py. -platform_envs/ +# ============ Legacy root platform dirs ============ +/.agent/ +/.agents/ +/.codex/ +/.opencode/ +/.claude/ +/.gemini/ # Local platform permissions/settings are never source templates. -platform_adapters/claude-code/settings.local.json +src/platform_adapters/claude-code/settings.local.json # ============ 归档(不纳入版本控制)============ -archive/* -!archive/.gitkeep +src/archive/* +!src/archive/.gitkeep # ============ 临时 LaTeX / TeX 测试文件 ============ xetest.* @@ -86,4 +82,5 @@ _preamble.tex # ============ 研究项目(实际数据,不纳入版本控制)============ # 如需备份,请用独立的私有仓库 -projects/ +src/projects/* +!src/projects/.gitkeep diff --git a/README.md b/README.md index 759f39a..c7ceefb 100644 --- a/README.md +++ b/README.md @@ -1,523 +1,67 @@ -# Deep Research 系统 +# Deep Research -> 生物医药行业的 AI 驱动深度研究流水线。v0.20 起以项目自有 Python core + skills + model profiles 为核心,以麦肯锡/德勤式方法论产出专业级研究报告(PDF + DOCX)。 +生物医药 Deep Research 仓库。根目录只保留入口说明和环境重建脚本;所有源文件放在 `src/`,各平台运行目录由脚本生成。 -**当前状态**:v0.20 重构启动。核心编排从平台 prompt 迁移到项目自有 Python runtime:模型选择、skills、任务卡并发、中文原生成稿都由 `scripts/dr.py` 与 `configs/models.yaml` 驱动;OpenCode/Codex/Claude Code/Antigravity/Gemini CLI 只作为表层入口。 -详见 `PLAN.md` 了解完整方案、版本记录与迭代路径。 +## Directory Layout ---- - -## 快速开始 - -> 项目在 **macOS** 与 **Debian/Ubuntu** 上均通用。Python 包管理用 [**uv**](https://docs.astral.sh/uv/)(Rust 写的 Python 包管理器,比 pip 快 10-100 倍,Astral 出品)。 - -### 1. 一键初始化(推荐) - -```bash -bash scripts/setup.sh -``` - -这个脚本会自动: -- 检查并安装 **uv**(没有会交互询问,走官方 `curl -LsSf https://astral.sh/uv/install.sh` 脚本) -- 调用 `uv sync` 按 `pyproject.toml` 创建 `.venv/` 并装所有依赖(ReportLab、matplotlib、biopython 等) -- uv 会自动管理 Python 版本(>=3.10),不依赖系统 Python -- 检查并提示缺失的系统二进制(pandoc、opencode) - -**为什么选 uv 而不是 pip**: -- macOS Homebrew Python、Debian 12+ 默认 PEP 668 保护,`pip install` 到系统会被拒 -- uv 把 venv + 版本管理 + 依赖解析一次搞定,不需要手动 `python -m venv` + `source activate` + `pip install` -- `uv sync` 10-30 秒装完一整个科学计算栈(pip 要 2-5 分钟) -- 有 `uv.lock` 锁定精确版本,mac 和 debian 装出来的环境完全一致 - -### 2. 安装系统二进制(setup.sh 不装这些) - -```bash -# macOS -brew install pandoc -curl -fsSL https://opencode.ai/install | bash - -# Debian/Ubuntu -sudo apt update && sudo apt install -y pandoc curl -curl -fsSL https://opencode.ai/install | bash -``` - -> uv 会帮你装 Python 本身,不需要再装 `python3-venv` / `python3-pip`。 - -### 3. 配置密钥 - -```bash -cp secrets.env.example secrets.env -# 编辑 secrets.env,填入: -# - ZENMUX_API_KEY(必填,格式 sk-ai-v1-xxx) -# - TAVILY_API_KEY / BRAVE_API_KEY / EXA_API_KEY -# - NCBI_API_KEY(可选,PubMed 高频查询时用) -``` - -### 4. 下载中文字体 - -```bash -bash .opencode/templates/fonts/download-fonts.sh -``` - -下载思源宋体 + 思源黑体 + 霞鹜文楷(SIL OFL 许可,约 140MB)。 - -### 5. 验证 zenmux 端点与 cache(强烈推荐) - -```bash -source scripts/activate.sh # 一键激活 venv + 加载 secrets -bash scripts/verify-zenmux.sh # 3 步自检 -``` - -`verify-zenmux.sh` 会: -1. 测 OpenAI 兼容端点(Gemini 3.1 Pro Preview) -2. 测 Anthropic 兼容端点(Claude Haiku 4.5) -3. 测 Claude prompt cache 两次调用命中(Opus 4.7 cache 读取仅 0.5 USD/M tokens) - -若第 3 步 `cache_read_input_tokens` 始终为 0,参见 `AGENTS.md` §6.5 诊断步骤。 - -### 6. 日常使用 - -```bash -cd ~/Documents/Projects/deep_research -source scripts/activate.sh # 激活 venv + 载入 secrets -opencode # 启动 TUI -``` - -**退出 venv**:`deactivate` - -**跑单个 Python 脚本**(不用先激活): -```bash -uv run python scripts/build_report.py # 默认 ReportLab -uv run python scripts/build_report.py --engine quarto # Quarto/xelatex -``` - -网络不稳或 API 限流时,把 `--workers` 降到 `3` 或 `1` 即可断点续跑。 - -### 多平台兼容 - -v0.20 后,OpenCode/Codex/Claude Code/Gemini CLI 都是 Python core 的 surface adapter。各平台配置源放在非隐藏目录 `platform_adapters/`;本地运行环境由 `scripts/update_platform_envs.py` 重建到被忽略的 `platform_envs/`。Antigravity 走 native 模式,用自身模型配额按 phase 执行研究,Python core 只做辅助。详细调用方式见 `docs/platform-adapters.md`。 - -- OpenCode:生成到 `platform_envs/opencode/.opencode/commands/*.md`,薄封装 Python CLI。 -- Codex:使用 `AGENTS.md` + 部署到 `$CODEX_HOME` 的 adapter 文件,优先用 GPT 系列做代码/测试/审阅。 -- Claude Code:生成到 `platform_envs/claude-code/.claude/skills/*/SKILL.md`,优先用 Opus/Sonnet 做访谈、结构讨论和中文风格审阅。 -- Gemini CLI:生成到 `platform_envs/gemini-cli/.gemini/commands/dr/*.toml`,优先用 Gemini 做长上下文、多模态和替代框架审阅。 -- Antigravity:打开 `platform_envs/antigravity`,使用其中的 `.agent/rules` + `.agent/skills` 指导其用 Antigravity 模型配额原生执行 Deep Research;Python core 只做脚手架、校验、引用和出稿辅助。 - -更新/重建某个平台环境: - -```bash -python scripts/update_platform_envs.py --platform antigravity -python scripts/update_platform_envs.py --platform all -``` - -Antigravity 推荐打开 clean workspace,不推荐直接打开完整多平台仓库。详见 `docs/antigravity-clean-workspace.md`。 -平台分支/环境隔离策略见 `docs/platform-branch-strategy.md`。 - -部署 Codex adapter(不在仓库内创建 `.codex`): - -```bash -uv run python scripts/deploy_adapters.py codex --force -``` - -Codex adapter 会写到 `$CODEX_HOME` 或 `~/.codex`;已有文件会在 `--force` 覆盖前生成 `.bak` 备份。adapter 默认面向自动化研究:workspace 可写、命令不逐次审批、实时 web search 与脚本网络访问开启;Tavily / Brave / Exa MCP 会默认启用但不设为必需服务。 - -安全默认:部署脚本不会复制 `config.toml`,避免覆盖用户级 Codex 配置。只有明确需要安装本项目 bundled profile 时,才使用 `--include-config`。 - -部署 Antigravity workspace adapter(从 `platform_adapters/antigravity` 写到目标工作区 `.agent/`,默认不覆盖已有文件): - -```bash -uv run python scripts/deploy_adapters.py antigravity --target /path/to/workspace --dry-run -uv run python scripts/deploy_adapters.py antigravity --target /path/to/workspace -``` - -Antigravity 部署不会修改全局设置。若目标工作区已有同名 agents/rule/skill/workflow 文件,默认跳过;只有显式加 `--force` 时才会先生成 `.bak` 备份再覆盖。Antigravity 分层为:`.agent/agents.md` 定义角色,`.agent/rules` 放强约束,`.agent/skills` 放能力,`.agent/workflows` 放流程。关键 artifact 包括 `search_log.jsonl`、`sources.jsonl`、`claims_ledger.jsonl`、`coverage_matrix.md` 和 `continuation_state.json`。 - -部署到新环境后自检: - -```bash -uv run python scripts/deploy_check.py -uv run python scripts/deploy_check.py --repair --force -``` - -运行平台无关 Python core: - -```bash -uv run python scripts/dr.py init "研究主题" --slug --method mckinsey_market -uv run python scripts/dr.py frame -uv run python scripts/dr.py run --method gmp_gap_assessment -uv run python scripts/dr.py research --workers 6 -uv run python scripts/dr.py research --workers 6 --execute-packets -uv run python scripts/dr.py research --workers 6 --execute-packets --allow-search-fallback -uv run python scripts/dr.py research --workers 6 --build-briefs -uv run python scripts/dr.py research --workers 6 --assemble-chapters -uv run python scripts/dr.py review -uv run python scripts/dr.py finalize -``` - -OpenCode/Codex/Claude Code/Gemini CLI adapter 只包装这些 CLI,不再承担核心调度或模型选择。Antigravity 是例外:它优先按生成环境中的 `.agent/skills/antigravity-surface-adapter` 用自身模型配额执行研究,避免主流程重新落回 ZenMux。 - -模型与搜索 API 选择见: -- `docs/model-playbook.md` -- `docs/search-playbook.md` - -模型预设配置文件: -- `configs/models.yaml`(统一预设,支持 `simple / medium / premium / cn_heavy / codex_native`) - -推荐时机:在 `/dr-init` 访谈阶段就确定 `model_profile`。v0.20 后模型选择优先在 Python runtime 中解析,adapter agent 文件只是兼容层。 - -命令行查看解析后的模型映射: - -```bash -uv run python scripts/dr.py models -uv run python scripts/dr.py models --list -uv run python scripts/dr.py models --profile premium -uv run python scripts/dr.py models --profile medium --model-override dr_verifier=zenmux/openai/gpt-5.4 -uv run python scripts/dr.py skills validate -uv run python scripts/dr.py skills sync -uv run python scripts/dr.py methods list -uv run python scripts/dr.py methods show gmp_gap_assessment - -# apply profile to agent files -uv run python scripts/dr.py apply-models --profile medium --target both --dry-run -uv run python scripts/dr.py apply-models --profile medium --target both -``` - -Sprint 5 回归检查(一键): - -```bash -uv run python scripts/sprint5_regression.py -``` - -统一搜索入口: - -```bash -uv run python scripts/search.py "dual-target RNAi 2024" --route scholar --year-low 2023 -uv run python scripts/search.py "FDA warning letter CAPA deviation change control pharmaceutical" --route evidence --json --trace -uv run python scripts/search.py "dual-target siRNA GalNAc" --route patents -``` - -v0.20 搜索分工:`evidence` 用 Exa highlights 做受控候选证据发现;`scholar/patents/news/fda` 保留专用路由;`general` 只做宽泛发现和兜底;Tavily Research 作为 Phase1 初扫、薄弱章节补证据和 Phase3 回炉工具,结果必须存盘、评分、去重后再进入 evidence packet。Antigravity 原生流程可优先使用 `paperfoot/search-cli` 的 `search` 命令作为统一检索前台,但所有结论仍必须回到本项目 Tier/source-quality 体系。 - ---- - -## 项目结构 - -``` +```text deep_research/ -├── PLAN.md # 完整方案(中断续接从此读起) -├── AGENTS.md # 跨平台研究方法论与运行规则 -├── README.md # 本文件 -├── secrets.env.example # 密钥模板 -├── secrets.env # 你的密钥(gitignore) -│ -├── .opencode/ -│ ├── opencode.json # MCP 配置 + 权限 -│ ├── agents/ # Agent 定义 -│ │ ├── dr-plan.md # [MVP] 框架规划师 Opus 0.7 -│ │ └── dr-pm.md # [MVP] 项目经理 Sonnet 0.2 -│ ├── skills/ # 可复用技能 -│ │ ├── search-strategy/ # [MVP] 检索策略总纲 -│ │ ├── source-quality/ # [MVP] 信源评级 -│ │ ├── length-budget/ # [MVP] 字数预算 -│ │ └── pdf-reportlab/ # [MVP] PDF 模板使用 -│ ├── commands/ -│ │ ├── dr-init.md # [MVP] /dr-init -│ │ └── dr-frame.md # [MVP] /dr-frame -│ └── templates/ -│ ├── report-template.py # [MVP] ReportLab PDF 生成器 -│ └── fonts/ -│ ├── download-fonts.sh -│ └── README.md -│ -├── projects/ # 每个研究一个子目录 -│ └── / -│ ├── manifest.json -│ ├── phase1/ -│ ├── phase2/ -│ ├── phase3/ -│ └── phase4/ -│ -└── archive/ # 完成项目归档 + README.md + setup.sh + src/ # canonical source: scripts, skills, docs, configs, platform adapters + codex/ # generated Codex workspace + antigravity/ # generated Antigravity workspace + opencode/ # generated OpenCode workspace + claude-code/ # generated Claude Code workspace + gemini-cli/ # generated Gemini CLI workspace ``` ---- +Generated platform directories are ignored by Git. Rebuild them whenever source templates change. -## 关键设计要点 +## Setup -### 1. Python core 防止上下文污染 - -OpenCode/Codex/Claude Code/Antigravity/Gemini CLI 的 subagent 或 agent thread 都可能把大上下文带入子会话。v0.20 起,默认并发由 Python runtime 的任务卡执行层控制:先生成 `phase1/research_brief.json` 固化研究意图和任务切分,再生成 `phase2/task_cards.json`,按任务卡产出 `phase2/packets/*.json`,经 `phase2/compressed_findings/*.json` 收束后再组装中文章节。平台 agent 只负责调用 CLI 和展示状态。 - -### 2. 信源分级(Tier 1-4 + 黑名单) - -详见 `AGENTS.md` §4 与 `skills/source-quality/SKILL.md`。 - -- **Tier 1**:PubMed、顶刊、FDA/NMPA 监管、ClinicalTrials、专利 -- **Tier 2**:权威咨询、系统综述、行业协会 -- **Tier 3**:预印本、券商研报、会议摘要(需 Tier 1-2 支撑) -- **Tier 4**:通用搜索(仅做发现入口,不做证据) -- **黑名单**:自媒体、撤稿论文、软文 - -### 3. 字数硬性要求 - -| 类型 | 最小字数 | -|---|---| -| 综述 | 10,000 | -| 研究 | 30,000 | -| 投资 | 20,000 | -| 管理 | 15,000 | - -Phase 1 分配章节配额,Phase 2 自检,不足返工。见 `skills/length-budget/SKILL.md`。 - -### 4. 中文 PDF 双引擎 - -`build_report.py` 现在支持两套 PDF 引擎,按需选择: - -#### 引擎 A:ReportLab(默认,无额外依赖) +Initialize all platform workspaces from local `src/`: ```bash -uv run python scripts/build_report.py +./setup.sh init all ``` -- 字体:思源宋 + 思源黑 + 霞鹜文楷(全 SIL OFL,可商用嵌入) -- 样式:集中在 `build_styles()`,所有字号行距单点维护 -- 速度:30,000 字 3-5 秒出稿 -- 局限:超宽表格(≥4 列且含长文本)需借助列宽 patch 或改为 bullet list 格式 - -#### 引擎 B:Quarto / xelatex(`--engine quarto`,推荐用于宽表报告) +Initialize one platform: ```bash -uv run python scripts/build_report.py --engine quarto +./setup.sh init antigravity +./setup.sh init codex +./setup.sh init opencode +./setup.sh init claude-code +./setup.sh init gemini-cli ``` -- 排版引擎:xelatex(TeX Live / TinyTeX),LaTeX 级排版质量 -- 字体:同样使用思源宋 + 思源黑,通过 fontspec 加载 -- 宽表支持:超宽表通过 `longtable` + `tbl-colwidths` 精确指定列宽比例,不溢出 -- 横向页面:通过 `{.landscape}` div 包裹超宽表,自动插入 `pdflscape` 代码(注意:101 行以上的 landscape longtable 可能触发 TeX `param_size` 上限,建议拆成 ≤20 行的子表块) -- 图表:暂不嵌入 matplotlib 图表(使用文字描述代替) - -**安装 Quarto 引擎**(一次性,系统级): +Pull latest changes and rebuild: ```bash -# 1. 安装 Quarto CLI -# 下载页:https://github.com/quarto-dev/quarto-cli/releases/latest -# Linux 选 .deb 安装包,macOS 选 .pkg - -# 2. 安装 TinyTeX(Quarto 内置命令) -quarto install tinytex - -# 3. 安装中文 LaTeX 支持包 -~/.TinyTeX/bin/x86_64-linux/tlmgr install ctex xecjk cjk xetex -# macOS 路径通常为:~/.TinyTeX/bin/universal-darwin/tlmgr - -# 4. 注册思源字体到 fontconfig -# (先确认字体已下载:bash .opencode/templates/fonts/download-fonts.sh) -mkdir -p ~/.fonts -cp .opencode/templates/fonts/*.otf ~/.fonts/ -cp .opencode/templates/fonts/*.ttf ~/.fonts/ -cp .opencode/templates/fonts/ttf/*.ttf ~/.fonts/ -fc-cache -fv ~/.fonts - -# 5. 验证 -quarto --version # 应输出 1.x.x -fc-list | grep "Source Han" # 应看到思源字体条目 +./setup.sh update all +./setup.sh update antigravity ``` -**两引擎对比**: +After rebuilding, open the generated platform directory in the matching tool: -| 指标 | ReportLab | Quarto/xelatex | -|------|-----------|----------------| -| 安装复杂度 | 无额外依赖 | 需安装 Quarto + TinyTeX | -| 渲染速度 | 3-5 秒 | 30-90 秒(LaTeX 编译) | -| 宽表格处理 | 需 workaround | longtable 原生支持 | -| 横向页面 | 不支持 | 支持(≤20 行/块) | -| 字体嵌入 | OTF 直接嵌入 | fontspec 系统字体 | -| 输出体积 | ~1.2 MB/100页 | ~0.9 MB/100页 | -| 目录生成 | 自定义实现 | LaTeX 自动 \tableofcontents | +- Codex: `deep_research/codex` +- Antigravity: `deep_research/antigravity` +- OpenCode: `deep_research/opencode` +- Claude Code: `deep_research/claude-code` +- Gemini CLI: `deep_research/gemini-cli` -### 5. zenmux 双 provider(Claude cache 关键) +## Source -Deep Research 大量使用**相同的长 system prompt + skill 内容**连续调用 Claude,如果 prompt cache 没生效,Opus/Sonnet 成本会翻 5-10 倍。所以本项目: +Shared skills and research rules should live in `src/` and be reused by platform adapters. Avoid duplicating method, source-quality, citation, evidence, and output-hygiene rules inside platform-specific files unless the platform requires a thin wrapper. -- **Claude 系列** → `zenmux-anthropic/claude-opus-4.7`(走 `https://zenmux.ai/api/anthropic`,`@ai-sdk/anthropic` 原生支持 `cache_control`) -- **非 Claude 系列** → `zenmux/google/gemini-3.1-pro-preview` 等(走 `https://zenmux.ai/api/v1`,隐式缓存自动生效) +Key source locations: -Opus 4.7 cache 读取价格 0.5 USD/M tokens(对比输入 25 USD/M,节省 98%)。 +- `src/scripts/` +- `src/configs/` +- `src/skills/` +- `src/platform_adapters/` +- `src/docs/` +- `src/PLAN.md` -**验证 cache 是否生效**: -1. 在 https://zenmux.ai/settings/logs 打开 API Call Logging -2. 运行一个真实 Claude/ZenMux 调用链路,例如 `uv run python scripts/dr.py research --execute-packets` -3. 第 2 次的 `cache_read_input_tokens` 字段应 > 0 -4. 若始终为 0,检查 `configs/models.yaml` 中对应 role 是否走 `zenmux-anthropic/...` - ---- - -## 已知待办 - -### 用户侧 -1. [x] ~~在 zenmux 后台确认模型 slug,更新 `AGENTS.md` §6 映射表~~(已在 v0.2 完成,使用双 provider 架构) -2. [ ] 填写 `secrets.env` -3. [ ] 运行 `download-fonts.sh` 下载字体 -4. [ ] 用一个小主题(如"5000 字 PD-1 综述")跑通 MVP 流水线 - -### 系统侧(下一阶段) -- [x] Python core `init/frame/research/review/finalize/status` 骨架 -- [x] OpenCode/Codex/Claude Code/Gemini CLI wrapper -- [x] Antigravity 专用 workspace rule + skill,按 Antigravity 模型配额原生执行研究 -- [x] 用户资料导入基础能力:PDF 文本抽取 + FireRed OCR 扫描件识别 + phase0 落盘 -- [ ] 用户资料导入增强:DOCX / PPTX / 表格抽取 / 版面结构化 -- [ ] PDF reporting 包继续拆分:字体、宽表、引用、渲染验证 - ---- - -## 排错 - -### 字体下载失败 -```bash -# 检查网络访问 GitHub -curl -I https://github.com - -# 用镜像手动下载(见 .opencode/templates/fonts/README.md) -``` - -### MCP Server 启动失败 -```bash -# 检查 npx 可用 -which npx - -# 验证 MCP server 可独立运行 -npx -y tavily-mcp@latest -``` - -### 平台 agent 看起来没有真正并发 -v0.20 不再用平台 subagent 作为默认并发机制。请检查 Python core 产物: - -```bash -uv run python scripts/dr.py status -ls projects//phase2/task_cards.json -ls projects//phase2/packets -ls projects//phase2/chapter_briefs -``` - -### ReportLab PDF 中文乱码 -```bash -# 确认字体已注册(venv 里) -source scripts/activate.sh -ls .opencode/templates/fonts/*.otf | wc -l # 应为 6+ - -# 手动测试 -python .opencode/templates/report-template.py --help -``` - -### Quarto PDF 生成失败 - -**字体找不到(`Could not resolve font "Source Han Serif CN/I"`)**: - -CJK 字体没有斜体变体,fontspec 默认会找 `/I` 导致报错。`build_report.py --engine quarto` 已通过 `mainfontoptions: [ItalicFont=...]` 自动绕开,无需手动处理。若自行编写 `.qmd`,需在 YAML 里加: - -```yaml -format: - pdf: - pdf-engine: xelatex - CJKmainfont: "Source Han Serif CN" - mainfontoptions: - - BoldFont=Source Han Serif CN - - ItalicFont=Source Han Serif CN - - BoldItalicFont=Source Han Serif CN -``` - -**`tlmgr` 找不到**: - -TinyTeX 不在系统 PATH,用完整路径: -```bash -~/.TinyTeX/bin/x86_64-linux/tlmgr install # Linux -~/.TinyTeX/bin/universal-darwin/tlmgr install # macOS -``` - -**`TeX capacity exceeded [parameter stack size]`**(landscape 大表): - -pdflscape 的 `\LS@makefcolumn` 在 101 行以上的 longtable 里递归过深,耗尽 TeX 的 `param_size`。解决方法:把超大表拆成每块 ≤20 行的子表,每块都包在 `{.landscape}` div 里: - -```markdown -::: {.landscape} -| 列1 | 列2 | ... | -|---|---|---| -| 第1-20行 | ... | -::: - -::: {.landscape} -| 列1 | 列2 | ... | -|---|---|---| -| 第21-40行 | ... | -::: -``` - -若使用 `build_report.py --engine quarto`,可通过传入预处理好的 `.md`(宽表已拆块)来避免此问题。 - -### uv 安装后找不到 -uv 官方脚本把 uv 装到 `~/.local/bin/`。若终端里 `which uv` 找不到: -```bash -export PATH="$HOME/.local/bin:$PATH" -# 永久生效: -echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc # macOS zsh -echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc # debian bash -``` - -### Python 依赖安装报 externally-managed-environment -不要用系统 pip!改用 uv(本项目标准方案): -```bash -bash scripts/setup.sh # uv sync 会自建 .venv 并装依赖 -``` - -### uv sync 很慢 / 下载超时 -国内网络下,可用镜像加速: -```bash -export UV_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple -# 或 -export UV_INDEX_URL=https://mirrors.aliyun.com/pypi/simple -uv sync -``` - -### 每次开终端都要手动 source -用 `source scripts/activate.sh` 一次搞定。或装 [direnv](https://direnv.net/): -```bash -# macOS -brew install direnv - -# Debian -sudo apt install direnv - -# 都装完后在项目根目录 -echo 'source scripts/activate.sh' > .envrc -direnv allow -``` -之后 `cd` 进项目目录就会自动激活,不用再想。 - ---- - -## 参考链接 - -- OpenCode 文档:https://opencode.ai/docs -- Agent 配置:https://opencode.ai/docs/agents -- 跨平台调用:`docs/platform-adapters.md` -- Skill 配置:https://opencode.ai/docs/skills -- MCP Servers:https://opencode.ai/docs/mcp-servers -- ReportLab 文档:https://docs.reportlab.com -- Quarto 文档:https://quarto.org/docs/output-formats/pdf-basics.html -- Quarto PDF 引擎:https://quarto.org/docs/output-formats/pdf-engine.html -- Quarto 表格文档:https://quarto.org/docs/authoring/tables.html -- 思源字体:https://github.com/adobe-fonts -- 霞鹜文楷:https://github.com/lxgw/LxgwWenKai - ---- - -## 变更记录 - -- **v0.1** (2026-04-20) — MVP 路径 2 完成:dr-plan + dr-pm 两主 agent、4 个核心 skill、2 个命令、ReportLab 模板基础版、字体下载脚本 -- **v0.2** (2026-04-20) — 双 provider 架构(zenmux-anthropic + zenmux),解决 Claude prompt cache 生效问题 -- **v0.3** (2026-04-20) — 修正 v0.2 模型名(回到 Opus 4.7 / Sonnet 4.6 / Gemini 3.1 Pro / GPT-5.4 Pro 等真实 slug);改 venv + requirements.txt 跨平台方案(macOS + Debian);新增 `scripts/setup.sh`、`scripts/activate.sh` -- **v0.13** (2026-05-02) — `build_report.py` 新增 `--engine quarto` 选项:Quarto 1.9 + xelatex 引擎,解决 ReportLab 超宽表格渲染 bug(`negative availWidth`/`NoneType` 问题);`report-template.py` 同步修复(`render_table_blocks` 分块 + 等宽列强制分配);README 补充双引擎安装指南与排错 -- **v0.20** (2026-05-05) — Skill-driven Python core 重构启动:新增 `scripts/runtime/*`、`scripts/dr.py init/frame/run/research/review/skills`、task-type 模型映射、中文原生 finalize 默认路径和 `scripts/reporting/*` 报告模块;OpenCode/Codex/Claude Code/Gemini CLI 命令降级为 Python CLI wrapper。 -- **v0.20.1** (2026-05-07) — Antigravity-native adapter:按 Gemini Flash 管理、Opus/Gemini 分 phase 执行研究;Python core 退为辅助工具。 - -见 `PLAN.md` §12 了解完整变更历史。 +Platform-specific behavior is documented in each generated workspace README and in `src/docs/platform-branch-strategy.md`. diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..7d43658 --- /dev/null +++ b/setup.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PYTHON_BIN="${PYTHON_BIN:-python3}" + +usage() { + cat <<'EOF' +Usage: + ./setup.sh init [platform|all] + ./setup.sh update [platform|all] + +Platforms: + antigravity + codex + opencode + claude-code + gemini-cli + all + +Commands: + init Rebuild generated platform environments from src/ without pulling. + update Run git pull --ff-only, then rebuild generated platform environments. +EOF +} + +cmd="${1:-}" +platform="${2:-all}" + +case "$cmd" in + init) + "$PYTHON_BIN" "$ROOT_DIR/src/scripts/update_platform_envs.py" --platform "$platform" --skip-pull + ;; + update) + "$PYTHON_BIN" "$ROOT_DIR/src/scripts/update_platform_envs.py" --platform "$platform" + ;; + -h|--help|help|"") + usage + ;; + *) + echo "Unknown command: $cmd" >&2 + usage >&2 + exit 2 + ;; +esac diff --git a/AGENTS.md b/src/AGENTS.md similarity index 100% rename from AGENTS.md rename to src/AGENTS.md diff --git a/CLAUDE.md b/src/CLAUDE.md similarity index 100% rename from CLAUDE.md rename to src/CLAUDE.md diff --git a/GEMINI.md b/src/GEMINI.md similarity index 100% rename from GEMINI.md rename to src/GEMINI.md diff --git a/PLAN.md b/src/PLAN.md similarity index 100% rename from PLAN.md rename to src/PLAN.md diff --git a/configs/model_profiles.yaml b/src/configs/model_profiles.yaml similarity index 100% rename from configs/model_profiles.yaml rename to src/configs/model_profiles.yaml diff --git a/configs/models.yaml b/src/configs/models.yaml similarity index 100% rename from configs/models.yaml rename to src/configs/models.yaml diff --git a/configs/research_methods.yaml b/src/configs/research_methods.yaml similarity index 100% rename from configs/research_methods.yaml rename to src/configs/research_methods.yaml diff --git a/configs/search_profiles.yaml b/src/configs/search_profiles.yaml similarity index 100% rename from configs/search_profiles.yaml rename to src/configs/search_profiles.yaml diff --git a/docs/antigravity-clean-workspace.md b/src/docs/antigravity-clean-workspace.md similarity index 100% rename from docs/antigravity-clean-workspace.md rename to src/docs/antigravity-clean-workspace.md diff --git a/docs/codex-usage.md b/src/docs/codex-usage.md similarity index 100% rename from docs/codex-usage.md rename to src/docs/codex-usage.md diff --git a/docs/model-playbook.md b/src/docs/model-playbook.md similarity index 100% rename from docs/model-playbook.md rename to src/docs/model-playbook.md diff --git a/docs/platform-adapters.md b/src/docs/platform-adapters.md similarity index 100% rename from docs/platform-adapters.md rename to src/docs/platform-adapters.md diff --git a/docs/platform-branch-strategy.md b/src/docs/platform-branch-strategy.md similarity index 100% rename from docs/platform-branch-strategy.md rename to src/docs/platform-branch-strategy.md diff --git a/docs/search-playbook.md b/src/docs/search-playbook.md similarity index 100% rename from docs/search-playbook.md rename to src/docs/search-playbook.md diff --git a/generate_report.py b/src/generate_report.py similarity index 100% rename from generate_report.py rename to src/generate_report.py diff --git a/src/platform_adapters/antigravity/README.md b/src/platform_adapters/antigravity/README.md new file mode 100644 index 0000000..dfee7ac --- /dev/null +++ b/src/platform_adapters/antigravity/README.md @@ -0,0 +1,23 @@ +# Antigravity Environment + +Open this directory in Antigravity. + +Antigravity is the only platform in this project that should run Deep Research natively with platform model quota. Use Gemini 3 Flash only as the surface manager, then switch models by phase as instructed in `.agent/workflows/deep-research-native.md`. + +Start by loading: + +- `AGENTS.md` +- `GEMINI.md` +- `.agent/agents.md` +- `.agent/rules/deep-research-antigravity.md` +- `.agent/skills/antigravity-surface-adapter/SKILL.md` +- `.agent/skills/method-selection/SKILL.md` +- `.agent/skills/research-quality-gates/SKILL.md` +- `.agent/workflows/deep-research-native.md` + +Do not open the parent repository for production research. Rebuild this environment from the parent repository with: + +```bash +./setup.sh init antigravity +./setup.sh update antigravity +``` diff --git a/platform_adapters/antigravity/agent/agents.md b/src/platform_adapters/antigravity/agent/agents.md similarity index 100% rename from platform_adapters/antigravity/agent/agents.md rename to src/platform_adapters/antigravity/agent/agents.md diff --git a/platform_adapters/antigravity/agent/rules/deep-research-antigravity.md b/src/platform_adapters/antigravity/agent/rules/deep-research-antigravity.md similarity index 100% rename from platform_adapters/antigravity/agent/rules/deep-research-antigravity.md rename to src/platform_adapters/antigravity/agent/rules/deep-research-antigravity.md diff --git a/platform_adapters/antigravity/agent/skills/antigravity-surface-adapter/SKILL.md b/src/platform_adapters/antigravity/agent/skills/antigravity-surface-adapter/SKILL.md similarity index 100% rename from platform_adapters/antigravity/agent/skills/antigravity-surface-adapter/SKILL.md rename to src/platform_adapters/antigravity/agent/skills/antigravity-surface-adapter/SKILL.md diff --git a/platform_adapters/antigravity/agent/skills/citation-manager/SKILL.md b/src/platform_adapters/antigravity/agent/skills/citation-manager/SKILL.md similarity index 100% rename from platform_adapters/antigravity/agent/skills/citation-manager/SKILL.md rename to src/platform_adapters/antigravity/agent/skills/citation-manager/SKILL.md diff --git a/platform_adapters/antigravity/agent/skills/en-zh-translation/SKILL.md b/src/platform_adapters/antigravity/agent/skills/en-zh-translation/SKILL.md similarity index 100% rename from platform_adapters/antigravity/agent/skills/en-zh-translation/SKILL.md rename to src/platform_adapters/antigravity/agent/skills/en-zh-translation/SKILL.md diff --git a/platform_adapters/antigravity/agent/skills/evidence-table/SKILL.md b/src/platform_adapters/antigravity/agent/skills/evidence-table/SKILL.md similarity index 100% rename from platform_adapters/antigravity/agent/skills/evidence-table/SKILL.md rename to src/platform_adapters/antigravity/agent/skills/evidence-table/SKILL.md diff --git a/platform_adapters/antigravity/agent/skills/humanizer-cn/SKILL.md b/src/platform_adapters/antigravity/agent/skills/humanizer-cn/SKILL.md similarity index 100% rename from platform_adapters/antigravity/agent/skills/humanizer-cn/SKILL.md rename to src/platform_adapters/antigravity/agent/skills/humanizer-cn/SKILL.md diff --git a/platform_adapters/antigravity/agent/skills/length-budget/SKILL.md b/src/platform_adapters/antigravity/agent/skills/length-budget/SKILL.md similarity index 100% rename from platform_adapters/antigravity/agent/skills/length-budget/SKILL.md rename to src/platform_adapters/antigravity/agent/skills/length-budget/SKILL.md diff --git a/platform_adapters/antigravity/agent/skills/mckinsey-method/SKILL.md b/src/platform_adapters/antigravity/agent/skills/mckinsey-method/SKILL.md similarity index 100% rename from platform_adapters/antigravity/agent/skills/mckinsey-method/SKILL.md rename to src/platform_adapters/antigravity/agent/skills/mckinsey-method/SKILL.md diff --git a/platform_adapters/antigravity/agent/skills/method-selection/SKILL.md b/src/platform_adapters/antigravity/agent/skills/method-selection/SKILL.md similarity index 100% rename from platform_adapters/antigravity/agent/skills/method-selection/SKILL.md rename to src/platform_adapters/antigravity/agent/skills/method-selection/SKILL.md diff --git a/platform_adapters/antigravity/agent/skills/output-hygiene/SKILL.md b/src/platform_adapters/antigravity/agent/skills/output-hygiene/SKILL.md similarity index 100% rename from platform_adapters/antigravity/agent/skills/output-hygiene/SKILL.md rename to src/platform_adapters/antigravity/agent/skills/output-hygiene/SKILL.md diff --git a/platform_adapters/antigravity/agent/skills/pdf-reportlab/SKILL.md b/src/platform_adapters/antigravity/agent/skills/pdf-reportlab/SKILL.md similarity index 100% rename from platform_adapters/antigravity/agent/skills/pdf-reportlab/SKILL.md rename to src/platform_adapters/antigravity/agent/skills/pdf-reportlab/SKILL.md diff --git a/platform_adapters/antigravity/agent/skills/research-quality-gates/SKILL.md b/src/platform_adapters/antigravity/agent/skills/research-quality-gates/SKILL.md similarity index 100% rename from platform_adapters/antigravity/agent/skills/research-quality-gates/SKILL.md rename to src/platform_adapters/antigravity/agent/skills/research-quality-gates/SKILL.md diff --git a/platform_adapters/antigravity/agent/skills/search-strategy/SKILL.md b/src/platform_adapters/antigravity/agent/skills/search-strategy/SKILL.md similarity index 100% rename from platform_adapters/antigravity/agent/skills/search-strategy/SKILL.md rename to src/platform_adapters/antigravity/agent/skills/search-strategy/SKILL.md diff --git a/platform_adapters/antigravity/agent/skills/source-quality/SKILL.md b/src/platform_adapters/antigravity/agent/skills/source-quality/SKILL.md similarity index 100% rename from platform_adapters/antigravity/agent/skills/source-quality/SKILL.md rename to src/platform_adapters/antigravity/agent/skills/source-quality/SKILL.md diff --git a/platform_adapters/antigravity/agent/workflows/deep-research-native.md b/src/platform_adapters/antigravity/agent/workflows/deep-research-native.md similarity index 100% rename from platform_adapters/antigravity/agent/workflows/deep-research-native.md rename to src/platform_adapters/antigravity/agent/workflows/deep-research-native.md diff --git a/src/platform_adapters/claude-code/README.md b/src/platform_adapters/claude-code/README.md new file mode 100644 index 0000000..bc5b4b4 --- /dev/null +++ b/src/platform_adapters/claude-code/README.md @@ -0,0 +1,12 @@ +# Claude Code Environment + +Open this directory in Claude Code. + +Claude Code is best used for interview-style framing, long-form Chinese editorial review, final wording quality, and careful reasoning around report structure. Shared research rules and skills still come from the generated workspace files, not from platform-specific rewrites. + +Rebuild from the parent repository with: + +```bash +./setup.sh init claude-code +./setup.sh update claude-code +``` diff --git a/platform_adapters/claude-code/skills/dr-finalize/SKILL.md b/src/platform_adapters/claude-code/skills/dr-finalize/SKILL.md similarity index 100% rename from platform_adapters/claude-code/skills/dr-finalize/SKILL.md rename to src/platform_adapters/claude-code/skills/dr-finalize/SKILL.md diff --git a/platform_adapters/claude-code/skills/dr-frame/SKILL.md b/src/platform_adapters/claude-code/skills/dr-frame/SKILL.md similarity index 100% rename from platform_adapters/claude-code/skills/dr-frame/SKILL.md rename to src/platform_adapters/claude-code/skills/dr-frame/SKILL.md diff --git a/platform_adapters/claude-code/skills/dr-init/SKILL.md b/src/platform_adapters/claude-code/skills/dr-init/SKILL.md similarity index 100% rename from platform_adapters/claude-code/skills/dr-init/SKILL.md rename to src/platform_adapters/claude-code/skills/dr-init/SKILL.md diff --git a/platform_adapters/claude-code/skills/dr-research/SKILL.md b/src/platform_adapters/claude-code/skills/dr-research/SKILL.md similarity index 100% rename from platform_adapters/claude-code/skills/dr-research/SKILL.md rename to src/platform_adapters/claude-code/skills/dr-research/SKILL.md diff --git a/platform_adapters/claude-code/skills/dr-review/SKILL.md b/src/platform_adapters/claude-code/skills/dr-review/SKILL.md similarity index 100% rename from platform_adapters/claude-code/skills/dr-review/SKILL.md rename to src/platform_adapters/claude-code/skills/dr-review/SKILL.md diff --git a/platform_adapters/claude-code/skills/dr-run/SKILL.md b/src/platform_adapters/claude-code/skills/dr-run/SKILL.md similarity index 100% rename from platform_adapters/claude-code/skills/dr-run/SKILL.md rename to src/platform_adapters/claude-code/skills/dr-run/SKILL.md diff --git a/src/platform_adapters/codex/README.md b/src/platform_adapters/codex/README.md new file mode 100644 index 0000000..de068ce --- /dev/null +++ b/src/platform_adapters/codex/README.md @@ -0,0 +1,14 @@ +# Codex Environment + +Open this directory in Codex. + +Codex is best used for repository work: scripts, schemas, tests, deployment logic, and code review. Deep Research model routing should normally use the Python core unless the user explicitly asks for manual Codex reasoning. + +This environment contains a local `.codex/` adapter generated from `src/platform_adapters/codex` plus shared skills copied into `.codex/skills`. + +Rebuild from the parent repository with: + +```bash +./setup.sh init codex +./setup.sh update codex +``` diff --git a/platform_adapters/codex/agents/dr-analyst.toml b/src/platform_adapters/codex/agents/dr-analyst.toml similarity index 100% rename from platform_adapters/codex/agents/dr-analyst.toml rename to src/platform_adapters/codex/agents/dr-analyst.toml diff --git a/platform_adapters/codex/agents/dr-chief-editor.toml b/src/platform_adapters/codex/agents/dr-chief-editor.toml similarity index 100% rename from platform_adapters/codex/agents/dr-chief-editor.toml rename to src/platform_adapters/codex/agents/dr-chief-editor.toml diff --git a/platform_adapters/codex/agents/dr-editor-in-chief.toml b/src/platform_adapters/codex/agents/dr-editor-in-chief.toml similarity index 100% rename from platform_adapters/codex/agents/dr-editor-in-chief.toml rename to src/platform_adapters/codex/agents/dr-editor-in-chief.toml diff --git a/platform_adapters/codex/agents/dr-plan.toml b/src/platform_adapters/codex/agents/dr-plan.toml similarity index 100% rename from platform_adapters/codex/agents/dr-plan.toml rename to src/platform_adapters/codex/agents/dr-plan.toml diff --git a/platform_adapters/codex/agents/dr-pm.toml b/src/platform_adapters/codex/agents/dr-pm.toml similarity index 100% rename from platform_adapters/codex/agents/dr-pm.toml rename to src/platform_adapters/codex/agents/dr-pm.toml diff --git a/platform_adapters/codex/agents/dr-reporter.toml b/src/platform_adapters/codex/agents/dr-reporter.toml similarity index 100% rename from platform_adapters/codex/agents/dr-reporter.toml rename to src/platform_adapters/codex/agents/dr-reporter.toml diff --git a/platform_adapters/codex/agents/dr-searcher.toml b/src/platform_adapters/codex/agents/dr-searcher.toml similarity index 100% rename from platform_adapters/codex/agents/dr-searcher.toml rename to src/platform_adapters/codex/agents/dr-searcher.toml diff --git a/platform_adapters/codex/agents/dr-verifier.toml b/src/platform_adapters/codex/agents/dr-verifier.toml similarity index 100% rename from platform_adapters/codex/agents/dr-verifier.toml rename to src/platform_adapters/codex/agents/dr-verifier.toml diff --git a/platform_adapters/codex/commands/dr-finalize.md b/src/platform_adapters/codex/commands/dr-finalize.md similarity index 100% rename from platform_adapters/codex/commands/dr-finalize.md rename to src/platform_adapters/codex/commands/dr-finalize.md diff --git a/platform_adapters/codex/commands/dr-frame.md b/src/platform_adapters/codex/commands/dr-frame.md similarity index 100% rename from platform_adapters/codex/commands/dr-frame.md rename to src/platform_adapters/codex/commands/dr-frame.md diff --git a/platform_adapters/codex/commands/dr-glossary.md b/src/platform_adapters/codex/commands/dr-glossary.md similarity index 100% rename from platform_adapters/codex/commands/dr-glossary.md rename to src/platform_adapters/codex/commands/dr-glossary.md diff --git a/platform_adapters/codex/commands/dr-init.md b/src/platform_adapters/codex/commands/dr-init.md similarity index 100% rename from platform_adapters/codex/commands/dr-init.md rename to src/platform_adapters/codex/commands/dr-init.md diff --git a/platform_adapters/codex/commands/dr-research.md b/src/platform_adapters/codex/commands/dr-research.md similarity index 100% rename from platform_adapters/codex/commands/dr-research.md rename to src/platform_adapters/codex/commands/dr-research.md diff --git a/platform_adapters/codex/commands/dr-review.md b/src/platform_adapters/codex/commands/dr-review.md similarity index 100% rename from platform_adapters/codex/commands/dr-review.md rename to src/platform_adapters/codex/commands/dr-review.md diff --git a/platform_adapters/codex/commands/dr-run.md b/src/platform_adapters/codex/commands/dr-run.md similarity index 100% rename from platform_adapters/codex/commands/dr-run.md rename to src/platform_adapters/codex/commands/dr-run.md diff --git a/platform_adapters/codex/commands/dr-status.md b/src/platform_adapters/codex/commands/dr-status.md similarity index 100% rename from platform_adapters/codex/commands/dr-status.md rename to src/platform_adapters/codex/commands/dr-status.md diff --git a/platform_adapters/codex/config.toml b/src/platform_adapters/codex/config.toml similarity index 100% rename from platform_adapters/codex/config.toml rename to src/platform_adapters/codex/config.toml diff --git a/src/platform_adapters/gemini-cli/README.md b/src/platform_adapters/gemini-cli/README.md new file mode 100644 index 0000000..5b9260f --- /dev/null +++ b/src/platform_adapters/gemini-cli/README.md @@ -0,0 +1,12 @@ +# Gemini CLI Environment + +Open this directory for Gemini CLI workflows. + +Gemini CLI is suitable for long-context review, multimodal material checks, and alternative framework evaluation. Treat Gemini-family factual claims as high risk unless search receipts, source IDs, and claim-ledger rows exist. + +Rebuild from the parent repository with: + +```bash +./setup.sh init gemini-cli +./setup.sh update gemini-cli +``` diff --git a/platform_adapters/gemini-cli/commands/dr/finalize.toml b/src/platform_adapters/gemini-cli/commands/dr/finalize.toml similarity index 100% rename from platform_adapters/gemini-cli/commands/dr/finalize.toml rename to src/platform_adapters/gemini-cli/commands/dr/finalize.toml diff --git a/platform_adapters/gemini-cli/commands/dr/frame.toml b/src/platform_adapters/gemini-cli/commands/dr/frame.toml similarity index 100% rename from platform_adapters/gemini-cli/commands/dr/frame.toml rename to src/platform_adapters/gemini-cli/commands/dr/frame.toml diff --git a/platform_adapters/gemini-cli/commands/dr/init.toml b/src/platform_adapters/gemini-cli/commands/dr/init.toml similarity index 100% rename from platform_adapters/gemini-cli/commands/dr/init.toml rename to src/platform_adapters/gemini-cli/commands/dr/init.toml diff --git a/platform_adapters/gemini-cli/commands/dr/research.toml b/src/platform_adapters/gemini-cli/commands/dr/research.toml similarity index 100% rename from platform_adapters/gemini-cli/commands/dr/research.toml rename to src/platform_adapters/gemini-cli/commands/dr/research.toml diff --git a/platform_adapters/gemini-cli/commands/dr/review.toml b/src/platform_adapters/gemini-cli/commands/dr/review.toml similarity index 100% rename from platform_adapters/gemini-cli/commands/dr/review.toml rename to src/platform_adapters/gemini-cli/commands/dr/review.toml diff --git a/platform_adapters/gemini-cli/commands/dr/run.toml b/src/platform_adapters/gemini-cli/commands/dr/run.toml similarity index 100% rename from platform_adapters/gemini-cli/commands/dr/run.toml rename to src/platform_adapters/gemini-cli/commands/dr/run.toml diff --git a/src/platform_adapters/opencode/README.md b/src/platform_adapters/opencode/README.md new file mode 100644 index 0000000..a4bf925 --- /dev/null +++ b/src/platform_adapters/opencode/README.md @@ -0,0 +1,12 @@ +# OpenCode Environment + +Open this directory in OpenCode. + +OpenCode is a thin surface adapter around the Python core. Use the `.opencode/commands` wrappers to call `scripts/dr.py`; do not let platform agents reimplement Phase 2 worker orchestration. + +Rebuild from the parent repository with: + +```bash +./setup.sh init opencode +./setup.sh update opencode +``` diff --git a/platform_adapters/opencode/agents/dr-analyst.md b/src/platform_adapters/opencode/agents/dr-analyst.md similarity index 100% rename from platform_adapters/opencode/agents/dr-analyst.md rename to src/platform_adapters/opencode/agents/dr-analyst.md diff --git a/platform_adapters/opencode/agents/dr-chief-editor.md b/src/platform_adapters/opencode/agents/dr-chief-editor.md similarity index 100% rename from platform_adapters/opencode/agents/dr-chief-editor.md rename to src/platform_adapters/opencode/agents/dr-chief-editor.md diff --git a/platform_adapters/opencode/agents/dr-editor-in-chief.md b/src/platform_adapters/opencode/agents/dr-editor-in-chief.md similarity index 100% rename from platform_adapters/opencode/agents/dr-editor-in-chief.md rename to src/platform_adapters/opencode/agents/dr-editor-in-chief.md diff --git a/platform_adapters/opencode/agents/dr-plan.md b/src/platform_adapters/opencode/agents/dr-plan.md similarity index 100% rename from platform_adapters/opencode/agents/dr-plan.md rename to src/platform_adapters/opencode/agents/dr-plan.md diff --git a/platform_adapters/opencode/agents/dr-pm.md b/src/platform_adapters/opencode/agents/dr-pm.md similarity index 100% rename from platform_adapters/opencode/agents/dr-pm.md rename to src/platform_adapters/opencode/agents/dr-pm.md diff --git a/platform_adapters/opencode/agents/dr-polisher.md b/src/platform_adapters/opencode/agents/dr-polisher.md similarity index 100% rename from platform_adapters/opencode/agents/dr-polisher.md rename to src/platform_adapters/opencode/agents/dr-polisher.md diff --git a/platform_adapters/opencode/agents/dr-reporter.md b/src/platform_adapters/opencode/agents/dr-reporter.md similarity index 100% rename from platform_adapters/opencode/agents/dr-reporter.md rename to src/platform_adapters/opencode/agents/dr-reporter.md diff --git a/platform_adapters/opencode/agents/dr-searcher.md b/src/platform_adapters/opencode/agents/dr-searcher.md similarity index 100% rename from platform_adapters/opencode/agents/dr-searcher.md rename to src/platform_adapters/opencode/agents/dr-searcher.md diff --git a/platform_adapters/opencode/agents/dr-translator.md b/src/platform_adapters/opencode/agents/dr-translator.md similarity index 100% rename from platform_adapters/opencode/agents/dr-translator.md rename to src/platform_adapters/opencode/agents/dr-translator.md diff --git a/platform_adapters/opencode/agents/dr-verifier.md b/src/platform_adapters/opencode/agents/dr-verifier.md similarity index 100% rename from platform_adapters/opencode/agents/dr-verifier.md rename to src/platform_adapters/opencode/agents/dr-verifier.md diff --git a/platform_adapters/opencode/commands/dr-apply-models.md b/src/platform_adapters/opencode/commands/dr-apply-models.md similarity index 100% rename from platform_adapters/opencode/commands/dr-apply-models.md rename to src/platform_adapters/opencode/commands/dr-apply-models.md diff --git a/platform_adapters/opencode/commands/dr-finalize.md b/src/platform_adapters/opencode/commands/dr-finalize.md similarity index 100% rename from platform_adapters/opencode/commands/dr-finalize.md rename to src/platform_adapters/opencode/commands/dr-finalize.md diff --git a/platform_adapters/opencode/commands/dr-frame.md b/src/platform_adapters/opencode/commands/dr-frame.md similarity index 100% rename from platform_adapters/opencode/commands/dr-frame.md rename to src/platform_adapters/opencode/commands/dr-frame.md diff --git a/platform_adapters/opencode/commands/dr-glossary.md b/src/platform_adapters/opencode/commands/dr-glossary.md similarity index 100% rename from platform_adapters/opencode/commands/dr-glossary.md rename to src/platform_adapters/opencode/commands/dr-glossary.md diff --git a/platform_adapters/opencode/commands/dr-init.md b/src/platform_adapters/opencode/commands/dr-init.md similarity index 100% rename from platform_adapters/opencode/commands/dr-init.md rename to src/platform_adapters/opencode/commands/dr-init.md diff --git a/platform_adapters/opencode/commands/dr-models.md b/src/platform_adapters/opencode/commands/dr-models.md similarity index 100% rename from platform_adapters/opencode/commands/dr-models.md rename to src/platform_adapters/opencode/commands/dr-models.md diff --git a/platform_adapters/opencode/commands/dr-research.md b/src/platform_adapters/opencode/commands/dr-research.md similarity index 100% rename from platform_adapters/opencode/commands/dr-research.md rename to src/platform_adapters/opencode/commands/dr-research.md diff --git a/platform_adapters/opencode/commands/dr-review.md b/src/platform_adapters/opencode/commands/dr-review.md similarity index 100% rename from platform_adapters/opencode/commands/dr-review.md rename to src/platform_adapters/opencode/commands/dr-review.md diff --git a/platform_adapters/opencode/commands/dr-run.md b/src/platform_adapters/opencode/commands/dr-run.md similarity index 100% rename from platform_adapters/opencode/commands/dr-run.md rename to src/platform_adapters/opencode/commands/dr-run.md diff --git a/platform_adapters/opencode/commands/dr-status.md b/src/platform_adapters/opencode/commands/dr-status.md similarity index 100% rename from platform_adapters/opencode/commands/dr-status.md rename to src/platform_adapters/opencode/commands/dr-status.md diff --git a/platform_adapters/opencode/opencode.json b/src/platform_adapters/opencode/opencode.json similarity index 100% rename from platform_adapters/opencode/opencode.json rename to src/platform_adapters/opencode/opencode.json diff --git a/platform_adapters/opencode/skills/citation-manager/SKILL.md b/src/platform_adapters/opencode/skills/citation-manager/SKILL.md similarity index 100% rename from platform_adapters/opencode/skills/citation-manager/SKILL.md rename to src/platform_adapters/opencode/skills/citation-manager/SKILL.md diff --git a/platform_adapters/opencode/skills/en-zh-translation/SKILL.md b/src/platform_adapters/opencode/skills/en-zh-translation/SKILL.md similarity index 100% rename from platform_adapters/opencode/skills/en-zh-translation/SKILL.md rename to src/platform_adapters/opencode/skills/en-zh-translation/SKILL.md diff --git a/platform_adapters/opencode/skills/evidence-table/SKILL.md b/src/platform_adapters/opencode/skills/evidence-table/SKILL.md similarity index 100% rename from platform_adapters/opencode/skills/evidence-table/SKILL.md rename to src/platform_adapters/opencode/skills/evidence-table/SKILL.md diff --git a/platform_adapters/opencode/skills/humanizer-cn/SKILL.md b/src/platform_adapters/opencode/skills/humanizer-cn/SKILL.md similarity index 100% rename from platform_adapters/opencode/skills/humanizer-cn/SKILL.md rename to src/platform_adapters/opencode/skills/humanizer-cn/SKILL.md diff --git a/platform_adapters/opencode/skills/length-budget/SKILL.md b/src/platform_adapters/opencode/skills/length-budget/SKILL.md similarity index 100% rename from platform_adapters/opencode/skills/length-budget/SKILL.md rename to src/platform_adapters/opencode/skills/length-budget/SKILL.md diff --git a/platform_adapters/opencode/skills/mckinsey-method/SKILL.md b/src/platform_adapters/opencode/skills/mckinsey-method/SKILL.md similarity index 100% rename from platform_adapters/opencode/skills/mckinsey-method/SKILL.md rename to src/platform_adapters/opencode/skills/mckinsey-method/SKILL.md diff --git a/platform_adapters/opencode/skills/output-hygiene/SKILL.md b/src/platform_adapters/opencode/skills/output-hygiene/SKILL.md similarity index 100% rename from platform_adapters/opencode/skills/output-hygiene/SKILL.md rename to src/platform_adapters/opencode/skills/output-hygiene/SKILL.md diff --git a/platform_adapters/opencode/skills/pdf-reportlab/SKILL.md b/src/platform_adapters/opencode/skills/pdf-reportlab/SKILL.md similarity index 100% rename from platform_adapters/opencode/skills/pdf-reportlab/SKILL.md rename to src/platform_adapters/opencode/skills/pdf-reportlab/SKILL.md diff --git a/platform_adapters/opencode/skills/search-gateway/SKILL.md b/src/platform_adapters/opencode/skills/search-gateway/SKILL.md similarity index 100% rename from platform_adapters/opencode/skills/search-gateway/SKILL.md rename to src/platform_adapters/opencode/skills/search-gateway/SKILL.md diff --git a/platform_adapters/opencode/skills/search-strategy/SKILL.md b/src/platform_adapters/opencode/skills/search-strategy/SKILL.md similarity index 100% rename from platform_adapters/opencode/skills/search-strategy/SKILL.md rename to src/platform_adapters/opencode/skills/search-strategy/SKILL.md diff --git a/platform_adapters/opencode/skills/source-quality/SKILL.md b/src/platform_adapters/opencode/skills/source-quality/SKILL.md similarity index 100% rename from platform_adapters/opencode/skills/source-quality/SKILL.md rename to src/platform_adapters/opencode/skills/source-quality/SKILL.md diff --git a/platform_adapters/opencode/templates/fonts/README.md b/src/platform_adapters/opencode/templates/fonts/README.md similarity index 100% rename from platform_adapters/opencode/templates/fonts/README.md rename to src/platform_adapters/opencode/templates/fonts/README.md diff --git a/platform_adapters/opencode/templates/fonts/download-fonts.sh b/src/platform_adapters/opencode/templates/fonts/download-fonts.sh similarity index 100% rename from platform_adapters/opencode/templates/fonts/download-fonts.sh rename to src/platform_adapters/opencode/templates/fonts/download-fonts.sh diff --git a/platform_adapters/opencode/templates/report-template.py b/src/platform_adapters/opencode/templates/report-template.py similarity index 100% rename from platform_adapters/opencode/templates/report-template.py rename to src/platform_adapters/opencode/templates/report-template.py diff --git a/scripts/lib/__init__.py b/src/projects/.gitkeep similarity index 100% rename from scripts/lib/__init__.py rename to src/projects/.gitkeep diff --git a/pyproject.toml b/src/pyproject.toml similarity index 100% rename from pyproject.toml rename to src/pyproject.toml diff --git a/requirements.txt b/src/requirements.txt similarity index 100% rename from requirements.txt rename to src/requirements.txt diff --git a/scripts/activate.sh b/src/scripts/activate.sh similarity index 100% rename from scripts/activate.sh rename to src/scripts/activate.sh diff --git a/scripts/apply_glossary.py b/src/scripts/apply_glossary.py similarity index 100% rename from scripts/apply_glossary.py rename to src/scripts/apply_glossary.py diff --git a/scripts/apply_model_profile.py b/src/scripts/apply_model_profile.py similarity index 100% rename from scripts/apply_model_profile.py rename to src/scripts/apply_model_profile.py diff --git a/scripts/build_glossary.py b/src/scripts/build_glossary.py similarity index 100% rename from scripts/build_glossary.py rename to src/scripts/build_glossary.py diff --git a/scripts/build_report.py b/src/scripts/build_report.py similarity index 100% rename from scripts/build_report.py rename to src/scripts/build_report.py diff --git a/scripts/check_citations.py b/src/scripts/check_citations.py similarity index 100% rename from scripts/check_citations.py rename to src/scripts/check_citations.py diff --git a/scripts/deploy_adapters.py b/src/scripts/deploy_adapters.py similarity index 100% rename from scripts/deploy_adapters.py rename to src/scripts/deploy_adapters.py diff --git a/scripts/deploy_check.py b/src/scripts/deploy_check.py similarity index 100% rename from scripts/deploy_check.py rename to src/scripts/deploy_check.py diff --git a/scripts/dr.py b/src/scripts/dr.py similarity index 100% rename from scripts/dr.py rename to src/scripts/dr.py diff --git a/scripts/export_antigravity_workspace.py b/src/scripts/export_antigravity_workspace.py similarity index 100% rename from scripts/export_antigravity_workspace.py rename to src/scripts/export_antigravity_workspace.py diff --git a/scripts/ground.py b/src/scripts/ground.py similarity index 100% rename from scripts/ground.py rename to src/scripts/ground.py diff --git a/scripts/install_codex_adapter.py b/src/scripts/install_codex_adapter.py similarity index 100% rename from scripts/install_codex_adapter.py rename to src/scripts/install_codex_adapter.py diff --git a/src/scripts/lib/__init__.py b/src/scripts/lib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/lib/markdown_chunker.py b/src/scripts/lib/markdown_chunker.py similarity index 100% rename from scripts/lib/markdown_chunker.py rename to src/scripts/lib/markdown_chunker.py diff --git a/scripts/lib/model_config.py b/src/scripts/lib/model_config.py similarity index 100% rename from scripts/lib/model_config.py rename to src/scripts/lib/model_config.py diff --git a/scripts/lib/search_client.py b/src/scripts/lib/search_client.py similarity index 100% rename from scripts/lib/search_client.py rename to src/scripts/lib/search_client.py diff --git a/scripts/lib/serper_client.py b/src/scripts/lib/serper_client.py similarity index 100% rename from scripts/lib/serper_client.py rename to src/scripts/lib/serper_client.py diff --git a/scripts/lib/zenmux_client.py b/src/scripts/lib/zenmux_client.py similarity index 100% rename from scripts/lib/zenmux_client.py rename to src/scripts/lib/zenmux_client.py diff --git a/scripts/number_citations.py b/src/scripts/number_citations.py similarity index 100% rename from scripts/number_citations.py rename to src/scripts/number_citations.py diff --git a/scripts/phase4_pipeline.py b/src/scripts/phase4_pipeline.py similarity index 100% rename from scripts/phase4_pipeline.py rename to src/scripts/phase4_pipeline.py diff --git a/scripts/polish.py b/src/scripts/polish.py similarity index 100% rename from scripts/polish.py rename to src/scripts/polish.py diff --git a/scripts/prompts/glossary_system.txt b/src/scripts/prompts/glossary_system.txt similarity index 100% rename from scripts/prompts/glossary_system.txt rename to src/scripts/prompts/glossary_system.txt diff --git a/scripts/prompts/polish_system.txt b/src/scripts/prompts/polish_system.txt similarity index 100% rename from scripts/prompts/polish_system.txt rename to src/scripts/prompts/polish_system.txt diff --git a/scripts/prompts/translate_system.txt b/src/scripts/prompts/translate_system.txt similarity index 100% rename from scripts/prompts/translate_system.txt rename to src/scripts/prompts/translate_system.txt diff --git a/scripts/reporting/__init__.py b/src/scripts/reporting/__init__.py similarity index 100% rename from scripts/reporting/__init__.py rename to src/scripts/reporting/__init__.py diff --git a/scripts/reporting/fonts.py b/src/scripts/reporting/fonts.py similarity index 100% rename from scripts/reporting/fonts.py rename to src/scripts/reporting/fonts.py diff --git a/scripts/reporting/references.py b/src/scripts/reporting/references.py similarity index 100% rename from scripts/reporting/references.py rename to src/scripts/reporting/references.py diff --git a/scripts/runtime/__init__.py b/src/scripts/runtime/__init__.py similarity index 100% rename from scripts/runtime/__init__.py rename to src/scripts/runtime/__init__.py diff --git a/scripts/runtime/artifacts.py b/src/scripts/runtime/artifacts.py similarity index 100% rename from scripts/runtime/artifacts.py rename to src/scripts/runtime/artifacts.py diff --git a/scripts/runtime/assembly.py b/src/scripts/runtime/assembly.py similarity index 100% rename from scripts/runtime/assembly.py rename to src/scripts/runtime/assembly.py diff --git a/scripts/runtime/materials.py b/src/scripts/runtime/materials.py similarity index 100% rename from scripts/runtime/materials.py rename to src/scripts/runtime/materials.py diff --git a/scripts/runtime/methods.py b/src/scripts/runtime/methods.py similarity index 100% rename from scripts/runtime/methods.py rename to src/scripts/runtime/methods.py diff --git a/scripts/runtime/orchestrator.py b/src/scripts/runtime/orchestrator.py similarity index 100% rename from scripts/runtime/orchestrator.py rename to src/scripts/runtime/orchestrator.py diff --git a/scripts/runtime/phase1.py b/src/scripts/runtime/phase1.py similarity index 100% rename from scripts/runtime/phase1.py rename to src/scripts/runtime/phase1.py diff --git a/scripts/runtime/review.py b/src/scripts/runtime/review.py similarity index 100% rename from scripts/runtime/review.py rename to src/scripts/runtime/review.py diff --git a/scripts/runtime/roles.py b/src/scripts/runtime/roles.py similarity index 100% rename from scripts/runtime/roles.py rename to src/scripts/runtime/roles.py diff --git a/scripts/runtime/skills.py b/src/scripts/runtime/skills.py similarity index 100% rename from scripts/runtime/skills.py rename to src/scripts/runtime/skills.py diff --git a/scripts/runtime/source_cache.py b/src/scripts/runtime/source_cache.py similarity index 100% rename from scripts/runtime/source_cache.py rename to src/scripts/runtime/source_cache.py diff --git a/scripts/runtime/sources.py b/src/scripts/runtime/sources.py similarity index 100% rename from scripts/runtime/sources.py rename to src/scripts/runtime/sources.py diff --git a/scripts/runtime/tasks.py b/src/scripts/runtime/tasks.py similarity index 100% rename from scripts/runtime/tasks.py rename to src/scripts/runtime/tasks.py diff --git a/scripts/runtime/workers.py b/src/scripts/runtime/workers.py similarity index 100% rename from scripts/runtime/workers.py rename to src/scripts/runtime/workers.py diff --git a/scripts/search.py b/src/scripts/search.py similarity index 100% rename from scripts/search.py rename to src/scripts/search.py diff --git a/scripts/setup.sh b/src/scripts/setup.sh similarity index 100% rename from scripts/setup.sh rename to src/scripts/setup.sh diff --git a/scripts/sprint5_regression.py b/src/scripts/sprint5_regression.py similarity index 100% rename from scripts/sprint5_regression.py rename to src/scripts/sprint5_regression.py diff --git a/scripts/translate.py b/src/scripts/translate.py similarity index 100% rename from scripts/translate.py rename to src/scripts/translate.py diff --git a/scripts/update_platform_envs.py b/src/scripts/update_platform_envs.py similarity index 74% rename from scripts/update_platform_envs.py rename to src/scripts/update_platform_envs.py index 48084a3..bb61078 100644 --- a/scripts/update_platform_envs.py +++ b/src/scripts/update_platform_envs.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Pull the repo and rebuild isolated platform workspaces under platform_envs/.""" +"""Pull the repo and rebuild isolated platform workspaces at repository root.""" from __future__ import annotations @@ -9,24 +9,32 @@ import subprocess from pathlib import Path -REPO_ROOT = Path(__file__).resolve().parent.parent -ENV_ROOT = REPO_ROOT / "platform_envs" -ADAPTER_ROOT = REPO_ROOT / "platform_adapters" +SRC_ROOT = Path(__file__).resolve().parent.parent +REPO_ROOT = SRC_ROOT.parent +ADAPTER_ROOT = SRC_ROOT / "platform_adapters" COMMON_FILES = [ "AGENTS.md", "GEMINI.md", - "README.md", + "CLAUDE.md", + "PLAN.md", "docs/antigravity-clean-workspace.md", "docs/platform-adapters.md", + "docs/platform-branch-strategy.md", "scripts/dr.py", "scripts/deploy_adapters.py", + "scripts/update_platform_envs.py", + "scripts/export_antigravity_workspace.py", + "pyproject.toml", + "requirements.txt", + "uv.lock", ] COMMON_DIRS = [ "configs", "scripts/runtime", "scripts/reporting", + "skills", ] @@ -41,7 +49,7 @@ def reset_dir(path: Path) -> None: def copy_file(rel: str, target_root: Path) -> None: - src = REPO_ROOT / rel + src = SRC_ROOT / rel if not src.exists(): raise FileNotFoundError(src) dst = target_root / rel @@ -61,49 +69,54 @@ def copy_common_workspace(target: Path) -> None: for rel in COMMON_FILES: copy_file(rel, target) for rel in COMMON_DIRS: - copy_dir(REPO_ROOT / rel, target / rel) + copy_dir(SRC_ROOT / rel, target / rel) (target / "projects").mkdir(parents=True, exist_ok=True) (target / "projects" / ".gitkeep").touch(exist_ok=True) def build_antigravity() -> Path: - target = ENV_ROOT / "antigravity" + target = REPO_ROOT / "antigravity" reset_dir(target) copy_common_workspace(target) copy_dir(ADAPTER_ROOT / "antigravity" / "agent", target / ".agent") + copy_file("platform_adapters/antigravity/README.md", target) return target def build_codex() -> Path: - target = ENV_ROOT / "codex" + target = REPO_ROOT / "codex" reset_dir(target) copy_common_workspace(target) - copy_dir(ADAPTER_ROOT / "codex", target / "codex_home") - copy_dir(ADAPTER_ROOT / "antigravity" / "agent" / "skills", target / "codex_home" / "skills") + copy_dir(ADAPTER_ROOT / "codex", target / ".codex") + copy_dir(ADAPTER_ROOT / "antigravity" / "agent" / "skills", target / ".codex" / "skills") + copy_file("platform_adapters/codex/README.md", target) return target def build_opencode() -> Path: - target = ENV_ROOT / "opencode" + target = REPO_ROOT / "opencode" reset_dir(target) copy_common_workspace(target) copy_dir(ADAPTER_ROOT / "opencode", target / ".opencode") + copy_file("platform_adapters/opencode/README.md", target) return target def build_claude_code() -> Path: - target = ENV_ROOT / "claude-code" + target = REPO_ROOT / "claude-code" reset_dir(target) copy_common_workspace(target) copy_dir(ADAPTER_ROOT / "claude-code", target / ".claude") + copy_file("platform_adapters/claude-code/README.md", target) return target def build_gemini_cli() -> Path: - target = ENV_ROOT / "gemini-cli" + target = REPO_ROOT / "gemini-cli" reset_dir(target) copy_common_workspace(target) copy_dir(ADAPTER_ROOT / "gemini-cli", target / ".gemini") + copy_file("platform_adapters/gemini-cli/README.md", target) return target @@ -134,7 +147,6 @@ def main() -> int: run_pull() names = list(BUILDERS) if args.platform == "all" else [args.platform] - ENV_ROOT.mkdir(parents=True, exist_ok=True) for name in names: target = BUILDERS[name]() print(f"rebuilt {name}: {target}") diff --git a/scripts/v020_regression.py b/src/scripts/v020_regression.py similarity index 100% rename from scripts/v020_regression.py rename to src/scripts/v020_regression.py diff --git a/scripts/verify-zenmux.sh b/src/scripts/verify-zenmux.sh similarity index 100% rename from scripts/verify-zenmux.sh rename to src/scripts/verify-zenmux.sh diff --git a/skills/deep-research/SKILL.md b/src/skills/deep-research/SKILL.md similarity index 100% rename from skills/deep-research/SKILL.md rename to src/skills/deep-research/SKILL.md diff --git a/skills/document-ingest/SKILL.md b/src/skills/document-ingest/SKILL.md similarity index 100% rename from skills/document-ingest/SKILL.md rename to src/skills/document-ingest/SKILL.md diff --git a/skills/search-gateway/SKILL.md b/src/skills/search-gateway/SKILL.md similarity index 100% rename from skills/search-gateway/SKILL.md rename to src/skills/search-gateway/SKILL.md diff --git a/skills/search-strategy/SKILL.md b/src/skills/search-strategy/SKILL.md similarity index 100% rename from skills/search-strategy/SKILL.md rename to src/skills/search-strategy/SKILL.md diff --git a/tests/test_adapter_deploy.py b/src/tests/test_adapter_deploy.py similarity index 100% rename from tests/test_adapter_deploy.py rename to src/tests/test_adapter_deploy.py diff --git a/tests/test_chapter_assembly.py b/src/tests/test_chapter_assembly.py similarity index 100% rename from tests/test_chapter_assembly.py rename to src/tests/test_chapter_assembly.py diff --git a/tests/test_phase0_materials.py b/src/tests/test_phase0_materials.py similarity index 100% rename from tests/test_phase0_materials.py rename to src/tests/test_phase0_materials.py diff --git a/tests/test_phase3_model_review.py b/src/tests/test_phase3_model_review.py similarity index 100% rename from tests/test_phase3_model_review.py rename to src/tests/test_phase3_model_review.py diff --git a/tests/test_polish_prompt.py b/src/tests/test_polish_prompt.py similarity index 100% rename from tests/test_polish_prompt.py rename to src/tests/test_polish_prompt.py diff --git a/tests/test_reporting.py b/src/tests/test_reporting.py similarity index 100% rename from tests/test_reporting.py rename to src/tests/test_reporting.py diff --git a/tests/test_research_methods.py b/src/tests/test_research_methods.py similarity index 100% rename from tests/test_research_methods.py rename to src/tests/test_research_methods.py diff --git a/tests/test_search_grounded_packets.py b/src/tests/test_search_grounded_packets.py similarity index 100% rename from tests/test_search_grounded_packets.py rename to src/tests/test_search_grounded_packets.py diff --git a/tests/test_source_cache.py b/src/tests/test_source_cache.py similarity index 100% rename from tests/test_source_cache.py rename to src/tests/test_source_cache.py diff --git a/tests/test_v020_cli.py b/src/tests/test_v020_cli.py similarity index 100% rename from tests/test_v020_cli.py rename to src/tests/test_v020_cli.py diff --git a/tests/test_v020_runtime.py b/src/tests/test_v020_runtime.py similarity index 100% rename from tests/test_v020_runtime.py rename to src/tests/test_v020_runtime.py diff --git a/tests/test_v020_workers.py b/src/tests/test_v020_workers.py similarity index 100% rename from tests/test_v020_workers.py rename to src/tests/test_v020_workers.py diff --git a/tests/test_zenmux_model_normalization.py b/src/tests/test_zenmux_model_normalization.py similarity index 100% rename from tests/test_zenmux_model_normalization.py rename to src/tests/test_zenmux_model_normalization.py diff --git a/uv.lock b/src/uv.lock similarity index 100% rename from uv.lock rename to src/uv.lock