Skip to content

Commit cc18d5b

Browse files
perf: ui/ux improved
1 parent 22c98b7 commit cc18d5b

44 files changed

Lines changed: 2715 additions & 78 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
name: devflow-codex
3+
description: 在 Codex 中运行 devflow。用户提到 devflow、start/resume/status/abort devflow、多 agent 工作流,或要求“按 Codex devflow 跑”时使用。
4+
---
5+
6+
# DevFlow Codex 工作流
7+
8+
这是 Codex 原生工作流入口。Codex 运行时只读取 `.codex/`,不读取
9+
`.codebuddy/`。
10+
11+
`.codex/` 与 `.codebuddy/` 是两套独立工作流资产;二者应保持流程契约一致,
12+
但互不作为运行时依赖。
13+
14+
## 必读文件
15+
16+
启动或恢复前必须读取:
17+
18+
1. `.codex/assets/devflow.defaults.yaml`
19+
2. `.codex/runtime/start-workflow.md`
20+
3. `.codex/runtime/workflow-state-spec.md`
21+
4. TASK-01 需求澄清时读取 `.codex/skills/superpowers/brainstorming/SKILL.md`
22+
5. TASK-05 知识沉淀时读取 `.codex/skills/knowledge-distillation/SKILL.md`
23+
6. 当前阶段对应的 `.codex/agents/<role>.md`
24+
7. 当前阶段需要的 `.codex/rules/` 和 `.codex/checklists/`
25+
26+
## 在 Codex 中如何触发
27+
28+
Codex 不会自动把仓库里的命令文件注册进 `/` 菜单。请用自然语言或显式
29+
skill 触发:
30+
31+
```text
32+
$devflow-codex start 需求描述...
33+
$devflow-codex status TASK_SLUG
34+
$devflow-codex resume TASK_SLUG
35+
$devflow-codex abort TASK_SLUG
36+
```
37+
38+
也可以直接说:
39+
40+
```text
41+
用 devflow 跑这个需求:...
42+
```
43+
44+
## 编排规则
45+
46+
- 主 Codex 线程是唯一 orchestrator。
47+
- `workflow-state.json` 是阶段交接和审计的唯一持久化状态。
48+
- 不使用 CodeBuddy 的 `team_create`、`send_message`、`team_delete`。
49+
- medium/large 的 TASK-01 必须使用 `superpowers:brainstorming` 做需求澄清,
50+
且必须等待用户明确回答或确认后才能进入 TASK-02。
51+
- TASK-02 及之后的角色阶段必须通过 Codex `multi_agent_v1.spawn_agent`
52+
派发;只有工具不存在或返回 unavailable/not found 时,才允许主线程内联执行
53+
并在 `workflow-state.json.decisions[]` 记录降级原因。
54+
- 阶段产物和状态 schema 必须保持 devflow 兼容。
55+
56+
## 启动协议
57+
58+
按 `.codex/runtime/start-workflow.md` 执行:
59+
60+
1. 初始化 `artifacts/{task_slug}/` 和 `workflow-state.json`。
61+
2. Phase 0 做需求草图、影响扫描和规模判定。
62+
3. small 进入 SOLO。
63+
4. medium/large 先由主 Codex 线程调用 `superpowers:brainstorming` 完成
64+
TASK-01 需求分析与澄清,写入 `01-requirement/requirement-report.md`,
65+
经用户确认后再进入 TASK-02。
66+
5. TASK-02 起使用 `multi_agent_v1.spawn_agent` 派发对应角色。
67+
6. 如果用户要求先确认方案,停在 TASK-03 前。
68+
69+
## 阶段协议
70+
71+
每个阶段:
72+
73+
1. 先读取 `workflow-state.json`。
74+
2. 读取 `.codex/agents/<role>.md`。
75+
3. 写入阶段开始状态。
76+
4. 产出对应 artifact。
77+
5. 更新 `workflow-state.json`。
78+
6. 返回主线程,由主线程按 routing table 决定下一阶段。
79+
80+
## 完成协议
81+
82+
结束时生成 `workflow-summary.md`,更新 summary 字段,保留全部产物,并向用户
83+
汇总改动、验证、审查和知识沉淀结果。
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
name: knowledge-distillation
3+
description: 通用知识沉淀能力。用于从 devflow 或其他交付过程的需求、设计、实现、审查、测试产物中提炼可复用经验、技术决策、踩坑记录和流程改进。
4+
---
5+
6+
# Knowledge Distillation
7+
8+
本 skill 提供知识沉淀方法论。它只定义如何收集、筛选、组织和输出知识点;
9+
具体输入产物与输出路径由调用方指定。
10+
11+
## DevFlow Override
12+
13+
当本 skill 由 Codex devflow 的 TASK-05 `knowledge-engineer` 调用时:
14+
15+
- 必须读取 `workflow-state.json` 中的 `task_slug`、`artifacts_dir` 和各阶段
16+
`artifact_path`。
17+
- 必须读取 TASK-01、TASK-02、TASK-03、CODE-REVIEW、TASK-04 的有效产物;
18+
若任一必需上游阶段未完成或产物缺失,TASK-05 应失败并写入 `last_error`。
19+
- 输出路径固定为 `{ARTIFACTS_ROOT}/knowledge/{task_slug}.md`,其中
20+
`ARTIFACTS_ROOT` 来自 `.codex/assets/devflow.defaults.yaml` 的
21+
`artifacts.root_dir`。
22+
- 只允许追加,不允许删除、覆盖或改写已有知识条目。
23+
- 如果同一 `task_slug` 的知识文件已存在,应先做标题和主题去重;相似条目合并为
24+
新子条目,不重复创建同义章节。
25+
- 完成后由 `knowledge-engineer` 更新 `workflow-state.json`:
26+
`stages.TASK-05.status = "completed"`、`artifact_path` 指向全局知识文件、
27+
`last_event = "TASK-05_completed"`、`next_target = "leader"`。
28+
29+
## When To Use
30+
31+
- 需求或项目交付完成后,提炼可复用经验。
32+
- 技术攻关后,记录关键决策和踩坑经验。
33+
- 代码改造后,沉淀可复用的改造模式。
34+
- 流程复盘时,记录后续 devflow 可改进点。
35+
36+
## Step 1: Collect Inputs
37+
38+
优先从结构化产物中提取信息:
39+
40+
| 来源 | 关注要点 |
41+
|------|----------|
42+
| 需求分析 | 关键约束、澄清过的歧义、纳入/排除范围 |
43+
| 技术方案 | 架构决策、取舍理由、风险控制 |
44+
| 执行计划 | 任务拆分、文件边界、并行协作约束 |
45+
| 代码实现 | 可复用改造模式、关键实现点、实际变更边界 |
46+
| 代码审查 | P0/P1 问题、门禁经验、质量规则 |
47+
| 测试报告 | 有效测试方法、无需测试的判定依据、环境限制 |
48+
49+
## Step 2: Filter And Distill
50+
51+
每条知识点必须满足:
52+
53+
| 标准 | 要求 | 反例 |
54+
|------|------|------|
55+
| 可复用 | 后续类似场景能直接参考 | 本次任务创建时间是某日某时 |
56+
| 具体明确 | 包含模块、文件、函数、配置项或流程节点 | 某个地方要注意 |
57+
| 结论导向 | 写清建议做法和原因 | 复述完整讨论过程 |
58+
| 精简 | 每条 1-3 句 | 大段复制原始报告 |
59+
60+
宁可少写,也不要为凑数写低价值条目。
61+
62+
## Step 3: Categorize
63+
64+
按需使用以下类别;没有价值的类别可省略:
65+
66+
- 业务知识:业务规则、模块职责、数据流向。
67+
- 技术决策:架构选型、方案取舍及理由。
68+
- 改造模式:可复用的代码或文档改造方式。
69+
- 踩坑记录:易错点、隐含约束、环境问题。
70+
- 流程改进:devflow、评审、测试或协作流程的改进建议。
71+
72+
## Output Template
73+
74+
```markdown
75+
---
76+
task_id: {task_id}
77+
stage: TASK-05
78+
author: 知识沉淀师
79+
date: {YYYY-MM-DD}
80+
run_mode: {auto/manual}
81+
---
82+
83+
## {YYYY-MM-DD} | {task_slug} | {title}
84+
85+
### 技术决策
86+
- ...
87+
88+
### 改造模式
89+
- ...
90+
91+
### 踩坑记录
92+
- ...
93+
94+
### 流程改进
95+
- ...
96+
```
97+
98+
如果本次交付没有新的可复用知识,也要追加一条简短记录说明“不产生新知识点”
99+
的依据,避免 TASK-05 看起来像被跳过。
100+
101+
## Write Rules
102+
103+
1. 追加不覆盖:不得删除或改写已有条目。
104+
2. 幂等安全:同一任务重复沉淀时先检查已有章节,避免重复。
105+
3. 可追溯:保留 YAML front matter 或追加章节中的日期、任务 slug。
106+
4. 不越权:不修改需求、设计、代码、审查、测试等阶段产物。
107+
108+
## Quality Check
109+
110+
完成前检查:
111+
112+
- 每条知识点是否可复用、具体、结论导向、精简。
113+
- 是否遗漏了关键决策理由或明确踩坑。
114+
- 是否含足够上下文,方便不了解本次任务的人理解。
115+
- 是否避免了大段复制原始产物。
116+
- 是否只写入调用方指定的知识文件。
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
---
2+
name: superpowers:brainstorming
3+
description: "Use during devflow TASK-01 requirement clarification before design or implementation. Explores user intent, requirements, constraints, and success criteria."
4+
---
5+
6+
# Brainstorming Ideas Into Designs
7+
8+
Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
9+
10+
## DevFlow Override
11+
12+
When this skill is invoked by `$devflow-codex` for TASK-01 requirement clarification:
13+
14+
- Save the clarified requirement report to `{artifacts_dir}/01-requirement/requirement-report.md`.
15+
- Do not save to `docs/superpowers/specs/` unless the user explicitly asks for a standalone superpowers spec.
16+
- Do not commit the requirement report.
17+
- Do not invoke `writing-plans`; TASK-02 architect writes `02-design/tech-design.md` and `02-design/execution-plan.md`.
18+
- The report must include: AI codebase/context analysis, clarification Q&A, accepted scope, excluded scope, success criteria, risks, and open questions.
19+
- After the report is written and the user has approved the clarified requirement, update `workflow-state.json` with `TASK-01_completed` and route to architect.
20+
- In devflow mode, medium/large TASK-01 must not be completed automatically.
21+
Even when the initial request appears complete, ask the user to confirm the
22+
clarified scope, success criteria, and exclusions before writing
23+
`TASK-01_completed`.
24+
- Do not use "no additional clarification needed" as a reason to skip user
25+
confirmation. If there is no obvious ambiguity, ask a confirmation question
26+
instead of continuing automatically.
27+
- In devflow mode, this override supersedes the default sections below that require writing to `docs/superpowers/specs/`, committing, running the spec review loop, or invoking `writing-plans`.
28+
29+
Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design and get user approval.
30+
31+
<HARD-GATE>
32+
Do NOT invoke any implementation skill, write any code, scaffold any project, or take any implementation action until you have presented a design and the user has approved it. This applies to EVERY project regardless of perceived simplicity.
33+
</HARD-GATE>
34+
35+
## Anti-Pattern: "This Is Too Simple To Need A Design"
36+
37+
Every project goes through this process. A todo list, a single-function utility, a config change — all of them. "Simple" projects are where unexamined assumptions cause the most wasted work. The design can be short (a few sentences for truly simple projects), but you MUST present it and get approval.
38+
39+
## Checklist
40+
41+
You MUST create a task for each of these items and complete them in order:
42+
43+
1. **Explore project context** — check files, docs, recent commits
44+
2. **Offer visual companion** (if topic will involve visual questions) — this is its own message, not combined with a clarifying question. See the Visual Companion section below.
45+
3. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
46+
4. **Propose 2-3 approaches** — with trade-offs and your recommendation
47+
5. **Present design** — in sections scaled to their complexity, get user approval after each section
48+
6. **Write design doc** — save to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` and commit
49+
7. **Spec review loop** — dispatch spec-document-reviewer subagent with precisely crafted review context (never your session history); fix issues and re-dispatch until approved (max 3 iterations, then surface to human)
50+
8. **User reviews written spec** — ask user to review the spec file before proceeding
51+
9. **Transition to implementation** — invoke writing-plans skill to create implementation plan
52+
53+
## Process Flow
54+
55+
```dot
56+
digraph brainstorming {
57+
"Explore project context" [shape=box];
58+
"Visual questions ahead?" [shape=diamond];
59+
"Offer Visual Companion\n(own message, no other content)" [shape=box];
60+
"Ask clarifying questions" [shape=box];
61+
"Propose 2-3 approaches" [shape=box];
62+
"Present design sections" [shape=box];
63+
"User approves design?" [shape=diamond];
64+
"Write design doc" [shape=box];
65+
"Spec review loop" [shape=box];
66+
"Spec review passed?" [shape=diamond];
67+
"User reviews spec?" [shape=diamond];
68+
"Invoke writing-plans skill" [shape=doublecircle];
69+
70+
"Explore project context" -> "Visual questions ahead?";
71+
"Visual questions ahead?" -> "Offer Visual Companion\n(own message, no other content)" [label="yes"];
72+
"Visual questions ahead?" -> "Ask clarifying questions" [label="no"];
73+
"Offer Visual Companion\n(own message, no other content)" -> "Ask clarifying questions";
74+
"Ask clarifying questions" -> "Propose 2-3 approaches";
75+
"Propose 2-3 approaches" -> "Present design sections";
76+
"Present design sections" -> "User approves design?";
77+
"User approves design?" -> "Present design sections" [label="no, revise"];
78+
"User approves design?" -> "Write design doc" [label="yes"];
79+
"Write design doc" -> "Spec review loop";
80+
"Spec review loop" -> "Spec review passed?";
81+
"Spec review passed?" -> "Spec review loop" [label="issues found,\nfix and re-dispatch"];
82+
"Spec review passed?" -> "User reviews spec?" [label="approved"];
83+
"User reviews spec?" -> "Write design doc" [label="changes requested"];
84+
"User reviews spec?" -> "Invoke writing-plans skill" [label="approved"];
85+
}
86+
```
87+
88+
**The terminal state is invoking writing-plans.** Do NOT invoke frontend-design, mcp-builder, or any other implementation skill. The ONLY skill you invoke after brainstorming is writing-plans.
89+
90+
## The Process
91+
92+
**Understanding the idea:**
93+
94+
- Check out the current project state first (files, docs, recent commits)
95+
- Before asking detailed questions, assess scope: if the request describes multiple independent subsystems (e.g., "build a platform with chat, file storage, billing, and analytics"), flag this immediately. Don't spend questions refining details of a project that needs to be decomposed first.
96+
- If the project is too large for a single spec, help the user decompose into sub-projects: what are the independent pieces, how do they relate, what order should they be built? Then brainstorm the first sub-project through the normal design flow. Each sub-project gets its own spec → plan → implementation cycle.
97+
- For appropriately-scoped projects, ask questions one at a time to refine the idea
98+
- Prefer multiple choice questions when possible, but open-ended is fine too
99+
- Only one question per message - if a topic needs more exploration, break it into multiple questions
100+
- Focus on understanding: purpose, constraints, success criteria
101+
102+
**Exploring approaches:**
103+
104+
- Propose 2-3 different approaches with trade-offs
105+
- Present options conversationally with your recommendation and reasoning
106+
- Lead with your recommended option and explain why
107+
108+
**Presenting the design:**
109+
110+
- Once you believe you understand what you're building, present the design
111+
- Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced
112+
- Ask after each section whether it looks right so far
113+
- Cover: architecture, components, data flow, error handling, testing
114+
- Be ready to go back and clarify if something doesn't make sense
115+
116+
**Design for isolation and clarity:**
117+
118+
- Break the system into smaller units that each have one clear purpose, communicate through well-defined interfaces, and can be understood and tested independently
119+
- For each unit, you should be able to answer: what does it do, how do you use it, and what does it depend on?
120+
- Can someone understand what a unit does without reading its internals? Can you change the internals without breaking consumers? If not, the boundaries need work.
121+
- Smaller, well-bounded units are also easier for you to work with - you reason better about code you can hold in context at once, and your edits are more reliable when files are focused. When a file grows large, that's often a signal that it's doing too much.
122+
123+
**Working in existing codebases:**
124+
125+
- Explore the current structure before proposing changes. Follow existing patterns.
126+
- Where existing code has problems that affect the work (e.g., a file that's grown too large, unclear boundaries, tangled responsibilities), include targeted improvements as part of the design - the way a good developer improves code they're working in.
127+
- Don't propose unrelated refactoring. Stay focused on what serves the current goal.
128+
129+
## After the Design
130+
131+
**Documentation:**
132+
133+
- Write the validated design (spec) to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`
134+
- (User preferences for spec location override this default)
135+
- Use elements-of-style:writing-clearly-and-concisely skill if available
136+
- Commit the design document to git
137+
138+
**Spec Review Loop:**
139+
After writing the spec document:
140+
141+
1. Dispatch spec-document-reviewer subagent (see spec-document-reviewer-prompt.md)
142+
2. If Issues Found: fix, re-dispatch, repeat until Approved
143+
3. If loop exceeds 3 iterations, surface to human for guidance
144+
145+
**User Review Gate:**
146+
After the spec review loop passes, ask the user to review the written spec before proceeding:
147+
148+
> "Spec written and committed to `<path>`. Please review it and let me know if you want to make any changes before we start writing out the implementation plan."
149+
150+
Wait for the user's response. If they request changes, make them and re-run the spec review loop. Only proceed once the user approves.
151+
152+
**Implementation:**
153+
154+
- Invoke the writing-plans skill to create a detailed implementation plan
155+
- Do NOT invoke any other skill. writing-plans is the next step.
156+
157+
## Key Principles
158+
159+
- **One question at a time** - Don't overwhelm with multiple questions
160+
- **Multiple choice preferred** - Easier to answer than open-ended when possible
161+
- **YAGNI ruthlessly** - Remove unnecessary features from all designs
162+
- **Explore alternatives** - Always propose 2-3 approaches before settling
163+
- **Incremental validation** - Present design, get approval before moving on
164+
- **Be flexible** - Go back and clarify when something doesn't make sense
165+
166+
## Visual Companion
167+
168+
A browser-based companion for showing mockups, diagrams, and visual options during brainstorming. Available as a tool — not a mode. Accepting the companion means it's available for questions that benefit from visual treatment; it does NOT mean every question goes through the browser.
169+
170+
**Offering the companion:** When you anticipate that upcoming questions will involve visual content (mockups, layouts, diagrams), offer it once for consent:
171+
> "Some of what we're working on might be easier to explain if I can show it to you in a web browser. I can put together mockups, diagrams, comparisons, and other visuals as we go. This feature is still new and can be token-intensive. Want to try it? (Requires opening a local URL)"
172+
173+
**This offer MUST be its own message.** Do not combine it with clarifying questions, context summaries, or any other content. The message should contain ONLY the offer above and nothing else. Wait for the user's response before continuing. If they decline, proceed with text-only brainstorming.
174+
175+
**Per-question decision:** Even after the user accepts, decide FOR EACH QUESTION whether to use the browser or the terminal. The test: **would the user understand this better by seeing it than reading it?**
176+
177+
- **Use the browser** for content that IS visual — mockups, wireframes, layout comparisons, architecture diagrams, side-by-side visual designs
178+
- **Use the terminal** for content that is text — requirements questions, conceptual choices, tradeoff lists, A/B/C/D text options, scope decisions
179+
180+
A question about a UI topic is not automatically a visual question. "What does personality mean in this context?" is a conceptual question — use the terminal. "Which wizard layout works better?" is a visual question — use the browser.
181+
182+
If they agree to the companion, read the detailed guide before proceeding:
183+
`visual-companion.md`

0 commit comments

Comments
 (0)