@c4a/context-cli 0.5.29-beta.20 → 0.5.29-beta.22

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,10 +1,10 @@
1
1
  ---
2
2
  name: skill-context-query
3
3
  description: >
4
- Packaged skill invoked by `/context:query`; not a user slash command.
5
- Uses structure-first strategy: explore Node structure via node_search/orientation first,
6
- then narrow to specific Nodes, then explore relationships. Semantic queries are secondary
7
- and only when structure queries cannot find the target Node. Always cite Node slug and Section id.
4
+ Packaged skill invoked by `/context:query`; not a user slash command.
5
+ Uses structure-first strategy: inspect orientation, resolve unknown Nodes with node_lookup,
6
+ open known Nodes with node_view, then query Section details with section_search. Always
7
+ cite Node slug and Section id.
8
8
  Activates when `/context:query` is invoked or when an agent needs to
9
9
  answer a question using local Context workspace knowledge with citations.
10
10
  tools:
@@ -19,7 +19,7 @@ of local knowledge; never read workspace files directly.
19
19
 
20
20
  ## TL;DR — Non-negotiables
21
21
 
22
- - **Structure first**: When problem is vague, don't do semantic search—explore Node structure via `node_search` or `orientation` to let user choose which Node to focus on.
22
+ - **Structure first**: When problem is vague, don't do semantic search; inspect `orientation`, use `node_lookup` only to find a slug, and use `node_view` to open a known Node.
23
23
  - **CLI only**: Use only `context query` output as evidence. Never Read/Glob/Grep/Write workspace files.
24
24
  - **Route by intent**: Classify problem intent (vague / clear Node / relationship / detail) and choose the right command; see Query Route table below.
25
25
  - **Orientation is navigation**: `context query --intent orientation` returns a budgeted `[Slug Map]` plus optional `[Summary]` hints for scope choice only; it is not direct answer evidence.
@@ -42,14 +42,15 @@ returned row as a small evidence card.
42
42
  | `refers_to_nodes` | Optional supplemental anchors when present |
43
43
  | `slug` | Candidate handle when the output is asking you to choose a Node |
44
44
  | `message` | Miss, broad-query, blocked, or narrowing guidance |
45
+ | `visibility` / `visible:` footer | Completeness signal for `node_view`; when `complete=true` / `visible: complete`, the shown Node Sections are exhaustive and there is no pagination |
45
46
 
46
47
  Supplemental context can come from:
47
48
 
48
49
  ```text
49
- context query --intent node_search --scope <slug>
50
+ context query --intent node_view --scope <slug>
50
51
  context query --intent impact_analysis --scope <slug>
51
- context query --intent node_search --refers-to <slug>
52
- context query --intent description_search --scope <slug> --query "<keywords>"
52
+ context query --intent node_view --refers-to <slug>
53
+ context query --intent section_search --scope <slug> --query "<keywords>"
53
54
  ```
54
55
 
55
56
  ## Query Route Decision Table
@@ -58,10 +59,10 @@ Choose the `context query` command based on problem intent. **Structure queries
58
59
 
59
60
  | Problem intent | Primary command | When to use |
60
61
  |---|---|---|
61
- | **Vague question, no Node named** User asks "what is X" / "what are the X types" | `context query --intent orientation` or `context query --intent node_search --query "<keyword>"` | User unsure which Node to focus on; show structure first |
62
- | **Node explicitly named** User mentions a specific service/system | `context query --intent node_search --scope <slug>` | User wants to explore a specific known Node |
62
+ | **Vague question, no Node named** User asks "what is X" / "what are the X types" | `context query --intent orientation` or `context query --intent node_lookup --query "<keyword>"` | User unsure which Node to focus on; show structure first |
63
+ | **Node explicitly named** User mentions a specific service/system | `context query --intent node_view --scope <slug>` | User wants to open a specific known Node |
63
64
  | **Relationship / impact** User asks what depends on X / impact of changing X | `context query --intent impact_analysis --scope <slug>` | User asks about how a Node connects to others |
