@c4a/context 0.6.0-beta.8 → 0.6.1-beta.2
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/LICENSE +21 -0
- package/README.md +101 -54
- package/README.zh-CN.md +118 -0
- package/contracts.d.ts +5 -0
- package/docs/README.md +5 -3
- package/docs/getting-started.md +45 -21
- package/docs/guides/agent-dialogue.md +38 -350
- package/docs/guides/agent-guide.md +118 -87
- package/docs/guides/package-outputs.md +69 -16
- package/docs/reference/package-templates.md +103 -20
- package/docs/reference/project-api.md +70 -74
- package/docs/reference/template-variables.md +27 -11
- package/index.d.ts +10 -3
- package/index.js +58 -4
- package/package.json +14 -1
- package/templates/package-templates/kb/AGENTS.md +10 -10
- package/templates/package-templates/kb/skills/knowledge-query/SKILL.md +16 -15
- package/templates/package-templates/kb/wikis/index.md +7 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 context4ai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,32 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Context SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[简体中文](./README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
`@c4a/context` is the declarative SDK for a Context workspace. It provides the
|
|
6
|
+
typed API used by `src/index.ts` to describe sources, processing phases, review
|
|
7
|
+
gates, and package outputs. It does not perform filesystem writes or run the
|
|
8
|
+
workflow; those operations belong to the
|
|
9
|
+
[Context CLI](../context-cli/README.md).
|
|
8
10
|
|
|
9
|
-
##
|
|
11
|
+
## Project Model
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
For local SDK development:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
./start.sh link
|
|
17
|
-
context init context --dev
|
|
18
|
-
cd context
|
|
19
|
-
bun install
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Tiny Example
|
|
13
|
+
A Context project follows a sources-to-phases-to-packages model:
|
|
23
14
|
|
|
24
15
|
```ts
|
|
25
16
|
import {
|
|
26
17
|
defineProject,
|
|
27
18
|
extractTs,
|
|
28
|
-
reviewValidity,
|
|
29
19
|
kbPackage,
|
|
20
|
+
reviewValidity,
|
|
30
21
|
source,
|
|
31
22
|
} from "@c4a/context";
|
|
32
23
|
|
|
@@ -51,50 +42,106 @@ export default defineProject({
|
|
|
51
42
|
});
|
|
52
43
|
```
|
|
53
44
|
|
|
54
|
-
|
|
45
|
+
`src/index.ts` is similar to a Webpack configuration for knowledge. It defines
|
|
46
|
+
what enters the project, which transformations and gates run, and what is built
|
|
47
|
+
at the end. The installed Agent plugin provides thin entries; the current
|
|
48
|
+
workflow route selects the procedures and manuals needed to maintain this
|
|
49
|
+
configuration from a user's requirements.
|
|
50
|
+
|
|
51
|
+
## Public Surface
|
|
52
|
+
|
|
53
|
+
| API | Purpose |
|
|
54
|
+
|---|---|
|
|
55
|
+
| `defineProject()` | Declares the complete project graph. |
|
|
56
|
+
| `source()` and `allSources()` | References registered repo, file, or Lark source boundaries. |
|
|
57
|
+
| `extractTs()` | Extracts TypeScript/TSX symbols and relationships into `codegraph` candidates. |
|
|
58
|
+
| `alignProse()` and `compileProse()` | Structures document evidence and compiles source-bound knowledge candidates. |
|
|
59
|
+
| `reviewValidity()` | Declares the review gate for one collection or the project. |
|
|
60
|
+
| `customPhase()` | Adds project-specific orchestration when built-in phase factories are not enough. |
|
|
61
|
+
| `kbPackage()` | Builds an Agent knowledge-base package from approved knowledge and templates. |
|
|
62
|
+
| `llmsPackage()` | Builds a single text bundle for model context or RAG import. |
|
|
63
|
+
|
|
64
|
+
Use the built-in phase factories first. `customPhase()` is an escape hatch for
|
|
65
|
+
project-specific orchestration, not a replacement for source, extraction,
|
|
66
|
+
review, and package lifecycle rules.
|
|
67
|
+
|
|
68
|
+
## Knowledge Collections
|
|
69
|
+
|
|
70
|
+
Approved Markdown is organized under `knowledge/<collection>/`:
|
|
71
|
+
|
|
72
|
+
| Collection | What it contains | Typical sources |
|
|
73
|
+
|---|---|---|
|
|
74
|
+
| `codegraph` | Code symbols, modules, and relationships | Code repositories |
|
|
75
|
+
| `business` | Business concepts, roles, and relationships | Business and Lark documents |
|
|
76
|
+
| `product` | Product capabilities and behavior | Product and requirement documents |
|
|
77
|
+
| `architecture` | System structure and design explanations | Architecture and design documents |
|
|
78
|
+
| `sop` | Procedures, runbooks, and operational steps | Handbooks and operation documents |
|
|
79
|
+
| `faq` | Common questions and troubleshooting | FAQs, support documents, experience notes |
|
|
80
|
+
| `decision` | Decisions, alternatives, and trade-offs | Design reviews and decision records |
|
|
81
|
+
| `incident` | Incident timelines, response, and follow-up | Incident reports and retrospectives |
|
|
82
|
+
| `standards` | Normative rules and constraints | Engineering standards and business rules |
|
|
83
|
+
| `test` | Validation rules, scenarios, and acceptance criteria | Test plans and acceptance documents |
|
|
84
|
+
| `feats` | Capability records for a specific use case | Custom project workflows and approved knowledge |
|
|
85
|
+
|
|
86
|
+
Collections are semantic classifications, not final package directories.
|
|
87
|
+
Package build maps selected collections into OKF roots such as `wikis/`,
|
|
88
|
+
`guides/`, `rules/`, and `feats/`. One source may contribute to several
|
|
89
|
+
collections; classification should be based on evidence and user confirmation,
|
|
90
|
+
not filenames.
|
|
91
|
+
|
|
92
|
+
## Package Templates
|
|
93
|
+
|
|
94
|
+
Package declarations point at editable templates under
|
|
95
|
+
`src/package-templates/`. Installed examples are available at:
|
|
55
96
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
- [Getting Started](./docs/getting-started.md)
|
|
60
|
-
- [Agent Guide](./docs/guides/agent-guide.md)
|
|
61
|
-
- [Package Outputs](./docs/guides/package-outputs.md)
|
|
62
|
-
- [Project API](./docs/reference/project-api.md)
|
|
63
|
-
- [Package Templates](./docs/reference/package-templates.md)
|
|
97
|
+
```text
|
|
98
|
+
node_modules/@c4a/context/templates/package-templates/
|
|
99
|
+
```
|
|
64
100
|
|
|
65
|
-
|
|
101
|
+
The default KB template includes:
|
|
66
102
|
|
|
67
103
|
```text
|
|
68
|
-
|
|
104
|
+
kb/
|
|
105
|
+
|-- AGENTS.md
|
|
106
|
+
|-- skills/
|
|
107
|
+
| `-- knowledge-query/SKILL.md
|
|
108
|
+
`-- wikis/index.md
|
|
69
109
|
```
|
|
70
110
|
|
|
71
|
-
|
|
72
|
-
|
|
111
|
+
The `knowledge-query` Skill teaches consuming Agents how to navigate indexes,
|
|
112
|
+
inspect approved knowledge, and cite evidence. A project can add more Skills or
|
|
113
|
+
template files under `wikis/`, `guides/`, `rules/`, and other package paths.
|
|
114
|
+
|
|
115
|
+
Templates use Handlebars variables in file contents and paths. Common variables
|
|
116
|
+
include `{{packageName}}`, `{{displayName}}`, `{{knowledgeCount}}`,
|
|
117
|
+
`{{knowledgeGroups}}`, `{{knowledgeItems}}`, `{{knowledgeTree}}`, and
|
|
118
|
+
`{{buildInventory}}`.
|
|
73
119
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
`
|
|
78
|
-
|
|
79
|
-
`context`, and do not add frontmatter `source_refs`. Section provenance lives in
|
|
80
|
-
`context:section` source-ref comments.
|
|
120
|
+
Every KB package defaults `distribution.knowledgeNamespace` to its package
|
|
121
|
+
`name`, producing a short single-level knowledge directory. Set the field
|
|
122
|
+
explicitly when a multi-segment namespace such as
|
|
123
|
+
`personal-user.123/package` is required. Context isolates OKF roots under the
|
|
124
|
+
complete value; Skill names remain author-maintained and independent.
|
|
81
125
|
|
|
82
|
-
|
|
126
|
+
For advanced routing and retrieval, a template may carry a local script such as
|
|
127
|
+
`query.ts`, with a Skill describing when and how an Agent should call it. The
|
|
128
|
+
Skill can also route the Agent to MCP servers, CLI commands, or other tools to
|
|
129
|
+
form a package-specific Agentic Search workflow.
|
|
83
130
|
|
|
84
|
-
|
|
131
|
+
## State Boundary
|
|
85
132
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
133
|
+
The SDK stays declarative. It may describe reads, writes, phases, review, and
|
|
134
|
+
package selection, but the CLI owns source materialization, capture, extraction,
|
|
135
|
+
review application, approved Markdown materialization, verification, and build.
|
|
136
|
+
Do not replace CLI lifecycle operations with direct edits to `sources/`,
|
|
137
|
+
`unapproved/`, `knowledge/`, or `dist/`.
|
|
91
138
|
|
|
92
|
-
|
|
139
|
+
## Documentation
|
|
93
140
|
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
- package
|
|
99
|
-
-
|
|
100
|
-
-
|
|
141
|
+
- [Documentation index](./docs/README.md)
|
|
142
|
+
- [Getting Started](./docs/getting-started.md)
|
|
143
|
+
- [Agent Guide](./docs/guides/agent-guide.md)
|
|
144
|
+
- [Project API](./docs/reference/project-api.md)
|
|
145
|
+
- [Package Outputs](./docs/guides/package-outputs.md)
|
|
146
|
+
- [Package Templates](./docs/reference/package-templates.md)
|
|
147
|
+
- [Template Variables](./docs/reference/template-variables.md)
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Context SDK
|
|
2
|
+
|
|
3
|
+
[English](./README.md)
|
|
4
|
+
|
|
5
|
+
`@c4a/context` 是 Context workspace 使用的声明式 SDK。它为 `src/index.ts` 提供类型化 API,用来描述知识来源、处理阶段、审核门禁和知识包输出。SDK 本身不写入工作区,也不执行流程;这些操作由 [Context CLI](../context-cli/README.zh-CN.md) 负责。
|
|
6
|
+
|
|
7
|
+
## 项目模型
|
|
8
|
+
|
|
9
|
+
Context 项目使用“来源 → 阶段 → 知识包”的声明模型:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import {
|
|
13
|
+
defineProject,
|
|
14
|
+
extractTs,
|
|
15
|
+
kbPackage,
|
|
16
|
+
reviewValidity,
|
|
17
|
+
source,
|
|
18
|
+
} from "@c4a/context";
|
|
19
|
+
|
|
20
|
+
const sampleLib = source("20260712", "sample-lib");
|
|
21
|
+
|
|
22
|
+
export default defineProject({
|
|
23
|
+
sources: [sampleLib],
|
|
24
|
+
phases: [
|
|
25
|
+
extractTs({ source: sampleLib, collection: "codegraph" }),
|
|
26
|
+
reviewValidity({ collection: "codegraph" }),
|
|
27
|
+
],
|
|
28
|
+
packages: [
|
|
29
|
+
kbPackage({
|
|
30
|
+
name: "sample-lib-kb",
|
|
31
|
+
template: {
|
|
32
|
+
path: "src/package-templates/kb",
|
|
33
|
+
vars: { displayName: "Sample Library KB" },
|
|
34
|
+
},
|
|
35
|
+
select: { collections: ["codegraph"], okfRoots: ["wikis"] },
|
|
36
|
+
}),
|
|
37
|
+
],
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`src/index.ts` 有点像知识项目的 Webpack 配置:它定义哪些内容进入项目、经过哪些转换和门禁,以及最终构建什么产物。安装好的 Agent 插件只提供薄入口,当前工作流路由会按需选择维护这份配置所需的流程资源和 SDK 文档。
|
|
42
|
+
|
|
43
|
+
## 主要 API
|
|
44
|
+
|
|
45
|
+
| API | 用途 |
|
|
46
|
+
|---|---|
|
|
47
|
+
| `defineProject()` | 声明完整的项目处理图。 |
|
|
48
|
+
| `source()` 和 `allSources()` | 引用已经登记的代码仓库、本地文件或飞书来源边界。 |
|
|
49
|
+
| `extractTs()` | 从 TypeScript/TSX 中提取符号和关系,生成 `codegraph` 候选。 |
|
|
50
|
+
| `alignProse()` 和 `compileProse()` | 整理文档证据,并生成与来源绑定的知识候选。 |
|
|
51
|
+
| `reviewValidity()` | 声明单个知识类型或整个项目的审核门禁。 |
|
|
52
|
+
| `customPhase()` | 在内置阶段无法覆盖时增加项目专用编排。 |
|
|
53
|
+
| `kbPackage()` | 使用审核通过的知识和模板构建 Agent 知识库。 |
|
|
54
|
+
| `llmsPackage()` | 构建供模型上下文或 RAG 导入使用的单文件文本包。 |
|
|
55
|
+
|
|
56
|
+
优先使用内置阶段。`customPhase()` 是项目专用编排的扩展口,不应该绕开来源、提取、审核和打包的生命周期规则。
|
|
57
|
+
|
|
58
|
+
## 知识分类
|
|
59
|
+
|
|
60
|
+
审核通过的 Markdown 会存放在 `knowledge/<collection>/`:
|
|
61
|
+
|
|
62
|
+
| 知识类型 | 主要内容 | 常见来源 |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| `codegraph` | 代码符号、模块和调用关系 | 代码仓库 |
|
|
65
|
+
| `business` | 业务概念、角色和业务关系 | 业务文档、飞书文档 |
|
|
66
|
+
| `product` | 产品能力、功能行为和产品关系 | 产品文档、需求文档 |
|
|
67
|
+
| `architecture` | 系统结构、模块职责和设计说明 | 架构文档、设计文档 |
|
|
68
|
+
| `sop` | 操作流程、运行手册和处理步骤 | 操作手册、值班文档 |
|
|
69
|
+
| `faq` | 常见问题、解释和排障方法 | FAQ、支持文档、经验记录 |
|
|
70
|
+
| `decision` | 方案选择、取舍和决策背景 | 设计评审、决策记录 |
|
|
71
|
+
| `incident` | 故障过程、处置方式和后续行动 | 故障复盘、事故报告 |
|
|
72
|
+
| `standards` | 必须遵守的规范和约束 | 研发规范、业务规则 |
|
|
73
|
+
| `test` | 验证规则、测试场景和验收标准 | 测试文档、验收说明 |
|
|
74
|
+
| `feats` | 面向具体场景整理的能力记录 | 项目自定义处理和已确认知识 |
|
|
75
|
+
|
|
76
|
+
知识类型是语义分类,不是最终知识包目录。构建时会把选中的类型映射到 `wikis/`、`guides/`、`rules/`、`feats/` 等 OKF 目录。同一份来源可能贡献多种知识,分类应该依据证据和用户确认,而不是文件名。
|
|
77
|
+
|
|
78
|
+
## 知识包模板
|
|
79
|
+
|
|
80
|
+
知识包声明会引用 `src/package-templates/` 下的可编辑模板。安装后的示例位于:
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
node_modules/@c4a/context/templates/package-templates/
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
默认 KB 模板包含:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
kb/
|
|
90
|
+
|-- AGENTS.md
|
|
91
|
+
|-- skills/
|
|
92
|
+
| `-- knowledge-query/SKILL.md
|
|
93
|
+
`-- wikis/index.md
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`knowledge-query` Skill 会告诉消费知识包的 Agent 如何浏览索引、读取审核通过的知识并引用证据。项目还可以增加更多 Skills,或者在 `wikis/`、`guides/`、`rules/` 等目录中加入模板文件。
|
|
97
|
+
|
|
98
|
+
模板使用 Handlebars 变量,可以作用于文件内容和路径。常用变量包括 `{{packageName}}`、`{{displayName}}`、`{{knowledgeCount}}`、`{{knowledgeGroups}}`、`{{knowledgeItems}}`、`{{knowledgeTree}}` 和 `{{buildInventory}}`。
|
|
99
|
+
|
|
100
|
+
每个 KB 包默认使用包 `name` 作为 `distribution.knowledgeNamespace`,生成简短的
|
|
101
|
+
单级知识目录。需要 `personal-user.123/package` 这类多段目录时可以显式配置该字段。
|
|
102
|
+
Context 会按照完整 namespace 隔离各个 OKF 根目录;Skill 名称仍由作者独立维护。
|
|
103
|
+
|
|
104
|
+
如果需要更强的路由和检索能力,模板可以携带 `query.ts` 一类本地脚本,再由 Skill 约定 Agent 何时、如何调用。Skill 也可以把 Agent 路由到 MCP、CLI 或其他工具,组成适合当前知识包的 Agentic Search 流程。
|
|
105
|
+
|
|
106
|
+
## 状态边界
|
|
107
|
+
|
|
108
|
+
SDK 只负责声明。它可以描述读取、写入、阶段、审核和知识包选择,但来源物化、内容读取、代码提取、审核应用、正式知识写入、质量验证和构建都由 CLI 负责。不要通过直接编辑 `sources/`、`unapproved/`、`knowledge/` 或 `dist/` 来替代 CLI 生命周期操作。
|
|
109
|
+
|
|
110
|
+
## 参考文档
|
|
111
|
+
|
|
112
|
+
- [文档索引](./docs/README.md)
|
|
113
|
+
- [快速开始](./docs/getting-started.md)
|
|
114
|
+
- [Agent 指南](./docs/guides/agent-guide.md)
|
|
115
|
+
- [项目 API](./docs/reference/project-api.md)
|
|
116
|
+
- [知识包输出](./docs/guides/package-outputs.md)
|
|
117
|
+
- [知识包模板](./docs/reference/package-templates.md)
|
|
118
|
+
- [模板变量](./docs/reference/template-variables.md)
|
package/contracts.d.ts
CHANGED
|
@@ -19,6 +19,11 @@ export type PackageSelectDefinition = {
|
|
|
19
19
|
include?: readonly string[];
|
|
20
20
|
exclude?: readonly string[];
|
|
21
21
|
};
|
|
22
|
+
export type PackageNavigationDefinition = {
|
|
23
|
+
foldDirectoryIndexes: boolean;
|
|
24
|
+
maxInlineEntries: number;
|
|
25
|
+
};
|
|
26
|
+
export declare const DEFAULT_PACKAGE_NAVIGATION: Readonly<PackageNavigationDefinition>;
|
|
22
27
|
export declare const DOC_MAINLINE_COLLECTIONS: readonly DocumentMainlineCollection[];
|
|
23
28
|
export declare const MAINLINE_COLLECTIONS: readonly MainlineCollection[];
|
|
24
29
|
export declare const TOP_LEVEL_NAMESPACES: readonly TopLevelNamespace[];
|
package/docs/README.md
CHANGED
|
@@ -6,14 +6,16 @@ These docs ship inside the installed SDK package at:
|
|
|
6
6
|
node_modules/@c4a/context/docs/
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
For lifecycle work, Agents should first consume the resources selected by
|
|
10
|
+
`context status --format json` `workflow.current`. Read these SDK manuals when
|
|
11
|
+
the selected route requires project configuration, package templates, or
|
|
12
|
+
general reference; do not preload the whole manual set.
|
|
11
13
|
|
|
12
14
|
## Read First
|
|
13
15
|
|
|
14
16
|
- [Getting Started](./getting-started.md) — end-to-end component-library flow.
|
|
15
17
|
- [Agent Guide](./guides/agent-guide.md) — what an agent should do, and what it should not inspect manually.
|
|
16
|
-
- [Agent Dialogue](./guides/agent-dialogue.md) —
|
|
18
|
+
- [Agent Dialogue](./guides/agent-dialogue.md) — stable dialogue principles and how route-selected gate resources are discovered.
|
|
17
19
|
- [Package Outputs](./guides/package-outputs.md) — how to choose between an agent knowledge-base package, LLM text, or no package output.
|
|
18
20
|
- [Project API](./reference/project-api.md) — `defineProject`, sources, phases, review, and packages.
|
|
19
21
|
- [Package Templates](./reference/package-templates.md) — `kbPackage`, `llmsPackage`, template variables, and examples.
|
package/docs/getting-started.md
CHANGED
|
@@ -10,14 +10,18 @@ source boundary, then declare the matching phases in `src/index.ts`.
|
|
|
10
10
|
context init context --dev
|
|
11
11
|
cd context
|
|
12
12
|
bun install
|
|
13
|
-
context status
|
|
13
|
+
context status --format json
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Use `--dev` when testing a local link or prepared pack before the matching SDK
|
|
17
17
|
version is published. It writes a `file:` dependency to the SDK resolved beside
|
|
18
18
|
the active CLI. Published users can omit it and install the versioned SDK from
|
|
19
19
|
the registry.
|
|
20
|
-
When operating through an Agent plugin, use the installed Context continuation
|
|
20
|
+
When operating through an Agent plugin, use the installed Context continuation
|
|
21
|
+
entry from the project root after initialization. It consumes
|
|
22
|
+
`workflow.current`, loads only the selected resources, and calls lower-level
|
|
23
|
+
CLI primitives as needed. The exact slash command or skill name is
|
|
24
|
+
host-specific.
|
|
21
25
|
|
|
22
26
|
## 2. Choose And Register A Source Boundary
|
|
23
27
|
|
|
@@ -30,7 +34,8 @@ suffixes from prose or content. ViewRef/NodeRef are identity fields, not path
|
|
|
30
34
|
strings:
|
|
31
35
|
|
|
32
36
|
```text
|
|
33
|
-
knowledge/<collection>/<
|
|
37
|
+
knowledge/<collection>/<slug>.md
|
|
38
|
+
knowledge/<collection>/<containment>/<slug>.md # intentional hierarchy only
|
|
34
39
|
repo:<date>/<module>#symbol:...
|
|
35
40
|
file:<source-name>/<document>#span:...
|
|
36
41
|
lark:<source-name>/<document>#span:...
|
|
@@ -98,21 +103,27 @@ module first. An explicit request to capture/read those exact paths or URLs is
|
|
|
98
103
|
the read confirmation for that requested batch; do not ask again after
|
|
99
104
|
registration. Merely mentioning a possible source is not permission.
|
|
100
105
|
`context status --format json` returns all remaining capture phases in
|
|
101
|
-
`
|
|
102
|
-
|
|
103
|
-
pausing for another date name or
|
|
104
|
-
|
|
105
|
-
`
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
`workflow.current.commands`. Every item requiring the confirmed read scope is
|
|
107
|
+
marked `after-human-confirmation`, so one explicit confirmation can authorize
|
|
108
|
+
the complete requested batch without pausing for another date name or
|
|
109
|
+
collection choice between modules. If any module lacks a declaration,
|
|
110
|
+
`workflow.current.configuration` identifies the precise project change instead
|
|
111
|
+
of returning an unexecutable command. Read every
|
|
112
|
+
`workflow.current.resources.required` item before acting; long procedures and
|
|
113
|
+
semantic rules remain available as files and are loaded only for the route that
|
|
114
|
+
needs them.
|
|
115
|
+
|
|
116
|
+
After capture, status selects `route.document.classification-required` for
|
|
117
|
+
document modules without an align declaration. Run the Gate's returned
|
|
118
|
+
collection-neutral inspection commands first; only then propose a mainline
|
|
119
|
+
collection and ask for confirmation. Batch read permission does not choose a
|
|
120
|
+
collection.
|
|
111
121
|
|
|
112
122
|
When the workspace also contains repo sources, Context prioritizes untouched
|
|
113
|
-
code after all document captures finish:
|
|
114
|
-
until the code extraction round is current,
|
|
115
|
-
investigation. An existing document
|
|
123
|
+
code after all document captures finish: the current reason is
|
|
124
|
+
`route.extract.pending-target` until the code extraction round is current,
|
|
125
|
+
then routing returns to document investigation. An existing document
|
|
126
|
+
structure/compile gate is never interrupted.
|
|
116
127
|
|
|
117
128
|
For a single component package, use the package directory as the repo source
|
|
118
129
|
boundary:
|
|
@@ -173,8 +184,8 @@ the wrong ref, ask the user before running repo operations outside the CLI.
|
|
|
173
184
|
### Document Source Flow
|
|
174
185
|
|
|
175
186
|
For source documents, keep the project declaration small and let the CLI guide
|
|
176
|
-
the evidence views, structure confirmation, compile
|
|
177
|
-
close steps:
|
|
187
|
+
the evidence views, structure confirmation, deterministic compile projection,
|
|
188
|
+
review, and close steps:
|
|
178
189
|
|
|
179
190
|
```ts
|
|
180
191
|
import {
|
|
@@ -200,7 +211,8 @@ export default defineProject({
|
|
|
200
211
|
});
|
|
201
212
|
```
|
|
202
213
|
|
|
203
|
-
Then start from `context status` or the installed Context
|
|
214
|
+
Then start from `context status` or the installed host-specific Context
|
|
215
|
+
continuation entry. The
|
|
204
216
|
normal sequence is:
|
|
205
217
|
|
|
206
218
|
1. capture the source into committed snapshots;
|
|
@@ -242,8 +254,11 @@ context run extract:20260712/component-lib:codegraph
|
|
|
242
254
|
When operating through an Agent, use `--dry-run --format json` as the CLI
|
|
243
255
|
implementation for a no-write preview. For extract phases it returns a
|
|
244
256
|
`preview` block with resolved sources, modules, file counts, symbol counts,
|
|
245
|
-
|
|
246
|
-
|
|
257
|
+
resolved entry files, exported/internal counts, symbol-kind counts, candidate
|
|
258
|
+
estimates, `knowledgeTree`, `knowledgePathExamples`, and module-level hints.
|
|
259
|
+
Treat that preview as a structural scope check before producing draft
|
|
260
|
+
candidates; the CLI does not decide which symbols are important to a business
|
|
261
|
+
or audience.
|
|
247
262
|
|
|
248
263
|
The codegraph path keeps the stable module identity. The date stays in the repo
|
|
249
264
|
source ref and phase id, not in the knowledge path:
|
|
@@ -311,6 +326,15 @@ Choose an agent knowledge-base package when agents should consume the reviewed
|
|
|
311
326
|
knowledge as a reusable package. After the user chooses this output shape,
|
|
312
327
|
declare it with `kbPackage()`.
|
|
313
328
|
|
|
329
|
+
The package name becomes its stable single-level knowledge namespace by
|
|
330
|
+
default. Ask for a custom namespace only when the user needs another value. An
|
|
331
|
+
explicit namespace may contain several concise lowercase path segments, such
|
|
332
|
+
as `group/package` or `personal-user.123/package`; each segment may use letters
|
|
333
|
+
and numbers joined by hyphens or dots. Do not infer custom values from
|
|
334
|
+
downstream platform identifiers. Ask separately whether the author wants a
|
|
335
|
+
short Skill prefix, then maintain the complete final Skill directory name in
|
|
336
|
+
the template.
|
|
337
|
+
|
|
314
338
|
The default `knowledge-query` skill teaches agents how to query copied OKF root
|
|
315
339
|
directories structure-first, starting with `wikis/`, cite
|
|
316
340
|
page/section evidence, inspect structure/build metadata when present, and report
|