Cold Start: Memory Bank + Agents bootstrap (greenfield & brownfield)
冷启动:Memory Bank + Agent 搭建(全新项目greenfield & 遗留系统brownfield)
Note:
is the
package skill for all-in-one bootstrap.
Do not confuse it with the generated project command
: that command is a lightweight router used
after skeleton creation inside a target repo.
For modular usage, prefer individual skills:
(skeleton),
(greenfield),
(brownfield),
(review),
(implementation),
(UAT).
- What it does: creates the Memory Bank skeleton, writes agent entry points, and routes the repo into the right workflow.
- Use it when: you want one entry point for either a new project with a PRD or an existing codebase that needs mapping first.
- Input: repository root plus either / requirements text or an existing codebase.
- Output: , , , agent entry files, and the next step for greenfield or brownfield work.
Supported scenarios:
- Greenfield: repo has or requirements text, but no code yet.
- Brownfield: repo already contains code and needs as-is documentation before change planning.
注意:
是一站式搭建的
包技能。
请勿将其与生成的项目命令
混淆:该命令是目标仓库内骨架创建完成后使用的轻量级路由工具。
如需模块化使用,建议选用独立技能:
(骨架搭建)、
(全新项目greenfield)、
(遗留系统brownfield)、
(评审)、
(实施)、
(用户验收测试UAT)。
- 功能:创建Memory Bank骨架,编写Agent入口点,并将仓库接入对应的工作流。
- 适用场景:你希望通过单一入口点处理两种情况——一是带有PRD的新项目,二是需要先进行映射的现有代码库。
- 输入:仓库根目录,加上/需求文本,或现有代码库。
- 输出:、、、Agent入口文件,以及全新项目或遗留系统工作的下一步指引。
支持的场景:
- 全新项目(Greenfield):仓库包含或需求文本,但尚无代码。
- 遗留系统(Brownfield):仓库已包含代码,在变更规划前需要如实完成文档记录。
Non-negotiable principles
不可妥协的原则
1) Orchestrator vs workers
1) 编排者 vs 执行者
- You (main agent) are the orchestrator. You plan and coordinate.
- Workers (subagents) do the heavy lifting (scanning many files, producing long reports).
- Max depth = 2: orchestrator → subagent. No sub-sub-agents.
- 你(主Agent)是编排者:负责规划与协调工作。
- 执行者(子Agent)负责繁重工作(扫描大量文件、生成冗长报告)。
- 最大层级=2:编排者 → 子Agent。不允许存在子子Agent。
2) is runtime memory (НЕ Memory Bank)
- Every agent process gets a unique task folder: .
- Subagents write detailed outputs there, and return only short summaries to the orchestrator.
- 每个Agent进程都会获得唯一的任务文件夹:。
- 子Agent在其中写入详细输出,仅向编排者返回简短摘要。
3) Avoid conflicts by design
3) 从设计层面避免冲突
- Split work by non-overlapping file sets.
- If overlap is unavoidable, use git branches/worktrees per agent and merge later.
- 按无重叠的文件集拆分工作。
- 若无法避免重叠,为每个Agent使用Git分支/工作区,后续再合并。
4) Parallelism limits
4) 并行性限制
- Run up to 5–7 subagents in parallel.
- If your runtime supports multi-tool calls: spawn parallel subagents in a single orchestrator turn.
- 最多并行运行5–7个子Agent。
- 若运行时支持多工具调用:在单次编排者轮次中启动并行子Agent。
After completing any meaningful unit of work:
- Update Memory Bank while context is fresh.
- Then change code / commit.
完成任何有意义的工作单元后:
- 在上下文清晰时更新Memory Bank。
- 再进行代码修改/提交。
Output you MUST create/maintain
你必须创建/维护的输出
- (canonical, short, ~100 lines)
- → symlink (or copy) to
- (optional) → symlink (or copy) to
- (标准规范,简短,约100行)
- → 符号链接(或副本)指向
- (可选) → 符号链接(或副本)指向
- — durable knowledge base
- — operational runtime memory
- — file-based protocols (plans / decision logs / resume)
- — 持久化知识库
- — 运行时操作内存
- — 基于文件的协议(计划/决策日志/进展记录)
Step 0 — Detect environment (don’t guess)
步骤0 — 检测环境(请勿猜测)
-
Check what tools you have:
- Codex available? (Codex CLI / MCP tool)
- Claude Code available? (CLI , subagents)
- Browser tools? (Playwright / agent-browser / CDP MCP)
-
Decide primary engine:
- If working inside Codex: use for implementation and review (prefer fresh sessions for critical reviews).
- If working inside Claude Code: use subagents for analysis + use Opus for synthesis; optionally call Codex via shell for second opinion or structured review.
- If both Codex and Claude are available (dual-engine): use Claude for wide-context scanning and synthesis, Codex for structured review and implementation. Cross-validate critical outputs (MB compliance, architecture) by running the review step on the other engine. See Step 4 for the hybrid workflow.
If you don’t control Codex model selection via UI, create a project
profile set (see Step 1.5).
-
检查可用工具:
- 是否有Codex?(Codex CLI / MCP工具)
- 是否有Claude Code?(CLI 、子Agent)
- 是否有浏览器工具?(Playwright / agent-browser / CDP MCP)
-
确定主引擎:
- 若在Codex内工作:使用进行实施与评审(关键评审建议使用全新会话)。
- 若在Claude Code内工作:使用子Agent进行分析 + 使用Opus进行合成;可通过Shell调用Codex获取第二意见或结构化评审。
- 若同时拥有Codex和Claude(双引擎):使用Claude进行宽上下文扫描与合成,使用Codex进行结构化评审与实施。通过在另一引擎上运行评审步骤,交叉验证关键输出(MB合规性、架构)。混合工作流详见步骤4。
若无法通过UI选择Codex模型,创建项目
配置文件(见步骤1.5)。
Step 1 — Bootstrap the skeleton
步骤1 — 搭建骨架
1.1 Create directories
1.1 创建目录
Create (if missing):
-
- (optional but recommended)
- (optional but recommended)
- (optional but recommended)
- (optional; can keep if you already use it)
- (optional but recommended)
- (Memory Bank backlog & plans)
- (slash-command specs used by humans/agents)
- (subagent prompt library)
-
-
创建(若不存在):
-
- (可选但推荐)
- (可选但推荐)
- (可选但推荐)
- (可选;若已使用可保留)
- (可选但推荐)
- (Memory Bank 待办事项与计划)
- (人类/Agent使用的斜杠命令规范)
- (子Agent提示词库)
-
-
1.2 Create core files (use the templates)
1.2 创建核心文件(使用模板)
Use the templates in:
./references/shared-structure-template.md
At minimum you must create:
- symlink/copy
.memory-bank/mbb/index.md
.memory-bank/requirements.md
.memory-bank/testing/index.md
.memory-bank/tasks/backlog.md
Also create the command specs under
(use
).
使用以下路径中的模板:
./references/shared-structure-template.md
至少必须创建:
- 符号链接/副本
.memory-bank/mbb/index.md
.memory-bank/requirements.md
.memory-bank/testing/index.md
.memory-bank/tasks/backlog.md
1.2.1 Create native skills (proxy commands)
1.2.1 创建原生技能(代理命令)
Create thin proxy skills so commands work natively in each runtime:
.claude/skills/<name>/SKILL.md
→ Claude Code + OpenCode
.agents/skills/<name>/SKILL.md
→ Codex CLI + OpenCode
Each proxy just says:
Read and follow the instructions in .memory-bank/commands/<name>.md
.
This makes commands available natively (
,
,
, etc.) in all three tools.
The
script creates both sets automatically.
创建轻量代理技能,使命令可在各运行时原生工作:
.claude/skills/<name>/SKILL.md
→ Claude Code + OpenCode
.agents/skills/<name>/SKILL.md
→ Codex CLI + OpenCode
每个代理仅需包含:
Read and follow the instructions in .memory-bank/commands/<name>.md
(读取并遵循
.memory-bank/commands/<name>.md
中的指令)。
这样可使命令在三个工具中原生可用(
、
、
等)。
1.3 Enforce frontmatter rule
1.3 强制实施前置元数据规则
Every markdown file inside
must include YAML frontmatter with at least:
status: draft|active|deprecated|archived
内的每个Markdown文件必须包含YAML前置元数据,至少包括:
status: draft|active|deprecated|archived
Create a task folder for this run (pick a new id):
Inside it, create:
TASK-MB-INIT-S-00-orchestrator-plan.md
— what you will do + which subagents
为此运行创建任务文件夹(选择新ID):
在其中创建:
TASK-MB-INIT-S-00-orchestrator-plan.md
— 你的工作计划 + 子Agent分配
1.5 Optional: Codex profile presets
1.5 可选:Codex配置预设
If Codex is used, create
with profiles:
- default: coding (gpt-5.2, high)
- profile : review (gpt-5.2, xhigh)
(If your repo is shared, consider keeping it local or documenting it in
.)
- default: coding (gpt-5.2, high)
- profile : review (gpt-5.2, xhigh)
(若仓库为共享仓库,建议将其设为本地文件,或在
中记录)。
Step 2 — Choose scenario
步骤2 — 选择场景
- If repo has substantial code (, , , , etc.) → Brownfield (Step 3B).
- If repo is mostly empty and you have → Greenfield (Step 3A).
- If both exist: treat as Brownfield + PRD delta (Step 3B).
- If repo is empty/new and no → Skeleton-only (Step 3C).
Record the scenario in:
.tasks/TASK-MB-INIT/TASK-MB-INIT-S-00-orchestrator-plan.md
- 若仓库包含大量代码(、、、等)→ 遗留系统(Brownfield)(步骤3B)。
- 若仓库基本为空且包含 → 全新项目(Greenfield)(步骤3A)。
- 若两者都存在:按遗留系统 + PRD增量处理(步骤3B)。
- 若仓库为新创建/空仓库且无 → 仅骨架(步骤3C)。
将场景记录在:
.tasks/TASK-MB-INIT/TASK-MB-INIT-S-00-orchestrator-plan.md
Step 3A — Greenfield workflow (PRD → Memory Bank)
步骤3A — 全新项目工作流(PRD → Memory Bank)
3A.1 Read PRD and do Deep Questioning
3A.1 读取PRD并进行深度提问
- Read .
- If gaps exist, run deep questioning in rounds (3–5 questions each). Use
./references/shared-deep-questioning.md
.
- If PRD mentions “use skills/tools/CLIs” — run first (project-installed → marketplace).
If user is temporarily unavailable (“запуск и ушёл”):
- Record in
.protocols/PRD-BOOTSTRAP/decision-log.md
.
- Stop and wait (do not invent facts; do not proceed to EP/FT/backlog generation without answers).
If the user explicitly wants autonomous mode:
- record non-blocking gaps as
- halt only on blocking gaps (security/compliance/external contract/data-loss risks)
- after L1–L3 + review gate, continue with
- 读取。
- 若存在信息缺口,分轮次进行深度提问(每轮3–5个问题)。使用
./references/shared-deep-questioning.md
。
- 若PRD提及“使用技能/工具/CLI” — 先运行(优先项目已安装技能 → 市场技能)。
若用户暂时不可用(“启动后离开”):
- 将记录在
.protocols/PRD-BOOTSTRAP/decision-log.md
中。
- 停止并等待(请勿编造信息;未得到答案前,请勿进行史诗/功能/待办事项生成)。
若用户明确要求自主模式:
- 将非阻塞缺口记录为
- 仅在遇到阻塞缺口(安全/合规/外部合同/数据丢失风险)时暂停
- 完成L1–L3 + 评审关卡后,使用继续
3A.2 Write product brief (L1)
3A.2 编写产品简介(L1)
Update
using user’s wording.
3A.3 Requirements + RTM
3A.3 需求 + 需求跟踪矩阵(RTM)
Update
.memory-bank/requirements.md
:
- REQ-IDs
- RTM table mapping REQ → Epic → Feature → Test
更新
.memory-bank/requirements.md
:
- 需求ID(REQ-IDs)
- RTM表格,映射需求 → 史诗 → 功能 → 测试
3A.4 Create epics and features
3A.4 创建史诗与功能
Create:
.memory-bank/epics/EP-001-<slug>.md
.memory-bank/features/FT-001-<slug>.md
Each feature MUST include:
- use cases
- acceptance criteria
- failure modes / edge cases
- test strategy pointers
Status policy:
- Default EP/FT frontmatter to until are resolved.
- Promote to only when acceptance criteria + verification plan are stable.
创建:
.memory-bank/epics/EP-001-<slug>.md
.memory-bank/features/FT-001-<slug>.md
每个功能必须包含:
状态规则:
- 默认史诗/功能前置元数据为,直至得到解决。
- 仅当验收标准 + 验证计划稳定后,才升级为。
3A.5 Tasks planning (per-feature, no “everything at once”)
3A.5 任务规划(按功能拆分,禁止“一次性全部生成”)
Do not generate a full task backlog for all features in one pass.
Instead:
- Create/refresh
.memory-bank/tasks/backlog.md
as a skeleton (waves + placeholders).
- For each selected feature, run to produce:
.memory-bank/tasks/plans/IMPL-FT-<NNN>.md
- atomic items grouped by waves in
请勿一次性为所有功能生成完整的任务待办事项。
而是:
- 创建/更新
.memory-bank/tasks/backlog.md
作为骨架(阶段 + 占位符)。
- 对每个选定的功能,运行生成:
.memory-bank/tasks/plans/IMPL-FT-<NNN>.md
- 在中按阶段分组的原子化项
3A.6 Identify key concepts and create duo docs
3A.6 识别关键概念并创建配套文档
For every non-trivial concept, create a duo:
.memory-bank/architecture/<concept>.md
(WHAT/WHY)
.memory-bank/guides/<concept>.md
(HOW)
对于每个非平凡概念,创建一组配套文档:
.memory-bank/architecture/<concept>.md
(是什么/为什么)
.memory-bank/guides/<concept>.md
(怎么做)
3A.7 Update index
3A.7 更新索引
Update
with annotated links to all created docs.
Step 3B — Brownfield workflow (Repo → Memory Bank)
步骤3B — 遗留系统工作流(仓库 → Memory Bank)
3B.1 Spawn repo-scanning subagents (parallel)
3B.1 启动仓库扫描子Agent(并行)
Create a new task folder:
Spawn up to 5 subagents in parallel with non-overlapping scopes:
- : build/tooling (package managers, scripts, CI)
- : backend/services
- : frontend/UI
- : data layer (DB, migrations, schema)
- : tests + quality gates
Each subagent MUST:
- verify its file glob targets exist ("smart calling")
- write a detailed report into using naming:
TASK-MB-MAP-S-0X-final-report-<code|docs>-YY.md
- return a 5–10 line summary + file list
Use
./agents/shared-repo-scanner.md
as baseline prompt, but scope it.
创建新的任务文件夹:
并行启动最多5个具有无重叠范围的子Agent:
- :构建/工具链(包管理器、脚本、CI)
- :后端/服务
- :前端/UI
- :数据层(数据库、迁移、 schema)
- :测试 + 质量关卡
每个子Agent必须:
- 验证其文件匹配目标是否存在(“智能调用”)
- 将详细报告写入,命名格式:
TASK-MB-MAP-S-0X-final-report-<code|docs>-YY.md
- 返回5–10行摘要 + 文件列表
使用
./agents/shared-repo-scanner.md
作为基础提示词,但需限定范围。
3B.2 Synthesize Memory Bank from reports
3B.2 从报告合成Memory Bank
- — what the system is today
.memory-bank/architecture/
— C4 L1–L3 overview + key invariants
- — setup, dev, test, deploy
- — API/event contracts
.memory-bank/testing/index.md
— canonical gates + verification notes
- — annotated links
PRD-less rule (non-negotiable): if there is
no , you MUST NOT create or populate:
.memory-bank/tasks/backlog.md
with waves/tasks
Empty skeleton files/folders are allowed if they were created by bootstrap.
Repo mapping is as-is documentation, not roadmap planning. If something cannot be derived from code/logs/tests, record it as a hypothesis or an open question.
- — 当前系统的实际情况
.memory-bank/architecture/
— C4 L1–L3概览 + 关键不变量
- — 搭建、开发、测试、部署指南
- — API/事件契约
.memory-bank/testing/index.md
— 标准质量关卡 + 验证说明
- — 带注释的链接
- 包含阶段/任务的
.memory-bank/tasks/backlog.md
允许保留由搭建过程创建的空骨架文件/文件夹。
仓库映射是如实记录文档,而非路线图规划。若无法从代码/日志/测试中推导信息,将其记录为假设或未解决问题。
3B.3 Ask user for PRD delta
3B.3 向用户请求PRD增量
After baseline MB exists:
- ask the user for describing what to change/add
- run and style decomposition against the existing baseline
基准Memory Bank创建完成后:
- 向用户请求,描述需要修改/添加的内容
- 针对现有基准运行和风格的分解流程
Step 3C — Skeleton-only workflow (no PRD, no code)
步骤3C — 仅骨架工作流(无PRD,无代码)
When the repo is new/empty and no
is available:
3C.1 Create skeleton only
3C.1 仅创建骨架
Run Step 1 as usual — create all directories, core files from templates,
,
symlink.
The skeleton provides a ready-to-fill structure:
,
,
, etc. remain as draft stubs.
按步骤1正常执行 — 创建所有目录、模板核心文件、
、
符号链接。
骨架提供了可直接填充的结构:
、
、
等保留为草稿占位符。
3C.2 Ask for PRD
3C.2 请求PRD
After skeleton is created, ask the user to provide a PRD:
"Memory Bank skeleton created. To fill it with product details, epics, features, and a backlog, please provide a
file (or paste requirements text). You can do this now or later — run
when ready."
骨架创建完成后,向用户请求提供PRD:
"Memory Bank骨架已创建。如需填充产品详情、史诗、功能与待办事项,请提供
文件(或粘贴需求文本)。你可现在提供或稍后提供 — 准备就绪后运行
命令即可。"
3C.3 Wait or proceed
3C.3 等待或继续
- If user provides PRD now → continue to Step 3A (Greenfield workflow).
- If user defers → stop here. The skeleton is valid and usable. The user can invoke or later to fill the Memory Bank.
- If user provides partial info → run deep questioning (
./references/shared-deep-questioning.md
) to extract enough for product.md, then stop and wait for full PRD.
Note: The skeleton-only state is a valid stopping point.
+
+ MBB rules are enough for agents to start navigating the repo.
- 若用户现在提供PRD → 继续执行步骤3A(全新项目工作流)。
- 若用户推迟提供 → 在此停止。骨架已可用,用户可稍后调用或填充Memory Bank。
- 若用户提供部分信息 → 运行深度提问(
./references/shared-deep-questioning.md
)以提取足够信息用于,然后停止并等待完整PRD。
注意:仅骨架状态是有效的停止点。
+
+ MBB规则已足够Agent开始导航仓库。
Step 4 — Hybrid mode (Claude ↔ Codex)
步骤4 — 混合模式(Claude ↔ Codex)
If you’re in Claude Code but want Codex quality or long-horizon autonomy:
- Use Claude subagents to produce the scan reports into .
- Call Codex via shell to synthesize Memory Bank:
bash
codex exec --ephemeral --full-auto -m gpt-5.2-high \
'Read .tasks/TASK-MB-MAP and build/refresh .memory-bank per MBB. Keep AGENTS.md short. Produce a summary and run a self-review.'
- Then run a Codex deep review profile (or a fresh Claude session) for 5-expert review.
若在Claude Code内工作,但希望获得Codex的质量或长周期自主性:
- 使用Claude子Agent将扫描报告生成到。
- 通过Shell调用Codex合成Memory Bank:
bash
codex exec --ephemeral --full-auto -m gpt-5.2-high \
'Read .tasks/TASK-MB-MAP and build/refresh .memory-bank per MBB. Keep AGENTS.md short. Produce a summary and run a self-review.'
- 然后运行Codex深度评审配置(或全新Claude会话)进行5专家评审。
Step 5 — Multi-expert review loop (fresh context)
步骤5 — 多专家评审循环(全新上下文)
Run fresh-context reviewers (do not reuse the writer context):
- Architect (C4 + dependencies)
- Scope analyst (REQ → Epic → Feature → Task coverage)
- MBB compliance reviewer (frontmatter, links, atomics, duo)
- Plan reviewer (backlog quality, waves, gates)
- Security reviewer (auth, sensitive data, OWASP risks)
- Code quality reviewer (conditional: if code exists — quality gates, conventions, hotspots)
Use prompts in
./agents/shared-review-*.md
and
./agents/shared-mb-reviewer.md
.
Rules:
- If any reviewer returns REJECT → fix MB and repeat review.
- Persist reviewer reports into .
运行全新上下文评审者(请勿复用编写者上下文):
- 架构师(C4 + 依赖关系)
- 范围分析师(需求 → 史诗 → 功能 → 任务覆盖)
- MBB合规性评审者(前置元数据、链接、原子化、配套文档)
- 计划评审者(待办事项质量、阶段、关卡)
- 安全评审者(认证、敏感数据、OWASP风险)
- 代码质量评审者(条件:若存在代码 — 质量关卡、规范、热点)
使用
./agents/shared-review-*.md
和
./agents/shared-mb-reviewer.md
中的提示词。
规则:
- 若任何评审者返回REJECT → 修复Memory Bank并重复评审。
- 将评审报告持久化到。
Step 6 — Start executing tasks
步骤6 — 开始执行任务
After review gate passes (APPROVE):
- Pick the highest-priority task from
.memory-bank/tasks/backlog.md
.
- Run for the task (plan → implement → quality gates → MB-SYNC).
- Run to check acceptance criteria and record evidence.
- Repeat until the wave is complete or user stops.
If the intended mode is unattended end-to-end:
- do not stay in manual loop here
- switch to generated project command
If
or
are not installed, follow their SKILL.md manually.
评审关卡通过(APPROVE)后:
- 从
.memory-bank/tasks/backlog.md
中选择最高优先级任务。
- 对该任务运行(计划 → 实施 → 质量关卡 → MB同步)。
- 运行检查验收标准并记录证据。
- 重复直至阶段完成或用户停止。
若目标模式为无人值守端到端执行:
You are done when:
- exists, short, points to .
- is a symlink/copy of .
- contains at minimum: index + MBB + product + testing (requirements/backlog can remain as stubs until PRD exists).
- contains scan/review artifacts with naming + stage ids.
- Greenfield: epics/features/backlog created from PRD.
- Brownfield: repo mapped as-is into MB and user asked for PRD delta (no roadmap entities invented without PRD).
- Skeleton-only: skeleton created, user asked for PRD (valid stopping point).
- Multi-expert review passes (APPROVE) — for Greenfield/Brownfield; skip for Skeleton-only.
- Execution loop is available (mb-execute + mb-verify reachable or documented).
- Autonomous loop is available ( + documented).
满足以下条件即完成:
- 已存在,内容简短,指向。
- 是的符号链接/副本。
- 至少包含:索引 + MBB + 产品 + 测试文档(需求/待办事项可保留为占位符,直至PRD存在)。
- 包含符合命名规范 + 阶段ID的扫描/评审产物。
- 全新项目场景:已从PRD创建史诗/功能/待办事项。
- 遗留系统场景:仓库已如实映射到Memory Bank,且已向用户请求PRD增量(无PRD时禁止创建路线图实体)。
- 仅骨架场景:骨架已创建,已向用户请求PRD(有效停止点)。
- 多专家评审通过(APPROVE) — 适用于全新项目/遗留系统场景;仅骨架场景可跳过。
- 执行循环可用( + 可访问或已文档化)。
- 自主循环可用( + 已文档化)。
References in this skill
本技能中的参考文件
./references/shared-structure-template.md
./references/shared-deep-questioning.md
./agents/shared-repo-scanner.md
./agents/shared-mb-reviewer.md
./agents/shared-review-architect.md
./agents/shared-review-scope.md
./agents/shared-review-code.md
./agents/shared-review-plan.md
./agents/shared-review-security.md
./scripts/shared-init-mb.js
(optional helper)
./references/shared-structure-template.md
./references/shared-deep-questioning.md
./agents/shared-repo-scanner.md
./agents/shared-mb-reviewer.md
./agents/shared-review-architect.md
./agents/shared-review-scope.md
./agents/shared-review-code.md
./agents/shared-review-plan.md
./agents/shared-review-security.md
./scripts/shared-init-mb.js
(可选辅助工具)