Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Knowledge/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
| f2s-kb-distill | `.Knowledge/topics/f2s-kb-distill.md` | Q&A 驱动知识提取;自动判断创建新 topic 或追加现有 topic | 技能:skills/f2s-kb-distill/SKILL.mdc |
| flow2spec-init-defaults | `.Knowledge/topics/f2s-init-defaults.md` | `flow2spec init` 字段默认值、四处落点一致性、老项目缺字段补写、`init` 不动 stock/req/topics/matchers、manifest 两个版本字段(`projectRev` / `pkgRev`)对照 | 包源码:`lib/flow2specConfig.js` `DEFAULTS` / `CONFIG_FIELDS`;模板:`templates/{locale}/flow2spec.config.json` |
| flow2spec-doctor | `.Knowledge/topics/flow2spec-doctor.md` | `flow2spec doctor` 只读检查环境、项目初始化、协作上下文与知识库健康 | stock:[Doctor 诊断命令](stock-docs/Flow2Spec-doctor诊断命令.md);中英文命令文档:`docs/命令说明.md` / `docs/en/commands-reference.md` |
| flow2spec-dsh-adapter | `.Knowledge/topics/flow2spec-dsh-adapter.md` | `flow2spec init dsh`、DeepSeek Harness 项目技能发现与 `.dsh/` 目录适配 | 用户文档:`docs/使用说明.md` / `docs/en/usage-guide.md`;实现:`lib/dshAgentsAdapter.js` |

每主题保留 **1–3 条** 可点击摘要链接;全量路径对照写入 `.Knowledge/migration-report.md`(迁移场景)。
其中 **`implement-tech-design`**、**`f2s-doc-routing`**、**`config-precheck`**、**`f2s-task`** 在 `topics/` 内为**路由摘要**;执行长文见配置根 **`rules/f2s-*.md(c)`**;使用 Codex 时见 **`.codex/AGENTS.md`**、**`.codex/topics/f2s-*.md`**(`f2s-config-check` 与 `AGENTS` 前置同源,按需打开)。**`f2s-knowledge-preflight`** 与 **`f2s-kb-feedback-closing`** 是普通问答首读 / 源码补答收口门禁,作为配置根规则 / Codex 专题长文生效,不写入 `topicPaths` 或 `taskToTopicRules`;**`f2s-kb-feedback-closing`** 在 cases 1–3 建议执行 **`f2s-kb-distill`**。
Expand Down
18 changes: 17 additions & 1 deletion .Knowledge/manifest-routing.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"f2s-kb-distill": ".Knowledge/topics/f2s-kb-distill.md",
"flow2spec-init-defaults": ".Knowledge/topics/f2s-init-defaults.md",
"flow2spec-collaboration": ".Knowledge/topics/flow2spec-collaboration.md",
"flow2spec-doctor": ".Knowledge/topics/flow2spec-doctor.md"
"flow2spec-doctor": ".Knowledge/topics/flow2spec-doctor.md",
"flow2spec-dsh-adapter": ".Knowledge/topics/flow2spec-dsh-adapter.md"
},
"taskToTopicRules": [
{
Expand Down Expand Up @@ -156,6 +157,14 @@
"topics": [
"flow2spec-doctor"
]
},
{
"task": "flow2spec-dsh-adapter",
"matcherId": "m-flow2spec-dsh-adapter",
"matcherPath": ".Knowledge/matchers/m-flow2spec-dsh-adapter.json",
"topics": [
"flow2spec-dsh-adapter"
]
}
],
"topicMetadata": {
Expand Down Expand Up @@ -234,6 +243,13 @@
"tags": [
"module"
]
},
"flow2spec-dsh-adapter": {
"primary": "feature",
"confidence": "inferred",
"tags": [
"module"
]
}
}
}
16 changes: 16 additions & 0 deletions .Knowledge/matchers/m-flow2spec-dsh-adapter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"includeAny": [
"DeepSeek Harness",
"deepseek-harness",
"dsh",
"flow2spec init dsh",
".dsh/skills",
".dsh/topics",
"Cordis 插件",
"Harness 技能",
"Harness 适配"
],
"id": "m-flow2spec-dsh-adapter",
"version": "1.0.0",
"schema": "flow2spec.matcher.v1"
}
27 changes: 27 additions & 0 deletions .Knowledge/topics/flow2spec-dsh-adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
id: flow2spec-dsh-adapter
revision: 0
summary: "DeepSeek Harness 项目级技能初始化与目录适配"
primary: feature
confidence: inferred
tags: [module]
---
# DeepSeek Harness 适配

