@c4a/context-cli 0.7.25 → 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.
Files changed (27) hide show
  1. package/cli.js +59 -41
  2. package/indexers/contracts/profile-contract.json +245 -245
  3. package/indexers/release-manifest.json +1 -1
  4. package/package.json +12 -12
  5. package/parserEntryWorker.js +90 -10
  6. package/plugins/README.md +5 -5
  7. package/plugins/README_CN.md +4 -4
  8. package/plugins/VERSION +1 -1
  9. package/plugins/claude/.claude-plugin/plugin.json +3 -2
  10. package/plugins/claude/commands/context-inspect-search.md +45 -10
  11. package/plugins/claude/skills/context-inspect-search/SKILL.md +182 -0
  12. package/plugins/claude/skills/context-inspect-search/agents/openai.yaml +2 -0
  13. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  14. package/plugins/codex/skills/context-inspect-search/SKILL.md +45 -11
  15. package/plugins/codex/skills/context-inspect-search/agents/openai.yaml +1 -1
  16. package/plugins/cursor/.cursor-plugin/plugin.json +3 -2
  17. package/plugins/cursor/commands/c4a-context-inspect-search.md +45 -10
  18. package/plugins/cursor/skills/context-inspect-search/SKILL.md +182 -0
  19. package/plugins/cursor/skills/context-inspect-search/agents/openai.yaml +2 -0
  20. package/plugins/skills/context-inspect-search/SKILL.md +45 -11
  21. package/plugins/skills/context-inspect-search/agents/openai.yaml +1 -1
  22. package/providers/context/graphs/indexer.yaml +4 -0
  23. package/providers/context/manifest.json +17 -8
  24. package/providers/context/provider.yaml +1 -1
  25. package/providers/context/resources/procedures/document-code-investigation.md +45 -0
  26. package/providers/context/resources/procedures/repository-source-recovery.md +8 -1
  27. package/providers/context/skills/work-production-stage/SKILL.md +4 -0
@@ -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.25",
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.25",
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.25",
28
- "@c4a/extract": "0.7.25",
29
- "@c4a/extract-contract": "0.7.25",
30
- "@c4a/extract-go": "0.7.25",
31
- "@c4a/extract-mdx": "0.7.25",
32
- "@c4a/extract-proto": "0.7.25",
33
- "@c4a/extract-rush": "0.7.25",
34
- "@c4a/extract-sql": "0.7.25",
35
- "@c4a/extract-style": "0.7.25",
36
- "@c4a/extract-thrift": "0.7.25",
37
- "@c4a/extract-ts": "0.7.25",
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
@@ -5,7 +5,7 @@
5
5
  [简体中文](./README_CN.md)
6
6
 
7
7
  `plugins/context/` is the only human-maintained source for the Context Agent
8
- integration in this repository. It contains the Context production and explicit-only context-inspect-search Skills, the Code, Markdown, Note and Sessions
8
+ integration in this repository. It contains the Context production and host-routable context-inspect-search Skills, the Code, Markdown, Note and Sessions
9
9
  Indexer Provider Skills, host manifest templates, and shared assets.
10
10
 
11
11
  Run `bun run --filter @c4a/context-cli build:plugin` to regenerate the npm
@@ -30,11 +30,11 @@ Context workflow and Indexer Provider lifecycle.
30
30
 
31
31
  ## Query and attribute workspace knowledge
32
32
 
