@c4a/context 0.7.4 → 0.7.8
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 +17 -8
- package/README.zh-CN.md +15 -8
- 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 +19 -9
- package/docs/guides/agent-guide.md +52 -10
- package/docs/guides/code-indexer-skill-authoring.md +50 -5
- package/docs/guides/indexer-manifest-example.md +103 -0
- package/docs/guides/indexer-provider-and-customization.md +307 -31
- package/docs/guides/indexer-skill-creation.md +99 -0
- package/docs/guides/knowledge-updates.md +324 -0
- package/docs/guides/lark-resources.md +5 -1
- package/docs/guides/markdown-indexer-skill-authoring.md +25 -7
- package/docs/guides/note.md +37 -0
- package/docs/guides/package-outputs.md +22 -17
- 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 +116 -22
- package/docs/reference/package-templates.md +10 -9
- package/docs/reference/project-api.md +47 -13
- package/docs/reference/template-variables.md +7 -7
- package/index.d.ts +11 -0
- package/index.js +1819 -584
- package/indexerAgentStepProtocol.d.ts +1284 -2060
- package/indexerApprovedKnowledge.d.ts +371 -0
- package/indexerArticlePlan.d.ts +83 -0
- package/indexerArtifact.d.ts +10 -7
- package/indexerArtifactDependencies.d.ts +7 -5
- package/indexerArtifactPolicy.d.ts +16 -16
- 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/indexerCompositionFactDependencies.d.ts +16 -0
- 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 +7 -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/indexerProvider.d.ts +72 -28
- 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 +52 -0
- package/indexerRequirementConfirmation.d.ts +48 -16
- package/indexerRequirementLifecycle.d.ts +154 -42
- package/indexerResultReconciliation.d.ts +12 -11
- package/indexerSemanticInput.d.ts +28014 -1847
- 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/managedSources.d.ts +15 -0
- package/package.json +1 -1
- package/phases.d.ts +0 -3
- package/processedScopes.d.ts +75 -0
- package/readingStructure.d.ts +188 -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
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Prepare a conversation-summary source
|
|
2
|
+
|
|
3
|
+
Use sessions for a bounded summary formed from an authorized conversation:
|
|
4
|
+
requirements, design, troubleshooting, operational or general knowledge.
|
|
5
|
+
Code association is optional. An Agent or external supplier prepares the summary
|
|
6
|
+
before import. Do not scan host history, ingest the full transcript, invent a
|
|
7
|
+
conversation from a diff, or move an unrelated conversation into note merely
|
|
8
|
+
because it lacks a commit.
|
|
9
|
+
|
|
10
|
+
Keep the problem, confirmed decisions, useful reasons, constraints and open
|
|
11
|
+
questions. Remove repetitive turns, tool logs and abandoned attempts unless they
|
|
12
|
+
explain a current limit. Preserve whether each statement was proposed, agreed,
|
|
13
|
+
implemented or verified. If only a supplied summary is available, say so; do not
|
|
14
|
+
claim to have read the original. Do not make up speakers, dates or approval.
|
|
15
|
+
A session with no reusable information can remain outside the workspace.
|
|
16
|
+
|
|
17
|
+
Save through `context source import --input <file> --format json`, using
|
|
18
|
+
`type: sessions`, `name: YYYYMMDD/topic.md` and the prepared `markdown` string.
|
|
19
|
+
Choose the actual conversation date, or collection date if unknown, and retain
|
|
20
|
+
the same path for corrections. The summary needs no mandatory body headings.
|
|
21
|
+
|
|
22
|
+
Optional `changes` associates one or several code changes. Each row accepts
|
|
23
|
+
`commit` (full 40/64 hexadecimal Git SHA), `mr` (HTTP(S) MR/PR URL), and optional
|
|
24
|
+
`repository`. At least commit or mr is needed per row; omit the entire field
|
|
25
|
+
for unrelated sessions. Use actual known identifiers, never fabricated hashes.
|
|
26
|
+
A reference does not prove merge, deployment, tests or authorize fetching code.
|
|
27
|
+
The CLI stores this field in the source's YAML frontmatter, discovers it from
|
|
28
|
+
that same file, and does not introduce a sidecar or separate registry.
|
|
29
|
+
|
|
30
|
+
For example, an import may have `changes: [{mr: "https://git.example.org/team/project/merge_requests/42"}]`.
|
|
31
|
+
This is an illustrative URL, not a lookup target. The same payload without
|
|
32
|
+
changes imports an independent requirements discussion normally. Use the current
|
|
33
|
+
base_digest to change text or associations; explicit `changes: []` clears the
|
|
34
|
+
associations. Omission leaves the source's inline changes intact. When replacing
|
|
35
|
+
only the summary body, preserve existing associations unless explicitly removed.
|
|
36
|
+
Do not duplicate commit/MR fields into knowledge frontmatter.
|
|
37
|
+
|
|
38
|
+
Saving alone does not start indexing. Select a compatible Sessions Provider for
|
|
39
|
+
an independent reader topic, or keep an existing page's Code/Markdown primary
|
|
40
|
+
and include the summary in its authorized evidence/read scope. If specialized
|
|
41
|
+
interpretation is needed, explicitly select an extension from the Sessions or
|
|
42
|
+
business Provider. Knowledge turns useful conclusions into answers, explanations
|
|
43
|
+
and procedures, not a meeting recap. Existing structure.yaml source references
|
|
44
|
+
connect each relevant page/section to the saved summary and its optional changes.
|
|
45
|
+
|
|
46
|
+
Correct a faulty summary through source import with current base_digest and task
|
|
47
|
+
adjustment for pinned inputs. If the summary is accurate but the page is wrong,
|
|
48
|
+
revise the approved page. A new topic goes through structure review then normal
|
|
49
|
+
Author/Review. Neither knowledge approval nor source storage approves an upstream
|
|
50
|
+
change. A failed update retains source and approved knowledge for recovery.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Commit workspace results
|
|
2
|
+
|
|
3
|
+
Use Host Git tools, not an invented Context commit command. Commit only when
|
|
4
|
+
the user requests it; fully managed production does not itself authorize Git
|
|
5
|
+
commits or pushes. At the end of the entire requested production scope, after
|
|
6
|
+
close and all requested builds with no pending tasks, a single optional commit
|
|
7
|
+
suggestion is enough. Intermediate delivery is not that endpoint.
|
|
8
|
+
|
|
9
|
+
## Select the files
|
|
10
|
+
|
|
11
|
+
Locate the Context workspace and its actual Git root. Inspect status, staged
|
|
12
|
+
changes, unstaged changes, untracked files and ignore rules. In an embedded
|
|
13
|
+
workspace the Git root may be a much larger source repository. Explicitly select
|
|
14
|
+
workspace files; never run blanket `git add -A` or commit the entire staged index.
|
|
15
|
+
Check source records for required recovery information; a commit does not bundle
|
|
16
|
+
ignored checkouts or runtime progress. Do not force-add ignored files or assume
|
|
17
|
+
`dist` belongs in Git. Generated files are included only if the project's rules
|
|
18
|
+
and selected scope require them.
|
|
19
|
+
|
|
20
|
+
If there is no Git repository, establish the intended repository location before
|
|
21
|
+
initializing one. If nothing changed, report that no commit is necessary. If the
|
|
22
|
+
user asks for an intermediate snapshot, explain which saved files it contains
|
|
23
|
+
and that it cannot resume ignored Author state from Git alone.
|
|
24
|
+
|
|
25
|
+
## Commit the selected change
|
|
26
|
+
|
|
27
|
+
Summarize the actual change and choose a message consistent with repository rules.
|
|
28
|
+
Use precise paths and Git's scoped commit facilities or a carefully isolated
|
|
29
|
+
index. `git commit --only -- <paths>` can exclude unrelated staged files; new files
|
|
30
|
+
must first be known to the index. Inspect overlapping partially staged files
|
|
31
|
+
before selecting this approach: do not silently include changes the user did
|
|
32
|
+
not select. Preserve unrelated staged entries, including staged deletions.
|
|
33
|
+
|
|
34
|
+
Git identity, hooks, signing, conflicts and permissions are environmental
|
|
35
|
+
issues for the Agent to diagnose. Do not disable hooks or signing, rewrite global
|
|
36
|
+
Git configuration, stash other work or bypass ignore rules to force success.
|
|
37
|
+
Use an available authorized alternative or report the specific blocker.
|
|
38
|
+
|
|
39
|
+
## Verify the result
|
|
40
|
+
|
|
41
|
+
Read the actual commit SHA and its changed files/diff; compare against the
|
|
42
|
+
selected scope. Verify unrelated worktree and index content remain unchanged.
|
|
43
|
+
If a hook changed the result, inspect and report it before claiming completion.
|
|
44
|
+
Report the SHA and a brief description. Do not push, publish or create a remote
|
|
45
|
+
repository without the corresponding explicit request.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Prepare a workspace for the next task
|
|
2
|
+
|
|
3
|
+
Use only for an explicit workspace preparation request. The goal is usable
|
|
4
|
+
registered sources and no unfinished task, while retaining approved knowledge
|
|
5
|
+
and configuration. Lead with Host tools and actual observations; do not start
|
|
6
|
+
indexing merely because a status response offers production work.
|
|
7
|
+
|
|
8
|
+
## Establish the scope
|
|
9
|
+
|
|
10
|
+
Use `context entry` to locate the workspace. Inspect current work, active
|
|
11
|
+
processes, Git changes and source registrations. Explain which unfinished
|
|
12
|
+
drafts and queued maintenance will be discarded. Reuse the user's explicit
|
|
13
|
+
authorization; ask only about an unresolved loss, version or access boundary.
|
|
14
|
+
Wait for an active writer to finish and obtain its receipt before changing state.
|
|
15
|
+
If status is broken, inspect its diagnostic and files with Host tools rather
|
|
16
|
+
than treating failure as proof that the workspace is empty.
|
|
17
|
+
|
|
18
|
+
## End the old task
|
|
19
|
+
|
|
20
|
+
Run `context task prepare --format json`. It previews the exact Context-owned
|
|
21
|
+
task files, including production, Review and maintenance state. It preserves
|
|
22
|
+
approved pages, source records and snapshots, project configuration, repository
|
|
23
|
+
checkouts, other `.tmp` files and existing outputs. It does not claim the output
|
|
24
|
+
or sources are current.
|
|
25
|
+
|
|
26
|
+
Once discarding the shown scope is authorized, execute the returned apply
|
|
27
|
+
command with its plan digest. If the preview changes, inspect the new differences.
|
|
28
|
+
On interruption, rerun the preview and use its resume command; never clear a
|
|
29
|
+
transaction journal or repeat old Author submissions. Other incomplete writes
|
|
30
|
+
must be recovered before cleanup. The completion clears task state only; check
|
|
31
|
+
sources next. Do not manually delete the runtime directory to emulate this action.
|
|
32
|
+
|
|
33
|
+
Other caches are optional cleanup, not a requirement to empty `.tmp`. Inspect
|
|
34
|
+
their ownership and recoverability before deleting them with Host tools. Keep
|
|
35
|
+
reports, unique material, unknown files and modified checkouts unless their
|
|
36
|
+
specific loss is authorized. Do not delete locks, transaction records or active
|
|
37
|
+
tool directories. Empty task directories can remain.
|
|
38
|
+
|
|
39
|
+
## Restore usable sources
|
|
40
|
+
|
|
41
|
+
For repositories, run `context source recovery-plan --format json` and read
|
|
42
|
+
the installed repository recovery procedure and schema supplied by entry's
|
|
43
|
+
workflow bundle: `repository-source-recovery.md` beside this guide and
|
|
44
|
+
`../../schemas/repository-source-recovery.schema.json`. Reuse a matching local
|
|
45
|
+
checkout or, when authorized, clone into a bounded location using
|
|
46
|
+
`context source restore --input <workspace-input-file> --format json`.
|
|
47
|
+
Group modules sharing a remote and fixed commit; do not clone per module.
|
|
48
|
+
Check registered commit and module paths. Never reset a supplied dirty checkout.
|
|
49
|
+
Authentication or checkout problems can be diagnosed with Host Git tools;
|
|
50
|
+
refresh the recovery plan after fixing them. Do not substitute a newer commit.
|
|
51
|
+
|
|
52
|
+
For Lark, inspect the stored body and required attachments against the source
|
|
53
|
+
records. Use the Host's document tools and the [existing capture guide](knowledge-updates.md)
|
|
54
|
+
to repair missing material, retaining the registered identity. A current remote
|
|
55
|
+
response is not proof of an older snapshot: if it differs, explain that source
|
|
56
|
+
updating is needed and resolve that choice before claiming recovery. If an old
|
|
57
|
+
snapshot is unavailable, report the exact limitation. Do not automatically
|
|
58
|
+
follow every document link or reread already complete materials.
|
|
59
|
+
|
|
60
|
+
For note, sessions and local files, preserve formal source content and verify
|
|
61
|
+
that declared paths can be read. Do not reconstruct lost original sources from
|
|
62
|
+
generated knowledge or scan arbitrary local directories.
|
|
63
|
+
|
|
64
|
+
## Finish
|
|
65
|
+
|
|
66
|
+
Verify that no task files remain in the preparation preview, no writer remains,
|
|
67
|
+
the required configuration can load, and selected sources resolve to their
|
|
68
|
+
registered versions and paths. CLI inspection or direct Host checks are both
|
|
69
|
+
valid; a failed check is not ready. Report outstanding blockers and their next
|
|
70
|
+
action. Stop when ready for the next user request, without running Author or
|
|
71
|
+
recapturing everything. Historical restoration may additionally require a
|
|
72
|
+
close/build; see [restore a version](workspace-restore.md).
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Restore a historical workspace version
|
|
2
|
+
|
|
3
|
+
Use the Agent's Git and environment tools. This restores selected workspace
|
|
4
|
+
files and usable sources; it does not reset the entire repository, rewind source
|
|
5
|
+
repositories, or restore ignored runtime progress.
|
|
6
|
+
|
|
7
|
+
## Resolve the target
|
|
8
|
+
|
|
9
|
+
Locate the workspace and Git root, then inspect history for that workspace path.
|
|
10
|
+
With no explicit target, select the most recent commit saving its state to undo
|
|
11
|
+
uncommitted results. “Previous version” instead selects the preceding relevant
|
|
12
|
+
saved state, not mechanically `HEAD~1` of a large repository. Validate an explicit
|
|
13
|
+
SHA. For dates, use the user's timezone and actual meaning (for example, as of
|
|
14
|
+
end of that day), inspect candidate history and resolve ambiguity with the user.
|
|
15
|
+
Git history can be nonlinear; do not choose an unrelated branch by timestamp.
|
|
16
|
+
The final target is a concrete SHA and path scope, never a date string alone.
|
|
17
|
+
|
|
18
|
+
Compare target files with current tracked, untracked and staged files. Include
|
|
19
|
+
current additions absent at the target in the proposed removal scope. Keep
|
|
20
|
+
unrelated files, existing staged work and ignored source checkouts. Account for
|
|
21
|
+
workspace moves or renames instead of treating a missing old path as an empty
|
|
22
|
+
version. Reuse explicit authorization; ask when the target or loss is unresolved.
|
|
23
|
+
|
|
24
|
+
## Restore files and environment
|
|
25
|
+
|
|
26
|
+
Wait for active Context writers and obtain their result. Use the task-state
|
|
27
|
+
preview/apply from [workspace preparation](workspace-prepare.md) to abandon the
|
|
28
|
+
authorized old work before restoring files; it also clears pending maintenance.
|
|
29
|
+
Do not use an old Route after restoration.
|
|
30
|
+
|
|
31
|
+
Use Git to restore only the agreed paths from the selected SHA. A scoped
|
|
32
|
+
`git restore --source=<sha> --worktree -- <paths>` preserves branch history;
|
|
33
|
+
decide separately how authorized overlapping staged changes should be handled.
|
|
34
|
+
Use explicit deletion for agreed additions absent at the target. Never use a
|
|
35
|
+
whole-repository `reset --hard` or `clean -fdx` as a workspace shortcut.
|
|
36
|
+
|
|
37
|
+
Use the restored source records with the preparation guide to restore pinned
|
|
38
|
+
repository versions, module paths, document snapshots and attachments. New remote
|
|
39
|
+
content cannot stand in for lost old snapshots. Do not reclone usable sources.
|
|
40
|
+
On interruption, inspect the actual file diff and remaining source gaps and
|
|
41
|
+
continue those operations; do not assume the previous Git command completed or
|
|
42
|
+
replay old task submissions.
|
|
43
|
+
|
|
44
|
+
Old build output does not describe the restored version. If output is requested,
|
|
45
|
+
follow the current close/build or approved-output rebuild capability from the
|
|
46
|
+
[knowledge update guide](knowledge-updates.md); do not start full indexing merely
|
|
47
|
+
because the restored source configuration is available. Until rebuilt, state
|
|
48
|
+
that existing output is stale. If the historical schema is incompatible, diagnose
|
|
49
|
+
the available migration or tool-version choice, report necessary adaptations,
|
|
50
|
+
and do not pretend incompatible content is current or silently rewrite all pages.
|
|
51
|
+
|
|
52
|
+
## Verify and stop
|
|
53
|
+
|
|
54
|
+
Compare the selected files with the target commit, identify any agreed adaptations,
|
|
55
|
+
verify unrelated changes/index entries survived, and check source readiness and
|
|
56
|
+
absence of old task state. When building was requested, check the new output as
|
|
57
|
+
well. If only some sources could be restored, report partial completion with the
|
|
58
|
+
specific missing access or version. No automatic commit, branch rewrite or push;
|
|
59
|
+
the user may separately [commit the restored results](workspace-commit.md).
|
|
@@ -20,20 +20,32 @@ declare a separate extraction phase in `src/index.ts`.
|
|
|
20
20
|
| `@c4a/extract-ts` | TypeScript/JavaScript symbols, exports, imports, calls, and React Router routes |
|
|
21
21
|
| `@c4a/extract-go` | Go declarations, imports, calls, and common HTTP routes |
|
|
22
22
|
| `@c4a/extract-rush` | Rush projects, tags, entries, dependencies, and owner boundaries |
|
|
23
|
+
| `@c4a/extract-thrift` | Thrift services, methods and declared data types |
|
|
24
|
+
| `@c4a/extract-proto` | Protobuf messages, fields and service definitions |
|
|
25
|
+
| `@c4a/extract-mdx` | Markdown/MDX document structure and source spans |
|
|
26
|
+
| `@c4a/extract-contract` | Supported structured API contract declarations |
|
|
27
|
+
| `@c4a/extract-style` | Stylesheet declarations, selectors and related structure |
|
|
28
|
+
| `@c4a/extract-sql` | Supported SQL schema declarations |
|
|
23
29
|
| `@c4a/extract` | Shared extraction result and adapter contracts |
|
|
24
30
|
|
|
25
31
|
These packages do not create Candidate rows, write `knowledge/`, or control
|
|
26
|
-
Review. The
|
|
32
|
+
Review. The CLI owns those lifecycle responsibilities; Providers interpret the
|
|
33
|
+
supplied facts and sources and return structured semantic results. Package
|
|
34
|
+
presence alone does not prove a parser is selected or supports every dialect.
|
|
35
|
+
Use the selected profile's actual capabilities and parser diagnostics.
|
|
27
36
|
|
|
28
37
|
## Unsupported technologies
|
|
29
38
|
|
|
30
|
-
When
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
When a required boundary is unsupported, distinguish a parser limitation from
|
|
40
|
+
missing writing guidance. Config can select supported behavior; instructions or
|
|
41
|
+
templates cannot create missing structural facts. Follow the current Route's
|
|
42
|
+
capability-gap report and smallest supported customization step. A program
|
|
43
|
+
extension requires its existing execution authorization. Prefer a reusable
|
|
44
|
+
parser when the same technology is useful across projects; do not create a
|
|
45
|
+
parallel project-local knowledge pipeline.
|
|
46
|
+
|
|
47
|
+
Mechanical inventory closure requires an explicit disposition for each supplied
|
|
48
|
+
item. It does not prove that the pages answer the reader's questions. Review
|
|
49
|
+
checks usefulness and fidelity separately. Internal or out-of-scope items can
|
|
50
|
+
have justified exclusions without generating pages; symbol count is not a
|
|
51
|
+
knowledge-quality measure.
|
|
@@ -1,12 +1,51 @@
|
|
|
1
1
|
# Indexer Provider protocol
|
|
2
2
|
|
|
3
3
|
Context defines one Provider manifest, `context-indexer.yaml`, with protocol
|
|
4
|
-
`context.indexer.provider/v1`. Code and
|
|
4
|
+
`context.indexer.provider/v1`. Code, Markdown, Note and Sessions Providers use the same field
|
|
5
5
|
tree; `domains`, profiles and declared operations describe their applicable
|
|
6
6
|
inputs.
|
|
7
7
|
|
|
8
8
|
This page documents the protocol surface currently exposed by `@c4a/context`.
|
|
9
|
-
|
|
9
|
+
Use the current CLI Route for executable inputs, schemas and selected resources.
|
|
10
|
+
A protocol validator exported by the SDK is not a separate production workflow.
|
|
11
|
+
|
|
12
|
+
## Articles supported by approved knowledge
|
|
13
|
+
|
|
14
|
+
An article plan may declare `knowledge_dependencies`: stable `artifact_ref`,
|
|
15
|
+
optional `section_refs` (empty means the approved article), and `required`.
|
|
16
|
+
Use references supplied by Context; reader titles and output paths are not
|
|
17
|
+
article identities. Each article keeps its existing primary subject and owned
|
|
18
|
+
members. Referencing another article does not assign its members again.
|
|
19
|
+
|
|
20
|
+
The current Partition/Author workflow delivers ready upstream articles before
|
|
21
|
+
dependent required articles. An unavailable dependency remains visible in the
|
|
22
|
+
structure preview; `request-adjustment` returns to planning. It cannot finish
|
|
23
|
+
as an empty Author wave. Optional Composer output does not satisfy a required
|
|
24
|
+
article plan.
|
|
25
|
+
|
|
26
|
+
Review saves the approved fact payloads, evidence coordinates and versions with
|
|
27
|
+
the approved Markdown transaction. These remain in `knowledge/structure.yaml`
|
|
28
|
+
after close and temporary-cache cleanup. Author receives authorized supporting
|
|
29
|
+
facts separately from approved interpretation. Current source captures, the
|
|
30
|
+
Provider's accepted evidence kinds and the approved article version constrain
|
|
31
|
+
that projection. A stored snapshot alone never expands source access.
|
|
32
|
+
|
|
33
|
+
Previously approved dependencies can reuse their registered source reader even
|
|
34
|
+
when that source has no owned Partition group in the current wave. Only the
|
|
35
|
+
referenced authorized files enter the supporting projection. Missing or changed
|
|
36
|
+
source files remain an upstream update task.
|
|
37
|
+
|
|
38
|
+
An approved dependency change produces a verification warning for downstream
|
|
39
|
+
articles. Use the existing `context revise` action on an affected article; its
|
|
40
|
+
current route exposes `knowledge_input` with supporting facts and interpretations.
|
|
41
|
+
Review accepts the refreshed supporting version even when the Agent confirms
|
|
42
|
+
that the wording can stay the same. A plain edit with unavailable support does
|
|
43
|
+
not clear the warning. `--regenerate` remains the existing program-block rebuild
|
|
44
|
+
option, not a prerequisite for revising a prose synthesis.
|
|
45
|
+
|
|
46
|
+
Writing style, chapter drift and ordinary Provider version differences remain
|
|
47
|
+
guidance. Changed source/approval identities invalidate an in-flight supporting
|
|
48
|
+
projection; they are not semantic content judgments.
|
|
10
49
|
|
|
11
50
|
## Resources and execution
|
|
12
51
|
|
|
@@ -76,6 +115,15 @@ config against the Bundle's closed data-only schema, binds the project-local
|
|
|
76
115
|
customization fingerprint and requires a policy digest for executable
|
|
77
116
|
resources. Missing, duplicate, stale or extra inputs fail closed.
|
|
78
117
|
|
|
118
|
+
Selection validation is not an upgrade gate on an instruction-only bundled
|
|
119
|
+
Provider. On resume, the CLI resolves that Provider by Skill and portable
|
|
120
|
+
distribution from the current installation, checks the required capabilities,
|
|
121
|
+
and refreshes instruction delivery without comparing it to the registry's
|
|
122
|
+
historical version/integrity. Compatible persisted tasks keep their original
|
|
123
|
+
request/result identities. The current Route revision still prevents stale
|
|
124
|
+
submissions. This does not change staged program execution authorization or
|
|
125
|
+
allow results to be reused across changed source, config or result contracts.
|
|
126
|
+
|
|
79
127
|
The final stable report excludes transport paths, delivery timestamps and
|
|
80
128
|
runtime receipt digests. Those values remain in a separate runtime receipt
|
|
81
129
|
projection, so rematerializing identical content does not make the selection
|
|
@@ -375,6 +423,19 @@ temporary Provider path.
|
|
|
375
423
|
|
|
376
424
|
## Controlled invocation
|
|
377
425
|
|
|
426
|
+
Author result acceptance checks the actual task, source/module, subject and
|
|
427
|
+
Provider layer. Provider integrity, bundle/config/customization fingerprints
|
|
428
|
+
remain recorded metadata, not byte-equality gates between a resumed request and
|
|
429
|
+
its result. Selected Facts are resolved by their supplied identity and source
|
|
430
|
+
references; their current values are recorded without comparing a previous
|
|
431
|
+
parser payload digest. Source-span line ranges may expand within the same file
|
|
432
|
+
content. Structured declarations resolve actual file/item identities, not a
|
|
433
|
+
previous inventory or signature fingerprint. Source file content checks,
|
|
434
|
+
unknown-reference rejection and atomic write protection remain in force.
|
|
435
|
+
|
|
436
|
+
These continuation rules do not relax executable program authorization or allow
|
|
437
|
+
an Agent to select undeclared sources.
|
|
438
|
+
|
|
378
439
|
`context.indexer.controlled-invocation/v1` binds:
|
|
379
440
|
|
|
380
441
|
- the exact Indexer, Provider, version, Bundle integrity and stable Provider
|
|
@@ -387,7 +448,7 @@ temporary Provider path.
|
|
|
387
448
|
- a stable trust-policy and authority digest;
|
|
388
449
|
- timeout and stdin/stdout/stderr byte limits.
|
|
389
450
|
|
|
390
|
-
The
|
|
451
|
+
The built-in Host capability is `sandboxed_program: false`. A first-party,
|
|
391
452
|
verified or exact project-authorized program may use the `trusted-program` path,
|
|
392
453
|
which is not an isolation claim. An untrusted program without a real sandbox is
|
|
393
454
|
not executable.
|
|
@@ -535,8 +596,11 @@ children, cycles, path collisions and unregistered files fail. Reader bodies
|
|
|
535
596
|
over 1500 lines produce a non-blocking advisory only. Total physical Artifact
|
|
536
597
|
count has no global maximum.
|
|
537
598
|
|
|
538
|
-
An initial layout does not create
|
|
539
|
-
|
|
599
|
+
An initial layout does not create the protected `confirm-layout-change` Gate.
|
|
600
|
+
The main lifecycle still reviews its semantic structure before Author in
|
|
601
|
+
ordinary mode; new topics in an update receive that structure review too.
|
|
602
|
+
A content-only increment reuses the existing Artifact identity and skips the
|
|
603
|
+
protected layout-change Gate. Adding reader
|
|
540
604
|
fan-out to an already approved Node, removing or renaming an Artifact,
|
|
541
605
|
splitting/merging its declared lineage, moving a logical Section, or changing
|
|
542
606
|
an approved collection/path is represented by a digest-bound layout change
|
|
@@ -585,9 +649,11 @@ ledger, answer workset, or special close route for them.
|
|
|
585
649
|
Newly captured Markdown, tool snapshots, or other authorized material re-enter
|
|
586
650
|
the normal `main-index` operation. The affected Partition and Author worksets
|
|
587
651
|
run again, reconciliation is recomputed, and the user reviews the resulting
|
|
588
|
-
knowledge Candidate
|
|
589
|
-
|
|
590
|
-
|
|
652
|
+
knowledge Candidate through the existing content Review. Review apply writes
|
|
653
|
+
approved Markdown; close projects `knowledge/structure.yaml` and verifies it.
|
|
654
|
+
Delivery retains accepted work while more pages remain, then cleans completed
|
|
655
|
+
transient state. Durable `processed_scopes` advance only after the selected
|
|
656
|
+
scope's required work and build complete, not after one page in that scope.
|
|
591
657
|
|
|
592
658
|
## Detector and inspector
|
|
593
659
|
|
|
@@ -698,7 +764,7 @@ Only `{{variable:<id>}}` and `{{block:<id>}}` are accepted. Direct variables are
|
|
|
698
764
|
semantic prose. A block source variable is a deterministic Fact projection,
|
|
699
765
|
must bind canonical `fact_refs`, and must equal the CLI's normalized projection
|
|
700
766
|
of those Facts. Blocks select one of
|
|
701
|
-
the CLI-owned `bullet-list`, `key-value-table
|
|
767
|
+
the CLI-owned `bullet-list`, `key-value-table`, `json-code-block` or `public-contract-table` renderers;
|
|
702
768
|
templates cannot register code or helpers. A block directive occupies its own
|
|
703
769
|
template line so the renderer can retain an exact content-layer boundary. The
|
|
704
770
|
contract and body must declare exactly the same Sections and placeholders.
|
|
@@ -713,12 +779,13 @@ or sufficient evidence is absent from the rendered Candidate. A required
|
|
|
713
779
|
Section in the same state becomes the already-declared material-question
|
|
714
780
|
transition and makes `review_ready` false.
|
|
715
781
|
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
782
|
+
Context validates template-program directives, declared variable types and
|
|
783
|
+
expansion limits before rendering. Supplied variable values and Section prose
|
|
784
|
+
are content, not template programs: JSX, braces, comments, TODOs, headings and
|
|
785
|
+
example placeholders do not cause a content-validation failure. Missing or
|
|
786
|
+
invalid structured input is distinct from an author's choice of words.
|
|
787
|
+
Unfilled authoring placeholders can be mentioned during the existing Agent or
|
|
788
|
+
user Review, but are not an additional CLI gate. The rendered
|
|
722
789
|
Section content, ordered content-layer ledger and evidence receive stable
|
|
723
790
|
digests. Deterministic blocks contribute catalog completeness but never
|
|
724
791
|
semantic-prose density. Later `build` projects this approved body; it does not
|
|
@@ -732,10 +799,37 @@ unit, one of its CLI-owned inventory members, or an authorized target-resolution
|
|
|
732
799
|
identity. Missing owners, outside subjects, unknown evidence and evidence that
|
|
733
800
|
is known globally but absent from the owner Section all fail Result validation.
|
|
734
801
|
|
|
735
|
-
Main-run validation
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
802
|
+
Main-run validation does not produce a prose-quality audit. Content usefulness,
|
|
803
|
+
completeness and faithfulness belong to the existing Agent or user Review.
|
|
804
|
+
Structured owner/source checks still run, but no keyword, punctuation, heading
|
|
805
|
+
or sentence-pattern scan can reject an otherwise valid Result. Physical output
|
|
806
|
+
checks distinguish a missing or blank body from an authored body; they do not
|
|
807
|
+
decide whether headings, comments or short prose are sufficient knowledge.
|
|
808
|
+
|
|
809
|
+
### Groups narrowed by a scope decision
|
|
810
|
+
|
|
811
|
+
The CLI may attach `scope_change.removed_member_ids` to a derived PartitionPlan
|
|
812
|
+
group after excluding only part of its membership. This is runtime provenance,
|
|
813
|
+
not an extra field Provider authors should invent in semantic Partition results.
|
|
814
|
+
The remaining identity stays stable; the old page form/template is no longer a
|
|
815
|
+
binding choice. Author receives the change in `page_plan.scope_change` and must
|
|
816
|
+
reassess the residual sources, title and reader task. It can choose an allowed
|
|
817
|
+
page form or an applicable non-publishing outcome. This metadata does not belong
|
|
818
|
+
in knowledge frontmatter and is not proof that remaining material is useful.
|
|
819
|
+
|
|
820
|
+
## Incremental planning handoff
|
|
821
|
+
|
|
822
|
+
A semantic Partition group may declare `ready_for_author: true` when the Agent
|
|
823
|
+
has resolved its subject, primary ownership, reader task and shared dependencies.
|
|
824
|
+
The CLI can then deliver an initial wave before all Partition tasks are accepted.
|
|
825
|
+
This is an optional scheduling declaration, not a new evidence or approval gate.
|
|
826
|
+
Absent/false groups wait; every inventory member still needs a final disposition.
|
|
827
|
+
The original Partition ledger resumes after normal structure review, Author,
|
|
828
|
+
Composer, content Review, close and successful build. Later material for the same
|
|
829
|
+
subject reuses its page identity and approved prose. A wave finishing never means
|
|
830
|
+
the remaining source scope is complete.
|
|
831
|
+
|
|
832
|
+
Known code-symbol planning views provide member overviews with immutable full
|
|
833
|
+
fact links and bounded captured-source access. Providers must inspect details
|
|
834
|
+
when semantic boundaries are uncertain; unknown payload formats retain full
|
|
835
|
+
reading. Author receives full selected facts and source material.
|
|
@@ -182,7 +182,7 @@ Built-in variables:
|
|
|
182
182
|
| `{{displayName}}` | Display name. Defaults to a title-cased `packageName`; override with `template.vars.displayName`. |
|
|
183
183
|
| `{{knowledgeCount}}` | Number of selected approved Markdown files. |
|
|
184
184
|
| `{{knowledgeTimestamp}}` | Latest `timestamp` from selected approved Markdown, or `1970-01-01T00:00:00.000Z` when empty. |
|
|
185
|
-
| `{{knowledge}}` | Concatenated selected approved
|
|
185
|
+
| `{{knowledge}}` | Concatenated consumer projection of selected approved pages, with path headings and without lifecycle metadata. |
|
|
186
186
|
| `{{approvedKnowledge}}` | Alias for `{{knowledge}}`. |
|
|
187
187
|
| `{{knowledgeItems}}` | Array of selected approved knowledge page metadata for loops. |
|
|
188
188
|
| `{{knowledgeGroups}}` | Selected approved knowledge pages grouped by OKF root and first directory segment; each item also exposes `internal_collection`. |
|
|
@@ -322,7 +322,7 @@ Approved Markdown under `knowledge/` and its deterministic
|
|
|
322
322
|
revision, or build. Do not copy a compact page as a new page without using a
|
|
323
323
|
Context authoring command;
|
|
324
324
|
- do not nest Context production metadata under `context`; fields such as
|
|
325
|
-
`context.sources` and `context.code_symbols` are not
|
|
325
|
+
`context.sources` and `context.code_symbols` are not accepted production fields;
|
|
326
326
|
- section provenance lives in `<!-- context:section ... source_ref="..." -->`
|
|
327
327
|
comments. When a Section needs more than one citation, the CLI preserves the
|
|
328
328
|
complete set in its adjacent `context:source_refs` block;
|
|
@@ -352,8 +352,9 @@ treat the complete `source_ref` as opaque. Production pages do not expose
|
|
|
352
352
|
Candidate fingerprints, Indexer digests, or `code_origin`.
|
|
353
353
|
|
|
354
354
|
`#span:` refs retain source snapshot line ranges for human review, diffing, and
|
|
355
|
-
stable re-pinning. They resolve against
|
|
356
|
-
not the code symbol index.
|
|
355
|
+
stable re-pinning. They resolve against the stored file/Lark snapshot or the saved
|
|
356
|
+
Note/Sessions Markdown, not the code symbol index. A session's optional commit/MR
|
|
357
|
+
association stays in its source file; knowledge does not duplicate those fields.
|
|
357
358
|
|
|
358
359
|
The kb package root may contain agent files such as `AGENTS.md` and `skills/`.
|
|
359
360
|
The OKF-compatible surface is the selected `wikis/`, `guides/`, `rules/`, and
|
|
@@ -373,11 +374,11 @@ The OKF-compatible surface is the selected `wikis/`, `guides/`, `rules/`, and
|
|
|
373
374
|
6. Writes output under `dist/<package-name>/`.
|
|
374
375
|
|
|
375
376
|
`context-build-inventory.json` records what was selected and why. Each selected
|
|
376
|
-
file includes `selected_by` entries such as `{ "kind": "collection" }
|
|
377
|
-
`
|
|
378
|
-
and
|
|
379
|
-
|
|
380
|
-
|
|
377
|
+
file includes `selected_by` entries such as `{ "kind": "collection" }`,
|
|
378
|
+
`{ "kind": "okf_root" }`, `{ "kind": "include" }`, or `{ "kind": "default" }`,
|
|
379
|
+
and a `production_metadata` object for selected page-level production fields.
|
|
380
|
+
Child and relationship records use the inventory's canonical structure
|
|
381
|
+
projection. The inventory exposes package-visible typed
|
|
381
382
|
edges under `structure.edge_records`; these records are filtered to edges whose
|
|
382
383
|
endpoints are present in the selected package. Use those edge records for
|
|
383
384
|
relationship citations inside the package instead of assuming the workspace
|
|
@@ -26,14 +26,30 @@ state.
|
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
28
|
const repo = source("20260901", "component-lib");
|
|
29
|
-
const docs = source("product-docs", { type: "file" });
|
|
30
|
-
const handbook = source("handbook", { type: "lark" });
|
|
31
|
-
const
|
|
29
|
+
const docs = source("20260901/product-docs", { type: "file" });
|
|
30
|
+
const handbook = source("20260901/handbook", { type: "lark" });
|
|
31
|
+
const note = source("20260908/decision-context.md", { type: "note" });
|
|
32
|
+
const session = source("20260908/design-discussion.md", { type: "sessions" });
|
|
33
|
+
const everyRepo = allSources("repo"); // array: use ...everyRepo inside sources
|
|
34
|
+
const everySession = allSources("sessions");
|
|
32
35
|
```
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
`sources
|
|
36
|
-
|
|
37
|
+
Repo, file and Lark references resolve against their respective
|
|
38
|
+
`sources/<type>/index.yaml`. Their names include the registration date and module.
|
|
39
|
+
Register or refresh them through `context source ...`.
|
|
40
|
+
|
|
41
|
+
Note and Sessions references resolve directly to saved Markdown under
|
|
42
|
+
`sources/note/YYYYMMDD/topic.md` and `sources/sessions/YYYYMMDD/topic.md`.
|
|
43
|
+
Use `context source import` to save them; they have no separate registry or
|
|
44
|
+
capture phase. Explicitly include the desired typed references in `sources`,
|
|
45
|
+
for example `sources: [note, session]`, or use `sources: [...everySession]`
|
|
46
|
+
when all saved sessions are intended. Merely saving a source does not select it.
|
|
47
|
+
|
|
48
|
+
A project's source list enables acquisition and initial selection; requirements
|
|
49
|
+
and the selected Indexer's target/read scopes determine what it owns and may read.
|
|
50
|
+
Supporting text does not require a separate page or primary Indexer. See
|
|
51
|
+
[note preparation](../guides/note.md), [sessions preparation](../guides/sessions.md)
|
|
52
|
+
and [knowledge updates](../guides/knowledge-updates.md).
|
|
37
53
|
|
|
38
54
|
## Capture phases
|
|
39
55
|
|
|
@@ -44,8 +60,10 @@ captureLark({ source: handbook });
|
|
|
44
60
|
```
|
|
45
61
|
|
|
46
62
|
Capture only creates a deterministic readable snapshot. Classification,
|
|
47
|
-
partitioning
|
|
48
|
-
|
|
63
|
+
partitioning and authoring use the selected Provider's guidance. The CLI owns
|
|
64
|
+
worksets, Candidate creation, Review application and delivery. Code, Markdown,
|
|
65
|
+
Note and Sessions Providers can use authorized supporting documents without
|
|
66
|
+
creating a second capture or knowledge pipeline.
|
|
49
67
|
|
|
50
68
|
## `customPhase`
|
|
51
69
|
|
|
@@ -79,8 +97,10 @@ may be rebuilt; it is not an authoring source.
|
|
|
79
97
|
|
|
80
98
|
## Indexer registry
|
|
81
99
|
|
|
82
|
-
|
|
83
|
-
|
|
100
|
+
When this file is absent, the configuration Route supplies the initial schema:
|
|
101
|
+
write confirmed `requirements` with `indexers: []`, then re-evaluate. The Provider
|
|
102
|
+
selection Action supplies its own completion schema; that payload is not the
|
|
103
|
+
configuration file. Subsequent changes use typed proposals and applicable gates. Each selected Indexer binds requirements and scopes to one
|
|
84
104
|
primary Provider, with optional declared layers or composers. Provider code
|
|
85
105
|
must return the current Indexer result protocol; it must not write Candidate,
|
|
86
106
|
knowledge, or Review files directly.
|
|
@@ -90,6 +110,20 @@ current workflow Route when it is needed.
|
|
|
90
110
|
|
|
91
111
|
## Persistent versus runtime state
|
|
92
112
|
|
|
93
|
-
|
|
94
|
-
and approved knowledge
|
|
95
|
-
|
|
113
|
+
Source registries and snapshots, saved notes/summaries, project declarations,
|
|
114
|
+
package templates and approved knowledge are durable inputs. Version them only
|
|
115
|
+
when Git operations are authorized. Keep `.tmp/context-runtime/` out of Git;
|
|
116
|
+
it contains unfinished execution state, not the sole source of recovery truth.
|
|
117
|
+
|
|
118
|
+
`knowledge/structure.yaml` keeps shared page/source metadata and compact
|
|
119
|
+
`processed_scopes` for completed requirement/source/module ranges. A partial
|
|
120
|
+
update or failed build does not advance the whole range's processed version.
|
|
121
|
+
Session commit/MR associations stay in the saved source frontmatter, not copied
|
|
122
|
+
into every knowledge page. Use the CLI to adjust or roll back current work;
|
|
123
|
+
do not edit these baselines or remove runtime files to simulate completion.
|
|
124
|
+
|
|
125
|
+
## Source visual conversion preference
|
|
126
|
+
|
|
127
|
+
Workspace `package.json` accepts `context.convertVisuals` (boolean, default `true`). Initialization writes it explicitly; older workspaces without the field also default to enabled. This lets a capable Author Agent attempt faithful structural diagram/table conversion. Explicit session instructions override the saved preference. It does not disable native table capture or existing Mermaid when false.
|
|
128
|
+
|
|
129
|
+
Diagram style follows the workspace’s editable `AGENTS.md`; newly initialized workspaces default to minimal theme-aware diagrams without decorative colors. If the Agent cannot read the image or cannot preserve its meaning, it retains the original through the existing asset workflow. Source-based reuse avoids rereading unchanged visuals; file integrity and package hashes continue to reflect actual output changes.
|