64
- | **Detail within known scope** (only after Node chosen) User asks for specific feature/behavior within chosen Node | `context query --intent description_search --scope <slug> --query "<detail>"` | User wants specific detail within an already-chosen Node |
65
+ | **Detail within known scope** (only after Node chosen) User asks for specific feature/behavior within chosen Node | `context query --intent section_search --scope <slug> --query "<detail>"` | User wants specific detail within an already-chosen Node |
65
66
  | **Very specific fact** (fallback, rarely needed) User asks for exact implementation location | `context query "$ARGUMENTS"` | Semantic fallback when structure queries don't suffice |
66
67
  | **Archive / reconciliation** User asks "find duplicates" / "check coverage" | `context query --intent recall --profile <reconcile-dedupe\|reconcile-support\|reconcile-refresh> --query "..."` | Only when user explicitly asks for audit/reconciliation |
67
68
 
@@ -73,13 +74,13 @@ Choose the `context query` command based on problem intent. **Structure queries
73
74
  - Text output targets about 2000 tokens total. It prints `[Slug Map]` first, then `[Summary]`.
74
75
  - `[Slug Map]` uses finalized structure relationships and is for choosing the next `--scope <slug>`. If the workspace is too large, deeper layers are folded first.
75
76
  - `[Summary]` is truncated before the map. If output is still over budget, the command prints a continuation note. Drill down with scoped queries; there is no page-token pagination.
76
- - Use `context query --intent node_search --scope <slug>` for a Node overview, or `context query --intent description_search --scope <slug> --query "<keywords>"` for details inside that Node.
77
+ - Use `context query --intent node_view --scope <slug>` for a Node overview, or `context query --intent section_search --scope <slug> --query "<keywords>"` for details inside that Node.
77
78
  - Use `context query --intent orientation --tag <tag>` or `context query --intent orientation --domain <slug>` to reduce the map before choosing a scope.
78
79
  - When `slug` and `title` are equivalent after normalization (for example `payment-api` and `Payment API`), text output shows only the slug.
79
80
 
80
81
  ## BM25 Search Strategy
81
82
 
82
- When using `description_search`, `recall`, or `node_search --query`, the CLI uses BM25 (keyword-based, not embedding-based) for matching. BM25 requires explicit keyword coverage, so queries must be precise:
83
+ When using `section_search`, `recall`, or `node_lookup`, the CLI uses BM25 (keyword-based, not embedding-based) for matching. BM25 requires explicit keyword coverage, so queries must be precise:
83
84
 
84
85
  - **Mix bilingual keywords**: Include both Chinese and English terms when querying—e.g., `"<chinese-term> <english-equivalent>"`, `"<product-name> <alternate-name>"`
85
86
  - **Include synonyms & aliases**: BM25 is keyword-literal, so if your query doesn't match Section content exactly, try related terms
@@ -87,13 +88,13 @@ When using `description_search`, `recall`, or `node_search --query`, the CLI use
87
88
  - **Scope to reduce noise**: Use `--scope <slug>` to focus on a single Node; broad queries may be blocked or produce low-quality matches
88
89
 
89
90
  Query intents that use BM25:
90
- - `context query --intent node_search --query "<short-keyword>"` — find candidate Nodes from slug, title, summary, aliases, and tags when direct slug/title/alias matching does not resolve the query
91
- - `context query --intent description_search --scope <slug> --query "<keywords>"` — find Section details using keyword matching within a known Node
91
+ - `context query --intent node_lookup --query "<short-keyword>"` — find candidate Nodes from slug, title, summary, aliases, and tags when direct slug/title/alias matching does not resolve the query
92
+ - `context query --intent section_search --scope <slug> --query "<keywords>"` — find Section details using keyword matching within a known Node
92
93
  - `context query --intent recall --profile <profile> --query "<keywords>"` — archive audit and reconciliation queries using keyword matching
93
94
 
94
95
  Do NOT use BM25 strategy for:
95
- - `context query --intent node_search --scope <slug>` or `--node <slug>` — uses structure, not keywords
96
- - `context query --intent orientation` — uses structure, not keywords
96
+ - `context query --intent node_view --scope <slug>` or `--node <slug>` — uses structure, not keywords
97
+ - `context query --intent orientation` — uses structure, not keywords
97
98
  - `context query --intent impact_analysis` — uses structure, not keywords
