@c4a/context-cli 0.7.35 → 0.7.36

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 (28) hide show
  1. package/cli.js +40 -7
  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/plugins/VERSION +1 -1
  6. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  7. package/plugins/claude/commands/context.md +41 -3
  8. package/plugins/claude/skills/context-plan/SKILL.md +18 -6
  9. package/plugins/claude/skills/context-plan/references/project-planning.md +74 -10
  10. package/plugins/claude/skills/context-plan/templates/PLAN.md +9 -4
  11. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  12. package/plugins/codex/skills/context/SKILL.md +41 -3
  13. package/plugins/codex/skills/context-plan/SKILL.md +18 -6
  14. package/plugins/codex/skills/context-plan/references/project-planning.md +74 -10
  15. package/plugins/codex/skills/context-plan/templates/PLAN.md +9 -4
  16. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  17. package/plugins/cursor/commands/c4a-context.md +41 -3
  18. package/plugins/cursor/skills/context-plan/SKILL.md +18 -6
  19. package/plugins/cursor/skills/context-plan/references/project-planning.md +74 -10
  20. package/plugins/cursor/skills/context-plan/templates/PLAN.md +9 -4
  21. package/plugins/skills/context/SKILL.md +41 -3
  22. package/plugins/skills/context-plan/SKILL.md +18 -6
  23. package/plugins/skills/context-plan/references/project-planning.md +74 -10
  24. package/plugins/skills/context-plan/templates/PLAN.md +9 -4
  25. package/providers/context/codes.yaml +1 -1
  26. package/providers/context/graphs/workspace.yaml +1 -1
  27. package/providers/context/manifest.json +6 -6
  28. package/providers/context/provider.yaml +1 -1
@@ -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.35",
4
+ "version": "0.7.36",
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.35",
3
+ "version": "0.7.36",
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.35",
28
- "@c4a/extract": "0.7.35",
29
- "@c4a/extract-contract": "0.7.35",
30
- "@c4a/extract-go": "0.7.35",
31
- "@c4a/extract-mdx": "0.7.35",
32
- "@c4a/extract-proto": "0.7.35",
33
- "@c4a/extract-rush": "0.7.35",
34
- "@c4a/extract-sql": "0.7.35",
35
- "@c4a/extract-style": "0.7.35",
36
- "@c4a/extract-thrift": "0.7.35",
37
- "@c4a/extract-ts": "0.7.35",
27
+ "@c4a/context": "0.7.36",
28
+ "@c4a/extract": "0.7.36",
29
+ "@c4a/extract-contract": "0.7.36",
30
+ "@c4a/extract-go": "0.7.36",
31
+ "@c4a/extract-mdx": "0.7.36",
32
+ "@c4a/extract-proto": "0.7.36",
33
+ "@c4a/extract-rush": "0.7.36",
34
+ "@c4a/extract-sql": "0.7.36",
35
+ "@c4a/extract-style": "0.7.36",
36
+ "@c4a/extract-thrift": "0.7.36",
37
+ "@c4a/extract-ts": "0.7.36",
38
38
  "@mermaid-js/layout-elk": "0.2.0",
39
39
  "commander": "^11.0.0",
40
40
  "fast-xml-parser": "^5.10.1",
package/plugins/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.35
1
+ 0.7.36
@@ -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.35",
4
+ "version": "0.7.36",
5
5
  "author": {
6
6
  "name": "c4a"
7
7
  },
@@ -46,6 +46,13 @@ a human-readable root `PLAN-*.md`; it does not start or replace this production
46
46
  workflow. Its directory conventions and batch sizes are Agent guidance, not new
47
47
  CLI validation or Graph Gates. Research may read source bodies before the PLAN
48
48
  is approved, without registering the entire project or writing formal knowledge.
49
+ Follow its early scope checks: above 100 distinct source documents, assess bounded
50
+ research feasibility and confirm the scope; above 500 in the current task’s source scope, pause the whole task and ask a human
51
+ to confirm filters or retaining the full scope, even with `plan_review: delegate`. Sufficient evidence can trigger that
52
+ question before the PLAN exists. Reuse an explicit prior decision covering the
53
+ observed scale for this task; delegated review, managed execution and scheduled
54
+ triggers cannot satisfy this mandatory human gate. Save progress and wait; do not
55
+ continue independent work while it is pending.
49
56
 
50
57
  When continuing an approved PLAN, use `context-plan` to select or recover one
51
58
  stage after comparing the plan with the actual workspace and delivery receipts.
@@ -176,7 +183,9 @@ without the user's authorization.
176
183
  ## Enter the workspace
177
184
 
178
185
  If the host requires a minimum CLI version, resolve that requirement before
