@c4a/context-cli 0.7.105 → 0.7.107

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 (30) hide show
  1. package/cli.js +2458 -1557
  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 +17 -5
  8. package/plugins/claude/resources/context/routine-update.md +46 -27
  9. package/plugins/claude/skills/context-plan/SKILL.md +4 -2
  10. package/plugins/claude/skills/context-plan/references/project-planning.md +9 -1
  11. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  12. package/plugins/codex/skills/context/SKILL.md +17 -5
  13. package/plugins/codex/skills/context/references/routine-update.md +46 -27
  14. package/plugins/codex/skills/context-plan/SKILL.md +4 -2
  15. package/plugins/codex/skills/context-plan/references/project-planning.md +9 -1
  16. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  17. package/plugins/cursor/commands/c4a-context.md +17 -5
  18. package/plugins/cursor/resources/context/routine-update.md +46 -27
  19. package/plugins/cursor/skills/context-plan/SKILL.md +4 -2
  20. package/plugins/cursor/skills/context-plan/references/project-planning.md +9 -1
  21. package/plugins/skills/context/SKILL.md +17 -5
  22. package/plugins/skills/context/references/routine-update.md +46 -27
  23. package/plugins/skills/context-plan/SKILL.md +4 -2
  24. package/plugins/skills/context-plan/references/project-planning.md +9 -1
  25. package/providers/context/manifest.json +10 -10
  26. package/providers/context/provider.yaml +1 -1
  27. package/providers/context/resources/manuals/guides/knowledge-updates.md +137 -0
  28. package/providers/context/resources/procedures/approved-revision.md +6 -1
  29. package/providers/context/resources/procedures/knowledge-updates.md +137 -0
  30. package/providers/context/resources/procedures/source-update.md +20 -0
@@ -73,7 +73,11 @@ workspace targets or the delivery configuration.
73
73
  with [version alignment](version-alignment.md). Enter the workspace named by
74
74
  the host configuration before the entry, cloning it when the current
75
75
  directory does not have it; never initialize a new workspace for a routine
76
- run, and report a missing or unconfigured workspace instead. Clone a missing
76
+ run, and report a missing or unconfigured workspace instead. Run every
77
+ Context command with the `CONTEXT_SOURCE_MODE` the host configuration sets
78
+ (`local` when unset). With `remote` or `auto`, a repository `context status`
79
+ reports as `access: remote` is read from Sourcegraph and needs no clone (the
80
+ knowledge-updates guide, "Update without cloning"). Clone any other missing
77
81
  registered repository (shallow or partial for large ones), then update the
78
82
  workspace branch from its remote. Never discard local work.