33
- Explicitly invoke `/c4a:context-inspect-search` (Cursor: `/c4a-context-inspect-search`)
34
- or 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
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. `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.
38
38
  It traces package pages through the build inventory to approved originals and registered sources, without resetting production. Accepted suggestions hand off to `context`.
39
- Codex disables implicit invocation through Skill policy; Claude commands disable
40
- model invocation. Other hosts must honor the explicit-only instructions.
39
+ The user-facing Claude command remains explicit-only. Host skill manifests expose
40
+ the Skill so configured knowledge Bots can select it without searching plugin files.
@@ -4,7 +4,7 @@
4
4
 
5
5
  [English](./README.md)
6
6
 
7
- 仓库中的 `plugins/context/` 是 Context Agent 接入唯一的人工维护真源,包含 Context 生产入口和显式触发的 context-inspect-search 技能、
7
+ 仓库中的 `plugins/context/` 是 Context Agent 接入唯一的人工维护真源,包含 Context 生产入口和可由宿主路由的 context-inspect-search 技能、
8
8
  Code/Markdown/Note/Sessions Indexer Provider Skills、各宿主 manifest 模板和共享资产。
9
9
 
10
10
  运行 `bun run --filter @c4a/context-cli build:plugin` 可重新生成 npm 投影及提交到
@@ -27,10 +27,10 @@ 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
  无需用户选择版本。通过构建清单关联批准原稿
34
34
  并追溯登记来源,不清理工作区、不为查询推进无关生产任务。证据充分时可建议更新,用户采纳后交给
35
- `context` 的当前流程。Codex 配置禁止隐式调用,Claude 命令配置禁止模型自动调用;
36
- 其他宿主依赖显式触发指引,不承诺其支持相同的自动调用控制。
35
+ `context` 的当前流程。面向用户的 Claude 命令仍只允许显式触发;宿主技能清单会公开该技能,
36
+ 使配置过的知识 Bot 无需搜索插件文件即可选择它。
package/plugins/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.25
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.25",
4
+ "version": "0.7.29",
5
5
  "author": {
6
6
  "name": "c4a"
7
7
  },
@@ -14,6 +14,7 @@
14
14
  "c4a"
15
15
  ],
16
16
  "skills": [
17
- "./skills/context-indexer-create"
17
+ "./skills/context-indexer-create",
18
+ "./skills/context-inspect-search"
18
19
  ]
19
20
  }
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Use only when the user explicitly invokes context-inspect-search to query available Context knowledge packages or approved workspace knowledge and trace answers to their identified sources. A local workspace is optional. Do not auto-start for ordinary coding, planning, debugging, or an active Context production workflow."
2
+ description: "Query available Context knowledge packages or approved workspace knowledge and trace answers to their identified sources when the user asks a knowledge question or the host configuration routes the request here. A local workspace is optional. Do not auto-start for ordinary coding, planning, debugging, or an active Context production workflow."
3
3
  argument-hint: "[project-dir or user intent]"
4
4
  disable-model-invocation: true
5
5
  ---
@@ -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.
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: context-inspect-search
3
+ description: Query available Context knowledge packages or approved workspace knowledge and trace answers to their identified sources when the user asks a knowledge question or the host configuration routes the request here. A local workspace is optional. Do not auto-start for ordinary coding, planning, debugging, or an active Context production workflow.
4
+ ---
5
+
6
+ # Context Inspect Search
7
+
8
+ ## Entry and boundaries
9
+
10
+ Use on explicit invocation and related follow-up questions; use the conversation
11
+ language. The invocation authorizes read-only investigation of the selected
12
+ knowledge packages, available workspace and identified sources within that scope,
13
+ including isolated source retrieval and bounded non-destructive checks. The Skill
14
+ can run from a global installation with host-provided packages and no workspace.
15
+ Resolve scope from the request, conversation and configuration before asking.
16
+ Continue through non-blocking issues; ask only for missing access, genuinely
17
+ unresolved scope or effects outside existing authorization.
18
+
19
+ Start from the supplied package locations or workspace configuration. If a
20
+ workspace exists, read its `AGENTS.md` and relevant configuration;
21
+ `context entry [project-dir] --format json` may help locate instructions.
22
+ Neither a workspace nor a working Context CLI is required for package retrieval;
23
+ do not call entry in an arbitrary directory just to satisfy a prerequisite.
24
+ Do not execute returned production actions, initialize a replacement workspace,
25
+ or install tools without existing authorization. Querying must not alter source
26
+ registrations, snapshots, tasks, approvals or user checkouts.
27
+
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.
57
+
58
+ A knowledge package may be workspace build output (usually `dist/`), a global
59
+ installation, or an equivalent host-provided directory. Locate it from available
60
+ configuration or installation metadata rather than assuming a fixed path.
61
+ Select packages relevant to the question. Follow their bundled query Skill when
62
+ present; otherwise search readable indexes and pages. Missing Skills or build
63
+ inventories do not block retrieval or justify rebuilding. If a needed package is
64
+ missing, use the host's configured, authorized package retrieval mechanism while
65
+ other reading continues. Only check or prepare tools needed for the next actual
66
+ operation; installation failure does not block independent local retrieval.
67
+
68
+ For gaps or latest-content questions, also search approved knowledge when a workspace is available:
69
+ use `knowledge/structure.yaml` and relevant `knowledge/` paths, trying business
70
+ terms, symbols and synonyms, then read matching sections in context. Delivered
71
+ content may lag approved knowledge; they are not independent corroboration.
72
+ Candidates and temporary reports are not approved pages. A search miss does not
73
+ prove a capability is absent. Do not build merely to answer a query; a separately
74
+ authorized build must follow its own workflow without advancing unrelated work.
75
+
76
+ When package or approved knowledge leaves a gap, directly trace relevant sources
77
+ without asking whether to deepen the query. Use available document, code-search
78
+ or extraction tools within the authorized scope, recording source identity and
79
+ version. Prepare sources while continuing other reading.
80
+ One failed source blocks only dependent claims. Answer when evidence is
81
+ sufficient, without completing unnecessary preparation.
82
+
83
+ ## Trace and retrieve only relevant sources
84
+
85
+ Without a workspace, use explicit source references in the package, its metadata
86
+ or user configuration to identify relevant documents or repository paths and
87
+ commits. Read or retrieve those sources directly within scope; the workspace
88
+ registry is not a mandatory intermediate step. If the source identity or version
89
+ cannot be established, retain package-grounded findings and qualify attribution;
90
+ do not invent a repository or equate current source with the package's baseline.
91
+
92
+ When a workspace and `context-build-inventory.json` are available, map a delivered page's
93
+ `dist_path` through `approved_knowledge.files` to its `approved_path`, relative
94
+ to the workspace's `knowledge/` root. Follow the approved page's associations in
95
+ `knowledge/structure.yaml` and `sources/*/index.yaml`. Without a reliable mapping,
96
+ continue package retrieval and follow explicit source references where available.
97
+ Do not guess originals from similar filenames or claim attribution without
98
+ checking the referenced material.
99
+
100
+ Use the repository and recorded commit identified by the package or workspace
101
+ as the source baseline.
102
+ Reuse existing checkouts only after checking remote, commit, module coverage
103
+ and local changes; do not reset them or change their sparse configuration.
104
+ Missing code goes into a reusable query-owned path such as
105
+ `.tmp/context-inspect/<host>/<repository-path>/<commit>/`, separate from user
106
+ checkouts and production-managed sources. Use safe, credential-free path
107
+ components and the full commit. Verify identity before reuse; never overwrite
108
+ a mismatched directory. Deduplicate recovery and use one writer per checkout;
109
+ that writer may append sparse paths without resetting existing files.
110
+
111
+ Default to lightweight retrieval and sparse checkout:
112
+
113
+ - Use shallow history (`--depth=1`) and deferred contents (`--filter=blob:none`)
114
+ where supported, with a complete partial-clone setup and named promisor remote.
115
+ Configure the sparse scope before checkout and verify the resulting commit.
116
+ - Start from known module paths. If unclear, inspect
117
+ `git ls-tree -r --name-only <commit>` for candidates, then read code to confirm
118
+ their relevance. Expand along imports, calls and service routes as needed;
119
+ deepen history only when needed. A sparse search miss is not a whole-repository miss.
120
+ - Read ready modules while other recovery proceeds. Allow sufficient command
121
+ time (for example 300 seconds or more), but investigate confirmed stalls
122
+ without waiting for timeout; silence alone is not a stall. If unsupported or
123
+ unsuccessful, try caches, commit-specific file retrieval or bounded shallow
124
+ retrieval; use a full clone only when necessary. Do not retry blindly or
125
+ silently substitute the default branch for an unavailable recorded commit.
126
+
127
+ Query retrieval never runs `context source restore`, `task prepare` or production
128
+ capture/recovery actions. Production recovery gates do not block this independent
129
+ inspection. Preserve unavailable-evidence gaps rather than changing production
130
+ state to get past them.
131
+
132
+ Compare relevant baseline files with current code when accessible, including
133
+ relevant local changes. Use actual diffs to assess impact; current code is not a
134
+ substitute for the baseline. Mention a missing comparison only when it limits
135
+ the answer. For documents, notes and sessions, read saved bodies and necessary
136
+ attachments; fetch missing accessible material within scope. A summary is not a
137
+ full transcript, an unread link is not evidence, and current remote content does
138
+ not prove a historical snapshot.
139
+
140
+ ## Answer with evidence and hand off updates
141
+
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,
157
+ declared contracts, test assertions, runtime observations and inferences. Perform
158
+ bounded non-destructive validation only when useful; inspect its effects first
159
+ and do not run unrelated scripts, builds or tests.
160
+
161
+ Link material actually read: source files at the inspected commit, knowledge
162
+ website articles and original documents. If no reliable clickable link exists,
163
+ give checkable local paths, symbols and short supporting excerpts with the
164
+ limitation. Do not dump internal reasoning, runtime identifiers or routine
165
+ version comparisons. Explain only differences affecting the answer; hashes may
166
+ appear in source URLs without requiring a separate version audit in the prose.
167
+
168
+ For website links, use `context-site-map.json` from the selected package or
169
+ sibling website output. Match `pages[].package_path` or `approved_path`, and
170
+ resolve `site_path` against `site_url` without prepending `base` again. Cite only
171
+ matched pages, deduplicate links and do not invent anchors. If mapping is absent
172
+ or invalid, retain local citations. Do not build, publish or probe remote sites
173
+ just to format citations; a local map is not proof of the current online content.
174
+
175
+ Suggest a knowledge update only with supporting evidence: identify the affected
176
+ page or gap, proposed change and bounded source scope. Check neighboring content
177
+ before proposing a new page. Only after user acceptance, hand the evidence and
178
+ scope to the installed `context` production Skill in the selected workspace and
179
+ its fresh Route. If no target workspace is known, resolve it at that handoff,
180
+ not as a prerequisite to answering. Do not edit approved knowledge, clear state
181
+ or reuse an earlier revision. If that entry
182
+ is unavailable, provide the handoff and state that no update has started.
@@ -0,0 +1,2 @@
1
+ policy:
2
+ allow_implicit_invocation: true
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c4a",
3
- "version": "0.7.25",
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.25",
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",
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: context-inspect-search
3
- description: Use only when the user explicitly invokes context-inspect-search to query available Context knowledge packages or approved workspace knowledge and trace answers to their identified sources. A local workspace is optional. Do not auto-start for ordinary coding, planning, debugging, or an active Context production workflow.
4
- disable-model-invocation: true
3
+ description: Query available Context knowledge packages or approved workspace knowledge and trace answers to their identified sources when the user asks a knowledge question or the host configuration routes the request here. A local workspace is optional. Do not auto-start for ordinary coding, planning, debugging, or an active Context production workflow.
5
4
  ---
6
5
 
7
6
  # Context Inspect Search
@@ -26,14 +25,35 @@ Do not execute returned production actions, initialize a replacement workspace,
26
25
  or install tools without existing authorization. Querying must not alter source
27
26
  registrations, snapshots, tasks, approvals or user checkouts.
28
27
 
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.
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.
37
57
 
38
58
  A knowledge package may be workspace build output (usually `dist/`), a global
39
59
  installation, or an equivalent host-provided directory. Locate it from available
@@ -119,7 +139,21 @@ not prove a historical snapshot.
119
139
 
120
140
  ## Answer with evidence and hand off updates
121
141
 
122
- 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,
123
157
  declared contracts, test assertions, runtime observations and inferences. Perform
124
158
  bounded non-destructive validation only when useful; inspect its effects first
125
159
  and do not run unrelated scripts, builds or tests.
@@ -1,2 +1,2 @@
1
1
  policy:
2
- allow_implicit_invocation: false
2
+ allow_implicit_invocation: true
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "c4a",
3
3
  "displayName": "C4A Context",
4
- "version": "0.7.25",
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",
@@ -26,6 +26,7 @@
26
26
  ],
27
27
  "commands": "./commands/",
28
28
  "skills": [
29
- "./skills/context-indexer-create"
29
+ "./skills/context-indexer-create",
30
+ "./skills/context-inspect-search"
30
31
  ]
31
32
  }