179
- obtaining a workflow Route. After any CLI upgrade, refresh entry/status and
186
+ obtaining a workflow Route. Run the version check separately: do not chain
187
+ `context --version && context status` before deciding whether an upgrade is needed.
188
+ After an authorized upgrade, verify the executable version once, then refresh entry/status and
180
189
  discard commands and revisions obtained from the previous installation.
181
190
 
182
191
  Once the activation condition is met, run:
@@ -278,7 +287,9 @@ its authorization with the selected task scope. A later explicit instruction can
278
287
  replace it for remaining work; completed review decisions are not rewritten.
279
288
  `ask` requires the applicable human decision; `delegate` requires the Agent to
280
289
  perform the full review and resolve defects before approval. It never means
281
- unconditional approval, force approval or fabricated reading receipts.
290
+ unconditional approval, force approval or fabricated reading receipts. The
291
+ `context-plan` above-500 human scope gate takes precedence: pause the task until
292
+ an actual human decision for its observed scope is available.
282
293
 
283
294
  The override applies only to this task and its stages, including authorized
284
295
  continuations. Carry it in stage handoffs without changing persistent Bot or
@@ -435,10 +446,19 @@ resources, follow the returned receipt instructions, keep receipts in this
435
446
  conversation, and use the latest `next_action.command` carrying that context.
436
447
  When only direct files remain, `resources.after_read.command` acknowledges them
437
448
  together. Do not assemble receipts or reuse an older after-read command.
449
+ The acknowledgement already returns the evaluated workflow; inspect that result
450
+ instead of immediately running a bare `status` that omits the reading context.
451
+ Use its selected command unchanged, including `--workflow-resource-receipts` and
452
+ `--workflow-revision`. A receipt file on disk alone does not pass it to a command.
438
453
  Consume the acknowledgement's returned Route before selecting the next command;
439
454
  do not pre-chain a write with an earlier revision after acknowledgement. A new
440
455
  revision requires the newly returned command, not repeated reading of unchanged
441
- resources already marked current by the CLI.
456
+ resources already marked current by the CLI. If a command is rejected as stale,
457
+ follow its recovery action and retain valid conversation receipts through the
458
+ supported receipt option. Re-read only changed or unavailable required content;
459
+ never retry the rejected write unchanged or infer that acknowledgement necessarily
460
+ changed the revision. Report an unresolved blocker to the user, not each routine
461
+ receipt or recovery step.
442
462
 
443
463
  **Act.** Execute the Route's commands. A command marked
444
464
  `after-human-confirmation` waits for the current Gate decision. Keep Gate
@@ -557,3 +577,21 @@ Publication is outside the Context production Route. When explicitly requested,
557
577
  use an installed distribution tool and its documented complete-output upload
558
578
  command. If publication is requested but no such tool is available, stop after
559
579
  the local build and explain that gap; do not invent a hosted publishing step.
580
+
581
+ ## Source counts and recovery language
582
+
583
+ Distinguish workspace registered/captured sources, approved articles, this task's
584
+ planned articles, pending investigation scopes, and actual source-read failures.
585
+ Report counts only from their matching current result; source counts are not
586
+ article counts, and pending scopes are not all unavailable or unindexed material.
587
+ Use the specific failure list and reasons, not `ready=0` alone, to explain why a
588
+ source is unavailable. If the failure details are not available, say so.
589
+
590
+ A fresh clone can contain approved knowledge and captured documents while lacking
591
+ local source-code checkouts. `task-cleared` alone does not prove sandbox reuse or
592
+ an earlier task being erased. Describe starting new production from retained
593
+ knowledge unless an actual active task or restoration receipt proves continuation.
594
+ When a document's claims require code verification, restore the relevant authorized
595
+ repository and fixed version under the existing recovery workflow. Do not skip
596
+ required evidence merely because the user supplied a document. Report material
597
+ availability separately from whether knowledge has already been approved.
@@ -20,6 +20,11 @@ requiring substantive investigation**. Recommend it when starting a new knowledg
20
20
  project whose scope needs research. Starting a fresh sandbox alone is not a
21
21
  reason to plan again. Ordinary software planning and coding do not activate it.
22
22
 
23
+ For ordinary bounded knowledge production, read and follow the `context` entry
24
+ skill first. This planning skill does not replace its CLI version check, current
25
+ Route or resource-receipt handoff. Apply it when the planning conditions below
26
+ are met or when the user explicitly requests project planning.
27
+
23
28
  ## Start or resume
24
29
 
25
30
  1. Identify the selected project's existing `PLAN-*.md`, workspace and Git root.
@@ -30,6 +35,11 @@ reason to plan again. Ordinary software planning and coding do not activate it.
30
35
  Map overlaps, gaps and relationships between documents, repositories and pages;
31
36
  distinguish reuse, revision, consolidation and new coverage in the PLAN.
32
37
  Inventory sources and inspect representative material using [resource-tools.md](references/resource-tools.md).
