kld-sdd 2.6.7 → 2.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/kld-sdd-init.js +39 -3
- package/lib/init.js +320 -45
- package/lib/workspace-layout.js +2 -0
- package/package.json +2 -2
- package/skywalk-sdd/context-client.cjs +59 -5
- package/skywalk-sdd/ontology/active-changes.cjs +297 -0
- package/skywalk-sdd/ontology/change-key.cjs +241 -0
- package/skywalk-sdd/ontology/cli.cjs +135 -0
- package/skywalk-sdd/ontology/list-changes.cjs +110 -0
- package/skywalk-sdd/ontology/modules.cjs +167 -0
- package/skywalk-sdd/ontology/naming-diagnose.cjs +594 -0
- package/skywalk-sdd/ontology/sdd-config.cjs +335 -0
- package/skywalk-sdd/ontology/workspace-layout.cjs +194 -0
- package/templates/dot-sdd.yaml +8 -0
- package/templates/git-hooks/commit-msg-sdd-trailer.cjs +224 -0
- package/templates/modules.yaml +13 -0
- package/templates/openspec/proposal.md +7 -1
- package/templates/sdd.config.yaml +12 -0
- package/templates/skills/kld-sdd/openspec-sync-specs/SKILL.md +148 -0
- package/templates/skills/kld-sdd/openspec-update-change/SKILL.md +86 -0
- package/templates/skills/kld-sdd/opsx-apply/SKILL.md +3 -3
- package/templates/skills/kld-sdd/opsx-apply/checklist.md +1 -1
- package/templates/skills/kld-sdd/opsx-archive/SKILL.md +11 -1
- package/templates/skills/kld-sdd/opsx-check/SKILL.md +73 -3
- package/templates/skills/kld-sdd/opsx-design/SKILL.md +9 -0
- package/templates/skills/kld-sdd/opsx-explore/SKILL.md +37 -17
- package/templates/skills/kld-sdd/opsx-kb-ingest/SKILL.md +9 -14
- package/templates/skills/kld-sdd/opsx-ontology-query/SKILL.md +83 -109
- package/templates/skills/kld-sdd/opsx-ontology-query/phase-1-prechange.md +276 -0
- package/templates/skills/kld-sdd/opsx-ontology-query/phase-2-during.md +354 -0
- package/templates/skills/kld-sdd/opsx-ontology-query/phase-3-postchange.md +223 -0
- package/templates/skills/kld-sdd/opsx-ontology-query/phase-4-explore.md +240 -0
- package/templates/skills/kld-sdd/opsx-ontology-query/phase-5-governance.md +232 -0
- package/templates/skills/kld-sdd/opsx-ontology-query/reference.md +92 -4
- package/templates/skills/kld-sdd/opsx-propose/SKILL.md +87 -16
- package/templates/skills/kld-sdd/opsx-propose/checklist.md +1 -0
- package/templates/skills/kld-sdd/opsx-spec/SKILL.md +33 -3
- package/templates/skills/kld-sdd/opsx-task/SKILL.md +10 -0
- package/templates/skills/kld-sdd/opsx-tdd-core/checklist.md +1 -1
|
@@ -27,6 +27,15 @@ allowed-tools:
|
|
|
27
27
|
> **完成本阶段后,绝对禁止自动继续执行 task 等后续阶段。**
|
|
28
28
|
> 阶段边界自检见 `./checklist.md`「阶段边界⛔」。
|
|
29
29
|
|
|
30
|
+
> **KB 上下文**:设计时可参考历史设计决策。
|
|
31
|
+
> 1. 检查 proposal.md frontmatter `kb-status`:若 `degraded(by-user-choice)` → 跳过 KB,仅用本地上下文。
|
|
32
|
+
> 2. 否则运行 KB 就绪检查:
|
|
33
|
+
> ```bash
|
|
34
|
+
> node skywalk-sdd/context-client.cjs --check-only
|
|
35
|
+
> ```
|
|
36
|
+
> - `"available": true` → 若需查历史设计参考,先 `Read` `opsx-ontology-query/phase-2-during.md` §1
|
|
37
|
+
> - `"available": false` → **KB 不可用不阻塞 design 流程**,仅跳过历史设计参考查询
|
|
38
|
+
|
|
30
39
|
> **⚠️ 渐进式上下文加载原则**
|
|
31
40
|
>
|
|
32
41
|
> - 本技能针对**单一 Capability** 执行设计(Simple 模式例外,见下方 S1 说明)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
2
|
name: opsx-explore
|
|
3
3
|
description: "浏览变更技能 - 查看所有变更状态和 SDD 文档完整性概览"
|
|
4
4
|
argument-hint: "[change-name]"
|
|
@@ -10,8 +10,6 @@ metadata:
|
|
|
10
10
|
allowed-tools:
|
|
11
11
|
- Bash
|
|
12
12
|
- Read
|
|
13
|
-
- Write
|
|
14
|
-
- Edit
|
|
15
13
|
---
|
|
16
14
|
|
|
17
15
|
你是一个 SDD(Specification-Driven Development)变更浏览专家。激活本技能后,你将展示项目中所有变更的状态概览,并引导用户执行下一步操作。
|
|
@@ -40,8 +38,15 @@ allowed-tools:
|
|
|
40
38
|
|
|
41
39
|
## 启动流程
|
|
42
40
|
|
|
43
|
-
### 1.
|
|
41
|
+
### 1. 获取所有变更列表(按模块中文分组)
|
|
44
42
|
|
|
43
|
+
优先使用命名协议分组:
|
|
44
|
+
```bash
|
|
45
|
+
node skywalk-sdd/ontology/cli.cjs list-changes --project=.
|
|
46
|
+
# 需要结构化数据时加 --json
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
也可辅助:
|
|
45
50
|
```bash
|
|
46
51
|
openspec list
|
|
47
52
|
```
|
|
@@ -52,25 +57,40 @@ openspec list
|
|
|
52
57
|
### 2. 检查每个变更的 SDD 文档完整性
|
|
53
58
|
|
|
54
59
|
对每个变更,检查以下文件是否存在:
|
|
55
|
-
- `openspec/changes/<
|
|
56
|
-
- `openspec/changes/<
|
|
57
|
-
- `openspec/changes/<
|
|
58
|
-
- `openspec/changes/<
|
|
60
|
+
- `openspec/changes/<change-key>/proposal.md`(P)
|
|
61
|
+
- `openspec/changes/<change-key>/specs/<capability>/spec.md`(S)
|
|
62
|
+
- `openspec/changes/<change-key>/specs/<capability>/design.md`(D)
|
|
63
|
+
- `openspec/changes/<change-key>/specs/<capability>/tasks.md`(T)
|
|
59
64
|
|
|
60
65
|
同时获取每个变更状态:
|
|
61
66
|
```bash
|
|
62
|
-
openspec status --change "<
|
|
67
|
+
openspec status --change "<change-key>" --json
|
|
63
68
|
```
|
|
64
69
|
|
|
65
|
-
### 3.
|
|
70
|
+
### 3. 展示按模块分组的变更概览
|
|
71
|
+
|
|
72
|
+
展示格式(title 来自 proposal frontmatter,目录定位使用 change-key):
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
📦 财务核算 (fi)
|
|
76
|
+
● 会计凭证头创建
|
|
77
|
+
fi-260727-account-doc-head-create
|
|
78
|
+
P✅ S✅ D✅ T❌ | 建议: /opsx-task fi-260727-account-doc-head-create
|
|
79
|
+
|
|
80
|
+
📦 跨模块 (cross)
|
|
81
|
+
● 凭证与库存联动
|
|
82
|
+
cross-260727-fi-mm-voucher-stock-link
|
|
83
|
+
affected: fi, mm
|
|
84
|
+
|
|
85
|
+
📦 未分类
|
|
86
|
+
● legacy-add-user-auth
|
|
87
|
+
legacy-add-user-auth
|
|
88
|
+
```
|
|
66
89
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
> | add-user-auth | ✅ | ✅ | ✅ | ❌ | PENDING | `/opsx-task add-user-auth` |
|
|
72
|
-
> | payment-refund | ✅ | ❌ | ❌ | ❌ | PENDING | `/opsx-spec payment-refund` |
|
|
73
|
-
> | points-exchange | ✅ | ✅ | ✅ | ✅ | IMPLEMENTING | `/opsx-check points-exchange` |"
|
|
90
|
+
规则:
|
|
91
|
+
- 分组依据 `module`;中文组名来自 `modules.yaml`
|
|
92
|
+
- 缺少 change-key/title/module 的存量 change 归入「未分类」
|
|
93
|
+
- `module=cross` 时额外展示 `affected-modules`
|
|
74
94
|
|
|
75
95
|
### 4. 【交互引导】选择操作
|
|
76
96
|
|
|
@@ -13,20 +13,14 @@ description: >-
|
|
|
13
13
|
|
|
14
14
|
> 控制台知识库页另有浮动 Ontology Agent(会话登录 + SSE);本 Skill 仍走 API Key,二者分开。
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
```text
|
|
19
|
-
skills/opsx-kb-ingest/.local/state.json
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
字段说明 → [reference.md](reference.md)。
|
|
16
|
+
> **📡 共享状态**:本技能与 `opsx-ontology-query` **共用同一份 KB 配置**(`../.shared/kb-state.json`)。任一 skill 配置后,另一个自动可用,无需重复输入 API Key。
|
|
23
17
|
|
|
24
18
|
## Session 启动(每次用本 Skill 必做)
|
|
25
19
|
|
|
26
20
|
```
|
|
27
21
|
Task Progress:
|
|
28
|
-
- [ ] 1. 读
|
|
29
|
-
- [ ] 2. 无 apiKey →
|
|
22
|
+
- [ ] 1. 读 ../.shared/kb-state.json(没有则当空)
|
|
23
|
+
- [ ] 2. 无 apiKey → 向用户索取并写入共享 state(勿把完整 key 打进聊天摘要)
|
|
30
24
|
- [ ] 3. 无 targets 或用户要重置 → 拉空间/KB 列表,让用户多选后写入
|
|
31
25
|
- [ ] 4. 按意图执行入库操作(上传 / 查状态 / 列表 / 重试)
|
|
32
26
|
- [ ] 5. 按模板输出结果
|
|
@@ -36,9 +30,9 @@ Task Progress:
|
|
|
36
30
|
|
|
37
31
|
若 `state.apiKey` 为空或无效(401/403):
|
|
38
32
|
|
|
39
|
-
1. 请用户提供 API Key(控制台「API 密钥」创建,至少含 `archive:ingest
|
|
33
|
+
1. 请用户提供 API Key(控制台「API 密钥」创建,至少含 `archive:ingest`。建议同时勾选 `context:read`,使 `opsx-ontology-query` 也能复用此 Key)。
|
|
40
34
|
2. 可选:请用户确认 `api`(默认 `http://localhost:8090/api`)与 `tenantKey`(默认 `default`)。
|
|
41
|
-
3.
|
|
35
|
+
3. 写入共享 `../.shared/kb-state.json`(创建目录若不存在)。
|
|
42
36
|
4. 用 `GET $API/health` 探活;再用 `GET $API/v1/spaces?tenantKey=…` + Bearer 校验 key。
|
|
43
37
|
|
|
44
38
|
用户说「换密钥 / 重置 API Key」→ 清空 `apiKey`(可保留 targets),回到本步。
|
|
@@ -165,17 +159,18 @@ curl -sS -X POST "$API/v1/spaces/$SPACE_ID/knowledge-bases/$KB_ID/ingestions/$JO
|
|
|
165
159
|
- 无 `targets` 不得臆造 spaceId/kbId。
|
|
166
160
|
- 上传前确认 zip 包路径存在且为有效 zip 文件。
|
|
167
161
|
- 入库失败时展示 `errorCode` 和 `errorMessage`,不编造原因。
|
|
168
|
-
- 完整 apiKey
|
|
162
|
+
- 完整 apiKey 只写共享 state 文件(`../.shared/kb-state.json`);聊天里最多显示前缀(如 `sk_sdd_****`)。
|
|
169
163
|
- 401/403 时清掉 `apiKey`,请用户重贴;勿循环重试。
|
|
164
|
+
- **共享状态**:state 文件与 `opsx-ontology-query` 共用。如用户此前已通过查询 skill 配置过 KB,本 skill 启动时直接读取已有配置,无需重复询问。
|
|
170
165
|
|
|
171
166
|
## 用户口令
|
|
172
167
|
|
|
173
168
|
| 用户说 | Agent 做 |
|
|
174
169
|
|--------|----------|
|
|
175
|
-
| (首次使用) | 要 key → 选 KB(多选)→
|
|
170
|
+
| (首次使用) | 要 key → 选 KB(多选)→ 写共享 state → 再操作。此后 `opsx-ontology-query` 也自动可用 |
|
|
176
171
|
| 换密钥 / 重置 API Key | 清 apiKey,重走第 2 步 |
|
|
177
172
|
| 重新选择 / 重置空间或知识库 | 清 targets,重走第 3 步 |
|
|
178
|
-
| 上传 / 入库 |
|
|
173
|
+
| 上传 / 入库 | 用当前共享 targets 中选中的 KB 上传 zip |
|
|
179
174
|
| 查状态 / 看任务 | 用 jobId 查询任务状态 |
|
|
180
175
|
| 列任务 / 看历史 | 列出最近入库任务 |
|
|
181
176
|
| 重试 | 对失败的 jobId 执行重试 |
|
|
@@ -5,126 +5,85 @@ description: >-
|
|
|
5
5
|
entity/impact/ontology-view). Prompts for API key and multi-selects spaces/KBs into
|
|
6
6
|
local skill state. Use when looking up Spec/design facts, Spec reuse, impact, or
|
|
7
7
|
citation-backed answers from the ontology KB.
|
|
8
|
+
argument-hint: "[query or continuity intent]"
|
|
9
|
+
license: MIT
|
|
10
|
+
compatibility: Requires Engineering KB API (API Key with context:read).
|
|
11
|
+
metadata:
|
|
12
|
+
author: sdd-team
|
|
13
|
+
version: "2.0"
|
|
14
|
+
source: "kb-sdd/skills/opsx-ontology-query"
|
|
15
|
+
allowed-tools:
|
|
16
|
+
- Bash
|
|
17
|
+
- Read
|
|
18
|
+
- Write
|
|
19
|
+
- Edit
|
|
8
20
|
---
|
|
9
21
|
|
|
10
22
|
# 本体知识库 · 查询
|
|
11
23
|
|
|
12
24
|
只负责**查**。鉴权只用 **API Key**(`Authorization: Bearer sk_sdd_…`),**禁止**走手机号登录。
|
|
13
25
|
|
|
14
|
-
>
|
|
15
|
-
>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
> 交互硬规则:自然语言优先,不向用户索要 UUID;多实体时用 `ask_user` Generative UI 卡片(`type=choice`,options.label=名称)。
|
|
19
|
-
>
|
|
20
|
-
> **Skills 激活**:控制台 Agent 通过 AgentScope `FileSystemSkillRepository`(`skillsRoot`,见
|
|
21
|
-
> `classpath:agent/agent.yml`)挂载本目录;运行时用内置工具 `load_skill_through_path`
|
|
22
|
-
> (skillId=`opsx-ontology-query`,path=`SKILL.md` / `reference.md`)按需加载,不把全文塞进 system prompt。
|
|
23
|
-
>
|
|
24
|
-
> **记忆**:会话短期用 AgentScope `InMemoryAgentStateStore`;本体事实仍走 KB(pgvector/SQL)。
|
|
25
|
-
> **不需要 mem0**,除非以后要跨会话个人偏好记忆。
|
|
26
|
-
|
|
27
|
-
本地状态文件(含密钥,勿提交):
|
|
26
|
+
> **部署说明**:随 `kld-sdd-init` 安装。`opsx-propose` / `opsx-spec` 等流程技能**硬依赖**本技能,缺失时不得用本地 archive 兜底。
|
|
27
|
+
> 控制台 Agent 架构 / Skills 激活机制 / 记忆策略等实现细节 → [reference.md](reference.md)「实现备注」。
|
|
28
|
+
|
|
29
|
+
## ⚠️ 数据边界(必读)
|
|
28
30
|
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
+
```
|
|
32
|
+
SDD 流程:Propose → Spec → Design → Task → Check → Apply → Archive → kb-ingest
|
|
33
|
+
↑
|
|
34
|
+
此刻之前,当前变更不在 KB 中
|
|
31
35
|
```
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
- Propose → Check 阶段查 KB = 查**历史上下文**(上一次入库的状态)
|
|
38
|
+
- 当前变更的 added/modified 实体在 KB 中**不存在**或**只有旧版本**
|
|
39
|
+
- 当前变更内部一致性 → **本地文件 + semantic-check**,不查 KB
|
|
40
|
+
- 只有 Archive → kb-ingest 后,当前变更才进入 KB(Phase 3 验证)
|
|
34
41
|
|
|
35
42
|
## Session 启动(每次用本 Skill 必做)
|
|
36
43
|
|
|
44
|
+
> **📡 共享状态**:本技能与 `opsx-kb-ingest` **共用同一份 KB 配置**(`../.shared/kb-state.json`)。任一 skill 配置后,另一个自动可用,无需重复输入 API Key。
|
|
45
|
+
|
|
37
46
|
```
|
|
38
47
|
Task Progress:
|
|
39
|
-
- [ ] 1. 读
|
|
40
|
-
- [ ] 2. 无 apiKey →
|
|
48
|
+
- [ ] 1. 读 ../.shared/kb-state.json(没有则当空)
|
|
49
|
+
- [ ] 2. 无 apiKey → 向用户索取并写入共享 state(勿把完整 key 打进聊天摘要)
|
|
41
50
|
- [ ] 3. 无 targets 或用户要重置 → 拉空间/KB 列表,让用户多选后写入
|
|
42
51
|
- [ ] 4. 按意图查询(可对多个 KB 逐个查询)
|
|
43
52
|
- [ ] 5. 按模板输出;无命中不编造
|
|
44
53
|
```
|
|
45
54
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
若 `state.apiKey` 为空或无效(401/403):
|
|
49
|
-
|
|
50
|
-
1. 请用户提供 API Key(控制台「API 密钥」创建,至少含 `context:read`)。
|
|
51
|
-
2. 可选:请用户确认 `api`(默认 `http://localhost:8090/api`)与 `tenantKey`(默认 `default`)。
|
|
52
|
-
3. 写入 `.local/state.json`(创建目录若不存在)。
|
|
53
|
-
4. 用 `GET $API/health` 探活;再用 `GET $API/v1/spaces?tenantKey=…` + Bearer 校验 key。
|
|
54
|
-
|
|
55
|
-
用户说「换密钥 / 重置 API Key」→ 清空 `apiKey`(可保留 targets),回到本步。
|
|
55
|
+
**API Key**:控制台「API 密钥」创建,scope ≥ `context:read`。401/403 → 清掉 apiKey 请用户重贴,勿循环重试。
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
**选择空间/KB**:`GET $API/v1/spaces?tenantKey=…` → 对每个 space `GET …/knowledge-bases` → 展示清单**允许多选** → 写入共享 `../.shared/kb-state.json` 的 `targets`。
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
> state.json 字段 schema、鉴权细节、列表接口 → [reference.md](reference.md)。
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
2. 对每个相关 space:`GET $API/v1/spaces/{spaceId}/knowledge-bases`
|
|
63
|
-
3. 向用户展示「空间名 / spaceId → KB 名 / kbId」清单,**允许多选**。
|
|
64
|
-
4. 写入 `targets: [{ spaceId, spaceName, spaceKey, kbId, kbName }, …]`。
|
|
65
|
-
5. 仅清空 targets、保留 apiKey 即完成「重置空间和知识库」。
|
|
61
|
+
## 查询
|
|
66
62
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
### 4. 查询
|
|
70
|
-
|
|
71
|
-
路径前缀:`/api/v1/spaces/{spaceId}/knowledge-bases/{kbId}`
|
|
63
|
+
路径前缀:`/api/v1/spaces/{spaceId}/knowledge-bases/{kbId}`
|
|
72
64
|
所有请求:`-H "Authorization: Bearer $API_KEY"`
|
|
73
65
|
|
|
74
66
|
| 意图 | 调用 |
|
|
75
67
|
|------|------|
|
|
76
68
|
| 开放问题 / 相似事实 | `POST …/context/search` |
|
|
77
|
-
| Continuity / 按外部需求号定位身份 | `POST …/entities/resolve
|
|
78
|
-
| Spec 复用 / 转换 | `POST …/context/match-requirement
|
|
69
|
+
| Continuity / 按外部需求号定位身份 | `POST …/entities/resolve` |
|
|
70
|
+
| Spec 复用 / 转换 | `POST …/context/match-requirement` |
|
|
79
71
|
| 对象详情 | `GET …/entities/{id}/current-version` |
|
|
80
72
|
| 一跳结构 | `GET …/entities/{id}/ontology-view` |
|
|
81
73
|
| 多跳影响 | `GET …/entities/{id}/impact` |
|
|
82
|
-
|
|
|
83
|
-
|
|
84
|
-
**机器意图(SDD 流程 Agent)**
|
|
74
|
+
| 版本谱系 | `GET …/entities/{id}/lineage` |
|
|
75
|
+
| 原文 | `POST …/context/disclosures` |
|
|
85
76
|
|
|
86
|
-
|
|
87
|
-
- Spec 复用 → `POST …/context/match-requirement`,带 external 与/或 `entityId`
|
|
88
|
-
- **禁止**扫描消费方本地 `archive/` 目录当跨迭代继承源;历史有效规格以 KB current 为准
|
|
77
|
+
> 各 API 的完整 curl 示例、请求/响应字段、matchType 含义、降级处理 → [reference.md](reference.md)。
|
|
89
78
|
|
|
90
|
-
|
|
79
|
+
**机器意图(SDD 流程 Agent)**:
|
|
91
80
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
-d '{"query":"用户登录与会话","entityTypes":[],"limit":15}'
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
**entities/resolve(外部需求号)**
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
curl -sS -X POST "$API/v1/spaces/$SPACE_ID/knowledge-bases/$KB_ID/entities/resolve" \
|
|
102
|
-
-H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
|
|
103
|
-
-d '{
|
|
104
|
-
"externalSystem":"requirement-mgmt",
|
|
105
|
-
"externalObjectType":"requirement",
|
|
106
|
-
"externalId":"REQ-FI-2024-001",
|
|
107
|
-
"entityType":"Capability"
|
|
108
|
-
}'
|
|
109
|
-
```
|
|
81
|
+
- Continuity(只要身份)→ 优先 `entities/resolve`
|
|
82
|
+
- Spec 复用 → `context/match-requirement`,带 external 与/或 `entityId`
|
|
83
|
+
- **KB 可用时禁止**扫描消费方本地 `archive/` 目录当跨迭代继承源;entity-id 必须来自 KB resolve by canonicalKey。KB degraded 时 archive 可作为降级手段(标注 `source: archive(degraded)`),历史有效规格以 KB current 为准
|
|
110
84
|
|
|
111
85
|
命中时关注:`resolution=LINK_EXISTING` 且 `inheritanceAllowed=true`(可继承 n);`removedBindingCount`(已失效绑定 m);`matchType=HISTORICAL_ONLY` 表示仅有失效绑定,不可继承。
|
|
112
86
|
|
|
113
|
-
**按功能号圈能力(propose 前)**
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
curl -sS -X POST "$API/v1/spaces/$SPACE_ID/knowledge-bases/$KB_ID/entities/resolve" \
|
|
117
|
-
-H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
|
|
118
|
-
-d '{
|
|
119
|
-
"externalSystem":"requirement-mgmt",
|
|
120
|
-
"externalObjectType":"feature",
|
|
121
|
-
"externalId":"FEAT-FI-012",
|
|
122
|
-
"entityType":"Capability"
|
|
123
|
-
}'
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
展示该功能下存活 / 失效能力清单,辅助勾选本次 CAP 范围;此查询只作范围参考,不改变 Continuity 判定优先级。
|
|
127
|
-
|
|
128
87
|
### 编号文法速查(权威在 KB 仓设计 §2)
|
|
129
88
|
|
|
130
89
|
```text
|
|
@@ -135,24 +94,9 @@ scenario: ^REQ-…:SCN-[a-z0-9]+(-[a-z0-9]+)*-[0-9]{3}$
|
|
|
135
94
|
|
|
136
95
|
归一化:trim;REQ/FEAT 段大写;SCN slug 小写。编号五律摘要:REQ/FEAT 仅需求系统铸号;SCN 由 kld-sdd/opsx-spec 铸号;编号≠身份;归属权威在需求系统;历史绑定 append-only。
|
|
137
96
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
curl -sS -X POST "$API/v1/spaces/$SPACE_ID/knowledge-bases/$KB_ID/context/match-requirement" \
|
|
142
|
-
-H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
|
|
143
|
-
-d '{
|
|
144
|
-
"query":"用户登录与会话",
|
|
145
|
-
"targetStage":"spec",
|
|
146
|
-
"entityId":"<capability-entity-uuid>",
|
|
147
|
-
"externalSystem":"requirement-mgmt",
|
|
148
|
-
"externalObjectType":"requirement",
|
|
149
|
-
"externalId":"REQ-FI-2024-001"
|
|
150
|
-
}'
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
检索通道:精确/结构 + 全文 + 向量(就绪时)→ RRF →(可选)图谱扩展。看 `degraded` / `degradationReasons`。
|
|
97
|
+
> 按功能号圈能力(FEAT query)、match-requirement / resolve 完整 curl 示例与响应字段解读 → [reference.md](reference.md)。
|
|
154
98
|
|
|
155
|
-
|
|
99
|
+
## 输出模板
|
|
156
100
|
|
|
157
101
|
```markdown
|
|
158
102
|
### 本体查询结论
|
|
@@ -160,6 +104,7 @@ curl -sS -X POST "$API/v1/spaces/$SPACE_ID/knowledge-bases/$KB_ID/context/match-
|
|
|
160
104
|
- 意图:{复用 | 事实检索 | 影响}
|
|
161
105
|
- 可信度:{高 | 中(降级) | 无命中}
|
|
162
106
|
- 降级:{reasons 或 无}
|
|
107
|
+
- 建议性:{是(advisory=true) | 否}
|
|
163
108
|
|
|
164
109
|
### 命中
|
|
165
110
|
1. **{displayName}**({entityType})@ {kbName}
|
|
@@ -167,25 +112,54 @@ curl -sS -X POST "$API/v1/spaces/$SPACE_ID/knowledge-bases/$KB_ID/context/match-
|
|
|
167
112
|
- 若外部键命中:可继承 n / 已失效绑定 m
|
|
168
113
|
```
|
|
169
114
|
|
|
170
|
-
|
|
115
|
+
## 硬规则
|
|
171
116
|
|
|
172
117
|
- 无 `apiKey` 不得猜密钥、不得改走 login。
|
|
173
118
|
- 无 `targets` 不得臆造 spaceId/kbId。
|
|
174
119
|
- 无命中 → 写明「无当前依据」,禁止编造条款。
|
|
175
|
-
- 完整 apiKey
|
|
120
|
+
- 完整 apiKey 只写共享 state 文件(`../.shared/kb-state.json`);聊天里最多显示前缀(如 `sk_sdd_****`)。
|
|
121
|
+
- **共享状态**:state 文件与 `opsx-kb-ingest` 共用。配置一次,两个 skill 都生效。
|
|
176
122
|
|
|
177
123
|
## 用户口令
|
|
178
124
|
|
|
179
125
|
| 用户说 | Agent 做 |
|
|
180
126
|
|--------|----------|
|
|
181
|
-
| (首次使用) | 要 key → 选 KB(多选)→
|
|
182
|
-
| 换密钥 / 重置 API Key | 清 apiKey
|
|
183
|
-
| 重新选择 / 重置空间或知识库 | 清 targets
|
|
184
|
-
| 查 / Spec 复用 / 影响… |
|
|
127
|
+
| (首次使用) | 要 key → 选 KB(多选)→ 写共享 state → 再查。此后 `opsx-kb-ingest` 也自动可用 |
|
|
128
|
+
| 换密钥 / 重置 API Key | 清 apiKey,重走 Session 第 2 步 |
|
|
129
|
+
| 重新选择 / 重置空间或知识库 | 清 targets,重走 Session 第 3 步 |
|
|
130
|
+
| 查 / Spec 复用 / 影响… | 用当前共享 targets 查询 |
|
|
185
131
|
|
|
186
|
-
##
|
|
132
|
+
## 心智模型
|
|
187
133
|
|
|
188
134
|
- 本体真相在 PG(entity + relation);控制台地图/对象用 SQL 遍历。
|
|
189
135
|
- **外部需求号是确定性身份**;自然语言只产生 REFERENCE 候选,不能自动 sameAs。
|
|
190
|
-
- `context/search`
|
|
191
|
-
|
|
136
|
+
- `context/search` 是语义检索主通道(+ 可选 AGE 扩邻);跨迭代 Continuity 走 `entities/resolve`。
|
|
137
|
+
|
|
138
|
+
## 渐进披露(阶段 Playbook)
|
|
139
|
+
|
|
140
|
+
> **何时读哪个文件**——SDD 各阶段 skill 在对应步骤 `Read` 以下文件,获取场景化的 API 调用示例和决策逻辑。
|
|
141
|
+
|
|
142
|
+
| 文件 | 何时 Read | 场景 |
|
|
143
|
+
|------|----------|------|
|
|
144
|
+
| [reference.md](reference.md) | 需要 API 字段细节 / state schema / 鉴权细节 | 完整 API 参考 |
|
|
145
|
+
| [phase-1-prechange.md](phase-1-prechange.md) | opsx-propose §6.5 / opsx-spec §3 | 连续性检查、影响预评、历史 AC、Spec 复用、约束冲突 |
|
|
146
|
+
| [phase-2-during.md](phase-2-during.md) | opsx-design / opsx-task / opsx-check | 历史设计参考、历史任务参考、历史覆盖率基线、入库前预检 |
|
|
147
|
+
| [phase-3-postchange.md](phase-3-postchange.md) | opsx-archive 入库后 | 版本生效验证、AC 保留、关系完整性、谱系验证、冲突检测 |
|
|
148
|
+
| [phase-4-explore.md](phase-4-explore.md) | 跨迭代探索 / 开发者手动 | 谱系追踪、语义检索、原文溯源、图谱导航、多跳影响 |
|
|
149
|
+
| [phase-5-governance.md](phase-5-governance.md) | 治理流程 / 定期巡检 | 覆盖率仪表盘、一致性检查、漂移检测、候选审批、变更统计 |
|
|
150
|
+
|
|
151
|
+
**快速定位**:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
propose 前查影响范围? → phase-1-prechange.md §2
|
|
155
|
+
看某 STMT 有哪些历史 AC? → phase-1-prechange.md §3
|
|
156
|
+
复用历史 Spec? → phase-1-prechange.md §4
|
|
157
|
+
查历史设计作参考? → phase-2-during.md §1
|
|
158
|
+
查历史覆盖率基线? → phase-2-during.md §3
|
|
159
|
+
入库前预检 predecessor? → phase-2-during.md §5
|
|
160
|
+
入库后验证版本生效? → phase-3-postchange.md §1
|
|
161
|
+
查实体完整变更历史? → phase-4-explore.md §1
|
|
162
|
+
用自然语言搜工程事实? → phase-4-explore.md §2
|
|
163
|
+
看全局覆盖率仪表盘? → phase-5-governance.md §1
|
|
164
|
+
当前变更内部一致性验证? → 不查 KB,走本地文件 + semantic-check
|
|
165
|
+
```
|