98
99
 
99
100
  ## Answer citation shape
@@ -135,11 +136,11 @@ Determine what the user is trying to learn. Choose the appropriate command from
135
136
  - **Vague problem** — user unsure which Node to focus on
136
137
  - Indicators: asks "what is X", "what are the X types", "how to understand X", or question without Node anchor
137
138
  - Action: Run `context query --intent orientation` to show available Nodes and structure; then pick a Node or ask for narrower scope
138
- - **Note**: `node_search` uses structure not BM25; orientation always works regardless of workspace content
139
+ - **Note**: `node_lookup` resolves unknown Node names; `node_view` opens known Node structure; orientation always works regardless of workspace content
139
140
 
140
141
  - **Node explicitly named** — user mentions a specific service/system/concept
141
142
  - Indicators: user names a specific Node or system, "tell me about X", "show me X"
142
- - Action: Run `context query --intent node_search --scope <slug>` to explore that Node
143
+ - Action: Run `context query --intent node_view --scope <slug>` to explore that Node
143
144
 
144
145
  - **Relationship / impact** — user asks how Nodes relate or what breaks if X changes
145
146
  - Indicators: "what depends on X", "impact of X", "relationship between X and Y"
@@ -147,7 +148,7 @@ Determine what the user is trying to learn. Choose the appropriate command from
147
148
 
148
149
  - **Detail within known scope** — user already chose a Node, now asking for specific detail
149
150
  - Indicators: (comes after Node is selected) user asks "how does X handle [feature]", "what features does X support"
150
- - Action: Run `context query --intent description_search --scope <slug> --query "<detail-keywords>"` — use BM25 keywords for precise matching
151
+ - Action: Run `context query --intent section_search --scope <slug> --query "<detail-keywords>"` — use BM25 keywords for precise matching
151
152
 
152
153
  - **Archive / reconciliation** — user explicitly asks for dedup/audit/coverage
153
154
  - Indicators: "find duplicates", "check source coverage"
@@ -170,6 +171,7 @@ Run the command from Step 1. Read the CLI output carefully.
170
171
  - Only suggest `/context:align` + `/context:compile` if user wants it compiled
171
172
  - ⚠️ **`truncated`** (entries cut off) → Mark answer as "non-exhaustive"
172
173
  - Proceed to Step 3; ask for narrowing only if user needs complete inventory
174
+ - ✓ **`node_view` says `visible: complete` / `visibility.complete=true`** → Do not run `section_search` merely to check completeness; use `section_search` only when you need keyword narrowing or ranking inside the Node
173
175
  - ✓ **Entries returned** → Proceed to Step 3
174
176
 
175
177
  ## Step 3: Compose answer from returned structure
@@ -188,7 +190,7 @@ Use only the returned Node/Section structure and content. Do not synthesize beyo
188
190
  ```
189
191
  User asks: "What systems handle X in our architecture?"
190
192
 
191
- Better query (structure-first):
193
+ Better query (structure-first):
192
194
  context query --intent orientation # Shows all available Nodes
193
195
 
194
196
  Returns several candidate Nodes matching the question.
@@ -202,7 +204,7 @@ To dive deeper into any system, ask me for more details or let me know which Nod
202
204
  ```
203
205
 
204
206
  **Why show structure first?** Even when you know keywords, structure queries reveal the full landscape.
205
- Agents should explore Nodes first, then use description_search for details within a chosen Node.
207
+ Agents should explore Nodes first, then use section_search for details within a chosen Node.
206
208
 
207
209
  ## Step 4: Explore further (if user requests)
208
210
 
@@ -211,10 +213,10 @@ Once Node scope is clear, user may ask for deeper exploration.
211
213
  **Supplemental query triggers:**
212
214
 
213
215
  - User asks about Node's relationships/dependencies → `context query --intent impact_analysis --scope <slug>`
214
- - User asks for full Node content after partial answer → `context query --intent node_search --scope <slug>`
215
- - User asks specific detail within chosen Node → `context query --intent description_search --scope <slug> --query "<keywords>"`
216
+ - User asks for full Node content after partial answer → `context query --intent node_view --scope <slug>`
217
+ - User asks specific detail within chosen Node → `context query --intent section_search --scope <slug> --query "<keywords>"`
216
218
  - **Use BM25 strategy**: mix Chinese and English keywords for better matching (e.g., mix synonym or translated forms of the search term)