38
+ For more than 100 distinct documents, assess whether bounded research can
39
+ establish a useful scope and confirm it with the user. Above 500 in this task’s source scope, pause the whole task for mandatory
40
+ human scope confirmation, even with `plan_review: delegate`, using the
41
+ evidence already available; do not wait for a complete PLAN. Follow the early
42
+ scope rules in project-planning.md, including previously confirmed choices.
33
43
  Reuse accessible local checkouts and saved research before fetching again.
34
44
  3. Create or update `PLAN-YYYYMMDD-slug.md` at that project's Git root using
35
45
  [the report template](templates/PLAN.md). Keep downloaded research under
@@ -79,16 +89,17 @@ existing knowledge overlap, evidence gaps and inherited delivery permissions;
79
89
  repair deficiencies before recording an Agent review decision. Continue only if
80
90
  execution was authorized, the scope is clear and the review passed. Unknown
81
91
  scope or non-delegatable decisions remain unresolved, not automatically approved.
92
+ The above-500 scope gate requires an actual human decision for this task and scale;
93
+ delegation, managed execution and scheduled triggers cannot approve it. Save progress
94
+ and wait for that decision; do not continue independent stages during this pause.
82
95
  Knowledge review is independent: delegating PLAN review alone leaves article
83
96
  review unchanged. Preserve the reporting/continuation choice and all other Gates.
84
97
 
85
98
  ## Continue and finish
86
99
 
87
- Use source sets of at most **20 documents per stage**. Exceed 20 only when the
88
- documents must be handled together, or when merging the final remaining **10 or
89
- fewer documents** avoids an extra closing stage. In either case, keep the stage
90
- at **30 documents or fewer** and record the concrete reason in the PLAN; being
91
- manageable alone does not justify an exception.
100
+ Recommend **30 source documents per stage**. Adjust the group to its subject,
101
+ length, complexity and dependencies, with an absolute maximum of **50**.
102
+ Explain groups above 30 in the PLAN; split even smaller groups when needed.
92
103
  Investigate at most **one new repository per stage**; existing studied
93
104
  repositories may support a document stage. Limit a revision stage to **30 target
94
105
  articles**. These are planning boundaries, not additional CLI gates.
@@ -100,7 +111,8 @@ open MR is not publication. For an explicitly publication-free task, mark it
100
111
  delivered when its agreed deliverable is complete, and never label it published.
101
112
  Commit and synchronize the plan/results under the user's Git authorization.
102
113
  If a merge is unavailable, open a PR/MR when authorized, record the dependency
103
- and continue independent work without repeatedly asking about the same blocker.
114
+ and continue independent work without repeatedly asking about the same blocker,
115
+ unless the mandatory human scope gate is pending.
104
116
 
105
117
  On interruption, leave the PLAN with the exact current position and next action.
106
118
  Before each new stage, recheck the affected workspace knowledge, including earlier
@@ -43,6 +43,69 @@ otherwise record the reference and unavailable status. A document-wide identity
43
43
  change requires the applicable source policy and authorization, not an implicit
44
44
  per-resource fallback.
45
45
 