## 适用场景

用于 `flow2spec init dsh`、DeepSeek Harness 技能发现、`.dsh/skills`、`.dsh/topics` 和根 `AGENTS.md` 入口问题。

## 已落地能力

- `flow2spec init dsh` 将 Flow2Spec 技能复制到 `.dsh/skills/<skill-name>/SKILL.md`。
- 将模板规则长文镜像到 `.dsh/topics/*.md`,并写入 `.dsh/AGENTS.md` 目录指针。
- 根目录没有 `AGENTS.md` 时生成 Harness 兼容的完整入口;已有入口不会被覆盖。
- 原生 Cordis 插件不在本适配范围内,属于后续路线图事项。

## 维护边界

- Agent 注册:`lib/agents.js`
- 初始化适配:`lib/init.js`、`lib/dshAgentsAdapter.js`
- 诊断与回归:`lib/doctor.js`、`scripts/test-dsh-init.js`
- 用户文档:`docs/使用说明.md`、`docs/en/usage-guide.md`、`docs/目录与路径约定.md`
9 changes: 6 additions & 3 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
</p>

<p align="center">
<strong>Give Cursor, Claude Code, and Codex the project facts they need before editing.</strong>
<strong>Give each initialized AI coding client the project facts it needs before editing.</strong>
</p>

<p align="center">
<a href="./README.zh-CN.md">中文</a> ·
<a href="https://double-coding-lab.github.io/Flow2Spec">Live demo</a> ·
<a href="./docs/en/Flow2Spec-Introduction.md">Introduction</a> ·
<a href="./docs/en/usage-guide.md">Usage guide</a> ·
<a href="./docs/en/commands-reference.md">Commands</a>
<a href="./docs/en/commands-reference.md">Commands</a> ·
<a href="https://github.com/orgs/double-coding-lab/projects/2/views/1">Roadmap</a>
</p>

<p align="center">
Expand All @@ -26,6 +27,8 @@ Flow2Spec adds a spec-driven workflow layer to AI coding agents. It creates a sm

```bash
npx @double-coding/flow2spec@latest init
# DeepSeek Harness projects:
flow2spec init dsh
```

## Why it exists
Expand All @@ -47,7 +50,7 @@ Flow2Spec does not add documentation for its own sake. It keeps a small, machine
| --- | --- | --- |
| Knowledge routing | Maps a request to the few topics the agent needs to read. | `.Knowledge/manifest-routing.json`, `.Knowledge/matchers/*.json` |
| Topic shards | Stores project facts such as APIs, limits, locks, data rules, and workflows. | `.Knowledge/topics/*.md` |
| Agent entrypoints | Installs rules and skills for Cursor, Claude Code, and Codex. | `.cursor/`, `.claude/`, `.codex/`, `AGENTS.md` |
| Agent entrypoints | Installs rules and skills for the selected AI coding clients. | client configuration roots, `.dsh/`, `AGENTS.md` |
| Skill workflows | Clarifies requirements, writes specs, implements, fixes, syncs knowledge, and commits. | `f2s-*` skills |
| Local task state | Keeps AI steps and user-side todos separate from product knowledge. | `.task/` |

Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
</p>

<p align="center">
<strong>Give Cursor, Claude Code, and Codex the project facts they need before editing.</strong>
<strong>Give each initialized AI coding client the project facts it needs before editing.</strong>
</p>

<p align="center">
<a href="./README.zh-CN.md">中文</a> ·
<a href="https://double-coding-lab.github.io/Flow2Spec">Live demo</a> ·
<a href="./docs/en/Flow2Spec-Introduction.md">Introduction</a> ·
<a href="./docs/en/usage-guide.md">Usage guide</a> ·
<a href="./docs/en/commands-reference.md">Commands</a>
<a href="./docs/en/commands-reference.md">Commands</a> ·
<a href="https://github.com/orgs/double-coding-lab/projects/2/views/1">Roadmap</a>
</p>

<p align="center">
Expand All @@ -26,6 +27,8 @@ Flow2Spec adds a spec-driven workflow layer to AI coding agents. It creates a sm

```bash
npx @double-coding/flow2spec@latest init
# DeepSeek Harness projects:
flow2spec init dsh
```