79
83
  2. **Resume first.** If `context status` shows an unfinished task, finish it (use
@@ -96,32 +100,43 @@ workspace targets or the delivery configuration.
96
100
  ones that hold no lasting knowledge (step 7), report "no knowledge changes
97
101
  this run" and stop without publication. The only commit allowed then is a
98
102
  workspace SDK upgrade from version alignment, delivered on its own.
99
- 5. **Size the work.** One repository with at most 30 affected articles: update it
100
- directly. Otherwise use `context-plan` with one repository per stage. One
101
- source update always covers all affected articles of that repository; to keep
102
- a large one in groups of about 30, approve and deliver checked pages early
103
- with the Route's `context run --deliver` while the rest stay pending. Above 500
104
- source documents, the `context-plan` human scope gate applies: save progress
105
- and stop.
103
+ 5. **Size the work.** Batch the changed sources as the knowledge-updates guide
104
+ describes in "Refresh several registered sources": size them read-only, give
105
+ a large repository or a monorepo its own batch, and group the rest by
106
+ requirement. Use `context-plan` only for a large repository that needs
107
+ several stages. One source update always covers all affected articles of its
108
+ sources; to keep a large one in groups of about 30, approve and deliver
109
+ checked pages early with the Route's `context run --deliver` while the rest
110
+ stay pending. Above 500 source documents, the `context-plan` human scope
111
+ gate applies: save progress and stop.
106
112
  6. **Run one batch at a time.** Context keeps one active update; finish its
107
- review and delivery before the next. For each repository, move only its
108
- existing registration: rerun `context source add repo` with the registered
109
- namespace, `--module`, remote or local path and subpath, changing only
110
- `--ref <sha>`. Then start the update with `context update --input` naming that
111
- repository's scopes. Use `context update --pending --format json` only when its
112
- pending set is exactly this stage's repository. Only `--pending` downloads:
113
- `--input` reads what the checkout already has, so for it first fetch and check
114
- out the new commit in a shallow or partial clone. Before writing, restore every
115
- source the candidate pages cite, not only this repository: a page that cites
116
- a missing source cannot be submitted. `context source recovery-plan --format
117
- json` lists them with a fill-in restore input. Re-capture changed documents
118
- through their normal capture Route; for a newer origin version, install it
119
- into a new version directory and move the registration first, as in the
120
- knowledge-updates guide's versioned external content section. For pages kept
121
- as written, keep revisions of code contradictions locally, list them in the
122
- run report, and do not raise again a contradiction the history shows was
123
- kept unless its cited code changed. Do not
124
- start a new batch after the time budget; finish or checkpoint the current one.
113
+ review and delivery before the next. Start each batch in this order (the
114
+ knowledge-updates guide, "Refresh several registered sources", step 4):
115
+ 1. Fetch and check out each of the batch's repositories at its new commit in
116
+ a shallow or partial clone, keeping the processed commit available:
117
+ `--input` reads only what the checkout already has. Skip this for a
118
+ repository read from Sourcegraph; size its change with the Sourcegraph
119
+ diff instead.
120
+ 2. Move only the batch's registrations: rerun `context source add repo` with
121
+ the registered namespace, `--module`, remote or local path and subpath,
122
+ changing only `--ref <sha>`.
123
+ 3. Re-capture the batch's changed documents through their normal capture
124
+ Route; for a newer origin version, install it into a new version
125
+ directory and move the registration first, as in the knowledge-updates
126
+ guide's "Versioned external content and archived collections".
127
+ 4. Start one `context update --input` naming the batch's repository and
128
+ document scopes, each with its `requirement_ref`; list a source shared by
129
+ several requirements once per requirement. Use `context update --pending
130
+ --format json` instead only when the batch is every pending repository
131
+ and has no documents; it also downloads what it needs.
132
+
133
+ Before writing, restore every source the candidate pages cite, not only this
134
+ batch's: a page that cites a missing source cannot be submitted. `context
135
+ source recovery-plan --format json` lists them with a fill-in restore input.
136
+ For pages kept as written, keep revisions of code contradictions locally,
137
+ list them in the run report, and do not raise again a contradiction the
138
+ history shows was kept unless its cited code changed. Do not start a new
139
+ batch after the time budget; finish or checkpoint the current one.
125
140
  7. **Cover uncited changes.** In the source-update decision, go through
126
141
  `uncited_changes` by directory, new directories first. Skip tests, lock
127
142
  files, generated code and third-party directories, and read the diff only for
@@ -134,7 +149,9 @@ workspace targets or the delivery configuration.
134
149
  `instruction`; when it needs a page, add it to `new_topics` and let the Indexer
135
150
  Skills write it with the revisions. Write at most 5 new pages per run; put the
136
151
  rest, or a whole new subsystem, into the PLAN as a later `context-plan` stage,
137
- and give each assessed group you do not write a one-line reason.
152
+ and give each assessed group you do not write a one-line reason. When the
153
+ trigger or the workspace `AGENTS.md` asks for corrections only, add no
154
+ `new_topics`; state the left-out additions in `scope_summary` and the result.
138
155
  8. **Write the current state.** Revise each affected article so it reads as the
139
156
  current knowledge, one coherent article: work the change into the existing
140
157
  text instead of appending patch notes, "updated", "new" or "no longer"
@@ -176,6 +193,8 @@ workspace targets or the delivery configuration.
176
193
  | CLI missing or below the host minimum | Install or upgrade once as the entry Skill describes |
177
194
  | Previous run left a task or PLAN | Resume it; never reset or plan again |
178
195
  | Repository or document unreadable | Record a gap, continue with the rest |
196
+ | A command returns `next_action.mcp_tool: authorize_cli` | Call that Sourcegraph MCP tool with `client: "context"` once, run the returned `command` with its `code` and `host`, then rerun the command; on `TEMPORARY_TOKEN_LIMIT` run `context source sourcegraph-auth --refused TEMPORARY_TOKEN_LIMIT` and continue without remote reads |
197
+ | The update lists `skipped_sources` | Those repositories keep their processed versions; report each reason and step, and continue with the rest |
179
198
  | Update stops because cited file contents are not downloaded (`source-content-missing`) | Make them available in the checkout in whatever way suits the environment, such as fetching, checking out the commit or cloning again, then rerun the update |
180
199
  | Review finds fixable problems | Fix the drafts and review again under delegation |
181
200
  | Remote moved during merge | Rebase; re-inspect against the remote commit and record the version again |
@@ -131,8 +131,10 @@ Recommend **30 source documents per stage**. Adjust the group to its subject,
131
131
  length, complexity and dependencies, with an absolute maximum of **50**.
132
132
  Explain groups above 30 in the PLAN; split even smaller groups when needed.
133
133
  Investigate at most **one new repository per stage**; existing studied
134
- repositories may support a document stage. Limit a revision stage to **30 target
135
- articles**. These are planning boundaries, not additional CLI gates.
134
+ repositories may support a document stage. Refreshing repositories that are
135
+ already registered is not new investigation: batch it by requirement as the
136
+ knowledge-updates guide describes, with only a large repository on its own.
137
+ Limit a revision stage to **30 target articles**. These are planning boundaries, not additional CLI gates.
136
138
 
137
139
  After each stage, record actual research, production, review, merge and delivery
138
140
  results in the PLAN. When publication is required, mark it delivered only after
@@ -174,7 +174,7 @@ the next production stage. Plan these bounds:
174
174
  | Stage kind | Default scope |
175
175
  | --- | --- |
176
176
  | 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. |
177
- | New repository investigation | One repository, with selected modules and research objectives. Split additional repositories into later stages. |
177
+ | New repository investigation | One repository, with selected modules and research objectives. Split additional repositories into later stages. A refresh of already registered repositories is not new investigation; see below. |
178
178
  | Revision of existing knowledge | At most 30 target articles, while respecting the stage's source limits. |
179
179
 
180
180
  Thirty is a recommended batch size, not a minimum or a required exact count.
@@ -223,6 +223,14 @@ without an old snapshot, explain the observable current state and do not claim
223
223
  a line-by-line historical diff. Treat unsupported resource representations as
224
224
  coverage limits rather than silently considering the document fully read.
225
225
 
226
+ When the comparison covers repositories that are already registered, batch the
227
+ update as the knowledge-updates guide describes in "Refresh several registered
228
+ sources": size every source read-only first, give a large repository or a
229
+ monorepo its own stage, and group the rest by requirement. Its changed-file
230
+ hint (about 500 code and Markdown files) only decides whether a repository gets
231
+ its own stage; it is unrelated to the mandatory human scope gate above 500 source
232
+ documents.
233
+
226
234
  Summarize the proposed article changes, unchanged coverage and uncertain cases
227
235
  in the PLAN. If the user asked only to inspect changes or provide a comparison,
228
236
  stop at that report. Agreement with the findings alone does not authorize
@@ -93,8 +93,10 @@ as knowledge. Explicit audience-oriented rewriting remains ordinary production.
93
93
  For an authorized knowledge-production request involving more than 30 original
94
94
  documents or at least two repositories needing substantive investigation, use
95
95
  the installed `context-plan` Skill before registering the full request. Also use
96
- it for multi-repository baseline updates and broad document-change scans. Count
97
- the requested change, not all historical workspace sources; repositories used
96
+ it for broad document-change scans. A refresh of already registered sources
97
+ is not new investigation: batch it as the knowledge-updates guide describes in
98
+ "Refresh several registered sources", and plan only a large repository or a
99
+ monorepo that needs its own stages. Count the requested change, not all historical workspace sources; repositories used
98
100
  only as existing reference material do not count as new investigation. A large
99
101
  single repository or long document may warrant planning by module or chapter.
100
102
  For a new knowledge project with unclear boundaries or several deliveries,
@@ -140,7 +142,7 @@ without the user's authorization.
140
142
 
141
143
  ### Check the CLI first
142
144
 
143
- This Skill ships with Context 0.7.105.
145
+ This Skill ships with Context 0.7.107.
144
146
 
145
147
  When entering production in a workspace, align the CLI, this Skill and the
146
148
  workspace SDK once per session with [version alignment](references/version-alignment.md):
@@ -255,8 +257,8 @@ Within an active Context workflow, requests include, but are not limited to:
255
257
  | Capture named documents and pause | Register only the selected documents, capture through the current authorized Route, report usable snapshots and resource gaps, then stop before article planning. |
256
258
  | Preserve conversation insights | Save or use a summary of supplied discussion, not an entire session history. Code-change links are optional. |
257
259
  | Plan a large knowledge project or source refresh | Use `context-plan` for investigation, an approved PLAN and one bounded production stage at a time. |
258
- | Update knowledge from source changes | Assess a selected commit, MR/PR or document change against a fixed source version; route multi-repository or broad scans through `context-plan`, then update the selected stage's affected pages. |
259
- | Bring in another team's knowledge and follow it | A released knowledge package, Skill, documentation repository or wiki that another team maintains, shown here and kept current: register it as a `file` source with its origin and version (knowledge-updates guide, "Versioned external content"), then let the user choose between keeping its pages as written (`preserve_original`) and rewriting them as this knowledge base's articles. Do not copy it into custom website pages or write sync scripts; to only point readers to it, register an import. |
260
+ | Update knowledge from source changes | Assess a selected commit, MR/PR or document change against a fixed source version; refresh several registered sources in batches by requirement (knowledge-updates guide, "Refresh several registered sources"); route broad scans or a large repository through `context-plan`, then update the selected stage's affected pages. |
261
+ | Bring in another team's knowledge and follow it | A released knowledge package, Skill, documentation repository or wiki that another team maintains, shown here and kept current: register it as a `file` source with its origin and version (knowledge-updates guide, "Versioned external content and archived collections"), then let the user choose between keeping its pages as written (`preserve_original`) and rewriting them as this knowledge base's articles. Do not copy it into custom website pages or write sync scripts; to only point readers to it, register an import. |
260
262
  | Run a routine update | Refresh all registered sources (or the named subset) on a schedule without repeating task instructions: read [routine update](references/routine-update.md). |
261
263
  | Revise existing content | Correct current drafts or approved pages, including several pages or supported API-table regeneration. |
262
264
  | Organize pages and sources | Move pages within a collection, rename supported sources or remove unused sources with reference checks. |
@@ -512,6 +514,16 @@ follow its private-install recovery. Keep `CONTEXT_LARK_CLI_BIN` pointing to tha
512
514
  private executable on subsequent Context commands that access Lark; do not
513
515
  upgrade or replace the host's global `lark-cli`.
514
516
 
517
+ Repository sources are read from local checkouts unless `CONTEXT_SOURCE_MODE`
518
+ (or `--source-mode`) is `remote` or `auto`; pass the mode the user or host
519
+ configuration sets to every Context command. A source shown as `access: remote`
520
+ needs no clone for updates, revisions or verification: read its code through
521
+ the Sourcegraph MCP tools at the registered commit. When a command returns
522
+ `next_action.mcp_tool: authorize_cli`, call that tool with `client: "context"`
523
+ once and run the returned `command` with its `code` and `host`; never print the
524
+ token. New pages and code parsing still need a local checkout. The
525
+ knowledge-updates guide, "Update without cloning", has the details.
526
+
515
527
  ### Continue
516
528
 
517
529
  Use `next_route.inline` as the complete Route when present. Read
@@ -73,7 +73,11 @@ workspace targets or the delivery configuration.
73
73
  with [version alignment](version-alignment.md). Enter the workspace named by
74
74
  the host configuration before the entry, cloning it when the current
75
75
  directory does not have it; never initialize a new workspace for a routine
76
- run, and report a missing or unconfigured workspace instead. Clone a missing
76
+ run, and report a missing or unconfigured workspace instead. Run every
77
+ Context command with the `CONTEXT_SOURCE_MODE` the host configuration sets
78
+ (`local` when unset). With `remote` or `auto`, a repository `context status`
79
+ reports as `access: remote` is read from Sourcegraph and needs no clone (the
80
+ knowledge-updates guide, "Update without cloning"). Clone any other missing
77
81
  registered repository (shallow or partial for large ones), then update the
78
82
  workspace branch from its remote. Never discard local work.
79
83
  2. **Resume first.** If `context status` shows an unfinished task, finish it (use
@@ -96,32 +100,43 @@ workspace targets or the delivery configuration.
96
100
  ones that hold no lasting knowledge (step 7), report "no knowledge changes
97
101
  this run" and stop without publication. The only commit allowed then is a
98
102
  workspace SDK upgrade from version alignment, delivered on its own.
99
- 5. **Size the work.** One repository with at most 30 affected articles: update it
100
- directly. Otherwise use `context-plan` with one repository per stage. One
101
- source update always covers all affected articles of that repository; to keep
102
- a large one in groups of about 30, approve and deliver checked pages early
103
- with the Route's `context run --deliver` while the rest stay pending. Above 500
104
- source documents, the `context-plan` human scope gate applies: save progress
105
- and stop.
103
+ 5. **Size the work.** Batch the changed sources as the knowledge-updates guide
104
+ describes in "Refresh several registered sources": size them read-only, give
105
+ a large repository or a monorepo its own batch, and group the rest by
106
+ requirement. Use `context-plan` only for a large repository that needs
107
+ several stages. One source update always covers all affected articles of its
108
+ sources; to keep a large one in groups of about 30, approve and deliver
109
+ checked pages early with the Route's `context run --deliver` while the rest
110
+ stay pending. Above 500 source documents, the `context-plan` human scope
111
+ gate applies: save progress and stop.
106
112
  6. **Run one batch at a time.** Context keeps one active update; finish its
107
- review and delivery before the next. For each repository, move only its
108
- existing registration: rerun `context source add repo` with the registered
109
- namespace, `--module`, remote or local path and subpath, changing only
110
- `--ref <sha>`. Then start the update with `context update --input` naming that
111
- repository's scopes. Use `context update --pending --format json` only when its
112
- pending set is exactly this stage's repository. Only `--pending` downloads:
113
- `--input` reads what the checkout already has, so for it first fetch and check
114
- out the new commit in a shallow or partial clone. Before writing, restore every
115
- source the candidate pages cite, not only this repository: a page that cites
116
- a missing source cannot be submitted. `context source recovery-plan --format
117
- json` lists them with a fill-in restore input. Re-capture changed documents
118
- through their normal capture Route; for a newer origin version, install it
119
- into a new version directory and move the registration first, as in the
120
- knowledge-updates guide's versioned external content section. For pages kept
121
- as written, keep revisions of code contradictions locally, list them in the
122
- run report, and do not raise again a contradiction the history shows was
123
- kept unless its cited code changed. Do not
124
- start a new batch after the time budget; finish or checkpoint the current one.
113
+ review and delivery before the next. Start each batch in this order (the
114
+ knowledge-updates guide, "Refresh several registered sources", step 4):
115
+ 1. Fetch and check out each of the batch's repositories at its new commit in
116
+ a shallow or partial clone, keeping the processed commit available:
117
+ `--input` reads only what the checkout already has. Skip this for a
118
+ repository read from Sourcegraph; size its change with the Sourcegraph
119
+ diff instead.
120
+ 2. Move only the batch's registrations: rerun `context source add repo` with
121
+ the registered namespace, `--module`, remote or local path and subpath,
122
+ changing only `--ref <sha>`.
123
+ 3. Re-capture the batch's changed documents through their normal capture
124
+ Route; for a newer origin version, install it into a new version
125
+ directory and move the registration first, as in the knowledge-updates
126
+ guide's "Versioned external content and archived collections".
127
+ 4. Start one `context update --input` naming the batch's repository and
128
+ document scopes, each with its `requirement_ref`; list a source shared by
129
+ several requirements once per requirement. Use `context update --pending
130
+ --format json` instead only when the batch is every pending repository
131
+ and has no documents; it also downloads what it needs.
132
+
133
+ Before writing, restore every source the candidate pages cite, not only this
134
+ batch's: a page that cites a missing source cannot be submitted. `context
135
+ source recovery-plan --format json` lists them with a fill-in restore input.
136
+ For pages kept as written, keep revisions of code contradictions locally,
137
+ list them in the run report, and do not raise again a contradiction the
138
+ history shows was kept unless its cited code changed. Do not start a new
139
+ batch after the time budget; finish or checkpoint the current one.
125
140
  7. **Cover uncited changes.** In the source-update decision, go through
126
141
  `uncited_changes` by directory, new directories first. Skip tests, lock
127
142
  files, generated code and third-party directories, and read the diff only for
@@ -134,7 +149,9 @@ workspace targets or the delivery configuration.
134
149
  `instruction`; when it needs a page, add it to `new_topics` and let the Indexer
135
150
  Skills write it with the revisions. Write at most 5 new pages per run; put the
136
151
  rest, or a whole new subsystem, into the PLAN as a later `context-plan` stage,
137
- and give each assessed group you do not write a one-line reason.
152
+ and give each assessed group you do not write a one-line reason. When the
153
+ trigger or the workspace `AGENTS.md` asks for corrections only, add no
154
+ `new_topics`; state the left-out additions in `scope_summary` and the result.
138
155
  8. **Write the current state.** Revise each affected article so it reads as the
139
156
  current knowledge, one coherent article: work the change into the existing
140
157
  text instead of appending patch notes, "updated", "new" or "no longer"
@@ -176,6 +193,8 @@ workspace targets or the delivery configuration.
176
193
  | CLI missing or below the host minimum | Install or upgrade once as the entry Skill describes |
177
194
  | Previous run left a task or PLAN | Resume it; never reset or plan again |
178
195
  | Repository or document unreadable | Record a gap, continue with the rest |
196
+ | A command returns `next_action.mcp_tool: authorize_cli` | Call that Sourcegraph MCP tool with `client: "context"` once, run the returned `command` with its `code` and `host`, then rerun the command; on `TEMPORARY_TOKEN_LIMIT` run `context source sourcegraph-auth --refused TEMPORARY_TOKEN_LIMIT` and continue without remote reads |
197
+ | The update lists `skipped_sources` | Those repositories keep their processed versions; report each reason and step, and continue with the rest |
179
198
  | Update stops because cited file contents are not downloaded (`source-content-missing`) | Make them available in the checkout in whatever way suits the environment, such as fetching, checking out the commit or cloning again, then rerun the update |
180
199
  | Review finds fixable problems | Fix the drafts and review again under delegation |
181
200
  | Remote moved during merge | Rebase; re-inspect against the remote commit and record the version again |
@@ -130,8 +130,10 @@ Recommend **30 source documents per stage**. Adjust the group to its subject,
130
130
  length, complexity and dependencies, with an absolute maximum of **50**.
131
131
  Explain groups above 30 in the PLAN; split even smaller groups when needed.
132
132
  Investigate at most **one new repository per stage**; existing studied
133
- repositories may support a document stage. Limit a revision stage to **30 target
134
- articles**. These are planning boundaries, not additional CLI gates.
133
+ repositories may support a document stage. Refreshing repositories that are
134
+ already registered is not new investigation: batch it by requirement as the
135
+ knowledge-updates guide describes, with only a large repository on its own.
136
+ Limit a revision stage to **30 target articles**. These are planning boundaries, not additional CLI gates.
135
137
 
136
138
  After each stage, record actual research, production, review, merge and delivery
137
139
  results in the PLAN. When publication is required, mark it delivered only after
@@ -174,7 +174,7 @@ the next production stage. Plan these bounds:
174
174
  | Stage kind | Default scope |
175
175
  | --- | --- |
176
176
  | 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. |
177
- | New repository investigation | One repository, with selected modules and research objectives. Split additional repositories into later stages. |
177
+ | New repository investigation | One repository, with selected modules and research objectives. Split additional repositories into later stages. A refresh of already registered repositories is not new investigation; see below. |
178
178
  | Revision of existing knowledge | At most 30 target articles, while respecting the stage's source limits. |
179
179
 
180
180
  Thirty is a recommended batch size, not a minimum or a required exact count.
@@ -223,6 +223,14 @@ without an old snapshot, explain the observable current state and do not claim
223
223
  a line-by-line historical diff. Treat unsupported resource representations as
224
224
  coverage limits rather than silently considering the document fully read.
225
225
 
226
+ When the comparison covers repositories that are already registered, batch the
227
+ update as the knowledge-updates guide describes in "Refresh several registered
228
+ sources": size every source read-only first, give a large repository or a
229
+ monorepo its own stage, and group the rest by requirement. Its changed-file
230
+ hint (about 500 code and Markdown files) only decides whether a repository gets
231
+ its own stage; it is unrelated to the mandatory human scope gate above 500 source
232
+ documents.
233
+
226
234
  Summarize the proposed article changes, unchanged coverage and uncertain cases
227
235
  in the PLAN. If the user asked only to inspect changes or provide a comparison,
228
236
  stop at that report. Agreement with the findings alone does not authorize
@@ -2,7 +2,7 @@
2
2
  "schema": "agent-graph.bundle.v1",
3
3
  "provider": {
4
4
  "id": "c4a/context",
5
- "version": "0.7.105"
5
+ "version": "0.7.107"
6
6
  },
7
7
  "providerManifest": "provider.yaml",
8
8
  "graphs": [
@@ -293,7 +293,7 @@
293
293
  {
294
294
  "id": "procedure.approved-revision",
295
295
  "path": "resources/procedures/approved-revision.md",
296
- "digest": "sha256:6690d033c569f295a14b5670365e1a66bb7a95a4d2fb273d8c766c708c72009c"
296
+ "digest": "sha256:4614b1564a07caeedd6d6af370edaa897bcd5e85e1a486845485af8e945a33c5"
297
297
  },
298
298
  {
299
299
  "id": "procedure.close-and-build",
@@ -328,7 +328,7 @@
328
328
  {
329
329
  "id": "procedure.knowledge-updates",
330
330
  "path": "resources/procedures/knowledge-updates.md",
331
- "digest": "sha256:08fe0c29905aa64b47d311dee0297d427ccab7a3e3a2ad7cb6a559b1f636184b"
331
+ "digest": "sha256:ce2c33ef8ab66d04220eb455a3153b901cbc2bc9d3f1873fecf7651b386657b2"
332
332
  },
333
333
  {
334
334
  "id": "procedure.note",
@@ -388,7 +388,7 @@
388
388
  {
389
389
  "id": "procedure.source-update",
390
390
  "path": "resources/procedures/source-update.md",
391
- "digest": "sha256:88422cad3e2b589e8b0d540c0bcd14f55f8ce7ae05a058bb0d6210fa0be309f1"
391
+ "digest": "sha256:e0de1bbbdb08fb6dd38043e2d96e2d6b8e6c51231f0b16c5f1bb621224cfbda3"
392
392
  },
393
393
  {
394
394
  "id": "procedure.task-recovery",
@@ -598,7 +598,7 @@
598
598
  },
599
599
  {
600
600
  "path": "provider.yaml",
601
- "digest": "sha256:95d1794678fc51e0830b07d6a1cef3888766b6bc3e41bcfd9244a088d97108b2"
601
+ "digest": "sha256:4ff3ea3fa8ee460b99912ad7456cf6245df16764c6b80eac3a06016bb351a982"
602
602
  },
603
603
  {
604
604
  "path": "resources/contracts/indexer-provider-guide.yaml",
@@ -658,7 +658,7 @@
658
658
  },
659
659
  {
660
660
  "path": "resources/manuals/guides/knowledge-updates.md",
661
- "digest": "sha256:380c6f978c7275c621bce8ee0207b566b66c19db899765ca0b455c4df1782928"
661
+ "digest": "sha256:8ac769f9f5130d152c05c7353536659b3e64bd087602502e2e71c4f51ae4e880"
662
662
  },
663
663
  {
664
664
  "path": "resources/manuals/guides/lark-resources.md",
@@ -726,7 +726,7 @@
726
726
  },
727
727
  {
728
728
  "path": "resources/procedures/approved-revision.md",
729
- "digest": "sha256:6690d033c569f295a14b5670365e1a66bb7a95a4d2fb273d8c766c708c72009c"
729
+ "digest": "sha256:4614b1564a07caeedd6d6af370edaa897bcd5e85e1a486845485af8e945a33c5"
730
730
  },
731
731
  {
732
732
  "path": "resources/procedures/close-and-build.md",
@@ -754,7 +754,7 @@
754
754
  },
755
755
  {
756
756
  "path": "resources/procedures/knowledge-updates.md",
757
- "digest": "sha256:08fe0c29905aa64b47d311dee0297d427ccab7a3e3a2ad7cb6a559b1f636184b"
757
+ "digest": "sha256:ce2c33ef8ab66d04220eb455a3153b901cbc2bc9d3f1873fecf7651b386657b2"
758
758
  },
759
759
  {
760
760
  "path": "resources/procedures/note.md",
@@ -802,7 +802,7 @@
802
802
  },
803
803
  {
804
804
  "path": "resources/procedures/source-update.md",
805
- "digest": "sha256:88422cad3e2b589e8b0d540c0bcd14f55f8ce7ae05a058bb0d6210fa0be309f1"
805
+ "digest": "sha256:e0de1bbbdb08fb6dd38043e2d96e2d6b8e6c51231f0b16c5f1bb621224cfbda3"
806
806
  },
807
807
  {
808
808
  "path": "resources/procedures/task-recovery.md",
@@ -921,5 +921,5 @@
921
921
  "indexer": [],
922
922
  "workspace": []
923
923
  },
924
- "digest": "sha256:0d0ca2b076dcb6791fca32c0df90bbe96e856380a7de42e32d84de16dddb6990"
924
+ "digest": "sha256:ea176547125847c529283a51c9b35ebc9c03db40434ccac829b8cc33b885a0e3"
925
925
  }
@@ -1,6 +1,6 @@
1
1
  schema: agent-graph.provider.v1
2
2
  id: c4a/context
3
- version: 0.7.105
3
+ version: 0.7.107
4
4
  name: Context workflow
5
5
  description: Internal work contract for Context knowledge workspaces.
6
6
  graphs:
@@ -456,6 +456,136 @@ Before importing a `note`, read [note source preparation](note.md).
456
456
  Before importing `sessions`, read [development summary preparation](sessions.md).
457
457
  Choose the reference for the actual input; do not read both by default.
458
458
 
459
+ ## Refresh several registered sources
460
+
461
+ When several registered sources move to newer versions together, size them
462
+ first and update them in batches, so each review covers related pages:
463
+
464
+ 1. **Size read-only.** Before changing `sources/repo/index.yaml`, fetch only the
465
+ target commits (`git ls-remote`, or `git fetch` with `--filter=blob:none` in a
466
+ partial clone). Do not pull, check out or move any HEAD yet: a checkout that
467
+ no longer matches its registered commit reports a changed source boundary.
468
+ List each repository's changes with `git diff --name-status <processed>
469
+ <target> -- <registered subpath>`, which compares trees without downloading
470
+ file contents and prints full paths; do not use `--stat`, which downloads
471
+ both versions of every changed file. Count official code and Markdown files,
472
+ not tests, lock files, generated output (including run records such as
473
+ workflow artifacts) or third-party directories. For documents, check their
474
+ current revision; a `file` source whose local directory no longer exists
475
+ cannot be refreshed, so report it instead of counting it as unchanged.
476
+ 2. **Separate large repositories.** A monorepo, a large repository, or one with
477
+ many relevant changed files (about 500 as a guide, or many new directories
478
+ whose features need assessing) gets its own batch. This is a judgment, not a
479
+ limit: a few new directories are assessed as uncited changes in their batch.
480
+ 3. **Group the rest by requirement.** Each requirement in `src/indexers.yaml`
481
+ whose sources changed forms one batch. A source shared by several
482
+ requirements moves once, in one batch: put it with the requirement whose
483
+ pages cite it most (`knowledge/structure.yaml` lists each page's citations),
484
+ and list it in that update once per
485
+ requirement that includes it. The update covers every page citing it
486
+ whatever its requirement, but advances only the listed requirements; one
487
+ left out stays pending and returns the same citations in another update. A
488
+ requirement whose sources bring only citation changes or one to three pages
489
+ joins the smallest batch instead of forming its own; mention it separately
490
+ in the batch report. Across
491
+ sources, split a batch above 30 pages by source: `module_refs` do not narrow
492
+ the candidate pages of one source, so a smaller batch needs fewer sources. A
493
+ single source above 30 pages uses `context run --deliver` to deliver checked
494
+ pages in groups.
495
+ 4. **Run one batch at a time.** Context keeps one active update. When a batch
496
+ starts, fetch and check out its repositories at the target commits with the
497
+ cited files' contents available (`--input` reads only what the checkout has;
498
+ keep the processed commit available for history), move only this batch's
499
+ registrations (`context source add repo` changing only `--ref`; register a
500
+ checkout kept outside the workspace through a workspace-relative alias such
501
+ as `.tmp/repo/<name>`, as `context source restore` does, not an absolute
502
+ path that only exists on this machine), recapture its documents and upgrade
503
+ its versioned file sources (see "Versioned external content and archived
504
+ collections"), then start one `context update --input` listing all of the batch's `repo:`, `lark:` and `file:` scopes, each
505
+ with its `requirement_ref`. Do not move later batches' registrations early.
506
+ 5. **`--pending` only for one repository-only batch.** `context update
507
+ --pending` covers repositories only and is a write: once it runs, the batch
508
+ cannot be split with `--input` without rolling back. Use it only when the
509
+ batch is every pending repository and has no documents.
510
+
511
+ The user or the workspace `AGENTS.md` may also ask for a corrections-only
512
+ update: correct what pages already say, add no features or topics the pages did
513
+ not cover, and avoid repeating the same detail across pages. In the
514
+ source-update decision, then leave `new_topics` empty, say in `scope_summary`
515
+ which uncited additions were left out, and put the rule into each revised
516
+ page's `instruction` so the writing step follows it.
517
+
518
+ ## Update without cloning: read repositories through Sourcegraph
519
+
520
+ When a registered repository is also registered on a Sourcegraph site, Context
521
+ can read it over HTTP instead of from a checkout. Updates (`context update
522
+ --input` and `--pending`), revisions, submission checks, `verify` and `status`
523
+ then need no clone. The result is byte for byte the same: Context reads the raw
524
+ blob at the registered commit, checks it against its Git object id, and compares
525
+ commits with a names-only diff, so citations, `changed_references`, evidence
526
+ and `uncited_changes` match a local checkout. Writing new pages and parsing code
527
+ still need a local checkout, and so do `context source restore` and `ensure`.
528
+
529
+ Choose the mode with `CONTEXT_SOURCE_MODE` or `--source-mode` (the option wins):
530
+
531
+ | Mode | Behavior |
532
+ | --- | --- |
533
+ | `local` (default) | Checkouts only, exactly as before; Context sends no Sourcegraph request even when a site or token is configured. |
534
+ | `remote` | Every repository source is read from Sourcegraph. A repository it cannot serve is skipped: the update leaves that scope out (its processed version does not move), lists it in `skipped_sources` with the reason, and continues with the other scopes. |
535
+ | `auto` | Sourcegraph first, per repository; one the site cannot serve uses its local checkout, restored as usual when missing. Without a token, auto mode asks for authorization like remote mode instead of falling back. |
536
+
537
+ Sourcegraph can serve a repository when the site declares the remote-read
538
+ operations, the registered `git.remote` names the same code host and repository
539
+ as the Sourcegraph registration, one registered path group contains the whole
540
+ `subpath`, and the registered commit is readable. Commands that read remotely
541
+ say so: `context update` and `verify --format json` return `source_access`
542
+ (each repository's `access`, site, repository and commit, or the reason it was
543
+ skipped or read locally), and in `status` each such source has `access: remote`
544
+ instead of checkout advice. `ready` keeps describing the local checkout.
545
+
546
+ **Authorization.** The Sourcegraph MCP server the Agent already uses is the only
547
+ configuration needed. When a command needs a token and has none, it returns a
548
+ `next_action` with `mcp_tool: authorize_cli`, once, at top level
549
+ (`source_authorization`); sources waiting for it are listed with
550
+ `reason_code: sourcegraph-authorization-required` and need no clone. Call that MCP tool once with
551
+ `client: "context"`, then run
552
+
553
+ ```bash
554
+ context source sourcegraph-auth --code <code> --host <host> --format json
555
+ ```
556
+
557
+ with the returned one-time `code` and `host` (the site's API root). The CLI
558
+ exchanges the code for a temporary read-only token, keeps it in
559
+ `.tmp/context-runtime/sourcegraph/token.json` (mode 600, never committed) and
560
+ reuses it for later commands in this workspace. Authorize again only when a
561
+ command asks for it again: after the token expired unused, was revoked, or
562
+ reached its maximum lifetime. Never print, copy or log the token. If
563
+ `authorize_cli` answers `TEMPORARY_TOKEN_LIMIT`, do not retry; run `context
564
+ source sourcegraph-auth --refused TEMPORARY_TOKEN_LIMIT --format json`, after
565
+ which remote mode skips repository sources and auto mode reads checkouts until
566
+ earlier temporary tokens expire or are revoked in the Sourcegraph user
567
+ settings. On a development machine or in CI, `SOURCEGRAPH_URL` and
568
+ `SOURCEGRAPH_API_TOKEN` take precedence and need no authorization; Sourcegraph
569
+ CLI login configuration is not read.
570
+
571
+ **Versions.** Only the registered commit decides whether a repository can be
572
+ read. When it is not readable yet, `status`, `verify`, revisions and an explicit
573
+ `update --input` report it and change nothing; `context update --pending` asks
574
+ Sourcegraph to prepare its content (when the site allows), waits a bounded time
575
+ and otherwise reports the job and the next step. Rate limits and full quotas
576
+ are reported, never retried in a loop. When only the processed commit is no
577
+ longer readable, the update still runs: history evidence is `unavailable` and
578
+ `uncited_changes` reports the comparison as unknown, as with a shallow checkout.
579
+ A site that cannot list directories still groups uncited changes but marks no
580
+ `new_directory`, and says so in the entry's `note`.
581
+
582
+ **Reading for writing.** For a source the CLI reads from Sourcegraph, size the
583
+ change with the Sourcegraph diff of the processed and registered commits, and
584
+ read or search code through the Sourcegraph MCP tools pinned to the registered
585
+ full commit; do not clone it for the update. A source read locally, a new page
586
+ and code parsing follow the checkout steps above. A read failure in remote mode
587
+ is never a citation change: `verify` reports those citations as not checked.
588
+
459
589
  ## Versioned external content and archived collections
460
590
 
461
591
  Published content that another team versions, such as a documentation
@@ -771,6 +901,13 @@ An unrelated queued page does not revoke an unchanged current page's review.
771
901
  If a page has already been applied, finish its close/build before changing its
772
902
  inputs. Only the final completed scope advances its processed baseline.
773
903
 
904
+ For a source update, the adjustment keeps the citation results the update
905
+ already computed; it does not read the sources again. When those results came
906
+ from the local checkout rather than the source (for example, every citation of
907
+ a repository reported `unavailable` before its checkout was restored or moved),
908
+ discard the unfinished update as described in "Adjust or roll back current work"
909
+ and start `context update` again.
910
+
774
911
  For several documents, `source import` also accepts a JSON/YAML array of the same
775
912
  single-document inputs. Its receipt reports each zero-based input index and
776
913
  success or error separately; a partial batch returns a nonzero exit code.
@@ -9,6 +9,8 @@ mediaType: text/markdown
9
9
  The current action contains the approved page and the user's instruction. Read
10
10
  the entire page first. Revise only what the instruction and available sources
11
11
  support; retain still-correct explanations and confirmed user contributions.
12
+ When the instruction asks for corrections only, do not add material it does not
13
+ ask for.
12
14
 
13
15
  For an expression-only change, the approved text is enough. Do not capture,
14
16
  parse, partition, or reconfigure its source. For changed facts, read the relevant
@@ -178,7 +180,10 @@ fixed source, signing) against the current Route and returns one result per page
178
180
  with its issues, without saving drafts, task state or source caches. It reports problems and never repairs them: for example, a line range
179
181
  past the end of a file is reported, not clamped. Write the whole batch, preview
180
182
  it once, correct the flagged pages, then submit; do not write ad-hoc validation
181
- or re-signing scripts.
183
+ or re-signing scripts. For pages from a source update, the task input does not
184
+ list which citations changed: the preview reports each citation the processed
185
+ source no longer confirms (`processed-reference-stale`, with the old text's new
186
+ lines when known), so re-cite those, or quote or rewrite the paragraph.
182
187
 
183
188
  Preview is useful only when its assembled text will be read before deciding to
184
189
  submit. An unattended loop submits directly. Continue from the receipt's