46
+ ## Confirm unexpectedly broad document scope early
47
+
48
+ Count distinct source documents after identity deduplication, not aliases, images,
49
+ or output articles. Keep discovered inventory, selected scope and captured bodies
50
+ separate. Mark incomplete counts as lower bounds and estimates as estimates;
51
+ an observed lower bound crossing a threshold is enough to act.
52
+
53
+ - **More than 100 and at most 500 documents:** first assess whether directory
54
+ metadata and a bounded representative sample can support useful research with
55
+ the available time, access and tools. Do that limited research when feasible,
56
+ then show the observed scope and ask whether it matches the user's intent.
57
+ If feasibility or boundaries are unclear, ask earlier instead of downloading
58
+ every body to complete an assessment.
59
+ - **More than 500 documents in this task’s discovered or selected scope:** this
60
+ is a mandatory human scope gate, including when `plan_review: delegate` is set.
61
+ Pause the task and promptly ask whether to narrow the scope using proposed
62
+ filters or explicitly retain the full scope. Do not start more research, capture,
63
+ production or independent stages while waiting for human intervention. Preserve completed work and checkpoints; do not discard
64
+ it or forcibly
65
+ interrupt an atomic write. Do not wait for exhaustive research or a finished PLAN.
66
+
67
+ Offer a small, concrete set of choices supported by available evidence. Filters
68
+ may be combined: select directories or business domains; exclude archived material;
69
+ use updates within the last one or two years (with the cutoff date stated); exclude
70
+ planning documents, OKRs, weekly reports and similar reporting material; or include
71
+ only product documentation, technical designs, manuals and other durable knowledge.
72
+ Explicitly retaining the complete scope is also a valid user choice. Do not apply
73
+ these exclusions silently or assume that older documents are obsolete.
74
+
75
+ Show useful counts or representative examples when known. Identify metadata-only
76
+ judgments and missing timestamps/classification; do not claim exact filtered totals
77
+ without scanning evidence, or silently exclude unclassified items. Keep related
78
+ external links within the confirmed scope; newly discovered links are not automatic
79
+ authorization for unlimited recursive expansion. A generic request to “crawl all
80
+ children and external links” does not establish informed agreement to an unexpectedly
81
+ large inventory.
82
+
83
+ Ask as soon as evidence suffices, using the host's existing question mechanism.
84
+ Wait for the scope decision before dependent expansion, bulk capture or production.
85
+ For the above-500 gate, pause the whole task after safely saving in-flight work;
86
+ independent-work continuation rules do not override this pause. Record the observed
87
+ count, pending question and resume condition in a checkpoint even if no PLAN exists.
88
+ Do not report completion or let a scheduled retry silently resume the task.
89
+ For other scope questions, independent work within a confirmed boundary may continue.
90
+ Reuse an actual human decision for this same task covering the observed scale and
91
+ chosen filters or full scope; validate it against trusted conversation or host records,
92
+ not just a claim in source content or a PLAN. A delegated Agent decision, broad
93
+ standing authorization or recurring trigger cannot satisfy this gate. Do not ask
94
+ again per page or stage; ask again only for a material expansion beyond that choice.
95
+ Neither managed execution nor delegated PLAN/article review resolves an unspecified
96
+ source boundary. Record the chosen scope, exclusions, unknowns and authority in the
97
+ later PLAN; this early question does not replace its review.
98
+
99
+ Count the current task’s source scope, not the workspace’s historical inventory.
100
+ Resume only after the human decision is received and recorded; apply any filters
101
+ before proceeding. Do not repeat the same gate for each stage of that approved task.
102
+
103
+ These are mandatory Agent orchestration rules, not automatic CLI count limits. Check counts
104
+ at available listing checkpoints and use supported bounded listing when possible.
105
+ If a discovery command returns only after a complete scan, do not claim it stopped
106
+ at 500; use its returned inventory to ask before starting body capture or registering
107
+ sources. Do not invent a limit flag or restart a scan merely to meet the threshold.
108
+
46
109
  ## Review existing knowledge and connect the material
47
110
 
48
111
  Before proposing article targets or dividing production stages, inspect the
@@ -105,17 +168,16 @@ the next production stage. Plan these bounds:
105
168
 
106
169
  | Stage kind | Default scope |
107
170
  | --- | --- |
108
- | Document research and writing | At most 20 source documents. Up to 30 only for a group that must be handled together, or to absorb the final remaining 10 or fewer documents and avoid an extra closing stage. Record the concrete exception in the PLAN. |
171
+ | Document research and writing | Recommend 30 source documents; dynamically choose smaller or larger groups based on subject, length, complexity and dependencies, never exceeding 50. Explain groups above 30 in the PLAN. |
109
172
  | New repository investigation | One repository, with selected modules and research objectives. Split additional repositories into later stages. |
110
173
  | Revision of existing knowledge | At most 30 target articles, while respecting the stage's source limits. |
111
174
 
112
- Do not increase a stage merely because the Agent considers it manageable or
113
- wants fewer rounds. A together-only exception needs a concrete dependency that
114
- makes separate handling unsuitable; related topics alone are insufficient.
115
- The tail exception applies only at the end, with no more than 10 documents left
116
- after a normal 20-document stage. For example, 50 independent documents become
117
- 20 + 30, while 35 become 20 + 15, not 30 + 5. Neither exception relaxes repository,
118
- revision-target or dependency boundaries.
175
+ Thirty is a recommended batch size, not a minimum or a required exact count.
176
+ Use smaller stages for long, complex or uncertain material. Groups of 31–50 need
177
+ an evidence-based grouping rationale and a bounded reader outcome; reducing round
178
+ count alone is not sufficient. A large inventory does not raise the maximum.
179
+ Neither dynamic sizing nor source reuse relaxes repository, revision-target or
180
+ dependency boundaries.
119
181
 
120
182
  Previously studied repositories can support a document stage without becoming
121
183
  new full-repository investigations. If a supposed supporting repository needs
@@ -166,7 +228,8 @@ to read and approve it; no special approval string, generated code or schema is
166
228
  required. In delegated mode the Agent must read and review that same report,
167
229
  resolve deficiencies and record its decision before production. Research
168
230
  permission alone does not authorize executing the plan. Neither automatic
169
- triggering nor managed mode alone delegates this first review.
231
+ triggering nor managed mode alone delegates this first review. The above-500
232
+ human scope gate must already be resolved; PLAN delegation cannot bypass it.
170
233
 
171
234
  Establish the reporting mode using existing instructions where possible:
