@c4a/context-cli 0.7.26 → 0.7.29

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "protocol": "context.indexer.cli-release-manifest/v1",
3
3
  "package": "@c4a/context-cli",
4
- "version": "0.7.26",
4
+ "version": "0.7.29",
5
5
  "issuer": "context4ai/context",
6
6
  "bundles": [
7
7
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4a/context-cli",
3
- "version": "0.7.26",
3
+ "version": "0.7.29",
4
4
  "type": "module",
5
5
  "description": "Local runtime and Agent integration for traceable knowledge production",
6
6
  "license": "MIT",
@@ -24,17 +24,17 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@c4a/agent-graph": "0.3.0",
27
- "@c4a/context": "0.7.26",
28
- "@c4a/extract": "0.7.26",
29
- "@c4a/extract-contract": "0.7.26",
30
- "@c4a/extract-go": "0.7.26",
31
- "@c4a/extract-mdx": "0.7.26",
32
- "@c4a/extract-proto": "0.7.26",
33
- "@c4a/extract-rush": "0.7.26",
34
- "@c4a/extract-sql": "0.7.26",
35
- "@c4a/extract-style": "0.7.26",
36
- "@c4a/extract-thrift": "0.7.26",
37
- "@c4a/extract-ts": "0.7.26",
27
+ "@c4a/context": "0.7.29",
28
+ "@c4a/extract": "0.7.29",
29
+ "@c4a/extract-contract": "0.7.29",
30
+ "@c4a/extract-go": "0.7.29",
31
+ "@c4a/extract-mdx": "0.7.29",
32
+ "@c4a/extract-proto": "0.7.29",
33
+ "@c4a/extract-rush": "0.7.29",
34
+ "@c4a/extract-sql": "0.7.29",
35
+ "@c4a/extract-style": "0.7.29",
36
+ "@c4a/extract-thrift": "0.7.29",
37
+ "@c4a/extract-ts": "0.7.29",
38
38
  "@mermaid-js/layout-elk": "0.2.0",
39
39
  "commander": "^11.0.0",
40
40
  "fast-xml-parser": "^5.10.1",
@@ -20765,24 +20765,78 @@ var init_indexerSourceBoundary = __esm(() => {
20765
20765
  init_indexerReadScopeAuthorization();
20766
20766
  });
20767
20767
 
20768
+ // src/lib/errors.ts
20769
+ var ContextError;
20770
+ var init_errors2 = __esm(() => {
20771
+ ContextError = class ContextError extends Error {
20772
+ code;
20773
+ detail;
20774
+ constructor(code, message, detail) {
20775
+ super(message);
20776
+ this.name = "ContextError";
20777
+ this.code = code;
20778
+ this.detail = detail;
20779
+ }
20780
+ };
20781
+ });
20782
+
20783
+ // src/types/exitCode.ts
20784
+ var ExitCode;
20785
+ var init_exitCode = __esm(() => {
20786
+ ExitCode = {
20787
+ Success: 0,
20788
+ UserError: 1,
20789
+ WorkspaceStateError: 2,
20790
+ ExternalToolError: 3,
20791
+ UserAbort: 4
20792
+ };
20793
+ });
20794
+
20795
+ // src/lib/cliFeedback.ts
20796
+ function formatFeedback(block) {
20797
+ const subjectPart = block.subject ? ` ${block.subject}` : "";
20798
+ const lines = [`${block.symbol} ${block.action}${subjectPart}: ${block.headline}`];
20799
+ for (const item of block.body ?? []) {
20800
+ if (item === false || item === null || item === undefined)
20801
+ continue;
20802
+ if (typeof item === "string") {
20803
+ lines.push(item.length > 0 ? ` ${item}` : "");
20804
+ }
20805
+ }
20806
+ if (block.next) {
20807
+ lines.push(` next: ${block.next}`);
20808
+ }
20809
+ return `${lines.join(`
20810
+ `)}
20811
+ `;
20812
+ }
20813
+ var ErrorCategory;
20814
+ var init_cliFeedback = __esm(() => {
20815
+ ErrorCategory = {
20816
+ WorkspaceNotFound: "workspace-not-found",
20817
+ WorkspaceStateInvalid: "workspace-state-invalid",
20818
+ WorkflowRevisionStale: "workflow-revision-stale",
20819
+ SourceNotFound: "source-not-found",
20820
+ MountMatrixViolation: "mount-matrix-violation",
20821
+ SchemaInvalid: "schema-invalid",
20822
+ ProviderUnavailable: "provider-unavailable",
20823
+ ExternalToolFailed: "external-tool-failed",
20824
+ PartialFailure: "partial-failure",
20825
+ UserInputInvalid: "user-input-invalid",
20826
+ Unknown: "unknown"
20827
+ };
20828
+ });
20829
+
20768
20830
  // src/project/indexerParserSourceMaterialization.ts
20769
20831
  import { execFile } from "node:child_process";
20770
- import { lstat as lstat2, readFile as readFile6 } from "node:fs/promises";
20832
+ import { lstat as lstat2, readFile as readFile6, stat as stat2 } from "node:fs/promises";
20771
20833
  import { promisify } from "node:util";
20772
20834
  import { basename, extname, join as join4 } from "node:path";
20773
20835
  function sourceRefName(sourceRef) {
20774
20836
  return sourceRef.startsWith("repo:") ? sourceRef.slice("repo:".length) : null;
20775
20837
  }
20776
20838
  async function trackedPaths(root, ref) {
20777
- try {
20778
- await execFileAsync("git", ["diff", "--quiet", ref, "--", "."], { cwd: root });
20779
- } catch (error) {
20780
- const exitCode = error !== null && typeof error === "object" && "code" in error ? error.code : null;
20781
- if (exitCode === 1) {
20782
- throw new TypeError(`materialized repository source differs from its pinned ref: ${root}`);
20783
- }
20784
- throw error;
20785
- }
20839
+ await assertPinnedSource(root, ref);
20786
20840
  const { stdout } = await execFileAsync("git", ["ls-files", "-z", "--", "."], {
20787
20841
  cwd: root,
20788
20842
  encoding: "buffer",
@@ -20791,6 +20845,20 @@ async function trackedPaths(root, ref) {
20791
20845
  return Buffer.from(stdout).toString("utf8").split("\x00").filter(Boolean).sort();
20792
20846
  }
20793
20847
  async function assertPinnedSource(root, ref) {
20848
+ const sourceStat = await stat2(root).catch((error) => {
20849
+ if (error.code === "ENOENT" || error.code === "ENOTDIR")
20850
+ return;
20851
+ throw error;
20852
+ });
20853
+ if (!sourceStat?.isDirectory()) {
20854
+ throw new ContextError(ExitCode.WorkspaceStateError, `Repository source directory is unavailable: ${root}. Inspect recovery with context source recovery-plan --format json.`, {
20855
+ category: ErrorCategory.WorkspaceStateInvalid,
20856
+ reason_code: "repository-source-directory-unavailable",
20857
+ cwd: root,
20858
+ next_action: { command: "context source recovery-plan --format json" },
20859
+ input_schema: { type: "object", properties: {}, additionalProperties: false }
20860
+ });
20861
+ }
20794
20862
  try {
20795
20863
  await execFileAsync("git", ["diff", "--quiet", ref, "--", "."], { cwd: root });
20796
20864
  } catch (error) {
@@ -20798,6 +20866,15 @@ async function assertPinnedSource(root, ref) {
20798
20866
  if (exitCode === 1) {
20799
20867
  throw new TypeError(`materialized repository source differs from its pinned ref: ${root}`);
20800
20868
  }
20869
+ if (exitCode === "ENOENT") {
20870
+ throw new ContextError(ExitCode.ExternalToolError, `Git could not start for repository source ${root}. Check git --version and the source directory in the same host environment.`, {
20871
+ category: ErrorCategory.ExternalToolFailed,
20872
+ reason_code: "repository-git-spawn-unavailable",
20873
+ cwd: root,
20874
+ next_action: { command: "git --version" },
20875
+ input_schema: { type: "object", properties: {}, additionalProperties: false }
20876
+ });
20877
+ }
20801
20878
  throw error;
20802
20879
  }
20803
20880
  }
@@ -20861,6 +20938,9 @@ var init_indexerParserSourceMaterialization = __esm(() => {
20861
20938
  init_src();
20862
20939
  init_indexerReadScopeAuthorization();
20863
20940
  init_indexerSourceBoundary();
20941
+ init_errors2();
20942
+ init_exitCode();
20943
+ init_cliFeedback();
20864
20944
  execFileAsync = promisify(execFile);
20865
20945
  });
20866
20946
 
package/plugins/README.md CHANGED
@@ -31,7 +31,7 @@ Context workflow and Indexer Provider lifecycle.
31
31
  ## Query and attribute workspace knowledge
32
32
 
33
33
  Explicitly invoke `/c4a:context-inspect-search` (Cursor: `/c4a-context-inspect-search`),
34
- or let a host configuration route knowledge questions to the `context-inspect-search` Skill. It can start from a readable local, global or host-provided knowledge package and its query Skill without a local workspace. Without output, it
34
+ or let a host configuration route knowledge questions to the `context-inspect-search` Skill. `CONTEXT_QUERY_SOURCE_MODE` selects `repo-first` (the default), `package-first`, or `dual` retrieval. It can start from a readable local, global or host-provided knowledge package and its query Skill without a local workspace. Without output, it
35
35
  queries approved `knowledge` directly; a package build requires prior authorization for that workspace write.
36
36
  Read-only investigation and bounded non-destructive checks need no further approval. For code attribution, it
37
37
  retrieves the registered revision and checks relevant differences against current code without asking the user to select a version.
@@ -27,7 +27,7 @@ Skills 只能通过完成校验的 Context Indexer Provider 生命周期激活
27
27
  ## 查询知识与来源归因
28
28
 
29
29
  主动调用 `/c4a:context-inspect-search`(Cursor:`/c4a-context-inspect-search`),
30
- 或由宿主配置将知识问答路由到 `context-inspect-search` 技能。无需本地工作区即可检索本地、全局或宿主提供的知识包,优先使用包内查询技能;没有产物但有工作区时,
30
+ 或由宿主配置将知识问答路由到 `context-inspect-search` 技能。`CONTEXT_QUERY_SOURCE_MODE` 可选择默认的 `repo-first`、`package-first` 或 `dual` 检索。无需本地工作区也可检索本地、全局或宿主提供的知识包;没有产物但有工作区时,
31
31
  直接查询已批准的 `knowledge`,构建产物需事先获得写入工作区的授权。只读探索及有边界的
32
32
  非破坏性检查无需再次确认。代码归因自动取得登记版本,并核对相关文件与当前代码的差异,
33
33
  无需用户选择版本。通过构建清单关联批准原稿
package/plugins/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.26
1
+ 0.7.29
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "c4a",
3
3
  "description": "Start or continue a project-local knowledge workspace through one graph-routed entry.",
4
- "version": "0.7.26",
4
+ "version": "0.7.29",
5
5
  "author": {
6
6
  "name": "c4a"
7
7
  },
@@ -26,14 +26,35 @@ Do not execute returned production actions, initialize a replacement workspace,
26
26
  or install tools without existing authorization. Querying must not alter source
27
27
  registrations, snapshots, tasks, approvals or user checkouts.
28
28
 
29
- ## Search available material concurrently
30
-
31
- Check relevant knowledge packages, the workspace and reusable source checkouts
32
- in parallel. Search each as soon as it is readable; tool checks and authorized
33
- upgrades must not block independent reading. If a missing configured workspace
34
- is needed for further attribution, recover it into an isolated directory while
35
- package retrieval continues. Without a configured workspace, investigate the
36
- available packages directly; do not request or create one merely to start.
29
+ Resolve `CONTEXT_QUERY_SOURCE_MODE` from the host or Bot instance configuration
30
+ before choosing the first retrieval path. Supported values are:
31
+
32
+ - `repo-first` (default): inspect the configured knowledge workspace and
33
+ authorized repository sources first. Use an available package only when the
34
+ repository path is unavailable or leaves a material gap.
35
+ - `package-first`: inspect the selected package first, then use its recorded
36
+ workspace or repository sources for missing, stale or disputed evidence.
37
+ - `dual`: inspect the package and repository paths concurrently, then reconcile
38
+ relevant differences before answering.
39
+
40
+ An unknown or empty value is `repo-first`; do not invent a fourth mode. The
41
+ mode changes retrieval order, not authorization or evidence standards. It does
42
+ not make a missing secondary source mandatory: continue with readable configured
43
+ sources and identify only gaps that affect the answer.
44
+
45
+ ## Search available material according to the configured mode
46
+
47
+ Apply `CONTEXT_QUERY_SOURCE_MODE` before starting retrieval. In `repo-first`,
48
+ start with the configured workspace and reusable source checkouts; do not fetch
49
+ or install a package merely to begin the query. In `package-first`, start with
50
+ the selected readable package. In `dual`, start both paths concurrently. Search
51
+ each selected path as soon as it is readable; tool checks and authorized
52
+ upgrades must not block independent reading. If a configured primary path is
53
+ missing, continue with the readable fallback instead of stopping. If a missing
54
+ configured workspace is needed for further attribution, recover it into an
55
+ isolated directory while other selected retrieval continues. Without a
56
+ configured workspace, investigate available packages directly; do not request
57
+ or create one merely to start.
37
58
 
38
59
  A knowledge package may be workspace build output (usually `dist/`), a global
39
60
  installation, or an equivalent host-provided directory. Locate it from available
@@ -119,7 +140,21 @@ not prove a historical snapshot.
119
140
 
120
141
  ## Answer with evidence and hand off updates
121
142
 
122
- Lead with the conclusion and a concise evidence chain. Distinguish implementation,
143
+ Answer the user's question directly, keeping conditions that change the conclusion
144
+ beside it. For complex questions, explain the mechanism that determines the result,
145
+ not just the verdict and source links. Explain its practical meaning before using
146
+ a short code excerpt or concrete rule when that helps the reader verify or act.
147
+ Keep decisive evidence beside the claim it supports; separate supplementary facts
148
+ from the proof. State where a local rule applies rather than generalizing it to
149
+ the whole system, and do not infer presentation or behavior from data retrieval
150
+ alone without checking the controlling logic.
151
+
152
+ Adapt depth and structure to the question: keep simple answers short; use short
153
+ headings and, where supported, separators between major semantic sections in
154
+ longer answers. Do not impose a fixed outline, separate every paragraph, repeat
155
+ the conclusion, or remove necessary explanation just to shorten the answer.
156
+ Keep conditions affecting the answer prominent and supplementary reading secondary.
157
+ Distinguish implementation,
123
158
  declared contracts, test assertions, runtime observations and inferences. Perform
124
159
  bounded non-destructive validation only when useful; inspect its effects first
125
160
  and do not run unrelated scripts, builds or tests.
@@ -25,14 +25,35 @@ Do not execute returned production actions, initialize a replacement workspace,
25
25
  or install tools without existing authorization. Querying must not alter source
26
26
  registrations, snapshots, tasks, approvals or user checkouts.
27
27
 
28
- ## Search available material concurrently
29
-
30
- Check relevant knowledge packages, the workspace and reusable source checkouts
31
- in parallel. Search each as soon as it is readable; tool checks and authorized
32
- upgrades must not block independent reading. If a missing configured workspace
33
- is needed for further attribution, recover it into an isolated directory while
34
- package retrieval continues. Without a configured workspace, investigate the
35
- available packages directly; do not request or create one merely to start.
28
+ Resolve `CONTEXT_QUERY_SOURCE_MODE` from the host or Bot instance configuration
29
+ before choosing the first retrieval path. Supported values are:
30
+
31
+ - `repo-first` (default): inspect the configured knowledge workspace and
32
+ authorized repository sources first. Use an available package only when the
33
+ repository path is unavailable or leaves a material gap.
34
+ - `package-first`: inspect the selected package first, then use its recorded
35
+ workspace or repository sources for missing, stale or disputed evidence.
36
+ - `dual`: inspect the package and repository paths concurrently, then reconcile
37
+ relevant differences before answering.
38
+
39
+ An unknown or empty value is `repo-first`; do not invent a fourth mode. The
40
+ mode changes retrieval order, not authorization or evidence standards. It does
41
+ not make a missing secondary source mandatory: continue with readable configured
42
+ sources and identify only gaps that affect the answer.
43
+
44
+ ## Search available material according to the configured mode
45
+
46
+ Apply `CONTEXT_QUERY_SOURCE_MODE` before starting retrieval. In `repo-first`,
47
+ start with the configured workspace and reusable source checkouts; do not fetch
48
+ or install a package merely to begin the query. In `package-first`, start with
49
+ the selected readable package. In `dual`, start both paths concurrently. Search
50
+ each selected path as soon as it is readable; tool checks and authorized
51
+ upgrades must not block independent reading. If a configured primary path is
52
+ missing, continue with the readable fallback instead of stopping. If a missing
53
+ configured workspace is needed for further attribution, recover it into an
54
+ isolated directory while other selected retrieval continues. Without a
55
+ configured workspace, investigate available packages directly; do not request
56
+ or create one merely to start.
36
57
 
37
58
  A knowledge package may be workspace build output (usually `dist/`), a global
38
59
  installation, or an equivalent host-provided directory. Locate it from available
@@ -118,7 +139,21 @@ not prove a historical snapshot.
118
139
 
119
140
  ## Answer with evidence and hand off updates
120
141
 
121
- Lead with the conclusion and a concise evidence chain. Distinguish implementation,
142
+ Answer the user's question directly, keeping conditions that change the conclusion
143
+ beside it. For complex questions, explain the mechanism that determines the result,
144
+ not just the verdict and source links. Explain its practical meaning before using
145
+ a short code excerpt or concrete rule when that helps the reader verify or act.
146
+ Keep decisive evidence beside the claim it supports; separate supplementary facts
147
+ from the proof. State where a local rule applies rather than generalizing it to
148
+ the whole system, and do not infer presentation or behavior from data retrieval
149
+ alone without checking the controlling logic.
150
+
151
+ Adapt depth and structure to the question: keep simple answers short; use short
152
+ headings and, where supported, separators between major semantic sections in
153
+ longer answers. Do not impose a fixed outline, separate every paragraph, repeat
154
+ the conclusion, or remove necessary explanation just to shorten the answer.
155
+ Keep conditions affecting the answer prominent and supplementary reading secondary.
156
+ Distinguish implementation,
122
157
  declared contracts, test assertions, runtime observations and inferences. Perform
123
158
  bounded non-destructive validation only when useful; inspect its effects first
124
159
  and do not run unrelated scripts, builds or tests.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c4a",
3
- "version": "0.7.26",
3
+ "version": "0.7.29",
4
4
  "description": "Start or continue a project-local knowledge workspace through one graph-routed entry.",
5
5
  "author": { "name": "c4a" },
6
6
  "homepage": "https://github.com/context4ai/c4a",
@@ -10,7 +10,7 @@
10
10
  "skills": "./skills/",
11
11
  "interface": {
12
12
  "displayName": "C4A Context",
13
- "shortDescription": "Initialize and advance a local, source-linked project knowledge workspace.\nv0.7.26",
13
+ "shortDescription": "Initialize and advance a local, source-linked project knowledge workspace.\nv0.7.29",
14
14
  "longDescription": "Create a Context workspace and use agent-guided next steps to register sources, run extraction, review candidates, build package outputs, and verify health without silently mutating source repositories.",
15
15
  "developerName": "c4a",
16
16
  "category": "Productivity",
@@ -25,14 +25,35 @@ Do not execute returned production actions, initialize a replacement workspace,
25
25
  or install tools without existing authorization. Querying must not alter source
26
26
  registrations, snapshots, tasks, approvals or user checkouts.
27
27
 
28
- ## Search available material concurrently
29
-
30
- Check relevant knowledge packages, the workspace and reusable source checkouts
31
- in parallel. Search each as soon as it is readable; tool checks and authorized
32
- upgrades must not block independent reading. If a missing configured workspace
33
- is needed for further attribution, recover it into an isolated directory while
34
- package retrieval continues. Without a configured workspace, investigate the
35
- available packages directly; do not request or create one merely to start.
28
+ Resolve `CONTEXT_QUERY_SOURCE_MODE` from the host or Bot instance configuration
29
+ before choosing the first retrieval path. Supported values are:
30
+
31
+ - `repo-first` (default): inspect the configured knowledge workspace and
32
+ authorized repository sources first. Use an available package only when the
33
+ repository path is unavailable or leaves a material gap.
34
+ - `package-first`: inspect the selected package first, then use its recorded
35
+ workspace or repository sources for missing, stale or disputed evidence.
36
+ - `dual`: inspect the package and repository paths concurrently, then reconcile
37
+ relevant differences before answering.
38
+
39
+ An unknown or empty value is `repo-first`; do not invent a fourth mode. The
40
+ mode changes retrieval order, not authorization or evidence standards. It does
41
+ not make a missing secondary source mandatory: continue with readable configured
42
+ sources and identify only gaps that affect the answer.
43
+
44
+ ## Search available material according to the configured mode
45
+
46
+ Apply `CONTEXT_QUERY_SOURCE_MODE` before starting retrieval. In `repo-first`,
47
+ start with the configured workspace and reusable source checkouts; do not fetch
48
+ or install a package merely to begin the query. In `package-first`, start with
49
+ the selected readable package. In `dual`, start both paths concurrently. Search
50
+ each selected path as soon as it is readable; tool checks and authorized
51
+ upgrades must not block independent reading. If a configured primary path is
52
+ missing, continue with the readable fallback instead of stopping. If a missing
53
+ configured workspace is needed for further attribution, recover it into an
54
+ isolated directory while other selected retrieval continues. Without a
55
+ configured workspace, investigate available packages directly; do not request
56
+ or create one merely to start.
36
57
 
37
58
  A knowledge package may be workspace build output (usually `dist/`), a global
38
59
  installation, or an equivalent host-provided directory. Locate it from available
@@ -118,7 +139,21 @@ not prove a historical snapshot.
118
139
 
119
140
  ## Answer with evidence and hand off updates
120
141
 
121
- Lead with the conclusion and a concise evidence chain. Distinguish implementation,
142
+ Answer the user's question directly, keeping conditions that change the conclusion
143
+ beside it. For complex questions, explain the mechanism that determines the result,
144
+ not just the verdict and source links. Explain its practical meaning before using
145
+ a short code excerpt or concrete rule when that helps the reader verify or act.
146
+ Keep decisive evidence beside the claim it supports; separate supplementary facts
147
+ from the proof. State where a local rule applies rather than generalizing it to
148
+ the whole system, and do not infer presentation or behavior from data retrieval
149
+ alone without checking the controlling logic.
150
+
151
+ Adapt depth and structure to the question: keep simple answers short; use short
152
+ headings and, where supported, separators between major semantic sections in
153
+ longer answers. Do not impose a fixed outline, separate every paragraph, repeat
154
+ the conclusion, or remove necessary explanation just to shorten the answer.
155
+ Keep conditions affecting the answer prominent and supplementary reading secondary.
156
+ Distinguish implementation,
122
157
  declared contracts, test assertions, runtime observations and inferences. Perform
123
158
  bounded non-destructive validation only when useful; inspect its effects first
124
159
  and do not run unrelated scripts, builds or tests.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "c4a",
3
3
  "displayName": "C4A Context",
4
- "version": "0.7.26",
4
+ "version": "0.7.29",
5
5
  "description": "Start or continue a project-local knowledge workspace through one graph-routed entry.",
6
6
  "author": {
7
7
  "name": "Context4AI",
@@ -24,14 +24,35 @@ Do not execute returned production actions, initialize a replacement workspace,
24
24
  or install tools without existing authorization. Querying must not alter source
25
25
  registrations, snapshots, tasks, approvals or user checkouts.
26
26
 
27
- ## Search available material concurrently
28
-
29
- Check relevant knowledge packages, the workspace and reusable source checkouts
30
- in parallel. Search each as soon as it is readable; tool checks and authorized
31
- upgrades must not block independent reading. If a missing configured workspace
32
- is needed for further attribution, recover it into an isolated directory while
33
- package retrieval continues. Without a configured workspace, investigate the
34
- available packages directly; do not request or create one merely to start.
27
+ Resolve `CONTEXT_QUERY_SOURCE_MODE` from the host or Bot instance configuration
28
+ before choosing the first retrieval path. Supported values are:
29
+
30
+ - `repo-first` (default): inspect the configured knowledge workspace and
31
+ authorized repository sources first. Use an available package only when the
32
+ repository path is unavailable or leaves a material gap.
33
+ - `package-first`: inspect the selected package first, then use its recorded
34
+ workspace or repository sources for missing, stale or disputed evidence.
35
+ - `dual`: inspect the package and repository paths concurrently, then reconcile
36
+ relevant differences before answering.
37
+
38
+ An unknown or empty value is `repo-first`; do not invent a fourth mode. The
39
+ mode changes retrieval order, not authorization or evidence standards. It does
40
+ not make a missing secondary source mandatory: continue with readable configured
41
+ sources and identify only gaps that affect the answer.
42
+
43
+ ## Search available material according to the configured mode
44
+
45
+ Apply `CONTEXT_QUERY_SOURCE_MODE` before starting retrieval. In `repo-first`,
46
+ start with the configured workspace and reusable source checkouts; do not fetch
47
+ or install a package merely to begin the query. In `package-first`, start with
48
+ the selected readable package. In `dual`, start both paths concurrently. Search
49
+ each selected path as soon as it is readable; tool checks and authorized
50
+ upgrades must not block independent reading. If a configured primary path is
51
+ missing, continue with the readable fallback instead of stopping. If a missing
52
+ configured workspace is needed for further attribution, recover it into an
53
+ isolated directory while other selected retrieval continues. Without a
54
+ configured workspace, investigate available packages directly; do not request
55
+ or create one merely to start.
35
56
 
36
57
  A knowledge package may be workspace build output (usually `dist/`), a global
37
58
  installation, or an equivalent host-provided directory. Locate it from available
@@ -117,7 +138,21 @@ not prove a historical snapshot.
117
138
 
118
139
  ## Answer with evidence and hand off updates
119
140
 
120
- Lead with the conclusion and a concise evidence chain. Distinguish implementation,
141
+ Answer the user's question directly, keeping conditions that change the conclusion
142
+ beside it. For complex questions, explain the mechanism that determines the result,
143
+ not just the verdict and source links. Explain its practical meaning before using
144
+ a short code excerpt or concrete rule when that helps the reader verify or act.
145
+ Keep decisive evidence beside the claim it supports; separate supplementary facts
146
+ from the proof. State where a local rule applies rather than generalizing it to
147
+ the whole system, and do not infer presentation or behavior from data retrieval
148
+ alone without checking the controlling logic.
149
+
150
+ Adapt depth and structure to the question: keep simple answers short; use short
151
+ headings and, where supported, separators between major semantic sections in
152
+ longer answers. Do not impose a fixed outline, separate every paragraph, repeat
153
+ the conclusion, or remove necessary explanation just to shorten the answer.
154
+ Keep conditions affecting the answer prominent and supplementary reading secondary.
155
+ Distinguish implementation,
121
156
  declared contracts, test assertions, runtime observations and inferences. Perform
122
157
  bounded non-destructive validation only when useful; inspect its effects first
123
158
  and do not run unrelated scripts, builds or tests.
@@ -25,14 +25,35 @@ Do not execute returned production actions, initialize a replacement workspace,
25
25
  or install tools without existing authorization. Querying must not alter source
26
26
  registrations, snapshots, tasks, approvals or user checkouts.
27
27
 
28
- ## Search available material concurrently
29
-
30
- Check relevant knowledge packages, the workspace and reusable source checkouts
31
- in parallel. Search each as soon as it is readable; tool checks and authorized
32
- upgrades must not block independent reading. If a missing configured workspace
33
- is needed for further attribution, recover it into an isolated directory while
34
- package retrieval continues. Without a configured workspace, investigate the
35
- available packages directly; do not request or create one merely to start.
28
+ Resolve `CONTEXT_QUERY_SOURCE_MODE` from the host or Bot instance configuration
29
+ before choosing the first retrieval path. Supported values are:
30
+
31
+ - `repo-first` (default): inspect the configured knowledge workspace and
32
+ authorized repository sources first. Use an available package only when the
33
+ repository path is unavailable or leaves a material gap.
34
+ - `package-first`: inspect the selected package first, then use its recorded
35
+ workspace or repository sources for missing, stale or disputed evidence.
36
+ - `dual`: inspect the package and repository paths concurrently, then reconcile
37
+ relevant differences before answering.
38
+
39
+ An unknown or empty value is `repo-first`; do not invent a fourth mode. The
40
+ mode changes retrieval order, not authorization or evidence standards. It does
41
+ not make a missing secondary source mandatory: continue with readable configured
42
+ sources and identify only gaps that affect the answer.
43
+
44
+ ## Search available material according to the configured mode
45
+
46
+ Apply `CONTEXT_QUERY_SOURCE_MODE` before starting retrieval. In `repo-first`,
47
+ start with the configured workspace and reusable source checkouts; do not fetch
48
+ or install a package merely to begin the query. In `package-first`, start with
49
+ the selected readable package. In `dual`, start both paths concurrently. Search
50
+ each selected path as soon as it is readable; tool checks and authorized
51
+ upgrades must not block independent reading. If a configured primary path is
52
+ missing, continue with the readable fallback instead of stopping. If a missing
53
+ configured workspace is needed for further attribution, recover it into an
54
+ isolated directory while other selected retrieval continues. Without a
55
+ configured workspace, investigate available packages directly; do not request
56
+ or create one merely to start.
36
57
 
37
58
  A knowledge package may be workspace build output (usually `dist/`), a global
38
59
  installation, or an equivalent host-provided directory. Locate it from available
@@ -118,7 +139,21 @@ not prove a historical snapshot.
118
139
 
119
140
  ## Answer with evidence and hand off updates
120
141
 
121
- Lead with the conclusion and a concise evidence chain. Distinguish implementation,
142
+ Answer the user's question directly, keeping conditions that change the conclusion
143
+ beside it. For complex questions, explain the mechanism that determines the result,
144
+ not just the verdict and source links. Explain its practical meaning before using
145
+ a short code excerpt or concrete rule when that helps the reader verify or act.
146
+ Keep decisive evidence beside the claim it supports; separate supplementary facts
147
+ from the proof. State where a local rule applies rather than generalizing it to
148
+ the whole system, and do not infer presentation or behavior from data retrieval
149
+ alone without checking the controlling logic.
150
+
151
+ Adapt depth and structure to the question: keep simple answers short; use short
152
+ headings and, where supported, separators between major semantic sections in
153
+ longer answers. Do not impose a fixed outline, separate every paragraph, repeat
154
+ the conclusion, or remove necessary explanation just to shorten the answer.
155
+ Keep conditions affecting the answer prominent and supplementary reading secondary.
156
+ Distinguish implementation,
122
157
  declared contracts, test assertions, runtime observations and inferences. Perform
123
158
  bounded non-destructive validation only when useful; inspect its effects first
124
159
  and do not run unrelated scripts, builds or tests.