217
- - User names another Node in `refers_to_nodes` and asks about its relationship → `context query --intent node_search --refers-to <slug>`
219
+ - User names another Node in `refers_to_nodes` and asks about its relationship → `context query --intent node_view --refers-to <slug>`
218
220
 
219
221
  **BM25 tips for supplemental queries:**
220
222
  - When searching for a detail, include both native and translated forms of terms
@@ -26,6 +26,7 @@ only; the CLI performs every write.
26
26
  - Every `merge_update` / `supersede` / `keep_separate` / `split_then_reanchor` write must be supported by **one** valid `proposed.source_ref` covering the final content. Preserve raw evidence's domain terms, numbers, code literals, and named entities; do not introduce acronyms, translations, or aliases the cited evidence does not define. Do not cite a title, `Relations` / `Parent` / `Children` / `Related` navigation line as the sole support for a substantive claim.
27
27
  - Unresolved conflicts and low-confidence support → `action: ask_user`. Never expose `src-N`, Section ids, or source refs as the user-facing choice; they belong only in the structured payload.
28
28
  - `decided_by: user` only after a specific recent user message answering the specific question for the specific item. Auto mode, blanket "continue," and long-running permissions are **not** user confirmation. Never mark yourself.
29
+ - `decided_by: delegated_agent` is CLI-owned. Do not emit it manually; it appears only when the current compile workflow was created with user-authorized `--delegated`.
29
30
  - `omit` is never an automatic decision. If an item looks redundant or low-value, follow the Scope Review pass in [references/scope-review-and-omit.md](references/scope-review-and-omit.md); only a user-confirmed no-write outcome may become `action: omit` with `decided_by: user`.
30
31
  - `apply` consumes the ready review artifact for the current workflow scope: run plain `context reconcile apply`. There is no input file; do not extract `apply_document` with scripts.
31
32
  - Stable output: preserve prepared item order; the CLI rejects unknown fields (timestamps, random ids, storage paths, host absolute paths) and canonicalises stored payloads. Fixed rules and schema come from this skill; only the prepared context varies between repeated review calls.
@@ -37,7 +38,7 @@ only; the CLI performs every write.
37
38
  | `prepare.mode` is `drop` or `refresh` (covers `remove_unsupported` mode semantics, `reanchor`, `split_then_reanchor`) | [references/mode-semantics.md](references/mode-semantics.md) |
38
39
  | review returned `support_confirmation`, `omit_confirmation`, `scope_review_required`, or any `ask_user` you need to upgrade to an executable decision | [references/user-confirmation.md](references/user-confirmation.md) |
39
40
  | review returned `agent_hints[]` with `code: "context-only-leakage-high"` | [references/leakage-and-ownership.md](references/leakage-and-ownership.md) |
40
- | items carry `temporal_prior` / `source_captured_at` / `temporal_disposition`, `source_support.evidence_block_*`, `proposed.detail`, or review returned `example_detail_preservation` | [references/temporal-and-evidence.md](references/temporal-and-evidence.md) |
41
+ | items carry `temporal_prior` / `source_captured_at` / `temporal_disposition`, `source_support.evidence_block_*`, or prepared long `proposed.content` / `proposed.summary` | [references/temporal-and-evidence.md](references/temporal-and-evidence.md) |
41
42
  | considering `action: omit`, or items look redundant / low-value / scope-wrong | [references/scope-review-and-omit.md](references/scope-review-and-omit.md) |
42
43
 
43
44
  If none of the above hold, you are on this skill's main path: refresh/drop/non-compile reconcile, or compile scope-review fallback with no special review-time signals. Ordinary compile prepare relation/support judgment remains `skill-compile-judge`.