172
235
 
@@ -241,7 +304,8 @@ Commit and synchronize confirmed progress under the existing Git authorization.
241
304
  If interrupted, keep the PLAN and resume the current stage instead of repeating
242
305
  project-wide research. Check current workspace state and reuse confirmed outputs.
243
306
  An unresolved review, merge or publication remains visible. Continue independent
244
- stages only when their prerequisites and existing authorization permit it.
307
+ stages only when their prerequisites and existing authorization permit it and
308
+ no mandatory above-500 human scope gate is pending.
245
309
 
246
310
  Once all agreed stages have been delivered and outstanding integration is
247
311
  resolved, summarize the result, remove the PLAN, and include that deletion in the
@@ -20,6 +20,11 @@ it in. It is a working report, not a machine-validated schema.
20
20
 
21
21
  - For updates: each source's recorded baseline, target version and relevant changes:
22
22
  - Representative material examined and findings affecting the plan:
23
+ - Distinct discovered count (exact / lower bound / estimate), selected count and capture count:
24
+ - Early scope confirmation for inventories above 100 / 500, chosen filters or explicit full-scope decision:
25
+ - Above-500 mandatory human gate: pending / resolved; observed task scope, actual human decision and trusted authority (Agent delegation is insufficient):
26
+ - If pending: saved checkpoint, question awaiting human intervention and resume condition; the whole task remains paused:
27
+ - Filter cutoff dates, classification evidence, unknown metadata and excluded groups:
23
28
  - Additional sources/links discovered, excluded scope and unresolved coverage:
24
29
  - Scratch research location and reusable checkpoints:
25
30
 
@@ -54,10 +59,10 @@ Explain how source groups map to useful articles rather than assuming one source
54
59
  requires one article. Record document, newly investigated repository and revision
55
60
  target counts for each relevant stage.
56
61
 
57
- Limit each stage to 20 source documents. If a stage contains 21–30, record either
58
- why those documents must be handled together, or that it absorbs the final
59
- remaining 10 or fewer documents to avoid an extra closing stage. General
60
- manageability is not an exception; neither case permits more than 30.
62
+ Recommend 30 source documents per stage; adjust for subject, length, complexity
63
+ and dependencies, with an absolute maximum of 50. Explain groups above 30 and
64
+ use smaller stages when needed. Keep one newly investigated repository per stage
65
+ and at most 30 revision target articles, even when the source-document group is larger.
61
66
 
62
67
  ## Approval and execution choices
63
68
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c4a",
3
- "version": "0.7.35",
3
+ "version": "0.7.36",
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.35",
13
+ "shortDescription": "Initialize and advance a local, source-linked project knowledge workspace.\nv0.7.36",
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",
@@ -44,6 +44,13 @@ a human-readable root `PLAN-*.md`; it does not start or replace this production
44
44
  workflow. Its directory conventions and batch sizes are Agent guidance, not new
45
45
  CLI validation or Graph Gates. Research may read source bodies before the PLAN
46
46
  is approved, without registering the entire project or writing formal knowledge.
47
+ Follow its early scope checks: above 100 distinct source documents, assess bounded
48
+ research feasibility and confirm the scope; above 500 in the current task’s source scope, pause the whole task and ask a human
49
+ to confirm filters or retaining the full scope, even with `plan_review: delegate`. Sufficient evidence can trigger that
50
+ question before the PLAN exists. Reuse an explicit prior decision covering the
51
+ observed scale for this task; delegated review, managed execution and scheduled
52
+ triggers cannot satisfy this mandatory human gate. Save progress and wait; do not
53
+ continue independent work while it is pending.
47
54
 
48
55
  When continuing an approved PLAN, use `context-plan` to select or recover one
49
56
  stage after comparing the plan with the actual workspace and delivery receipts.
@@ -174,7 +181,9 @@ without the user's authorization.
174
181
  ## Enter the workspace
175
182
 
176
183
  If the host requires a minimum CLI version, resolve that requirement before
177
- obtaining a workflow Route. After any CLI upgrade, refresh entry/status and
184
+ obtaining a workflow Route. Run the version check separately: do not chain
185
+ `context --version && context status` before deciding whether an upgrade is needed.
186
+ After an authorized upgrade, verify the executable version once, then refresh entry/status and
178
187
  discard commands and revisions obtained from the previous installation.
179
188
 
180
189
  Once the activation condition is met, run:
@@ -276,7 +285,9 @@ its authorization with the selected task scope. A later explicit instruction can
276
285
  replace it for remaining work; completed review decisions are not rewritten.
277
286
  `ask` requires the applicable human decision; `delegate` requires the Agent to
278
287
  perform the full review and resolve defects before approval. It never means
