@c4a/context 0.7.10-alpha.2 → 0.7.10
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/docs/getting-started.md +29 -27
- package/docs/guides/agent-guide.md +10 -16
- package/docs/guides/indexer-provider-and-customization.md +0 -2
- package/docs/guides/knowledge-updates.md +28 -2
- package/docs/guides/workspace-prepare.md +17 -0
- package/docs/reference/project-api.md +37 -17
- package/index.js +1 -1
- package/package.json +1 -1
package/docs/getting-started.md
CHANGED
|
@@ -17,7 +17,7 @@ Use the dependency-install command returned by initialization if it differs.
|
|
|
17
17
|
Initialization creates the project configuration, source directories, package
|
|
18
18
|
templates and workspace rules. Read the generated `AGENTS.md`. It does not create
|
|
19
19
|
an empty `src/indexers.yaml`: the later configuration Route supplies its schema
|
|
20
|
-
and asks for
|
|
20
|
+
and asks for confirmed `requirements` only, without `protocol` or `indexers` keys.
|
|
21
21
|
|
|
22
22
|
Run workspace commands inside this initialized directory. Route paths and
|
|
23
23
|
`.tmp/` belong to this workspace, not the surrounding repository.
|
|
@@ -27,8 +27,8 @@ Run workspace commands inside this initialized directory. Route paths and
|
|
|
27
27
|
This example uses a code module and a local documentation directory:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
context source add repo 20260901 --module component-lib --local ../component-lib
|
|
31
|
-
context source add file 20260901 --module product-docs --local ../docs
|
|
30
|
+
context source add repo 20260901 --module component-lib --local ../component-lib --configure
|
|
31
|
+
context source add file 20260901 --module product-docs --local ../docs --configure
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
Replace the date and paths with the actual inputs. Both commands register a
|
|
@@ -40,17 +40,21 @@ Do not exclude content merely because a filename looks old.
|
|
|
40
40
|
For an authorized Lark document, registration instead looks like:
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
context source add lark 20260901 --module handbook --doc-token "<actual-token>"
|
|
43
|
+
context source add lark 20260901 --module handbook --doc-token "<actual-token>" --configure
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
`--configure` adds explicit source and default capture declarations to a simple
|
|
47
|
+
project entry without fetching content. Existing custom settings are preserved;
|
|
48
|
+
a `manual` configuration result asks for a focused edit, not a registration retry.
|
|
49
|
+
Omit the flag when you only want registration. Notes and conversation summaries
|
|
47
50
|
use `context source import`, without a source registry or capture phase. Read
|
|
48
51
|
[note preparation](guides/note.md) or [sessions preparation](guides/sessions.md)
|
|
49
52
|
for the actual input. Saving them alone does not start knowledge production.
|
|
50
53
|
|
|
51
54
|
## 3. Declare capture and output
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
The generated source/capture declarations can be combined with the selected output
|
|
57
|
+
configuration. For the code and local-document example, `src/index.ts` contains:
|
|
54
58
|
|
|
55
59
|
```ts
|
|
56
60
|
import { captureFile, defineProject, kbPackage, source } from "@c4a/context";
|
|
@@ -76,27 +80,26 @@ see [Package Outputs](guides/package-outputs.md) for alternatives. Repo sources
|
|
|
76
80
|
need no capture phase. For saved text, declare an explicit typed `source()` or
|
|
77
81
|
`allSources()` selection as described in [Project API](reference/project-api.md).
|
|
78
82
|
|
|
79
|
-
## 4.
|
|
83
|
+
## 4. Plan the requested knowledge
|
|
80
84
|
|
|
81
85
|
The Agent researches representative material, reuses the user's stated goals,
|
|
82
86
|
and asks about missing information that would change the scope or useful output.
|
|
83
87
|
Fully managed mode does not authorize guessing those answers. For substantial
|
|
84
88
|
new work, the selected workflow provides an opening report under `.tmp/`, with
|
|
85
|
-
scope,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
`src/index.ts`.
|
|
89
|
+
scope, relevant Skills and the first pages to expect. The report requires user
|
|
90
|
+
confirmation before writing, including in managed mode.
|
|
91
|
+
|
|
92
|
+
The configuration Route supplies the requirements schema and guide. Record the
|
|
93
|
+
reader purpose and authorized sources in `src/indexers.yaml`. The Agent chooses
|
|
94
|
+
relevant installed Code, Markdown, Note, Sessions or custom Indexer Skills during
|
|
95
|
+
planning; their use is recorded in the temporary plan, not a persistent Provider
|
|
96
|
+
registry. There is no separate Provider selection gate.
|
|
97
|
+
|
|
98
|
+
Plan reader topics, reusing related existing articles. Keep small document or
|
|
99
|
+
single-module tasks local; do not redesign the whole workspace. Once the report
|
|
100
|
+
is approved, write Markdown and references in the returned task directories and
|
|
101
|
+
submit their manifest. The CLI creates Candidates. Do not create a second
|
|
102
|
+
knowledge pipeline in `src/index.ts`.
|
|
100
103
|
|
|
101
104
|
## 5. Review and deliver pages
|
|
102
105
|
|
|
@@ -109,9 +112,8 @@ Review shows readable titles, paths, summaries and content. Approval applies the
|
|
|
109
112
|
pages to `knowledge/`; rejection or revision follows the current Route back to
|
|
110
113
|
writing. `close` rebuilds `knowledge/structure.yaml` and verifies the approved
|
|
111
114
|
knowledge without rewriting its prose. Build produces `dist/<package-name>/`.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
and build before continuing. These page counts do not count Partition tasks.
|
|
115
|
+
Delivery scope follows the agreed task and current Route, not fixed page-count
|
|
116
|
+
waves. Each delivery completes review, close and build before continuing.
|
|
115
117
|
|
|
116
118
|
## 6. Continue or update
|
|
117
119
|
|
|
@@ -133,8 +135,8 @@ explains their inputs, same-task adjustment and explicit rollback.
|
|
|
133
135
|
|
|
134
136
|
- Fix a missing or stale source through the source commands returned by the Route.
|
|
135
137
|
- Fix capture and output configuration in `src/index.ts`.
|
|
136
|
-
- Fix requirements
|
|
137
|
-
|
|
138
|
+
- Fix requirements through the current configuration Route; use its supplied
|
|
139
|
+
schema rather than adding Skill selections to the requirements file.
|
|
138
140
|
- Correct page content through revision and Review. Change Provider guidance when
|
|
139
141
|
the same writing problem affects future pages.
|
|
140
142
|
- Keep temporary input files under this workspace's `.tmp/`. Never use `dist/`
|
|
@@ -38,24 +38,18 @@ those mechanical operations or invent state to declare a step complete.
|
|
|
38
38
|
## Authoring boundary
|
|
39
39
|
|
|
40
40
|
`src/index.ts` owns source capture and package output. `src/indexers.yaml` owns
|
|
41
|
-
|
|
41
|
+
long-term reader requirements and authorized sources. Keep these responsibilities
|
|
42
42
|
separate.
|
|
43
43
|
|
|
44
|
-
Code, Markdown, Note, Sessions and
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
`
|
|
53
|
-
For Partition and Author steps, one Route may contain several independent
|
|
54
|
-
`tasks`. Read the shared instructions once, read each task's Authorized Workset
|
|
55
|
-
View, and return one `results[]` item for every task key in that batch. Submit
|
|
56
|
-
the whole batch with the Route's single `context action complete-current`
|
|
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.
|
|
44
|
+
Code, Markdown, Note, Sessions and custom Indexer Skills guide source investigation
|
|
45
|
+
and writing. Record relevant Skill use in the temporary plan's `indexer_usage`,
|
|
46
|
+
not `src/indexers.yaml`; there is no Provider resolution or registry-apply step.
|
|
47
|
+
Read shared instructions once, then the relevant task materials. Write Markdown
|
|
48
|
+
and reference files in the returned Agent directory and submit the short manifest
|
|
49
|
+
with the current `context action complete-current` command. Completed subsets
|
|
50
|
+
may be submitted without repeating accepted tasks. The CLI validates and persists
|
|
51
|
+
Candidates and owns Review, `knowledge/` and `dist/` writes. Do not fill retired
|
|
52
|
+
workset `results[]` protocols or put full article bodies in command arguments.
|
|
59
53
|
A shortened completion may point to `result_file` and `next_route.file`; read
|
|
60
54
|
them before deciding what was accepted. If preparing the next Route fails,
|
|
61
55
|
keep accepted results and use the supplied refresh action. Retry only tasks
|
|
@@ -28,7 +28,6 @@ production assignments. For example, replace the source and goals with the
|
|
|
28
28
|
user's actual scope:
|
|
29
29
|
|
|
30
30
|
```yaml
|
|
31
|
-
protocol: context.indexer.registry/v1
|
|
32
31
|
requirements:
|
|
33
32
|
- id: integration-guide
|
|
34
33
|
purpose: Help application developers understand and integrate the system.
|
|
@@ -41,7 +40,6 @@ requirements:
|
|
|
41
40
|
evidence_source_scope:
|
|
42
41
|
targets:
|
|
43
42
|
- source_ref: repo:sample
|
|
44
|
-
indexers: []
|
|
45
43
|
```
|
|
46
44
|
|
|
47
45
|
Use registered source identities, not guessed paths or URLs. Keep any confirmed
|
|
@@ -16,6 +16,22 @@ and continues through Review and delivery. Expression-only changes need no
|
|
|
16
16
|
source capture or Parser. Preserve prior confirmed contributions; distinguish
|
|
17
17
|
actual behavior, a confirmed decision, and a proposal that is not implemented.
|
|
18
18
|
|
|
19
|
+
## Keep planning local to the change
|
|
20
|
+
|
|
21
|
+
For one or two documents or a clearly bounded module, retain the useful planning
|
|
22
|
+
decision: add or revise which articles, and place them where readers expect them.
|
|
23
|
+
Do not expand this into a whole-workspace taxonomy, full navigation redesign or
|
|
24
|
+
multi-wave plan. Read related existing topics first and expand only as needed.
|
|
25
|
+
One module can contain several topics; scope and ambiguity, not source count,
|
|
26
|
+
determine how much investigation is useful.
|
|
27
|
+
|
|
28
|
+
Reuse an approved stage's plan for in-scope additions through its existing amendment
|
|
29
|
+
route. Keep completed work and unrelated pending investigation intact. If article
|
|
30
|
+
targets are already decided before approval, the preparation route supports a
|
|
31
|
+
known-task input to combine preparation and task creation. It still prepares
|
|
32
|
+
navigation and retains report confirmation; it is not a bypass for new source
|
|
33
|
+
authorization. Planning depth is an Agent judgment, not an additional CLI gate.
|
|
34
|
+
|
|
19
35
|
## First-task intake budget
|
|
20
36
|
|
|
21
37
|
Before registration and capture, the Agent uses the user's task instructions and
|
|
@@ -56,7 +72,14 @@ progress under `.tmp/` never causes a version increase.
|
|
|
56
72
|
Version recording runs at completed-scope delivery after Review, Close and package
|
|
57
73
|
configuration/template approval, before the final build. The record response
|
|
58
74
|
returns the next workspace Route, so no extra status call is needed. Build retries
|
|
59
|
-
reuse the recorded version when formal content is unchanged.
|
|
75
|
+
reuse the recorded version when formal content is unchanged. If build preparation
|
|
76
|
+
or rendering fails and formal corrections are needed, `version inspect` returns
|
|
77
|
+
`reusable_version` for the current entry only while it has no successful build or
|
|
78
|
+
publication receipt. Submit that same version with the complete iteration's title,
|
|
79
|
+
changes and triggers, including the repair; this replaces the pending changelog
|
|
80
|
+
entry rather than appending another version. Do not submit only the repair and
|
|
81
|
+
lose the original delivery description. Once built or published, the version is
|
|
82
|
+
sealed and further formal changes require an increase. Intermediate batches
|
|
60
83
|
do not each receive a version.
|
|
61
84
|
|
|
62
85
|
The workspace AGENTS.md and version-writing instructions require each entry's
|
|
@@ -85,7 +108,10 @@ actor:
|
|
|
85
108
|
```
|
|
86
109
|
|
|
87
110
|
`actor` is optional; omit it to use local Git `user.name` when configured. Use a
|
|
88
|
-
Lark display name only when explicitly known from the conversation.
|
|
111
|
+
Lark display name only when explicitly known from the conversation. Amending an
|
|
112
|
+
unbuilt entry preserves its actor unless a replacement is explicitly supplied.
|
|
113
|
+
If neither the conversation nor Git identifies the user, omit the actor and
|
|
114
|
+
mention the missing identity in the delivery summary; never guess it. Trigger kinds
|
|
89
115
|
are `initial`, `note`, `sessions`, `mr`, `module`, `document`, `navigation`,
|
|
90
116
|
`repair`, `dist`, and `other`. Agent-written fields describe the actual diff and
|
|
91
117
|
conversation; they must not expose credentials, raw transcripts or private IDs.
|
|
@@ -36,6 +36,23 @@ reports, unique material, unknown files and modified checkouts unless their
|
|
|
36
36
|
specific loss is authorized. Do not delete locks, transaction records or active
|
|
37
37
|
tool directories. Empty task directories can remain.
|
|
38
38
|
|
|
39
|
+
Prefer cleanup after successful delivery, not immediately after close: version
|
|
40
|
+
recording, build and retries may still need the current task. Completed production
|
|
41
|
+
drafts and Review state are removed by delivery cleanup. Do not invoke
|
|
42
|
+
`task resume` merely to make a completed workspace advance; it starts a new task
|
|
43
|
+
and requires an actual new user request.
|
|
44
|
+
|
|
45
|
+
Keep repository checkouts referenced by registered sources, including fixed
|
|
46
|
+
commits: removing them can force a costly clone before the next update. Keep
|
|
47
|
+
pending telemetry and source-region baselines; losing the latter reduces the
|
|
48
|
+
ability to distinguish relocated text from changed text. Debug and historical
|
|
49
|
+
views may be archived or removed after diagnosis when no operation is active,
|
|
50
|
+
but unknown Agent files are not automatically disposable.
|
|
51
|
+
|
|
52
|
+
After all scratch state is lost, an existing build receipt defaults the workspace
|
|
53
|
+
to waiting for an explicit new task. This does not restore lost drafts or prove
|
|
54
|
+
sources and outputs are current. Use the recovery checks below before resuming.
|
|
55
|
+
|
|
39
56
|
## Restore usable sources
|
|
40
57
|
|
|
41
58
|
For repositories, run `context source recovery-plan --format json` and read
|
|
@@ -4,8 +4,8 @@ The project has two durable declarations with separate responsibilities:
|
|
|
4
4
|
|
|
5
5
|
- `src/index.ts`: source references, document capture, custom non-knowledge
|
|
6
6
|
orchestration, and package outputs.
|
|
7
|
-
- `src/indexers.yaml`:
|
|
8
|
-
|
|
7
|
+
- `src/indexers.yaml`: long-term reader requirements, authorized target/supporting
|
|
8
|
+
sources and confirmed exclusions. Skill choices belong to the temporary plan.
|
|
9
9
|
|
|
10
10
|
Do not describe the same knowledge transformation in both files.
|
|
11
11
|
|
|
@@ -53,6 +53,19 @@ and [knowledge updates](../guides/knowledge-updates.md).
|
|
|
53
53
|
|
|
54
54
|
## Capture phases
|
|
55
55
|
|
|
56
|
+
For ordinary acquisition, add `--configure` to `context source add repo`, `file`,
|
|
57
|
+
`lark` or `batch`. The command registers the selected inputs and generates explicit
|
|
58
|
+
source references and default document capture phases in `src/index.ts`. It does
|
|
59
|
+
not fetch content, select other registrations or change package outputs.
|
|
60
|
+
|
|
61
|
+
Generation supports a literal `defineProject` with literal source/phase arrays
|
|
62
|
+
and recognizable SDK calls. Existing capture settings are preserved, repeated
|
|
63
|
+
registration is idempotent, and custom/dynamic entries remain untouched with a
|
|
64
|
+
`configuration.status: manual` hint. Registration is still saved; edit only the
|
|
65
|
+
needed declarations through the normal configuration path. For special processors
|
|
66
|
+
or resource options, configure them before following the capture Route. Omitting
|
|
67
|
+
`--configure` keeps registration-only behavior.
|
|
68
|
+
|
|
56
69
|
```ts
|
|
57
70
|
captureFile({ source: docs });
|
|
58
71
|
captureFile({ source: docs, processor: mdxJsonDocs() });
|
|
@@ -67,24 +80,27 @@ creating a second capture or knowledge pipeline.
|
|
|
67
80
|
|
|
68
81
|
### Batch capture from the source registry
|
|
69
82
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
83
|
+
For documents with shared capture settings, prefer registry-driven configuration
|
|
84
|
+
over repeating source declarations and capture calls, even for two documents.
|
|
85
|
+
Select the task's intended registrations first. The example below assumes all
|
|
86
|
+
registered Lark documents are in scope, with the standard `src/index.ts` entry:
|
|
73
87
|
|
|
74
88
|
```ts
|
|
75
89
|
import { fileURLToPath } from "node:url";
|
|
76
90
|
import {
|
|
77
|
-
|
|
91
|
+
captureLark, defineProject, loadSourcesRegistry, source,
|
|
78
92
|
} from "@c4a/context";
|
|
79
93
|
|
|
80
94
|
const workspaceRoot = fileURLToPath(new URL("../", import.meta.url));
|
|
81
95
|
const registry = await loadSourcesRegistry({ rootDir: workspaceRoot });
|
|
96
|
+
// For a subset, filter registry.larks by the authorized namespace/names here.
|
|
82
97
|
const documents = registry.larks.map(entry =>
|
|
83
98
|
source(entry.name, { type: "lark" }),
|
|
84
99
|
);
|
|
85
100
|
|
|
86
101
|
export default defineProject({
|
|
87
|
-
sources:
|
|
102
|
+
sources: documents,
|
|
103
|
+
// Shared settings, independent source identities and capture phases.
|
|
88
104
|
phases: documents.map(document => captureLark({ source: document })),
|
|
89
105
|
packages: [],
|
|
90
106
|
});
|
|
@@ -109,6 +125,10 @@ Registry loading only reads local registrations; it does not fetch documents.
|
|
|
109
125
|
- The map declares one phase per document. It does not fetch URLs, change capture
|
|
110
126
|
permissions, or request parallel execution. Run the declared phases through the
|
|
111
127
|
existing CLI flow so each document retains independent refresh and retry behavior.
|
|
128
|
+
This reduces configuration repetition, not the number of capture operations.
|
|
129
|
+
- Capture boundaries do not dictate article boundaries. During planning and
|
|
130
|
+
writing, combine related captured documents around reader tasks when useful;
|
|
131
|
+
do not create one article or a complete production cycle per source by default.
|
|
112
132
|
|
|
113
133
|
## `customPhase`
|
|
114
134
|
|
|
@@ -148,18 +168,18 @@ from the package name, if present. Omit it for KB-only output. It accepts `title
|
|
|
148
168
|
`src/knowledge-map.yaml` independently of KB directories; see
|
|
149
169
|
[Package Outputs](../guides/package-outputs.md#optional-static-documentation-website).
|
|
150
170
|
|
|
151
|
-
## Indexer
|
|
171
|
+
## Knowledge requirements and Indexer Skills
|
|
152
172
|
|
|
153
|
-
When
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
configuration file. Subsequent changes use typed proposals and applicable gates. Each selected Indexer binds requirements and scopes to one
|
|
157
|
-
primary Provider, with optional declared layers or composers. Provider code
|
|
158
|
-
must return the current Indexer result protocol; it must not write Candidate,
|
|
159
|
-
knowledge, or Review files directly.
|
|
173
|
+
When `src/indexers.yaml` is absent, the configuration Route supplies its schema.
|
|
174
|
+
Write `requirements` only; do not add `protocol`, `indexers`, Provider selections
|
|
175
|
+
or profiles. Re-evaluate after changing confirmed requirements.
|
|
160
176
|
|
|
161
|
-
|
|
162
|
-
|
|
177
|
+
Installed Indexer Skills guide investigation and writing. Relevant Skill choices
|
|
178
|
+
and optional configuration use `indexer_usage` in the temporary production plan,
|
|
179
|
+
not this durable file. There is no separate Provider selection or resolution gate.
|
|
180
|
+
The Agent writes task drafts and reference files under the returned temporary
|
|
181
|
+
directory; the CLI accepts them and owns Candidate, Review and formal output.
|
|
182
|
+
See [Indexer guidance](../guides/indexer-provider-and-customization.md).
|
|
163
183
|
|
|
164
184
|
## Persistent versus runtime state
|
|
165
185
|
|
package/index.js
CHANGED
|
@@ -15959,7 +15959,7 @@ function validateIndexerArtifactResult(input) {
|
|
|
15959
15959
|
capability_group_ref: group.capability_group_ref,
|
|
15960
15960
|
member_ids: group.member_evidence.map((member) => member.member_id)
|
|
15961
15961
|
})),
|
|
15962
|
-
material_gap_proposal_refs: result.
|
|
15962
|
+
material_gap_proposal_refs: result.question_target_dispositions.flatMap((disposition) => disposition.state === "material-gap" ? [disposition.material_question_proposal_ref] : [])
|
|
15963
15963
|
});
|
|
15964
15964
|
const targets = new Map(input.allowed_question_targets.map((target) => [target.question_target_key, target.question_ref]));
|
|
15965
15965
|
assertUnique(result.question_target_dispositions.map((item) => item.question_target_key), "question targets");
|