@c4a/context 0.7.5 → 0.7.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/README.md +12 -4
- package/README.zh-CN.md +11 -4
- package/docs/README.md +13 -1
- package/docs/README.zh-CN.md +13 -1
- package/docs/getting-started.md +95 -69
- package/docs/guides/agent-dialogue.md +20 -9
- package/docs/guides/agent-guide.md +48 -10
- package/docs/guides/code-indexer-skill-authoring.md +42 -11
- package/docs/guides/indexer-manifest-example.md +103 -0
- package/docs/guides/indexer-provider-and-customization.md +334 -15
- package/docs/guides/indexer-skill-creation.md +99 -0
- package/docs/guides/knowledge-updates.md +422 -0
- package/docs/guides/lark-resources.md +5 -1
- package/docs/guides/markdown-indexer-skill-authoring.md +16 -7
- package/docs/guides/note.md +37 -0
- package/docs/guides/package-outputs.md +231 -60
- package/docs/guides/sessions.md +50 -0
- package/docs/guides/workspace-commit.md +45 -0
- package/docs/guides/workspace-prepare.md +72 -0
- package/docs/guides/workspace-restore.md +59 -0
- package/docs/reference/code-extractors.md +23 -11
- package/docs/reference/indexer-provider-protocol.md +135 -22
- package/docs/reference/package-templates.md +10 -9
- package/docs/reference/project-api.md +100 -13
- package/docs/reference/template-variables.md +7 -7
- package/index.d.ts +15 -0
- package/index.js +1708 -626
- package/indexerAgentStepProtocol.d.ts +44 -0
- package/indexerApprovedKnowledge.d.ts +371 -0
- package/indexerArticlePlan.d.ts +83 -0
- package/indexerArtifact.d.ts +10 -7
- package/indexerArtifactDependencies.d.ts +5 -5
- package/indexerArtifactPolicy.d.ts +12 -12
- package/indexerArtifactResult.d.ts +76 -69
- package/indexerAuthoringFixture.d.ts +8 -8
- package/indexerAuthorizedWorksetView.d.ts +14 -14
- package/indexerBaseQuestionAmendment.d.ts +40 -0
- package/indexerCandidateCompile.d.ts +46 -36
- package/indexerCatalogFallback.d.ts +566 -48
- package/indexerContentLayers.d.ts +6 -4
- package/indexerContractDeclaration.d.ts +3 -0
- package/indexerControlledProgram.d.ts +1039 -238
- package/indexerCustomizationDraft.d.ts +188 -0
- package/indexerDependencyView.d.ts +17 -17
- package/indexerEffectiveArtifact.d.ts +26 -15
- package/indexerExampleFactDependencies.d.ts +17 -0
- package/indexerExampleIdentityAudit.d.ts +2 -2
- package/indexerInventoryDisposition.d.ts +44 -44
- package/indexerKnowledgeDependency.d.ts +46 -0
- package/indexerLayerComposition.d.ts +92 -54
- package/indexerLayoutChange.d.ts +8 -8
- package/indexerLayoutProposalSet.d.ts +15 -10
- package/indexerLayoutResolver.d.ts +15 -6
- package/indexerLayoutTransition.d.ts +8 -8
- package/indexerLifecycle.d.ts +1 -1
- package/indexerMainRunLedger.d.ts +3 -0
- package/indexerMainRunProtocol.d.ts +872 -196
- package/indexerMainWorkset.d.ts +50 -0
- package/indexerNavigationArtifactPlan.d.ts +2 -2
- package/indexerOverlayQuestionAmendment.d.ts +56 -16
- package/indexerOverlayQuestionApplyProposal.d.ts +98 -26
- package/indexerPartitionPlan.d.ts +585 -40
- package/indexerPhysicalArtifactAudit.d.ts +2 -2
- package/indexerPhysicalArtifactManifest.d.ts +24 -24
- package/indexerPostAuthorRunLedger.d.ts +60 -34
- package/indexerPrimaryProjection.d.ts +2 -2
- package/indexerProfileContract.d.ts +28 -28
- package/indexerProgramRunProtocol.d.ts +868 -194
- package/indexerProjectProposal.d.ts +36 -8
- package/indexerProjectedArtifactFanOutAudit.d.ts +2 -2
- package/indexerProtocolHash.d.ts +2 -0
- package/indexerProvider.d.ts +102 -58
- package/indexerProviderComposition.d.ts +4 -4
- package/indexerProviderRouting.d.ts +52 -0
- package/indexerProviderSelectionProposal.d.ts +48 -0
- package/indexerPublicContractFacts.d.ts +7 -0
- package/indexerPublicContractTable.d.ts +11 -0
- package/indexerReaderTargetInventory.d.ts +6 -6
- package/indexerReferenceOnlyAudit.d.ts +2 -2
- package/indexerRegistry.d.ts +658 -0
- package/indexerRequirementConfirmation.d.ts +48 -16
- package/indexerRequirementLifecycle.d.ts +154 -42
- package/indexerResultReconciliation.d.ts +12 -11
- package/indexerSemanticInput.d.ts +27168 -3813
- package/{indexerGeneratedAuthoringAudit.d.ts → indexerStructuredClaims.d.ts} +0 -84
- package/indexerStructuredDeclaration.d.ts +8 -8
- package/indexerTemplateRendering.d.ts +7 -7
- package/indexerToolSnapshot.d.ts +16 -16
- package/knowledgeMap.d.ts +188 -0
- package/managedSources.d.ts +15 -0
- package/package.json +1 -1
- package/packageSite.d.ts +25 -0
- package/phases.d.ts +0 -3
- package/processedScopes.d.ts +75 -0
- package/sessionMetadata.d.ts +49 -0
- package/sources.d.ts +9 -3
- package/templates/package-templates/kb/skills/knowledge-query/SKILL.md +15 -10
- package/templates/package-templates.zh-CN/kb/skills/knowledge-query/SKILL.md +8 -8
package/README.md
CHANGED
|
@@ -13,7 +13,8 @@ knowledge are not produced by project phases in `src/index.ts`.
|
|
|
13
13
|
## Project boundary
|
|
14
14
|
|
|
15
15
|
```text
|
|
16
|
-
sources
|
|
16
|
+
sources/{repo,file,lark}/index.yaml registered source boundaries
|
|
17
|
+
sources/{note,sessions}/YYYYMMDD/*.md saved notes and conversation summaries
|
|
17
18
|
src/index.ts capture and package declarations
|
|
18
19
|
src/indexers.yaml knowledge-authoring authority
|
|
19
20
|
knowledge/ approved, human-readable knowledge
|
|
@@ -38,7 +39,7 @@ import {
|
|
|
38
39
|
source,
|
|
39
40
|
} from "@c4a/context";
|
|
40
41
|
|
|
41
|
-
const docs = source("product-docs", { type: "file" });
|
|
42
|
+
const docs = source("20260901/product-docs", { type: "file" });
|
|
42
43
|
|
|
43
44
|
export default defineProject({
|
|
44
45
|
sources: [docs],
|
|
@@ -64,7 +65,7 @@ never enter knowledge identity or package output.
|
|
|
64
65
|
| API | Purpose |
|
|
65
66
|
|---|---|
|
|
66
67
|
| `defineProject()` | Declares the project boundary. |
|
|
67
|
-
| `source()` / `allSources()` | References registered repo
|
|
68
|
+
| `source()` / `allSources()` | References registered repo/file/Lark sources or explicitly selects saved Note/Sessions. |
|
|
68
69
|
| `captureFile()` / `captureLark()` | Creates deterministic document snapshots. |
|
|
69
70
|
| `mdxJsonDocs()` | Configures the MDX/JSON documentation capture processor. |
|
|
70
71
|
| `customPhase()` | Runs non-knowledge project orchestration. |
|
|
@@ -102,7 +103,10 @@ available from `node_modules/@c4a/context/templates/package-templates/`.
|
|
|
102
103
|
Do not directly edit lifecycle files under `.tmp/context-runtime/`. The CLI
|
|
103
104
|
owns Candidate state, Review application, recovery, close, verification, and
|
|
104
105
|
build. Source registries, `src/index.ts`, `src/indexers.yaml`, approved
|
|
105
|
-
`knowledge/`, and package templates are
|
|
106
|
+
`knowledge/`, saved Note/Sessions and package templates are durable inputs.
|
|
107
|
+
`structure.yaml` retains scope-level update baselines. Optional session commit/MR
|
|
108
|
+
associations stay in the source file, not copied into knowledge headers. Saving
|
|
109
|
+
a source alone does not start indexing.
|
|
106
110
|
|
|
107
111
|
## Documentation
|
|
108
112
|
|
|
@@ -113,3 +117,7 @@ build. Source registries, `src/index.ts`, `src/indexers.yaml`, approved
|
|
|
113
117
|
- [Indexer Provider Protocol](./docs/reference/indexer-provider-protocol.md)
|
|
114
118
|
- [Package Outputs](./docs/guides/package-outputs.md)
|
|
115
119
|
- [Package Templates](./docs/reference/package-templates.md)
|
|
120
|
+
|
|
121
|
+
- [Update existing knowledge](./docs/guides/knowledge-updates.md)
|
|
122
|
+
- [Prepare notes](./docs/guides/note.md)
|
|
123
|
+
- [Prepare conversation summaries](./docs/guides/sessions.md)
|
package/README.zh-CN.md
CHANGED
|
@@ -12,7 +12,8 @@ Profile、范围和定制。`src/index.ts` 中的项目阶段不再负责生产
|
|
|
12
12
|
## 项目边界
|
|
13
13
|
|
|
14
14
|
```text
|
|
15
|
-
sources
|
|
15
|
+
sources/{repo,file,lark}/index.yaml 已登记的来源边界
|
|
16
|
+
sources/{note,sessions}/YYYYMMDD/*.md 保存的笔记与会话总结
|
|
16
17
|
src/index.ts 采集与知识包声明
|
|
17
18
|
src/indexers.yaml 知识生产的唯一权威配置
|
|
18
19
|
knowledge/ 已批准、可读的知识
|
|
@@ -37,7 +38,7 @@ import {
|
|
|
37
38
|
source,
|
|
38
39
|
} from "@c4a/context";
|
|
39
40
|
|
|
40
|
-
const docs = source("product-docs", { type: "file" });
|
|
41
|
+
const docs = source("20260901/product-docs", { type: "file" });
|
|
41
42
|
|
|
42
43
|
export default defineProject({
|
|
43
44
|
sources: [docs],
|
|
@@ -61,7 +62,7 @@ Context 生命周期负责发现或更新 `src/indexers.yaml`,以有界批次
|
|
|
61
62
|
| API | 用途 |
|
|
62
63
|
|---|---|
|
|
63
64
|
| `defineProject()` | 声明项目边界。 |
|
|
64
|
-
| `source()` / `allSources()` |
|
|
65
|
+
| `source()` / `allSources()` | 引用已登记的代码/文件/飞书来源,或明确选择保存的 Note/Sessions。 |
|
|
65
66
|
| `captureFile()` / `captureLark()` | 生成确定性的文档快照。 |
|
|
66
67
|
| `mdxJsonDocs()` | 配置 MDX/JSON 文档采集处理器。 |
|
|
67
68
|
| `customPhase()` | 执行不生产知识的项目编排。 |
|
|
@@ -94,7 +95,9 @@ knowledge/architecture/product-guides/component-input-fields.md
|
|
|
94
95
|
|
|
95
96
|
不要直接修改 `.tmp/context-runtime/` 下的生命周期文件。Candidate 状态、审核应用、
|
|
96
97
|
恢复、close、验证与构建由 CLI 管理。来源注册表、`src/index.ts`、
|
|
97
|
-
`src/indexers.yaml`、批准后的 `knowledge
|
|
98
|
+
`src/indexers.yaml`、批准后的 `knowledge/`、保存的 Note/Sessions 和知识包模板是长期项目输入。
|
|
99
|
+
`structure.yaml` 保留范围级更新基线;会话的可选 commit/MR 关联放在来源文件,
|
|
100
|
+
不重复添加到知识页头部。保存来源不会自动开始索引。
|
|
98
101
|
|
|
99
102
|
## 参考文档
|
|
100
103
|
|
|
@@ -105,3 +108,7 @@ knowledge/architecture/product-guides/component-input-fields.md
|
|
|
105
108
|
- [Indexer Provider 协议](./docs/reference/indexer-provider-protocol.md)
|
|
106
109
|
- [知识包输出](./docs/guides/package-outputs.md)
|
|
107
110
|
- [知识包模板](./docs/reference/package-templates.md)
|
|
111
|
+
|
|
112
|
+
- [更新已有知识](./docs/guides/knowledge-updates.md)
|
|
113
|
+
- [准备 Note](./docs/guides/note.md)
|
|
114
|
+
- [准备 Sessions](./docs/guides/sessions.md)
|
package/docs/README.md
CHANGED
|
@@ -28,22 +28,34 @@ preload the whole manual set.
|
|
|
28
28
|
| Author or inspect an Indexer Provider protocol | [Indexer Provider Protocol](./reference/indexer-provider-protocol.md) |
|
|
29
29
|
| Select or customize an Indexer Provider | [Provider Selection and Customization](./guides/indexer-provider-and-customization.md) |
|
|
30
30
|
| Author a Code or Markdown Indexer Skill | [Code Indexer Authoring](./guides/code-indexer-skill-authoring.md) and [Markdown Indexer Authoring](./guides/markdown-indexer-skill-authoring.md) |
|
|
31
|
+
| Update approved pages, adjust current work, or roll back | [Knowledge Updates](./guides/knowledge-updates.md) |
|
|
32
|
+
| Prepare, commit or restore a workspace | [Prepare](./guides/workspace-prepare.md), [Commit](./guides/workspace-commit.md), [Restore](./guides/workspace-restore.md) |
|
|
33
|
+
| Save and use a note | [Note](./guides/note.md) |
|
|
34
|
+
| Save a conversation summary with optional commit/MR associations | [Sessions](./guides/sessions.md) |
|
|
31
35
|
| Choose a code extraction path | [Code Extractor Selection](./reference/code-extractors.md) |
|
|
32
36
|
| Choose an Agent package or LLM document | [Package Outputs](./guides/package-outputs.md) |
|
|
33
37
|
| Customize package files and indexes | [Package Templates](./reference/package-templates.md) and [Template Variables](./reference/template-variables.md) |
|
|
34
38
|
| Preserve Lark images and embedded resources | [Lark Resource Materialization](./guides/lark-resources.md) |
|
|
35
39
|
|
|
40
|
+
The defaults include Code, Markdown, Note and Sessions Indexers. The Host owns
|
|
41
|
+
installation and skill switches; the Agent selects a compatible visible Provider,
|
|
42
|
+
including a business replacement. Shared protocol does not mean shared editorial
|
|
43
|
+
policy: read the selected skill's source-specific resources, not all source guides.
|
|
44
|
+
|
|
36
45
|
## Complete reference
|
|
37
46
|
|
|
38
47
|
- [Getting Started](./getting-started.md) — end-to-end component-library flow.
|
|
39
48
|
- [Agent Guide](./guides/agent-guide.md) — what an agent should do, and what it should not inspect manually.
|
|
40
49
|
- [Agent Dialogue](./guides/agent-dialogue.md) — stable dialogue principles and how route-selected gate resources are discovered.
|
|
50
|
+
- [Knowledge Updates](./guides/knowledge-updates.md) — page revisions, source updates, adjustment and rollback.
|
|
51
|
+
- [Note](./guides/note.md) — originals, excerpts and summaries versus reader knowledge.
|
|
52
|
+
- [Sessions](./guides/sessions.md) — conversation summaries, optional code links and independent topics.
|
|
41
53
|
- [Package Outputs](./guides/package-outputs.md) — how to choose between an agent knowledge-base package, LLM text, or no package output.
|
|
42
54
|
- [Lark Resource Materialization](./guides/lark-resources.md) — how embedded resources move from source evidence to approved knowledge and package assets.
|
|
43
55
|
- [Project API](./reference/project-api.md) — `defineProject`, sources, capture, Indexers, and packages.
|
|
44
56
|
- [Indexer Provider Protocol](./reference/indexer-provider-protocol.md) — manifest, controlled execution, detector/inspector I/O, customization, and staged project apply.
|
|
45
57
|
- [Provider Selection and Customization](./guides/indexer-provider-and-customization.md) — registry-only selection, the six-level customization ladder, upgrade conflicts, debugging, and completion conditions.
|
|
46
|
-
- [Code Indexer Authoring](./guides/code-indexer-skill-authoring.md) — the
|
|
58
|
+
- [Code Indexer Authoring](./guides/code-indexer-skill-authoring.md) — the Provider Skill release contract and anonymous fixture expectations.
|
|
47
59
|
- [Markdown Indexer Authoring](./guides/markdown-indexer-skill-authoring.md) — capture/semantic boundaries, Section placement, material answers, editorial policy, and local incremental behavior.
|
|
48
60
|
- [Code Extractor Selection](./reference/code-extractors.md) — inspect module technology signals and choose a built-in extractor, reusable structural package, or project adapter.
|
|
49
61
|
- [Package Templates](./reference/package-templates.md) — `kbPackage`, `llmsPackage`, template variables, and examples.
|
package/docs/README.zh-CN.md
CHANGED
|
@@ -18,21 +18,33 @@
|
|
|
18
18
|
| 配置来源、采集、Indexer 或产物 | [Project API](./reference/project-api.md) |
|
|
19
19
|
| 选择或定制 Indexer Provider | [Provider Selection and Customization](./guides/indexer-provider-and-customization.md) |
|
|
20
20
|
| 编写 Code/Markdown Indexer Skill | [Code Indexer Authoring](./guides/code-indexer-skill-authoring.md) 和 [Markdown Indexer Authoring](./guides/markdown-indexer-skill-authoring.md) |
|
|
21
|
+
| 更新已有知识、调整当前任务或回滚 | [Knowledge Updates](./guides/knowledge-updates.md) |
|
|
22
|
+
| 整备、提交或恢复历史工作区 | [整备](./guides/workspace-prepare.md)、[提交](./guides/workspace-commit.md)、[历史恢复](./guides/workspace-restore.md) |
|
|
23
|
+
| 保存和使用笔记 | [Note](./guides/note.md) |
|
|
24
|
+
| 保存会话总结及可选 commit/MR 关联 | [Sessions](./guides/sessions.md) |
|
|
25
|
+
| 查询 Provider 共同协议 | [Indexer Provider Protocol](./reference/indexer-provider-protocol.md) |
|
|
21
26
|
| 选择代码提取方式 | [Code Extractor Selection](./reference/code-extractors.md) |
|
|
22
27
|
| 选择 Agent 知识包或 LLM 文档 | [Package Outputs](./guides/package-outputs.md) |
|
|
23
28
|
| 自定义包文件和索引 | [Package Templates](./reference/package-templates.md) 和 [Template Variables](./reference/template-variables.md) |
|
|
24
29
|
| 保留飞书图片和内嵌资源 | [Lark Resource Materialization](./guides/lark-resources.md) |
|
|
25
30
|
|
|
31
|
+
默认提供 Code、Markdown、Note、Sessions 四类 Indexer。安装和技能开关由 Host 管理;
|
|
32
|
+
Agent 从当前可见技能选择兼容 Provider,业务 Provider 可以替换默认实现。协议相同不代表
|
|
33
|
+
写作方式相同:按实际来源读取所选技能的指引,不要每次加载所有来源说明。
|
|
34
|
+
|
|
26
35
|
## 完整参考
|
|
27
36
|
|
|
28
37
|
- [Getting Started](./getting-started.md):从来源到知识包的端到端组件库示例。
|
|
29
38
|
- [Agent Guide](./guides/agent-guide.md):Agent 应该执行什么,以及哪些状态不能手工探查或修改。
|
|
30
39
|
- [Agent Dialogue](./guides/agent-dialogue.md):稳定的对话原则和 Route-selected Gate 资源发现方式。
|
|
40
|
+
- [Knowledge Updates](./guides/knowledge-updates.md):页面修订、来源更新、调整与回滚。
|
|
41
|
+
- [Note](./guides/note.md):原文、摘录、总结的保存与知识改写边界。
|
|
42
|
+
- [Sessions](./guides/sessions.md):会话总结、可选代码关联和独立知识主题。
|
|
31
43
|
- [Package Outputs](./guides/package-outputs.md):如何选择 Agent 知识包、LLM 文本或不构建产物。
|
|
32
44
|
- [Lark Resource Materialization](./guides/lark-resources.md):内嵌资源如何从来源证据进入正式知识和知识包。
|
|
33
45
|
- [Project API](./reference/project-api.md):`defineProject`、来源、采集、Indexer 和知识包声明。
|
|
34
46
|
- [Provider Selection and Customization](./guides/indexer-provider-and-customization.md):registry-only 选择、六级最小定制阶梯、升级冲突、调试与退出条件。
|
|
35
|
-
- [Code Indexer Authoring](./guides/code-indexer-skill-authoring.md):Code Provider Skill
|
|
47
|
+
- [Code Indexer Authoring](./guides/code-indexer-skill-authoring.md):Code Provider Skill 的作者/发布契约。
|
|
36
48
|
- [Markdown Indexer Authoring](./guides/markdown-indexer-skill-authoring.md):capture/semantic 边界、Section 投影、material answer、编辑策略与局部增量。
|
|
37
49
|
- [Code Extractor Selection](./reference/code-extractors.md):如何根据技术信号选择内建提取器、结构库或项目适配器。
|
|
38
50
|
- [Package Templates](./reference/package-templates.md):`kbPackage`、`llmsPackage`、模板变量和示例。
|
package/docs/getting-started.md
CHANGED
|
@@ -1,44 +1,65 @@
|
|
|
1
1
|
# Getting Started
|
|
2
2
|
|
|
3
|
-
Context turns
|
|
4
|
-
knowledge.
|
|
5
|
-
the
|
|
3
|
+
Context turns selected code, documents, notes and conversation summaries into
|
|
4
|
+
approved knowledge. Start through the installed Context Agent entry and follow
|
|
5
|
+
the current Route returned by the CLI.
|
|
6
6
|
|
|
7
|
-
## 1. Initialize
|
|
7
|
+
## 1. Initialize the workspace
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
context init ./context
|
|
11
11
|
cd ./context
|
|
12
|
+
bun install
|
|
13
|
+
context status --format json
|
|
12
14
|
```
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
Use the dependency-install command returned by initialization if it differs.
|
|
17
|
+
Initialization creates the project configuration, source directories, package
|
|
18
|
+
templates and workspace rules. Read the generated `AGENTS.md`. It does not create
|
|
19
|
+
an empty `src/indexers.yaml`: the later configuration Route supplies its schema
|
|
20
|
+
and asks for the confirmed requirements with `indexers: []`.
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
Run workspace commands inside this initialized directory. Route paths and
|
|
23
|
+
`.tmp/` belong to this workspace, not the surrounding repository.
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
## 2. Select and register sources
|
|
26
|
+
|
|
27
|
+
This example uses a code module and a local documentation directory:
|
|
20
28
|
|
|
21
29
|
```bash
|
|
22
30
|
context source add repo 20260901 --module component-lib --local ../component-lib
|
|
23
|
-
context source add file product-docs --local ../docs
|
|
24
|
-
context source add lark handbook --doc-token <token>
|
|
31
|
+
context source add file 20260901 --module product-docs --local ../docs
|
|
25
32
|
```
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
Replace the date and paths with the actual inputs. Both commands register a
|
|
35
|
+
boundary; they do not decide what knowledge to write. For a monorepo, select the
|
|
36
|
+
package or service needed for the reader's task. Discuss obsolete or unrelated
|
|
37
|
+
areas before indexing them: unnecessary material costs reading time and tokens.
|
|
38
|
+
Do not exclude content merely because a filename looks old.
|
|
39
|
+
|
|
40
|
+
For an authorized Lark document, registration instead looks like:
|
|
30
41
|
|
|
31
|
-
|
|
42
|
+
```bash
|
|
43
|
+
context source add lark 20260901 --module handbook --doc-token "<actual-token>"
|
|
44
|
+
```
|
|
32
45
|
|
|
33
|
-
Use `
|
|
46
|
+
Use `captureLark()` for that registered document. Notes and conversation summaries
|
|
47
|
+
use `context source import`, without a source registry or capture phase. Read
|
|
48
|
+
[note preparation](guides/note.md) or [sessions preparation](guides/sessions.md)
|
|
49
|
+
for the actual input. Saving them alone does not start knowledge production.
|
|
50
|
+
|
|
51
|
+
## 3. Declare capture and output
|
|
52
|
+
|
|
53
|
+
For the code and local-document example, `src/index.ts` contains:
|
|
34
54
|
|
|
35
55
|
```ts
|
|
36
56
|
import { captureFile, defineProject, kbPackage, source } from "@c4a/context";
|
|
37
57
|
|
|
38
|
-
const
|
|
58
|
+
const repo = source("20260901", "component-lib");
|
|
59
|
+
const docs = source("20260901/product-docs", { type: "file" });
|
|
39
60
|
|
|
40
61
|
export default defineProject({
|
|
41
|
-
sources: [docs],
|
|
62
|
+
sources: [repo, docs],
|
|
42
63
|
phases: [captureFile({ source: docs })],
|
|
43
64
|
packages: [
|
|
44
65
|
kbPackage({
|
|
@@ -50,66 +71,71 @@ export default defineProject({
|
|
|
50
71
|
});
|
|
51
72
|
```
|
|
52
73
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
This example assumes an Agent knowledge-base package is the intended output;
|
|
75
|
+
see [Package Outputs](guides/package-outputs.md) for alternatives. Repo sources
|
|
76
|
+
need no capture phase. For saved text, declare an explicit typed `source()` or
|
|
77
|
+
`allSources()` selection as described in [Project API](reference/project-api.md).
|
|
78
|
+
|
|
79
|
+
## 4. Follow requirements and Provider selection
|
|
80
|
+
|
|
81
|
+
The Agent researches representative material, reuses the user's stated goals,
|
|
82
|
+
and asks about missing information that would change the scope or useful output.
|
|
83
|
+
Fully managed mode does not authorize guessing those answers. For substantial
|
|
84
|
+
new work, the selected workflow provides an opening report under `.tmp/`, with
|
|
85
|
+
scope, Provider choices and the first pages to expect. The Agent invites the user
|
|
86
|
+
to read it before continuing unless that pause was explicitly waived; this is
|
|
87
|
+
conversation coordination, not a new approval record.
|
|
88
|
+
|
|
89
|
+
The configuration Route supplies the initial registry schema and guide. Declare
|
|
90
|
+
requirements with no selected Indexers, re-read the Route, then submit Provider
|
|
91
|
+
selection through its completion command. The shipped Code, Markdown, Note and
|
|
92
|
+
Sessions Providers share the same lifecycle. A compatible business Provider may
|
|
93
|
+
replace a default; installation alone does not enable it.
|
|
94
|
+
|
|
95
|
+
Partition organizes the selected material into reader topics. Its task batches
|
|
96
|
+
are planning work, not finished-page deliveries. After the outline is reviewed,
|
|
97
|
+
Author writes complete pages, selected Composers contribute where applicable,
|
|
98
|
+
and the CLI compiles Candidates. Do not create a second knowledge pipeline in
|
|
76
99
|
`src/index.ts`.
|
|
77
100
|
|
|
78
|
-
## 5. Review
|
|
101
|
+
## 5. Review and deliver pages
|
|
79
102
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
103
|
+
In ordinary mode, the user reviews the proposed structure and then the actual
|
|
104
|
+
Candidate pages. In explicitly authorized fully managed mode, the Agent performs
|
|
105
|
+
delegatable reviews and reports the results. Human-only decisions, such as
|
|
106
|
+
protected changes to an approved layout, still stop at their returned Gate.
|
|
84
107
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
knowledge/architecture/product-docs/component-contract.md
|
|
93
|
-
```
|
|
108
|
+
Review shows readable titles, paths, summaries and content. Approval applies the
|
|
109
|
+
pages to `knowledge/`; rejection or revision follows the current Route back to
|
|
110
|
+
writing. `close` rebuilds `knowledge/structure.yaml` and verifies the approved
|
|
111
|
+
knowledge without rewriting its prose. Build produces `dist/<package-name>/`.
|
|
112
|
+
The first readable delivery normally contains 1–3 pages, followed by batches of
|
|
113
|
+
30–50 pages or a smaller remaining tail. Each delivery completes review, close
|
|
114
|
+
and build before continuing. These page counts do not count Partition tasks.
|
|
94
115
|
|
|
95
|
-
|
|
116
|
+
## 6. Continue or update
|
|
96
117
|
|
|
97
|
-
|
|
118
|
+
Use the latest Route and revision. Accepted tasks must not be resubmitted. If a
|
|
119
|
+
completion points to `result_file` or `next_route.file`, read those files; do not
|
|
120
|
+
infer failure from a shortened console response. Follow its recovery command if
|
|
121
|
+
preparing the next Route failed after acceptance.
|
|
98
122
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
123
|
+
Approved knowledge and `structure.yaml` retain the durable information needed
|
|
124
|
+
for updates; `.tmp/context-runtime/` holds unfinished execution state and can be
|
|
125
|
+
cleaned after completed work. Its absence is not permission to replay accepted
|
|
126
|
+
work or advance an unfinished source baseline.
|
|
102
127
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
128
|
+
Use `context revise` for a selected page correction, and `context update` for a
|
|
129
|
+
selected source change. [Update existing knowledge](guides/knowledge-updates.md)
|
|
130
|
+
explains their inputs, same-task adjustment and explicit rollback.
|
|
106
131
|
|
|
107
132
|
## Troubleshooting boundary
|
|
108
133
|
|
|
109
|
-
- Fix a missing or stale source
|
|
110
|
-
- Fix capture configuration in `src/index.ts`.
|
|
111
|
-
- Fix
|
|
112
|
-
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
- Never
|
|
134
|
+
- Fix a missing or stale source through the source commands returned by the Route.
|
|
135
|
+
- Fix capture and output configuration in `src/index.ts`.
|
|
136
|
+
- Fix requirements or Provider selection through the current configuration or
|
|
137
|
+
proposal Route; use its supplied schema rather than guessing payload fields.
|
|
138
|
+
- Correct page content through revision and Review. Change Provider guidance when
|
|
139
|
+
the same writing problem affects future pages.
|
|
140
|
+
- Keep temporary input files under this workspace's `.tmp/`. Never use `dist/`
|
|
141
|
+
as an authoring source or hand-edit internal lifecycle state.
|
|
@@ -23,10 +23,10 @@ it knows which decision is current.
|
|
|
23
23
|
|
|
24
24
|
The ordinary path also selects short mode guidance after workspace creation
|
|
25
25
|
and source capture. Explain that ordinary review is the default, provides HTML
|
|
26
|
-
reports at review decisions, and
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
reports at review decisions, and waits for user responses there. Offer fully
|
|
27
|
+
managed mode for the current conversation when appropriate: the Agent performs
|
|
28
|
+
delegatable reviews and reports results without requiring per-batch approval.
|
|
29
|
+
Do not promise a fixed time saving; it depends on scope and response time.
|
|
30
30
|
|
|
31
31
|
## Stable Principles
|
|
32
32
|
|
|
@@ -39,8 +39,9 @@ opportunities to adjust intermediate content.
|
|
|
39
39
|
use concise A/B/C choices with one impact sentence each.
|
|
40
40
|
- Use semantic labels such as “Agent knowledge-base package” rather than SDK
|
|
41
41
|
factory names such as `kbPackage`.
|
|
42
|
-
-
|
|
43
|
-
|
|
42
|
+
- Reuse explicit decisions that still apply to this task. Do not infer a new
|
|
43
|
+
decision from a filename, URL, repository layout or example, and do not turn
|
|
44
|
+
another conversation's managed authority into current authorization.
|
|
44
45
|
- Keep transition reports short: what changed, the current state, and the next
|
|
45
46
|
decision or action.
|
|
46
47
|
|
|
@@ -58,6 +59,16 @@ question. A Gate may keep its ordinary inspection Action and dialogue resources
|
|
|
58
59
|
while replacing them with a direct revision-bound resolution path only for a
|
|
59
60
|
session-authority Route. Necessary evidence inspection remains selected for
|
|
60
61
|
semantic scope or classification work. This authority is not project
|
|
61
|
-
configuration and must not be persisted or reused in another conversation.
|
|
62
|
-
|
|
63
|
-
and
|
|
62
|
+
configuration and must not be persisted or reused in another conversation.
|
|
63
|
+
Managed mode by itself does not authorize expanding sources or performing remote
|
|
64
|
+
writes, and never bypasses validation. An explicit instruction to collect named
|
|
65
|
+
documents already establishes that read scope; do not ask for the same permission
|
|
66
|
+
again. Resolve essential missing goals or source boundaries before production.
|
|
67
|
+
|
|
68
|
+
`grill-me` is targeted clarification, not a fixed questionnaire. Research what the
|
|
69
|
+
available material can answer, then ask about consequential unknowns. A required
|
|
70
|
+
schema field is not automatically a question for the user. For the first production
|
|
71
|
+
task in a new workspace, the work-start report must resolve and display the agreed
|
|
72
|
+
purpose, source families, language, settings, outputs and first delivery before
|
|
73
|
+
source registration. Present it and wait for feedback even in managed mode. A
|
|
74
|
+
report must not silently substitute guessed decisions for unanswered questions.
|
|
@@ -7,7 +7,10 @@ invent a separate pipeline for code, documents, or a particular host.
|
|
|
7
7
|
|
|
8
8
|
Read `context status --format json`, then consume only the procedures, schemas,
|
|
9
9
|
and manuals selected by `workflow.current.resources`. Preserve revision and
|
|
10
|
-
authority flags in the next command.
|
|
10
|
+
authority flags in the next command. Resolve files from the initialized workspace;
|
|
11
|
+
its `.tmp/` and generated `AGENTS.md` belong to that same workspace. A resource
|
|
12
|
+
may be a file or a returned command: follow its read order and `after_read`
|
|
13
|
+
instructions instead of guessing a path or CLI subcommand. Do not infer progress from filenames or
|
|
11
14
|
probe ignored runtime files when the Route already states the next action.
|
|
12
15
|
|
|
13
16
|
## Stable decisions
|
|
@@ -21,9 +24,16 @@ Ask the user only when the answer changes a durable boundary:
|
|
|
21
24
|
- whether the proposed semantic outline organizes the requested knowledge;
|
|
22
25
|
- whether the displayed Candidate content is approved.
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
Reuse answers and authority already supplied for the current task; these are not
|
|
28
|
+
questions to repeat at every step. Even in fully managed mode, ask when missing
|
|
29
|
+
purpose or scope would change the outcome. Before indexing a large boundary,
|
|
30
|
+
identify irrelevant or obsolete areas with the user from actual material. Do not
|
|
31
|
+
exclude them by naming heuristics or include them all merely because they exist.
|
|
32
|
+
|
|
33
|
+
The Agent selects suitable Providers and makes semantic decisions about topics,
|
|
34
|
+
organization and content. The CLI executes parsers, validates source/page
|
|
35
|
+
identities, derives paths and schedules recovery. Do not make the Agent reproduce
|
|
36
|
+
those mechanical operations or invent state to declare a step complete.
|
|
27
37
|
|
|
28
38
|
## Authoring boundary
|
|
29
39
|
|
|
@@ -31,7 +41,7 @@ and recovery of an already completed step.
|
|
|
31
41
|
knowledge requirements and Provider selection. Keep these responsibilities
|
|
32
42
|
separate.
|
|
33
43
|
|
|
34
|
-
Code and
|
|
44
|
+
Code, Markdown, Note, Sessions and compatible business Providers receive controlled worksets and return typed
|
|
35
45
|
results. They do not write Candidate, Review, `knowledge/`, or `dist/` files.
|
|
36
46
|
Context validates and persists their result before the next action consumes it.
|
|
37
47
|
Initial Provider selection follows the same rule: use the requirements and
|
|
@@ -44,10 +54,14 @@ For Partition and Author steps, one Route may contain several independent
|
|
|
44
54
|
`tasks`. Read the shared instructions once, read each task's Authorized Workset
|
|
45
55
|
View, and return one `results[]` item for every task key in that batch. Submit
|
|
46
56
|
the whole batch with the Route's single `context action complete-current`
|
|
47
|
-
command
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
command. Use a workspace `.tmp/` JSON or YAML input file for a large payload,
|
|
58
|
+
then submit with `--input <file>`; avoid long JSON through an interactive PTY.
|
|
59
|
+
A shortened completion may point to `result_file` and `next_route.file`; read
|
|
60
|
+
them before deciding what was accepted. If preparing the next Route fails,
|
|
61
|
+
keep accepted results and use the supplied refresh action. Retry only tasks
|
|
62
|
+
still pending in the new Route, never the accepted tasks from an old batch.
|
|
63
|
+
Do not construct internal Result, digest, receipt, Fact or evidence-binding
|
|
64
|
+
objects, or materialize Views through commands the Route did not request.
|
|
51
65
|
|
|
52
66
|
The batch is only a transport boundary. Keep every task's semantic answer,
|
|
53
67
|
failure and retry independent, and do not combine unrelated Subjects merely
|
|
@@ -77,7 +91,22 @@ outline after all Partition shards converge; the second checks the final
|
|
|
77
91
|
reader-facing Candidate set. Ordinary mode presents both to the user. Fully
|
|
78
92
|
managed mode lets the Agent resolve both with current-conversation authority.
|
|
79
93
|
A destructive or ambiguous layout change is separate and always human-only.
|
|
80
|
-
Intermediate execution batches never create additional user approvals.
|
|
94
|
+
Intermediate execution batches never create additional user approvals. Page
|
|
95
|
+
delivery batches do complete their applicable content review, close and build;
|
|
96
|
+
they are distinct from Partition transport batches. The first delivery normally
|
|
97
|
+
contains 1–3 pages, followed by 30–50-page batches or a smaller remaining tail.
|
|
98
|
+
|
|
99
|
+
For the first production task in a new workspace, follow the selected work-start
|
|
100
|
+
report procedure using the user's task instructions and batch metadata titles for
|
|
101
|
+
the supplied list, falling back to at most 10 unresolved title lookups if unavailable.
|
|
102
|
+
Do not fetch source bodies or outlines before
|
|
103
|
+
capture; missing titles may remain unknown. Detailed plans are provisional until
|
|
104
|
+
captured evidence is available.
|
|
105
|
+
Resolve its required start conditions, present it and wait for feedback before
|
|
106
|
+
source registration or capture. Reuse explicit answers and defaults instead of
|
|
107
|
+
asking a fixed questionnaire. Existing-workspace lightweight changes may keep a
|
|
108
|
+
short conversational summary. The source-boundary Gate remains the confirmation
|
|
109
|
+
authority; fully managed mode does not bypass the first report handoff.
|
|
81
110
|
|
|
82
111
|
## Quality bar
|
|
83
112
|
|
|
@@ -95,6 +124,15 @@ When dogfooding, compare the generated knowledge with an existing useful
|
|
|
95
124
|
knowledge base. Feed gaps back into the Provider profile, instructions,
|
|
96
125
|
templates, or parser coverage rather than editing generated pages by hand.
|
|
97
126
|
|
|
127
|
+
## Corrections and source updates
|
|
128
|
+
|
|
129
|
+
Use `context revise` for a selected approved page and `context update` for a
|
|
130
|
+
selected source change. Writing starts from the existing approved text and uses
|
|
131
|
+
the current Route's Provider, template and source material. New topics enter the
|
|
132
|
+
applicable structure review before Author; they are not silent page additions.
|
|
133
|
+
Use `task adjust` for changed inputs in the current task and explicit rollback
|
|
134
|
+
for an agreed reversal. See [Update existing knowledge](knowledge-updates.md).
|
|
135
|
+
|
|
98
136
|
## Recovery and Git
|
|
99
137
|
|
|
100
138
|
Runtime artifacts under `.tmp/context-runtime/` may be rich because they are
|
|
@@ -21,16 +21,37 @@ rules, metric operators and thresholds.
|
|
|
21
21
|
|
|
22
22
|
## Author contract checklist
|
|
23
23
|
|
|
24
|
+
For generated API tables, test the final Candidate as well as the parser payload
|
|
25
|
+
and template preview. Cover direct and supporting references, partial contracts,
|
|
26
|
+
shared types with different implementation defaults, ambiguous or cross-file
|
|
27
|
+
links, and an approved-page regeneration after the source changes. Keep a known
|
|
28
|
+
field when only part of its implementation can be extracted. Do not equate an
|
|
29
|
+
accepted result with a corrected page.
|
|
30
|
+
|
|
31
|
+
Document what each supported language adapter actually establishes. Preserve
|
|
32
|
+
written expressions without evaluating arbitrary code, distinguish declaration
|
|
33
|
+
defaults from implementation defaults, and explain unresolved imports or types.
|
|
34
|
+
Unknown material, an unsupported parse, and a renderer contradicting a known fact
|
|
35
|
+
need different responses. Use existing material requests and repair routes;
|
|
36
|
+
neither a new content-quality gate nor a Provider-specific retry ledger is needed.
|
|
37
|
+
|
|
24
38
|
1. **Responsibility.** Classify supported code modules and produce evidence-
|
|
25
39
|
bound partitions, logical units, Artifact Bundles and Results. Do not own
|
|
26
40
|
source authorization, requirement approval, final review, CLI metrics or
|
|
27
|
-
package publication.
|
|
41
|
+
package publication. Source-specific Note/Sessions layers may contribute
|
|
42
|
+
declared guidance to a code page; they do not become another primary or
|
|
43
|
+
turn a conversation's proposed change into implemented code behavior.
|
|
28
44
|
2. **Manifest.** Use the sole `context-indexer.yaml` field tree. Bind domains,
|
|
29
45
|
profiles, operations/fragments, resources, source roles, logical units,
|
|
30
46
|
customization support and composition without duplicate aliases.
|
|
31
47
|
3. **Resource composition.** Combine only declared programs, profile-bound
|
|
32
48
|
instructions, templates and optional detector/inspector resources. Omitted
|
|
33
49
|
capabilities remain unsupported; natural language cannot add them.
|
|
50
|
+
Put any Agent-executed grouping rules in those declared instructions or
|
|
51
|
+
templates so Context delivers them with the current View. A partition
|
|
52
|
+
strategy id or digest is not an instruction resource. Context selects and
|
|
53
|
+
records strategy attempts; the Agent returns semantic groups and dispositions,
|
|
54
|
+
without discovering strategy implementations or managing fallback order.
|
|
34
55
|
4. **Activation and profiles.** Declare strong/supporting/negative signals.
|
|
35
56
|
Dependency names are candidates, not runtime proof. One module may combine
|
|
36
57
|
one primary profile with supporting/extensions and selected composers.
|
|
@@ -84,8 +105,8 @@ rules, metric operators and thresholds.
|
|
|
84
105
|
shapes. Local facts remain baseline when optional remote metadata is absent.
|
|
85
106
|
18. **Versioning.** Use Skill/Provider SemVer, exact Provider pins and Bundle
|
|
86
107
|
integrity. Fixed dependencies require exact versions and resolved
|
|
87
|
-
integrity. `@context-indexer-origin` is
|
|
88
|
-
|
|
108
|
+
integrity. `@context-indexer-origin` is required on workspace-local customization
|
|
109
|
+
files and grants no authority. It is not required on Provider bundle files.
|
|
89
110
|
19. **Trust boundary.** Skill/manifest describes capabilities; the verified
|
|
90
111
|
Bundle supplies bytes; workspace customization supplies project deltas;
|
|
91
112
|
CLI contracts supply hard rules. Keep these four authorities distinct.
|
|
@@ -113,12 +134,22 @@ rules, metric operators and thresholds.
|
|
|
113
134
|
consumed in the bounded Author View rather than copied into every
|
|
114
135
|
Partition decision.
|
|
115
136
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
source
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
137
|
+
The current Route delivers readable task material with goals and constraints
|
|
138
|
+
first, followed by the authorized sources and facts. For behavioral explanations,
|
|
139
|
+
read the complete source excerpts. Copy the displayed `source_items` into the
|
|
140
|
+
section's `source_items`; use Fact references in `facts`, not as source items.
|
|
141
|
+
Context resolves a text item's authorized source spans internally. Inventory
|
|
142
|
+
identities and a repository reference do not identify section source material.
|
|
143
|
+
These process-local excerpts are not new Facts or reader-page metadata. Do not
|
|
144
|
+
reopen the repository or infer behavior from a locator alone when the supplied
|
|
145
|
+
lines do not establish it. Batch size does not define a knowledge page boundary.
|
|
146
|
+
|
|
147
|
+
Author task resources may point to one shared batch reading file. Read that path
|
|
148
|
+
once, use shared material only for its listed task keys, and consider each task's
|
|
149
|
+
own goals and source excerpts. Context shares identical material, not conclusions:
|
|
150
|
+
prepare a separate result for each task and submit the `results[]` together through
|
|
151
|
+
the current completion command. A retry includes the remaining tasks' material in
|
|
152
|
+
full; no earlier batch file or additional reading command is required.
|
|
122
153
|
|
|
123
154
|
## Result and composition rules
|
|
124
155
|
|
|
@@ -130,8 +161,8 @@ an empty composer run still has a receipt. Composer selection is the
|
|
|
130
161
|
intersection of registry selection, manifest declaration and current profile
|
|
131
162
|
applicability, not array order.
|
|
132
163
|
|
|
133
|
-
Use canonical SubjectKey schemas and the Context NodeRef formula.
|
|
134
|
-
|
|
164
|
+
Use canonical SubjectKey schemas and the Context NodeRef formula. All selected
|
|
165
|
+
Providers must reuse the same Node when the SubjectKey is equal. An
|
|
135
166
|
enricher uses the supplied TargetResolutionView (`resolved`, `absent` or
|
|
136
167
|
`ambiguous`) and never guesses identity from a title or path resemblance.
|
|
137
168
|
|