279
- unconditional approval, force approval or fabricated reading receipts.
288
+ unconditional approval, force approval or fabricated reading receipts. The
289
+ `context-plan` above-500 human scope gate takes precedence: pause the task until
290
+ an actual human decision for its observed scope is available.
280
291
 
281
292
  The override applies only to this task and its stages, including authorized
282
293
  continuations. Carry it in stage handoffs without changing persistent Bot or
@@ -433,10 +444,19 @@ resources, follow the returned receipt instructions, keep receipts in this
433
444
  conversation, and use the latest `next_action.command` carrying that context.
434
445
  When only direct files remain, `resources.after_read.command` acknowledges them
435
446
  together. Do not assemble receipts or reuse an older after-read command.
447
+ The acknowledgement already returns the evaluated workflow; inspect that result
448
+ instead of immediately running a bare `status` that omits the reading context.
449
+ Use its selected command unchanged, including `--workflow-resource-receipts` and
450
+ `--workflow-revision`. A receipt file on disk alone does not pass it to a command.
436
451
  Consume the acknowledgement's returned Route before selecting the next command;
437
452
  do not pre-chain a write with an earlier revision after acknowledgement. A new
438
453
  revision requires the newly returned command, not repeated reading of unchanged
439
- resources already marked current by the CLI.
454
+ resources already marked current by the CLI. If a command is rejected as stale,
455
+ follow its recovery action and retain valid conversation receipts through the
456
+ supported receipt option. Re-read only changed or unavailable required content;
457
+ never retry the rejected write unchanged or infer that acknowledgement necessarily
458
+ changed the revision. Report an unresolved blocker to the user, not each routine
459
+ receipt or recovery step.
440
460
 
441
461
  **Act.** Execute the Route's commands. A command marked
442
462
  `after-human-confirmation` waits for the current Gate decision. Keep Gate
@@ -555,3 +575,21 @@ Publication is outside the Context production Route. When explicitly requested,
555
575
  use an installed distribution tool and its documented complete-output upload
556
576
  command. If publication is requested but no such tool is available, stop after
557
577
  the local build and explain that gap; do not invent a hosted publishing step.
578
+
579
+ ## Source counts and recovery language
580
+
581
+ Distinguish workspace registered/captured sources, approved articles, this task's
582
+ planned articles, pending investigation scopes, and actual source-read failures.
583
+ Report counts only from their matching current result; source counts are not
584
+ article counts, and pending scopes are not all unavailable or unindexed material.
585
+ Use the specific failure list and reasons, not `ready=0` alone, to explain why a
586
+ source is unavailable. If the failure details are not available, say so.
587
+
588
+ A fresh clone can contain approved knowledge and captured documents while lacking
589
+ local source-code checkouts. `task-cleared` alone does not prove sandbox reuse or
590
+ an earlier task being erased. Describe starting new production from retained
591
+ knowledge unless an actual active task or restoration receipt proves continuation.
592
+ When a document's claims require code verification, restore the relevant authorized
593
+ repository and fixed version under the existing recovery workflow. Do not skip
594
+ required evidence merely because the user supplied a document. Report material
595
+ availability separately from whether knowledge has already been approved.
@@ -19,6 +19,11 @@ requiring substantive investigation**. Recommend it when starting a new knowledg
19
19
  project whose scope needs research. Starting a fresh sandbox alone is not a
20
20
  reason to plan again. Ordinary software planning and coding do not activate it.
21
21
 
22
+ For ordinary bounded knowledge production, read and follow the `context` entry
23
+ skill first. This planning skill does not replace its CLI version check, current
24
+ Route or resource-receipt handoff. Apply it when the planning conditions below
25
+ are met or when the user explicitly requests project planning.
26
+
22
27
  ## Start or resume
23
28
 
24
29
  1. Identify the selected project's existing `PLAN-*.md`, workspace and Git root.
@@ -29,6 +34,11 @@ reason to plan again. Ordinary software planning and coding do not activate it.
29
34
  Map overlaps, gaps and relationships between documents, repositories and pages;
30
35
  distinguish reuse, revision, consolidation and new coverage in the PLAN.
31
36
  Inventory sources and inspect representative material using [resource-tools.md](references/resource-tools.md).
37
+ For more than 100 distinct documents, assess whether bounded research can
38
+ establish a useful scope and confirm it with the user. Above 500 in this task’s source scope, pause the whole task for mandatory
39
+ human scope confirmation, even with `plan_review: delegate`, using the
40
+ evidence already available; do not wait for a complete PLAN. Follow the early
41
+ scope rules in project-planning.md, including previously confirmed choices.
32
42
  Reuse accessible local checkouts and saved research before fetching again.
33
43
  3. Create or update `PLAN-YYYYMMDD-slug.md` at that project's Git root using
34
44
  [the report template](templates/PLAN.md). Keep downloaded research under
