# 文件空间布局 > 沿用 LemonBoss 现有「company-scoped 文件根」。所有 DevLoop 项目落在 `data/companies/{cid}/projects/{pid}/` 下,与已有 `conversations/` / `memory/` 并列。 ## 全景目录树 ``` data/ └── companies/ └── {cid}/ ├── agents/{agentId}/ # 复用:现有 agent 沙箱 ├── conversations/ # 复用 ├── memory/ # 复用根 │ └── devloop/ # NEW · DevLoop Agent 跨项目长期记忆 (M-11) │ ├── pm/{topic}.md │ ├── architect/{topic}.md │ ├── coder/{topic}.md │ └── ... └── projects/ # NEW · LoopController 根 └── {pid}/ ├── .git/ # NEW · per-project git repo (见 arch-git-versioning) ├── .gitignore # NEW · 排除 agent-state · history · stream.log · runs stdout ├── project.json # 项目元数据 (M-1) ├── prd/ # NEW · PM 写的多页 PRD 站点 (M-3) │ ├── index.html │ ├── reading-guide.html │ ├── assets/{shell.css, shell.js, search-index.json} │ ├── product/{background, personas, original-req, scope, success-metrics, glossary}.html │ ├── feature/feature-tree.html │ ├── flow/user-flows.html │ └── prototype/proto-{viewName}.html ├── sdd/ # NEW · Architect 写的多页 SDD 站点 (M-4) · 待 Phase 3 详定 │ ├── index.html │ ├── assets/{shell.css, shell.js, search-index.json} │ └── mvcp/{model, view, control, process}.html ├── units.json # Architect 字段 + UnitRegistry status (M-2) ├── timeline.ndjson # 全流程统一日志 append-only (M-13) ├── bugs.ndjson # NEW · 跨 run bug 台账 (M-14) ├── changelog.ndjson # NEW · 版本变更流 (M-15) ├── agent-state/ # NEW · Agent 持久化运行态 │ ├── pm.json # M-10 AgentRuntimeState │ ├── pm-todo.json # M-12 AgentTodolist │ ├── architect.json │ ├── architect-todo.json │ ├── coder.json # 单 agent 同时只跑一个 unit │ ├── coder-todo.json │ ├── ... (tester, integrator, bug-triager) │ └── snapshots/ # 输入/输出快照,call_id 索引 │ ├── {call_id}-in.json │ └── {call_id}-out.json ├── history/ # 全部 rev 归档 │ ├── prd-rev-001.html │ ├── prd-rev-002.html │ ├── sdd-rev-001.html │ └── units-rev-001.json ├── units/ │ ├── auth-be/ │ │ ├── spec.json │ │ ├── code/ # Coder 输出 │ │ │ ├── server.js │ │ │ ├── auth-service.js │ │ │ └── ... │ │ ├── tests/ # Tester 输出 │ │ │ └── login.spec.ts │ │ ├── contract.json # Coder 写 │ │ ├── coder.log # Coder 自己的决策日志 │ │ └── runs/ │ │ └── {runId}/ │ │ ├── result.json │ │ └── stdout.txt │ ├── auth-fe/... │ └── profile-be/... ├── integration/ │ ├── spec.json # Architect 写 │ └── runs/ │ └── {runId}/ │ ├── result.json # Integrator 写 │ ├── triage.json # BugTriager 写 │ └── process.log └── stream.log # SSE 客户端视角日志 (7 天滚动) ``` > _红 = 新增目录 · 灰 = 已存在并复用_ ## 命名规则 | 占位符 | 格式 | 示例 | | --- | --- | --- | | `{cid}` | company id (UUID) | `c-lemonv-001` | | `{pid}` | `p-` + 时间戳后 6 位 | `p-731042` | | `{unitId}` | `{feature}-{type}` | `auth-be` · `profile-fe` | | `{runId}` | `run-{YYYYMMDD-HHMM}` | `run-20260513-0731` | | L2 runId | `run-int-{YYYYMMDD-HHMM}` | `run-int-20260513-1031` | ## 沙箱边界(写白名单) | Agent | cwd | 可写路径 | | --- | --- | --- | | PM | `projects/{pid}/` | `prd.html` · `history/prd-*` | | Architect | `projects/{pid}/` | `sdd.html` · `units.json` (字段) · `integration/spec.json` · `history/sdd-* · history/units-*` | | Coder | `projects/{pid}/units/{unitId}/` | `code/**` · `contract.json` · `coder.log` | | Tester | `projects/{pid}/units/{unitId}/` | `tests/**` · `runs/{runId}/**` | | Integrator | `projects/{pid}/` | `integration/runs/{runId}/**` | | BugTriager | `projects/{pid}/` | `integration/runs/{runId}/triage.json` | > _沙箱由 Claude CLI 的 `cli.sandbox.writeAllowList` 配置强制执行;越权写直接被工具层拒绝。_ ## 磁盘占用估算 | 项目规模 | Unit 数 | 典型大小 | | --- | --- | --- | | 小 | 3-5 | ~5 MB(含日志) | | 中 | 10-20 | ~30 MB | | 大 | 50+ | ~150 MB | 主要开销在 `runs/*/stdout.txt`(每次 vitest 完整输出)。如需节省,启用 `project.json.compressOldRuns: true` 自动 gzip 14 天前的 run 目录。 ## 多项目共享 同一 company 下不同项目之间默认**隔离**。如需共享代码(如公共 utils),约定: - 在 `companies/{cid}/shared/` 放置共享库 - Unit spec 通过 `spec.shared_deps: ["@shared/utils"]` 显式声明 - Coder 沙箱里 `shared/` 是**只读**挂载,Coder 不能改 > _P1~P4 不实现 shared,留给 P5 视实际需要再加。_