## Why it exists
Expand All @@ -47,7 +50,7 @@ Flow2Spec does not add documentation for its own sake. It keeps a small, machine
| --- | --- | --- |
| Knowledge routing | Maps a request to the few topics the agent needs to read. | `.Knowledge/manifest-routing.json`, `.Knowledge/matchers/*.json` |
| Topic shards | Stores project facts such as APIs, limits, locks, data rules, and workflows. | `.Knowledge/topics/*.md` |
| Agent entrypoints | Installs rules and skills for Cursor, Claude Code, and Codex. | `.cursor/`, `.claude/`, `.codex/`, `AGENTS.md` |
| Agent entrypoints | Installs rules and skills for the selected AI coding clients. | client configuration roots, `.dsh/`, `AGENTS.md` |
| Skill workflows | Clarifies requirements, writes specs, implements, fixes, syncs knowledge, and commits. | `f2s-*` skills |
| Team collaboration | Keeps each developer's task state local while merging reviewed knowledge through structured deltas and topic revisions. | `.task/<developerId>/`, `.Knowledge/` |

Expand Down
9 changes: 6 additions & 3 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
</p>

<p align="center">
<strong>让 Cursor、Claude Code、Codex 在动手改代码前,先读到正确的项目事实。</strong>
<strong>让每个已初始化的 AI 编程客户端在动手改代码前,先读到正确的项目事实。</strong>
</p>

<p align="center">
<a href="./README.md">English</a> ·
<a href="https://double-coding-lab.github.io/Flow2Spec">在线演示</a> ·
<a href="./docs/Flow2Spec基础介绍.md">基础介绍</a> ·
<a href="./docs/使用说明.md">使用说明</a> ·
<a href="./docs/命令说明.md">命令说明</a>
<a href="./docs/命令说明.md">命令说明</a> ·
<a href="https://github.com/orgs/double-coding-lab/projects/2/views/1">路线图</a>
</p>

<p align="center">
Expand All @@ -26,6 +27,8 @@ Flow2Spec 是给 AI 编码工具使用的 Spec-driven 工作流层。它会在

```bash
npx @double-coding/flow2spec@latest init
# DeepSeek Harness 项目:
flow2spec init dsh
```

## 为什么需要它
Expand All @@ -47,7 +50,7 @@ Flow2Spec 不是为了增加文档数量。它把项目事实保存在一层小
| --- | --- | --- |
| 知识路由 | 把一次需求映射到 agent 需要读取的少量 topics。 | `.Knowledge/manifest-routing.json`, `.Knowledge/matchers/*.json` |
| 主题分片 | 保存 API、上限、锁、数据规则、业务流程等项目事实。 | `.Knowledge/topics/*.md` |
| Agent 入口 | 为 Cursor、Claude Code、Codex 安装规则和技能。 | `.cursor/`, `.claude/`, `.codex/`, `AGENTS.md` |
| Agent 入口 | 为选中的 AI 编程客户端安装规则和技能。 | 客户端配置根、`.dsh/`、`AGENTS.md` |
| 技能工作流 | 澄清需求、编写方案、实现、修复、同步知识、提交。 | `f2s-*` skills |
| 团队协作 | 每个人的任务现场留在本地,确认后的知识通过结构化 delta 与 topic revision 合入共享仓库。 | `.task/<developerId>/`, `.Knowledge/` |

Expand Down
19 changes: 8 additions & 11 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,26 +246,21 @@ agent(可多个,空格分隔;省略时交互选择):

示例:
flow2spec init # 交互选择工具和配置
flow2spec init claude # 直接写入 .claude/,跳过工具选择
flow2spec init cursor claude # 同时写入 .cursor/ 与 .claude/
flow2spec init codex --locale en-US # 使用英文模板初始化 Codex
flow2spec init <agent> # 直接写入指定客户端配置根,跳过工具选择
flow2spec init <agent> <agent> # 同时初始化多个客户端
flow2spec init <agent> --locale en-US # 使用英文模板初始化指定客户端
flow2spec init dsh # 初始化 DeepSeek Harness 项目技能
flow2spec init --yes # 跳过所有问答,使用默认值(适合 CI)
flow2spec init --reset-knowledge # 强制用模板覆盖 .Knowledge(谨慎)