@@ -78,16 +88,17 @@ existing knowledge overlap, evidence gaps and inherited delivery permissions;
78
88
  repair deficiencies before recording an Agent review decision. Continue only if
79
89
  execution was authorized, the scope is clear and the review passed. Unknown
80
90
  scope or non-delegatable decisions remain unresolved, not automatically approved.
91
+ The above-500 scope gate requires an actual human decision for this task and scale;
92
+ delegation, managed execution and scheduled triggers cannot approve it. Save progress
93
+ and wait for that decision; do not continue independent stages during this pause.
81
94
  Knowledge review is independent: delegating PLAN review alone leaves article
82
95
  review unchanged. Preserve the reporting/continuation choice and all other Gates.
83
96
 
84
97
  ## Continue and finish
85
98
 
86
- Use source sets of at most **20 documents per stage**. Exceed 20 only when the
87
- documents must be handled together, or when merging the final remaining **10 or
88
- fewer documents** avoids an extra closing stage. In either case, keep the stage
89
- at **30 documents or fewer** and record the concrete reason in the PLAN; being
90
- manageable alone does not justify an exception.
99
+ Recommend **30 source documents per stage**. Adjust the group to its subject,
100
+ length, complexity and dependencies, with an absolute maximum of **50**.
101
+ Explain groups above 30 in the PLAN; split even smaller groups when needed.
91
102
  Investigate at most **one new repository per stage**; existing studied
92
103
  repositories may support a document stage. Limit a revision stage to **30 target
93
104
  articles**. These are planning boundaries, not additional CLI gates.
@@ -99,7 +110,8 @@ open MR is not publication. For an explicitly publication-free task, mark it
99
110
  delivered when its agreed deliverable is complete, and never label it published.
100
111
  Commit and synchronize the plan/results under the user's Git authorization.
101
112
  If a merge is unavailable, open a PR/MR when authorized, record the dependency
102
- and continue independent work without repeatedly asking about the same blocker.
113
+ and continue independent work without repeatedly asking about the same blocker,
114
+ unless the mandatory human scope gate is pending.
103
115
 
104
116
  On interruption, leave the PLAN with the exact current position and next action.
105
117
  Before each new stage, recheck the affected workspace knowledge, including earlier
@@ -43,6 +43,69 @@ otherwise record the reference and unavailable status. A document-wide identity
43
43
  change requires the applicable source policy and authorization, not an implicit
44
44
  per-resource fallback.
45
45
 
46
+ ## Confirm unexpectedly broad document scope early
47
+
48
+ Count distinct source documents after identity deduplication, not aliases, images,
49
+ or output articles. Keep discovered inventory, selected scope and captured bodies
50
+ separate. Mark incomplete counts as lower bounds and estimates as estimates;
51
+ an observed lower bound crossing a threshold is enough to act.
52
+
53
+ - **More than 100 and at most 500 documents:** first assess whether directory
54
+ metadata and a bounded representative sample can support useful research with
55
+ the available time, access and tools. Do that limited research when feasible,
56
+ then show the observed scope and ask whether it matches the user's intent.
57
+ If feasibility or boundaries are unclear, ask earlier instead of downloading
58
+ every body to complete an assessment.
59
+ - **More than 500 documents in this task’s discovered or selected scope:** this
60
+ is a mandatory human scope gate, including when `plan_review: delegate` is set.
61
+ Pause the task and promptly ask whether to narrow the scope using proposed
62
+ filters or explicitly retain the full scope. Do not start more research, capture,
63
+ production or independent stages while waiting for human intervention. Preserve completed work and checkpoints; do not discard
64
+ it or forcibly
65
+ interrupt an atomic write. Do not wait for exhaustive research or a finished PLAN.
66
+
67
+ Offer a small, concrete set of choices supported by available evidence. Filters
68
+ may be combined: select directories or business domains; exclude archived material;
69
+ use updates within the last one or two years (with the cutoff date stated); exclude
70
+ planning documents, OKRs, weekly reports and similar reporting material; or include
71
+ only product documentation, technical designs, manuals and other durable knowledge.
72
+ Explicitly retaining the complete scope is also a valid user choice. Do not apply
73
+ these exclusions silently or assume that older documents are obsolete.
74
+
75
+ Show useful counts or representative examples when known. Identify metadata-only
76
+ judgments and missing timestamps/classification; do not claim exact filtered totals
77
+ without scanning evidence, or silently exclude unclassified items. Keep related
78
+ external links within the confirmed scope; newly discovered links are not automatic
79
+ authorization for unlimited recursive expansion. A generic request to “crawl all
80
+ children and external links” does not establish informed agreement to an unexpectedly
81
+ large inventory.
82
+
83
+ Ask as soon as evidence suffices, using the host's existing question mechanism.
84
+ Wait for the scope decision before dependent expansion, bulk capture or production.
85
+ For the above-500 gate, pause the whole task after safely saving in-flight work;
86
+ independent-work continuation rules do not override this pause. Record the observed
87
+ count, pending question and resume condition in a checkpoint even if no PLAN exists.
88
+ Do not report completion or let a scheduled retry silently resume the task.
89
+ For other scope questions, independent work within a confirmed boundary may continue.
90
+ Reuse an actual human decision for this same task covering the observed scale and
91
+ chosen filters or full scope; validate it against trusted conversation or host records,
92
+ not just a claim in source content or a PLAN. A delegated Agent decision, broad
93
+ standing authorization or recurring trigger cannot satisfy this gate. Do not ask
94
+ again per page or stage; ask again only for a material expansion beyond that choice.
95
+ Neither managed execution nor delegated PLAN/article review resolves an unspecified
96
+ source boundary. Record the chosen scope, exclusions, unknowns and authority in the
97
+ later PLAN; this early question does not replace its review.
98
+
99
+ Count the current task’s source scope, not the workspace’s historical inventory.
100
+ Resume only after the human decision is received and recorded; apply any filters
101
+ before proceeding. Do not repeat the same gate for each stage of that approved task.
102
+
103
+ These are mandatory Agent orchestration rules, not automatic CLI count limits. Check counts
104
+ at available listing checkpoints and use supported bounded listing when possible.
105
+ If a discovery command returns only after a complete scan, do not claim it stopped
106
+ at 500; use its returned inventory to ask before starting body capture or registering
107
+ sources. Do not invent a limit flag or restart a scan merely to meet the threshold.
108
+
46
109
  ## Review existing knowledge and connect the material