@@ -82,9 +83,9 @@ Edge-case actions (`reanchor`, `split_then_reanchor`, `remove_unsupported`, `omi
82
83
  | action | Required fields | Validation |
83
84
  |---|---|---|
84
85
  | `duplicate_skip` | `target` | Exact duplicate or already-applied no-op only. |
85
- | `merge_update` | `target`, `proposed.content`, `proposed.source_ref`, `proposed.detail` when present in prepare | Final content must be supported by cited evidence; `proposed.kind`, when present, must match target kind. |
86
- | `supersede` | `target`, `proposed.kind`, `proposed.content`, `proposed.source_ref`, `proposed.detail` when present in prepare | New Section claim must be supported by cited evidence. |
87
- | `keep_separate` | `target`, `proposed.kind`, `proposed.content`, `proposed.source_ref`, `proposed.detail` when present in prepare | New orthogonal claim must be supported by cited evidence. Weak support is allowed only after explicit user confirmation (`decided_by: user`). |
86
+ | `merge_update` | `target`, `proposed.content`, `proposed.source_ref`, `proposed.summary` when present in prepare | Final content must be supported by cited evidence; `proposed.kind`, when present, must match target kind. |
87
+ | `supersede` | `target`, `proposed.kind`, `proposed.content`, `proposed.source_ref`, `proposed.summary` when present in prepare | New Section claim must be supported by cited evidence. |
88
+ | `keep_separate` | `target`, `proposed.kind`, `proposed.content`, `proposed.source_ref`, `proposed.summary` when present in prepare | New orthogonal claim must be supported by cited evidence. Weak support is allowed only after explicit user confirmation (`decided_by: user`). |
88
89
  | `ask_user` | `user_confirmation.required: true` | Use when business meaning or support cannot be decided from prepared evidence. |
89
90
 
90
91
  Source-support gate: if the proposed claim cannot honestly point at one range covering every sentence, split the claim or ask the user instead of forcing it into an incorrect `source_ref`. If a useful reader summary would combine adjacent evidence, first broaden `proposed.source_ref` so the cited range covers every sentence; if that broadening would require unrelated content, split. See [references/temporal-and-evidence.md](references/temporal-and-evidence.md) for evidence-block repair hints.
@@ -29,7 +29,7 @@ These appear only in drop prepare items. They handle "a Section that the drop wo
29
29
  | Item shape | Decision |
30
30
  |---|---|
31
31
  | Drop item still **fully** supported by surviving source | `reanchor` + `reanchor` — repoint `proposed.source_ref` at the surviving evidence, keep target unchanged. |
32
- | Drop item **partly** supported (one fact survives, another does not) | `reanchor` + `split_then_reanchor` — split into `proposed.sections[]`, each with independent `kind` / `content` / `source_ref` / `detail`. |
32
+ | Drop item **partly** supported (one fact survives, another does not) | `reanchor` + `split_then_reanchor` — split into `proposed.sections[]`, each with independent `kind` / `content` / optional `summary` / `source_ref`. |
33
33
  | No surviving support | `unsupported` + `remove_unsupported` (physical remove on drop apply). |
34
34
 
35
35
  `split_then_reanchor` requires each split Section to be independently supported by its own cited evidence. The CLI rejects splits where any sub-Section's `source_ref` does not cover its `content`.
@@ -4,8 +4,7 @@ Consult this reference when prepare items carry **any** of:
4
4
 
5
5
  - `temporal_prior` / `proposed.source_captured_at` / candidate `source_captured_at` / `last_reconciled_at` / `temporal_disposition`
6
6
  - `source_support.evidence_block_candidates[]` or `source_support.evidence_block_*` repair hints
7
- - `proposed.detail` with command / config / code fence content
8
- - `agent_hints[]` with `code: "example_detail_preservation"`
7
+ - prepared long `proposed.content` / `proposed.summary`, especially with command / config / code fence content
9
8
 
10
9
  For prepare items that have none of the above, ignore this file.
11
10
 
@@ -42,25 +41,26 @@ These are **repair hints**, not automatic broadening permission. Rules:
42
41
 
43
42
  The support gate exists to prevent orphan claims and false evidence links, not to optimize retrieval. Prefer preserving a precise raw-backed claim over rewriting content into a smoother summary.
44
43
 
45
- ## `proposed.detail` preservation
44
+ ## Long `proposed.content` / `proposed.summary` preservation
46
45
 
47
- When the prepare item carries `proposed.detail`, treat it as load-bearing:
46
+ When the prepare item carries long `proposed.content` or a `proposed.summary`, treat both as load-bearing:
48
47
 
49
- - `detail` carries long-form prose, examples, and code blocks.
50
- - Dropping `detail` silently loses knowledge.
51
- - Preserve it **exactly** on executable write decisions (`merge_update`, `supersede.new`, `keep_separate`, `split_then_reanchor` sub-Sections).
52
- - The only legitimate way to clear `detail` is an update-style decision that explicitly emits `detail: null` as the chosen outcome.
48
+ - `content` carries the active Section knowledge, including long-form prose, examples, URLs, tables, commands, config, and code blocks.
49
+ - `summary` is the short reader/query aid for long content.
50
+ - Dropping either field silently loses knowledge or query UX.
51
+ - Preserve prepared `content` and `summary` on executable write decisions (`merge_update`, `supersede.new`, `keep_separate`, `split_then_reanchor` sub-Sections) unless the decision intentionally rewrites the user-facing content.
52
+ - The only legitimate way to clear `summary` is an update-style decision that explicitly emits `summary: null` as the chosen outcome.
53
53
 
54
- ## `example_detail_preservation` repair
54
+ ## Example content preservation repair
55
55
 
56
- If review returns `example_detail_preservation`, the cited example evidence contains a command / config / code fence that did **not** appear in `proposed.detail`. Repair:
56
+ If review reports that a cited example evidence contains a command / config / code fence missing from `proposed.content`, repair:
57
57
 
58
- - **Preferred**: regenerate the decision with the relevant fenced block included in `proposed.detail` (preserve language, fences, and exact code).
58
+ - **Preferred**: regenerate the decision with the relevant fenced block included in `proposed.content` (preserve language, fences, and exact code).
59
59
  - **Fallback only after user confirmation**: keep a prose-only example summary, mark the final decision `decided_by: user` per `references/user-confirmation.md`. Auto mode is not user confirmation.
60
60
 
61
61
  ## How this slots into the main procedure
62
62
 
63
63
  - **Step 1 — Consume**: scan prepare items for the signal fields above; flag affected items for the relevant repair path.
64
64
  - **Step 3 — Decide**: temporal priors inform `rationale` but never the action choice; evidence-block hints may justify broadening the cited range.
65
- - **Step 4 — Emit**: rerun `context reconcile review` after broadening ranges or restoring `detail`; only then proceed to apply.
66
- - **Step 5 — Self-verify**: no executable write strips a prepared `detail`; no temporal field leaks into `proposed`; every broadened `source_ref` has been re-reviewed.
65
+ - **Step 4 — Emit**: rerun `context reconcile review` after broadening ranges or restoring missing example content; only then proceed to apply.
66
+ - **Step 5 — Self-verify**: no executable write strips prepared `content` or `summary`; no temporal field leaks into `proposed`; every broadened `source_ref` has been re-reviewed.
@@ -14,6 +14,7 @@ For runs where review emits no questions, ignore this file.
14
14
  Only **explicit user reply to a question your agent asked**. The following are **not** confirmation:
15
15
 
16
16
  - Auto mode being active
17
+ - Delegated mode being active (`--delegated` lets the CLI make scoped low-risk review decisions; it is not user confirmation for a specific question)
17
18
  - A blanket "continue" / "yes go ahead" earlier in the session
18
19
  - Permission to run shell commands
19
20
  - A previous decision applied with `decided_by: user` for a different item
@@ -61,6 +62,7 @@ After user confirmation:
61
62
  - `decided_by` is a **top-level** decision field, not a `proposed` sub-field.
62
63
  - Final executable decisions must not carry `user_confirmation.required: true`. That flag belongs only on `action: ask_user` items that still need input.
63
64
  - User confirmation permits weak support and omit. It does **not** permit unsupported evidence, missing hard facts, or contradictory claims — those still need stricter evidence or stay `ask_user`.
65
+ - `decided_by: delegated_agent` is reserved for CLI-generated decisions inside a delegated compile workflow. Do not emit it from this skill.
64
66
 
65
67
  ## How this slots into the main procedure
66
68