init 会:
1. 交互询问要初始化的 AI 工具(cursor / claude / codex,可多选);已通过参数指定则跳过。
1. 交互询问要初始化的 AI 工具(见上方 agent 列表,可多选);已通过参数指定则跳过。
传 --yes 或非 TTY 环境时跳过问答,使用默认值。
2. 对 ${CONFIG_FILENAME} 中缺失的配置字段逐项提问(已有字段不覆盖)。模板语言由 --locale、已有 locale 或默认 zh-CN 决定。
传 --yes 时所有缺失字段使用各自默认值。
3. 默认仅补齐 .Knowledge 缺失模板,并对路由清单做包级/结构增量对齐(manifest-routing + matcherPath 分片;关键词仅写在 matchers/*.json);不替代 f2s-* 对业务文档与路由内容的写入。
传 --reset-knowledge 时才会强制用模板覆盖 .Knowledge 中模板承载部分。
4. 在各 agent 配置根写入 rules、skills(Claude 规则自动转 .md;Codex 在仓库根写入完整 AGENTS.md,.codex/ 写入指针)。
Claude 额外写入 .claude/hooks/f2s-config-session.js、f2s-config-inject.js 与 .claude/settings.json:
SessionStart 注入一次配置摘要;PreToolUse 仅在调用 f2s-* Skill 时提示首步必须 Read 配置。
Cursor 额外写入 f2s-config-check.mdc(alwaysApply),强制在技能首步读取配置文件;
并写入 .cursor/hooks.json,在 sessionStart 自动检测知识库版本。
Codex:仓库根 AGENTS.md(完整条令);.codex/AGENTS.md 为指针;
并写入 .codex/hooks.json,在 SessionStart 注入配置摘要并检测知识库版本。
4. 在各 agent 配置根写入对应的 rules、skills、入口和 hooks(若该客户端支持);具体落盘方式以客户端适配器为准。
5. 每次 init 将当前 locale 包模板 knowledge/index.md 复制到 .Knowledge/template/index.template.md,供 f2s-kb-upgrade 技能与 .Knowledge/index.md 对照;不自动改写 index.md。(「知识库升级」指 f2s-kb-upgrade 技能,init 本身不是升级命令。)
6. 非破坏式补充 .gitignore:忽略 .task/ 与 .Knowledge/update-check.json 这类本地运行态。
7. 规则与技能在各 agent 配置根加载;其他模版类文件在 .Knowledge/template/ 等目录。
Expand Down Expand Up @@ -795,6 +790,8 @@ if (sub === "init") {
const { root, label } = AGENTS[id];
if (id === "codex")
return ` - ${root}/:(${label})skills/、topics/、hooks/、hooks.json、AGENTS.md(指针);仓库根 AGENTS.md(完整)`;
if (id === "dsh")
return ` - ${root}/:(${label})skills/、topics/、AGENTS.md(指针);根 AGENTS.md(缺少时生成)`;
if (id === "claude") {
const hookLine = claudeHooksResult?.settingsChanged
? "rules/、skills/、hooks/f2s-config-session.js、hooks/f2s-config-inject.js、settings.json(已写入 f2s SessionStart/PreToolUse hooks)"
Expand Down
4 changes: 2 additions & 2 deletions docs/Flow2Spec基础介绍.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ Flow2Spec 提供三个互补命令,按触发方式与粒度区分:

<p><img src="./images/flow2spec-intro-13-quick-start.jpg" alt="适合什么项目与快速体验" style="max-width:720px;width:100%;" /></p>

**最适合**:中大型业务项目、长期维护的代码仓库、多人协作规则很多的项目、经常使用 Cursor / Claude Code / Codex 的团队、希望 AI 不只是"看文档"而是参与维护项目知识的场景。
**最适合**:中大型业务项目、长期维护的代码仓库、多人协作规则很多的项目、经常使用多个 AI 编程客户端的团队、希望 AI 不只是"看文档"而是参与维护项目知识的场景。

**可能不适合**:一次性脚本或非常小的个人项目(\< 5000 行,一份 README 够用)。

Expand All @@ -442,7 +442,7 @@ npx @double-coding/flow2spec@latest init

```

目前已支持 Cursor、Claude Code、Codex 三端初始化,也支持中文 / 英文模板。
目前支持按客户端初始化,也支持中文 / 英文模板;新增客户端可以沿用同一套知识库与技能分发模型

---

Expand Down
4 changes: 2 additions & 2 deletions docs/en/Flow2Spec-Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ In short: **single Q&A → distill (auto), new module bulk import → add, perio

<p><img src="../images/flow2spec-intro-13-quick-start.jpg" alt="What projects and quick start" style="max-width:720px;width:100%;" /></p>

**Best for**: medium to large business projects, long-lived codebases, multi-person teams with many rules, teams using Cursor / Claude Code / Codex regularly, and projects where you want AI to participate in maintaining project knowledge — not just read docs.
**Best for**: medium to large business projects, long-lived codebases, multi-person teams with many rules, teams using multiple AI coding clients, and projects where you want AI to participate in maintaining project knowledge — not just read docs.

**May not fit**: one-off scripts or very small personal projects (\< 5000 lines, a README is enough).

Expand All @@ -458,7 +458,7 @@ Common workflows:

```

Currently supports initialization for Cursor, Claude Code, and Codex, with both Chinese and English templates.
Initialization is client-selectable and supports both Chinese and English templates; new clients can reuse the same knowledge-base and skill-distribution model.

---

Expand Down
4 changes: 2 additions & 2 deletions docs/en/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Four rings in the repo (do not collapse rules + skills into a single "third ring
| --- | --- | --- |
| **Knowledge** | `.Knowledge/` | Routing, topics, stock/req docs (§2 layers) |
| **Task** | `.task/` | `todo.json`, checklists, user todos |
| **Rules** | `.cursor/.claude/.codex` rules, `AGENTS.md` | Read order, gap gates, execution constraints |
| **Rules** | `.cursor/.claude/.codex/.dsh` rules/topics, `AGENTS.md` | Read order, gap gates, execution constraints |
| **Skills** | config root `skills/*/SKILL.md` | `f2s-kb-feat/fix/sync`, etc. |

---
Expand Down Expand Up @@ -51,7 +51,7 @@ The pipeline `match → expand → verify → act` operates on L0–L2 (and L3 w
| Layer | Location | Role |
| --- | --- | --- |
| Knowledge layer (knowledge ring) | `.Knowledge/` | Business docs, index, routing (§2 layers) |
| Execution layer (rules + skills rings) | `.cursor/.claude/.codex` | Rules and skill entry points |
| Execution layer (rules + skills rings) | `.cursor/.claude/.codex/.dsh` | Rules and skill entry points |

---

Expand Down
6 changes: 3 additions & 3 deletions docs/en/design-principles.md
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,9 @@ Each SKILL.md's orchestration section reads:
#### 1. Tools are pluggable: one knowledge base, any tool combination

```
flow2spec init cursor claude codexall three tools installed
flow2spec init claude ← only Claude
flow2spec init cursor codex ← skip Claude
flow2spec init <selected-agents> initialize the requested tools
flow2spec init <one-agent> ← initialize one tool
flow2spec init <selected-agents> ← add or skip tools as needed

.Knowledge/ stays the same, tools can be added or removed at any time
```
Expand Down
4 changes: 3 additions & 1 deletion docs/en/directory-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

- `.Knowledge/`: **Knowledge ring** — business docs and machine-readable routing ([architecture.md §2](./architecture.md))
- `.task/`: **Task ring** — change tracking (not inside `.Knowledge/`)
- `Config Root` (`.cursor/.claude/.codex`): **Rules ring + skills ring**
- `Config Root` (`.cursor/.claude/.codex/.dsh`): **Rules ring + skills ring**

See [architecture.md §1](./architecture.md) for Memory Coding four rings.

Expand All @@ -29,6 +29,8 @@ See [architecture.md §1](./architecture.md) for Memory Coding four rings.
| `Config Root/skills/` | Skill definitions (`SKILL.md`) |
| `Config Root/template/` | (Deprecated) No longer written to; historical directories may be cleaned up |
| `.codex/AGENTS.md` | Codex unified entry point and loading instructions |
| `.dsh/AGENTS.md` | DeepSeek Harness directory pointer; the complete project entry remains root `AGENTS.md` |
| `.dsh/topics/` | Long-form rule mirrors loaded on demand by DeepSeek Harness |
| `flow2spec.config.json` | Project root configuration, controls `subAgent`, `switchAgentVerification`, `changeTracking` (nested object with `feat` / `fix` / `implement` sub-items) |

> See [Usage Guide Section 1](./usage-guide.md) for multi-platform references and path tables (detail maintained in a single table); **the authoritative source remains `Read(flow2spec.config.json)`**.
Expand Down
Loading
Loading