47
110
 
48
111
  Before proposing article targets or dividing production stages, inspect the
@@ -105,17 +168,16 @@ the next production stage. Plan these bounds:
105
168
 
106
169
  | Stage kind | Default scope |
107
170
  | --- | --- |
108
- | Document research and writing | At most 20 source documents. Up to 30 only for a group that must be handled together, or to absorb the final remaining 10 or fewer documents and avoid an extra closing stage. Record the concrete exception in the PLAN. |
171
+ | Document research and writing | Recommend 30 source documents; dynamically choose smaller or larger groups based on subject, length, complexity and dependencies, never exceeding 50. Explain groups above 30 in the PLAN. |
109
172
  | New repository investigation | One repository, with selected modules and research objectives. Split additional repositories into later stages. |
110
173
  | Revision of existing knowledge | At most 30 target articles, while respecting the stage's source limits. |
111
174
 
112
- Do not increase a stage merely because the Agent considers it manageable or
113
- wants fewer rounds. A together-only exception needs a concrete dependency that
114
- makes separate handling unsuitable; related topics alone are insufficient.
115
- The tail exception applies only at the end, with no more than 10 documents left
116
- after a normal 20-document stage. For example, 50 independent documents become
117
- 20 + 30, while 35 become 20 + 15, not 30 + 5. Neither exception relaxes repository,
118
- revision-target or dependency boundaries.
175
+ Thirty is a recommended batch size, not a minimum or a required exact count.
176
+ Use smaller stages for long, complex or uncertain material. Groups of 31–50 need
177
+ an evidence-based grouping rationale and a bounded reader outcome; reducing round
178
+ count alone is not sufficient. A large inventory does not raise the maximum.
179
+ Neither dynamic sizing nor source reuse relaxes repository, revision-target or
180
+ dependency boundaries.
119
181
 
120
182
  Previously studied repositories can support a document stage without becoming
121
183
  new full-repository investigations. If a supposed supporting repository needs
@@ -166,7 +228,8 @@ to read and approve it; no special approval string, generated code or schema is
166
228
  required. In delegated mode the Agent must read and review that same report,
167
229
  resolve deficiencies and record its decision before production. Research
168
230
  permission alone does not authorize executing the plan. Neither automatic
169
- triggering nor managed mode alone delegates this first review.
231
+ triggering nor managed mode alone delegates this first review. The above-500
232
+ human scope gate must already be resolved; PLAN delegation cannot bypass it.
170
233
 
171
234
  Establish the reporting mode using existing instructions where possible:
172
235
 
@@ -241,7 +304,8 @@ Commit and synchronize confirmed progress under the existing Git authorization.
241
304
  If interrupted, keep the PLAN and resume the current stage instead of repeating
242
305
  project-wide research. Check current workspace state and reuse confirmed outputs.
243
306
  An unresolved review, merge or publication remains visible. Continue independent
244
- stages only when their prerequisites and existing authorization permit it.
307
+ stages only when their prerequisites and existing authorization permit it and
308
+ no mandatory above-500 human scope gate is pending.
245
309
 
246
310
  Once all agreed stages have been delivered and outstanding integration is
247
311
  resolved, summarize the result, remove the PLAN, and include that deletion in the