@c4a/context-cli 0.7.30 → 0.7.35

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 (88) hide show
  1. package/cli.js +2491 -645
  2. package/indexers/bundles/context-code-indexer/references/indexer.md +17 -0
  3. package/indexers/bundles/context-code-indexer/templates/articles/c01.md +1 -1
  4. package/indexers/bundles/context-code-indexer/templates/articles/c07.md +1 -1
  5. package/indexers/bundles/context-code-indexer/templates/articles/l02.md +1 -1
  6. package/indexers/bundles/context-markdown-indexer/references/indexer.md +17 -0
  7. package/indexers/bundles/context-markdown-indexer/templates/articles/c01.md +1 -1
  8. package/indexers/bundles/context-markdown-indexer/templates/articles/c07.md +1 -1
  9. package/indexers/bundles/context-markdown-indexer/templates/articles/l02.md +1 -1
  10. package/indexers/bundles/context-note-indexer/references/writing.md +17 -0
  11. package/indexers/bundles/context-note-indexer/templates/articles/c01.md +1 -1
  12. package/indexers/bundles/context-note-indexer/templates/articles/c07.md +1 -1
  13. package/indexers/bundles/context-note-indexer/templates/articles/l02.md +1 -1
  14. package/indexers/bundles/context-sessions-indexer/references/writing.md +17 -0
  15. package/indexers/bundles/context-sessions-indexer/templates/articles/c01.md +1 -1
  16. package/indexers/bundles/context-sessions-indexer/templates/articles/c07.md +1 -1
  17. package/indexers/bundles/context-sessions-indexer/templates/articles/l02.md +1 -1
  18. package/indexers/contracts/profile-contract.json +245 -245
  19. package/indexers/release-manifest.json +21 -21
  20. package/package.json +12 -12
  21. package/plugins/README.md +45 -2
  22. package/plugins/README_CN.md +33 -2
  23. package/plugins/VERSION +1 -1
  24. package/plugins/claude/.claude-plugin/plugin.json +3 -2
  25. package/plugins/claude/commands/context-inspect-search.md +18 -0
  26. package/plugins/claude/commands/context-plan.md +12 -0
  27. package/plugins/claude/commands/context.md +125 -9
  28. package/plugins/claude/skills/context-inspect-search/SKILL.md +18 -0
  29. package/plugins/claude/skills/context-plan/SKILL.md +110 -0
  30. package/plugins/claude/skills/context-plan/agents/openai.yaml +2 -0
  31. package/plugins/claude/skills/context-plan/references/project-planning.md +250 -0
  32. package/plugins/claude/skills/context-plan/references/resource-tools.md +100 -0
  33. package/plugins/claude/skills/context-plan/templates/PLAN.md +113 -0
  34. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  35. package/plugins/codex/skills/context/SKILL.md +125 -9
  36. package/plugins/codex/skills/context-inspect-search/SKILL.md +18 -0
  37. package/plugins/codex/skills/context-plan/SKILL.md +109 -0
  38. package/plugins/codex/skills/context-plan/agents/openai.yaml +2 -0
  39. package/plugins/codex/skills/context-plan/references/project-planning.md +250 -0
  40. package/plugins/codex/skills/context-plan/references/resource-tools.md +100 -0
  41. package/plugins/codex/skills/context-plan/templates/PLAN.md +113 -0
  42. package/plugins/cursor/.cursor-plugin/plugin.json +3 -2
  43. package/plugins/cursor/commands/c4a-context-inspect-search.md +18 -0
  44. package/plugins/cursor/commands/c4a-context-plan.md +9 -0
  45. package/plugins/cursor/commands/c4a-context.md +125 -9
  46. package/plugins/cursor/skills/context-inspect-search/SKILL.md +18 -0
  47. package/plugins/cursor/skills/context-plan/SKILL.md +110 -0
  48. package/plugins/cursor/skills/context-plan/agents/openai.yaml +2 -0
  49. package/plugins/cursor/skills/context-plan/references/project-planning.md +250 -0
  50. package/plugins/cursor/skills/context-plan/references/resource-tools.md +100 -0
  51. package/plugins/cursor/skills/context-plan/templates/PLAN.md +113 -0
  52. package/plugins/skills/context/SKILL.md +125 -9
  53. package/plugins/skills/context-code-indexer/references/indexer.md +17 -0
  54. package/plugins/skills/context-code-indexer/templates/articles/c01.md +1 -1
  55. package/plugins/skills/context-code-indexer/templates/articles/c07.md +1 -1
  56. package/plugins/skills/context-code-indexer/templates/articles/l02.md +1 -1
  57. package/plugins/skills/context-inspect-search/SKILL.md +18 -0
  58. package/plugins/skills/context-markdown-indexer/references/indexer.md +17 -0
  59. package/plugins/skills/context-markdown-indexer/templates/articles/c01.md +1 -1
  60. package/plugins/skills/context-markdown-indexer/templates/articles/c07.md +1 -1
  61. package/plugins/skills/context-markdown-indexer/templates/articles/l02.md +1 -1
  62. package/plugins/skills/context-note-indexer/references/writing.md +17 -0
  63. package/plugins/skills/context-note-indexer/templates/articles/c01.md +1 -1
  64. package/plugins/skills/context-note-indexer/templates/articles/c07.md +1 -1
  65. package/plugins/skills/context-note-indexer/templates/articles/l02.md +1 -1
  66. package/plugins/skills/context-plan/SKILL.md +109 -0
  67. package/plugins/skills/context-plan/agents/openai.yaml +2 -0
  68. package/plugins/skills/context-plan/references/project-planning.md +250 -0
  69. package/plugins/skills/context-plan/references/resource-tools.md +100 -0
  70. package/plugins/skills/context-plan/templates/PLAN.md +113 -0
  71. package/plugins/skills/context-sessions-indexer/references/writing.md +17 -0
  72. package/plugins/skills/context-sessions-indexer/templates/articles/c01.md +1 -1
  73. package/plugins/skills/context-sessions-indexer/templates/articles/c07.md +1 -1
  74. package/plugins/skills/context-sessions-indexer/templates/articles/l02.md +1 -1
  75. package/providers/context/actions/repair-project-entry.yaml +1 -0
  76. package/providers/context/graphs/workspace.yaml +1 -1
  77. package/providers/context/manifest.json +27 -23
  78. package/providers/context/provider.yaml +1 -1
  79. package/providers/context/resources/manuals/guides/knowledge-updates.md +6 -0
  80. package/providers/context/resources/manuals/guides/lark-resources.md +94 -11
  81. package/providers/context/resources/manuals/guides/source-batches.md +89 -0
  82. package/providers/context/resources/manuals/guides/workspace-prepare.md +12 -0
  83. package/providers/context/resources/manuals/reference/project-api.md +4 -0
  84. package/providers/context/resources/procedures/document-capture.md +31 -11
  85. package/providers/context/resources/procedures/knowledge-review.md +13 -0
  86. package/providers/context/resources/procedures/knowledge-updates.md +6 -0
  87. package/providers/context/resources/procedures/source-capture-detailed.md +40 -8
  88. package/providers/context/resources/procedures/workspace-prepare.md +12 -0
@@ -2,7 +2,7 @@
2
2
  "schema": "agent-graph.bundle.v1",
3
3
  "provider": {
4
4
  "id": "c4a/context",
5
- "version": "0.7.30"
5
+ "version": "0.7.35"
6
6
  },
7
7
  "providerManifest": "provider.yaml",
8
8
  "graphs": [
@@ -14,7 +14,7 @@
14
14
  {
15
15
  "id": "workspace",
16
16
  "path": "graphs/workspace.yaml",
17
- "digest": "sha256:a0db554b3506e9a68464afe11a5d486a0ce0a0340747f810d8ebdf2fec285c43"
17
+ "digest": "sha256:d2cab288ca8c31fa361316f014f5a60c36ac433070acf28331198c750cdb8d73"
18
18
  }
19
19
  ],
20
20
  "actions": [
@@ -126,7 +126,7 @@
126
126
  {
127
127
  "id": "repair-project-entry",
128
128
  "path": "actions/repair-project-entry.yaml",
129
- "digest": "sha256:8ffa98a8d15d82aabe63786d473fc3154507cb1ab2389e2e6ed7827b47187312"
129
+ "digest": "sha256:c232c81d0a3e77b54faa7e9383e6ba23ca4ce68411dad9e61eaad53d175bc1cd"
130
130
  },
131
131
  {
132
132
  "id": "repair-verification",
@@ -183,7 +183,7 @@
183
183
  {
184
184
  "id": "context.sdk.lark-resources",
185
185
  "path": "resources/manuals/guides/lark-resources.md",
186
- "digest": "sha256:d5b6b44fe800f302232300adbdb4f32b04b78588ea7879dc9a5c247f36658b9d"
186
+ "digest": "sha256:18e00d57ecb21e990f847a5a104992a7c8cb24769f2b7dcdf7153137dd707663"
187
187
  },
188
188
  {
189
189
  "id": "context.sdk.package-outputs",
@@ -203,7 +203,7 @@
203
203
  {
204
204
  "id": "context.sdk.project-api",
205
205
  "path": "resources/manuals/reference/project-api.md",
206
- "digest": "sha256:a65131d5cd351d8353f5028303ab1d75447f5d0c09496fd8ec83bb5d76adfd78"
206
+ "digest": "sha256:d7af120518aa721f06ae2233a824a674b50eee5096244d1b9eb5efb659f8ea90"
207
207
  },
208
208
  {
209
209
  "id": "context.sdk.template-variables",
@@ -288,7 +288,7 @@
288
288
  {
289
289
  "id": "procedure.document-capture",
290
290
  "path": "resources/procedures/document-capture.md",
291
- "digest": "sha256:2e6b4e45587fffc1930a3dce0fc6b68d659499a034a367e1cc34a2ef46cb50d9"
291
+ "digest": "sha256:bc5b30df9dabe85f5bfe1cd9b4bdd7c1504e0ecb7fb7870f6f09de4dc1fb44fc"
292
292
  },
293
293
  {
294
294
  "id": "procedure.document-code-investigation",
@@ -308,12 +308,12 @@
308
308
  {
309
309
  "id": "procedure.knowledge-review",
310
310
  "path": "resources/procedures/knowledge-review.md",
311
- "digest": "sha256:f0532acbc93458c90209dfed3395b69873eeea6b7d431ae52a84d44c4553751e"
311
+ "digest": "sha256:fa37908e7766f62227e02f6d38f3f3cc9ec023fd1ab01374bcb56e11338cf6fa"
312
312
  },
313
313
  {
314
314
  "id": "procedure.knowledge-updates",
315
315
  "path": "resources/procedures/knowledge-updates.md",
316
- "digest": "sha256:bd457b533803f214899f58e03846354f50fafa479a97e01665beb5065a5e90fb"
316
+ "digest": "sha256:44cea5c34793c775a0729f589f4436546528ddcde524e36fe16b5bad0f8e32e1"
317
317
  },
318
318
  {
319
319
  "id": "procedure.note",
@@ -368,7 +368,7 @@
368
368
  {
369
369
  "id": "procedure.source-capture-detailed",
370
370
  "path": "resources/procedures/source-capture-detailed.md",
371
- "digest": "sha256:39644875f09bac66580332357c3d9701c234da036b61205c8a02029165455f76"
371
+ "digest": "sha256:f49fd80a51f68c1e27c59c9aeb4875fb21a4e53d10f26e75d251b4e024f49b83"
372
372
  },
373
373
  {
374
374
  "id": "procedure.source-update",
@@ -398,7 +398,7 @@
398
398
  {
399
399
  "id": "procedure.workspace-prepare",
400
400
  "path": "resources/procedures/workspace-prepare.md",
401
- "digest": "sha256:5fc94a9197a52ec894d5a58872faf1812c18c1e4ff06fd92244dc551147c1bb4"
401
+ "digest": "sha256:023b97b68dcfa74f5024f9e1cbebdb417af40f6918624e3154cd62a063f854eb"
402
402
  },
403
403
  {
404
404
  "id": "procedure.workspace-restore",
@@ -535,7 +535,7 @@
535
535
  },
536
536
  {
537
537
  "path": "actions/repair-project-entry.yaml",
538
- "digest": "sha256:8ffa98a8d15d82aabe63786d473fc3154507cb1ab2389e2e6ed7827b47187312"
538
+ "digest": "sha256:c232c81d0a3e77b54faa7e9383e6ba23ca4ce68411dad9e61eaad53d175bc1cd"
539
539
  },
540
540
  {
541
541
  "path": "actions/repair-verification.yaml",
@@ -571,11 +571,11 @@
571
571
  },
572
572
  {
573
573
  "path": "graphs/workspace.yaml",
574
- "digest": "sha256:a0db554b3506e9a68464afe11a5d486a0ce0a0340747f810d8ebdf2fec285c43"
574
+ "digest": "sha256:d2cab288ca8c31fa361316f014f5a60c36ac433070acf28331198c750cdb8d73"
575
575
  },
576
576
  {
577
577
  "path": "provider.yaml",
578
- "digest": "sha256:50adfb493675f902e6df4d6eade84bb279c64b767084aa15277d65870825458e"
578
+ "digest": "sha256:145fbe98232a53f310b8c26cc6e0cb66b132677b9edd8b98656783430a39e66a"
579
579
  },
580
580
  {
581
581
  "path": "resources/contracts/indexer-provider-guide.yaml",
@@ -631,11 +631,11 @@
631
631
  },
632
632
  {
633
633
  "path": "resources/manuals/guides/knowledge-updates.md",
634
- "digest": "sha256:8d408d8d15c4f322a2ffcaac7798ece234f3a0bf58d2a122ee3ab97472ef75c3"
634
+ "digest": "sha256:c85e58acf930b9ffae128f0bb83d5494024dd81ae1c338df4a2fa6fa0a95695f"
635
635
  },
636
636
  {
637
637
  "path": "resources/manuals/guides/lark-resources.md",
638
- "digest": "sha256:d5b6b44fe800f302232300adbdb4f32b04b78588ea7879dc9a5c247f36658b9d"
638
+ "digest": "sha256:18e00d57ecb21e990f847a5a104992a7c8cb24769f2b7dcdf7153137dd707663"
639
639
  },
640
640
  {
641
641
  "path": "resources/manuals/guides/markdown-indexer-skill-authoring.md",
@@ -657,13 +657,17 @@
657
657
  "path": "resources/manuals/guides/sessions.md",
658
658
  "digest": "sha256:b1d86d1fb96f1caba5baf7859bf20ac43e4fe890a40db453727cf2627d44fac6"
659
659
  },
660
+ {
661
+ "path": "resources/manuals/guides/source-batches.md",
662
+ "digest": "sha256:9e338332986deab67932e62398db0221a7be139ac056f0856a46738164df411e"
663
+ },
660
664
  {
661
665
  "path": "resources/manuals/guides/workspace-commit.md",
662
666
  "digest": "sha256:586ef0f6fc21b4c2183ef0f6764baac27558690aa4a0b75b9295a942135222d6"
663
667
  },
664
668
  {
665
669
  "path": "resources/manuals/guides/workspace-prepare.md",
666
- "digest": "sha256:057ab5a00ed51629bf856551a20b18fb9e81a9a597dcd87dd44e9b1c9dffd3f2"
670
+ "digest": "sha256:2b6ad6ab07597a6cf36cd91c36991cc8b042468cf0f87c1c72952074b47f29e7"
667
671
  },
668
672
  {
669
673
  "path": "resources/manuals/guides/workspace-restore.md",
@@ -679,7 +683,7 @@
679
683
  },
680
684
  {
681
685
  "path": "resources/manuals/reference/project-api.md",
682
- "digest": "sha256:a65131d5cd351d8353f5028303ab1d75447f5d0c09496fd8ec83bb5d76adfd78"
686
+ "digest": "sha256:d7af120518aa721f06ae2233a824a674b50eee5096244d1b9eb5efb659f8ea90"
683
687
  },
684
688
  {
685
689
  "path": "resources/manuals/reference/template-variables.md",
@@ -695,7 +699,7 @@
695
699
  },
696
700
  {
697
701
  "path": "resources/procedures/document-capture.md",
698
- "digest": "sha256:2e6b4e45587fffc1930a3dce0fc6b68d659499a034a367e1cc34a2ef46cb50d9"
702
+ "digest": "sha256:bc5b30df9dabe85f5bfe1cd9b4bdd7c1504e0ecb7fb7870f6f09de4dc1fb44fc"
699
703
  },
700
704
  {
701
705
  "path": "resources/procedures/document-code-investigation.md",
@@ -711,11 +715,11 @@
711
715
  },
712
716
  {
713
717
  "path": "resources/procedures/knowledge-review.md",
714
- "digest": "sha256:f0532acbc93458c90209dfed3395b69873eeea6b7d431ae52a84d44c4553751e"
718
+ "digest": "sha256:fa37908e7766f62227e02f6d38f3f3cc9ec023fd1ab01374bcb56e11338cf6fa"
715
719
  },
716
720
  {
717
721
  "path": "resources/procedures/knowledge-updates.md",
718
- "digest": "sha256:bd457b533803f214899f58e03846354f50fafa479a97e01665beb5065a5e90fb"
722
+ "digest": "sha256:44cea5c34793c775a0729f589f4436546528ddcde524e36fe16b5bad0f8e32e1"
719
723
  },
720
724
  {
721
725
  "path": "resources/procedures/note.md",
@@ -759,7 +763,7 @@
759
763
  },
760
764
  {
761
765
  "path": "resources/procedures/source-capture-detailed.md",
762
- "digest": "sha256:39644875f09bac66580332357c3d9701c234da036b61205c8a02029165455f76"
766
+ "digest": "sha256:f49fd80a51f68c1e27c59c9aeb4875fb21a4e53d10f26e75d251b4e024f49b83"
763
767
  },
764
768
  {
765
769
  "path": "resources/procedures/source-update.md",
@@ -783,7 +787,7 @@
783
787
  },
784
788
  {
785
789
  "path": "resources/procedures/workspace-prepare.md",
786
- "digest": "sha256:5fc94a9197a52ec894d5a58872faf1812c18c1e4ff06fd92244dc551147c1bb4"
790
+ "digest": "sha256:023b97b68dcfa74f5024f9e1cbebdb417af40f6918624e3154cd62a063f854eb"
787
791
  },
788
792
  {
789
793
  "path": "resources/procedures/workspace-restore.md",
@@ -878,5 +882,5 @@
878
882
  "indexer": [],
879
883
  "workspace": []
880
884
  },
881
- "digest": "sha256:36c06f801f991b92bb78cc94676c8d338389bdc031f49577eb196a96628b2f76"
885
+ "digest": "sha256:95dc30eefd6778add4f5d3adc118e5e41691a12d2d6df57c139c41e13443782f"
882
886
  }
@@ -1,6 +1,6 @@
1
1
  schema: agent-graph.provider.v1
2
2
  id: c4a/context
3
- version: 0.7.30
3
+ version: 0.7.35
4
4
  name: Context workflow
5
5
  description: Internal work contract for Context knowledge workspaces.
6
6
  graphs:
@@ -500,6 +500,12 @@ the user without blocking an independently supported local correction.
500
500
 
501
501
  ## Import a document response already read by the host
502
502
 
503
+ For complete snapshots produced by `context source fetch lark`, use the optional
504
+ `snapshot_dir` form described in [Lark resource reuse](lark-resources.md#reuse-a-complete-planning-snapshot).
505
+ It reuses saved bodies and all captured resources without remote reads, retaining
506
+ their original capture time and source revision. The response-file form below
507
+ remains supported when the host supplies its own full document responses.
508
+
503
509
  For a registered Lark source, retain the actual full JSON response from
504
510
  `lark-cli docs +fetch` and each returned continuation page. Do not reconstruct a
505
511
  response from a summary. Use the same source import command:
@@ -14,14 +14,65 @@ actual full response files and downloaded media for the same normalization and
14
14
  resource checks; it does not fetch that supplied body again. See
15
15
  [importing an existing response](knowledge-updates.md#import-a-document-response-already-read-by-the-host).
16
16
 
17
+ ## Reuse a complete planning snapshot
18
+
19
+ Before creating a workspace or registering sources, an authorized research task
20
+ can save a portable snapshot:
21
+
22
+ ```bash
23
+ context source fetch lark https://example.larkoffice.com/docx/example-token \
24
+ --output .tmp/research/handbook --as bot --format json
25
+ ```
26
+
27
+ The output directory must not exist. Fetch keeps one fixed identity for the body
28
+ and resources; Bot is the default and never switches to User automatically.
29
+ Explicit User reads use the host's existing authorization behavior. Supported
30
+ resources retain the same permission handling and rate-limit recovery as capture.
31
+ Read the returned fidelity and resource diagnostics before using the material.
32
+ A failed operation can leave an incomplete directory; only an intact completion
33
+ receipt can be imported.
34
+
35
+ After registering the matching source in the selected workspace, save this input
36
+ using its actual registered name and local snapshot path:
37
+
38
+ ```json
39
+ {
40
+ "type": "lark",
41
+ "name": "20260101/handbook",
42
+ "snapshot_dir": ".tmp/research/handbook"
43
+ }
44
+ ```
45
+
46
+ ```bash
47
+ context source import --input .tmp/import-handbook.json --format json
48
+ ```
49
+
50
+ Keep or move the complete directory: `snapshot.json`, document, original response
51
+ pages and resource files. Paths in the input resolve from the selected workspace.
52
+ Import checks the source match, file integrity and capture report, then follows
53
+ the existing capture write and workflow protections. It reuses structured
54
+ resources as well as images without remote reads. It retains the original
55
+ capture time, source revision and coverage gaps; importing does not establish
56
+ upstream freshness. The receipt verifies local integrity, not source authenticity.
57
+ The saved resource policy must match the configured capture phase. If it differs,
58
+ use that phase's normal capture operation or explicitly reconcile its configuration;
59
+ import does not silently reinterpret saved resources under a new policy.
60
+ Do not synthesize platform responses or repair a damaged receipt by editing it;
61
+ use an intact snapshot or fetch again into a new directory.
62
+
63
+ The existing `response_files` import contract remains supported. It avoids
64
+ fetching the supplied body again, but may fetch other resources; `snapshot_dir`
65
+ is the complete-snapshot alternative.
66
+
17
67
  ## Resource policy
18
68
 
19
69
  | Resource | Default capture behavior |
20
70
  |---|---|
21
- | Image and attachment | Download the original file and link it from the Markdown projection. |
71
+ | Image | Download the original; on explicit download permission denial, try a same-identity preview once and mark it as a preview. |
72
+ | Attachment | Download the original file and link it from the Markdown projection. |
22
73
  | Sheet | Read the complete selected sheet, render a Markdown table, and retain a CSV snapshot. |
23
74
  | Base | Read the selected table/view with pagination, render a Markdown table, and retain a canonical JSON snapshot. |
24
- | Whiteboard and diagram | Retain a readable preview plus the raw structured export. |
75
+ | Whiteboard and diagram | Retain a readable preview plus the raw structured export; if only raw export is denied, retain and explicitly label the available preview. |
25
76
  | Synced block | Resolve the exact source block, project its body, and retain a Markdown evidence snapshot. |
26
77
  | Poll | Preserve exported options and metadata as non-interactive Markdown; warn when the export omits them. |
27
78
  | Bookmark, citation, sub-document, chat, and generic embed | Preserve a stable navigation reference and provenance. |
@@ -34,21 +85,43 @@ preserves an unavailable-resource notice with the reason code
34
85
  `document.resource.source-missing`, reports a warning, and continues capture;
35
86
  it does not pretend that the deleted content was materialized. When the current
36
87
  identity can read the document body but the API explicitly returns
37
- `authorization/permission_denied` for an embedded resource, Context records
88
+ an explicit permission denial (including HTTP 403) for an embedded resource, Context records
38
89
  `document.resource.permission-denied`, keeps the stable resource identity in
39
90
  the audit layer, renders the same unavailable-resource notice, and continues
40
- with a warning. Missing scopes, transient network errors, malformed payloads,
41
- and unclassified authorization failures still block capture. Reference-only
91
+ with a warning. Explicit missing-scope and access-denied resource responses are
92
+ likewise recorded without changing identity. Transient network errors, malformed
93
+ payloads, and unclassified failures still block capture. Reference-only
42
94
  resources remain explicit in the capture report. Unknown non-empty XML blocks
43
95
  stay auditable in the raw XML and receive a warning; the CLI does not infer
44
96
  their meaning.
45
97
 
46
- Document and resource reads share one access identity. Context first uses the
47
- user identity; it falls back to the bot identity only when user credentials
48
- are unavailable, never when the source denies permission or reports missing
49
- scopes. This prevents a capture from mixing document text read by one identity
50
- with attachments read by another. A bot fallback is reported in the capture
51
- result and remains subject to the bot's own access boundary.
98
+ When raw whiteboard export is denied after its preview succeeds, the preview is
99
+ usable visual material, not complete structured evidence. The report retains a
100
+ preview warning; unavailable raw nodes must not be reconstructed or described as
101
+ successfully acquired. A permission failure before any usable representation is
102
+ obtained leaves only the reference and an unavailable-resource notice.
103
+
104
+ Document and resource reads share one access identity. The configured default is
105
+ user. Bot mode permits one whole-document user fallback for a body authorization
106
+ failure, restarting all pages. After the body is read, resources remain under
107
+ that identity. A resource failure never requests another identity's credentials.
108
+ Legacy explicit auto mode may select Bot when user credentials are unavailable;
109
+ all resources still use the identity that supplied the complete body.
110
+
111
+ ## Download concurrency and throttling
112
+
113
+ Independent resources use up to four concurrent requests within one capture.
114
+ Nested synced-block projections follow leaf resources. The CLI keeps one access
115
+ identity, deduplicates resources, and enforces the existing byte limits.
116
+
117
+ Explicit structured HTTP 429 or rate-limit responses reduce concurrency and
118
+ pause queued requests together. Each request receives at most three retries
119
+ with exponential backoff; exposed Retry-After values are respected. Eight
120
+ successful requests allow concurrency to increase by one, up to four. Exhausted
121
+ retries or a server wait longer than 30 seconds stop further resource requests
122
+ for this capture. Already acquired resources and failure diagnostics are retained.
123
+ This recovery does not ask for user confirmation or another identity's credentials;
124
+ persistent failures remain visible and are not reported as successful acquisition.
52
125
 
53
126
  ## Storage lifecycle
54
127
 
@@ -184,3 +257,13 @@ limits. The reading meaning of an image is handled in writing and Review.
184
257
  Source document links can be retained for viewing under the reader's permissions.
185
258
  Temporary signed media links are not durable image hosting. Do not embed access
186
259
  tokens in generated pages or claim that excluded images have been interpreted.
260
+
261
+ ### Capture identity and unavailable media
262
+
263
+ The selected document identity remains fixed for resource reads. In Bot mode,
264
+ only an authorization failure while reading the body can restart the article
265
+ as the current user. Resource failures never trigger that identity fallback.
266
+ Images may use the official same-identity preview endpoint after download
267
+ permission is denied. Previews are marked explicitly; unavailable resources
268
+ retain references and diagnostics. Use available body evidence without inferring
269
+ missing resource contents, and review evidence gaps before approving conclusions.
@@ -0,0 +1,89 @@
1
+ ---
2
+ id: context.sdk.source-batches
3
+ kind: procedure
4
+ mediaType: text/markdown
5
+ ---
6
+
7
+ # Resumable source operations
8
+
9
+ These optional commands improve source discovery and registration. They do not
10
+ select a production scope, capture document bodies, approve articles, or change
11
+ the current workflow. Existing single-source and batch commands remain valid.
12
+
13
+ ## Register a large batch
14
+
15
+ Use the existing batch payload and add checkpoints when recovery is useful:
16
+
17
+ ```bash
18
+ context source add batch 20260101 --input .tmp/sources.json --checkpoint --progress --format json
19
+ ```
20
+
21
+ The final JSON retains `kind`, `namespace`, `total`, and `registered`. When
22
+ checkpoints are enabled, `checkpoint` also provides `job_id`, `status_command`,
23
+ and `resume_command`. Progress is bounded JSON on stderr; stdout contains the
24
+ final receipt. Without `--progress`, existing output behavior is retained.
25
+
26
+ ```bash
27
+ context source batch-status <job-id> --format json
28
+ context source add batch --resume <job-id> --progress --format json
29
+ ```
30
+
31
+ The saved input remains under `.tmp/context-runtime/source-batches/`. Resume
32
+ validates and replays every input against the current registry; a saved cursor
33
+ is advisory and never authorizes skipping validation. Resume does not require
34
+ the original payload file. It registers sources only; `--configure` remains an
35
+ explicit choice. Do not combine `--resume` with a date or replacement input.
36
+
37
+ Batch registration retains partial-success semantics. Valid entries before a
38
+ failed item remain registered, and the error identifies completed entries and
39
+ the failed position. Lark entries are validated in memory and committed in
40
+ bounded atomic chunks. Repository and file entries retain their existing
41
+ registration checks. An unchanged chunk does not rewrite its registry.
42
+
43
+ Checkpoint initialization is checked before registration starts. If later
44
+ progress storage becomes unavailable, successful registration remains successful
45
+ and the receipt includes a warning. A missing progress file does not prevent
46
+ replaying an intact saved input.
47
+
48
+ Only one workspace writer may run at a time. Poll an active command rather than
49
+ starting another writer or deleting its lock. Normal cancellation finishes the
50
+ current bounded write and releases the lock. Forced termination can leave a
51
+ stale lock; follow `context task recover --format json` before resuming. A saved
52
+ checkpoint survives process restarts in the same workspace, but not deletion of
53
+ its temporary directory or a new workspace without those files.
54
+
55
+ ## Discover a Wiki directory
56
+
57
+ For an explicitly authorized Wiki subtree:
58
+
59
+ Run discovery from an existing Context workspace. It saves research metadata
60
+ without changing the source registry or production scope.
61
+
62
+ ```bash
63
+ context source discover lark https://example.larkoffice.com/wiki/example-token --as bot --format json
64
+ context source discover lark https://example.larkoffice.com/wiki/example-token --as bot --resume --format json
65
+ ```
66
+
67
+ Discovery saves directory metadata, object identities, aliases, and page receipts
68
+ under `.tmp/context-runtime/wiki-discovery/`. It reads neither document bodies nor
69
+ their external links, and does not register sources or create capture phases.
70
+ The result gives the manifest path and counts instead of printing the whole tree.
71
+
72
+ The identity defaults to Bot and is fixed for the job. Bot reads never switch to User credentials.
73
+ Permission failures are recorded without prompting for authorization or stopping
74
+ independent directories. Completed pages are reused; explicit resume retries
75
+ transient failures. The manifest describes the observed scan, not an atomic
76
+ snapshot of a remotely changing Wiki.
77
+
78
+ Explicit `--as user` uses the host's existing user-authorization behavior, which
79
+ may request consent when credentials or scopes are missing.
80
+
81
+ `--concurrency` accepts 1 through 4 and defaults to 4. Rate limits reduce active
82
+ concurrency and apply bounded retries with a shared cooldown. Exhausted retries
83
+ leave a resumable partial result. Progress goes to stderr by default; use
84
+ `--no-progress` to disable it. `completed`, `partial`, and `paused` distinguish
85
+ the outcome; partial or paused discovery exits nonzero while preserving results.
86
+
87
+ Existing jobs require `--resume` and the same identity. A running discovery owns
88
+ its job lease; a second invocation cannot overwrite it. Discovery does not hold
89
+ the workspace source-registration lock.
@@ -6,6 +6,18 @@ mediaType: text/markdown
6
6
 
7
7
  # Prepare a workspace for the next task
8
8
 
9
+ ## Capture-only requests in an existing workspace
10
+
11
+ An explicit request to capture named documents and pause does not start article
12
+ production. Register those sources first using the source-registration contract,
13
+ then reevaluate status for the capture Route. Capture precedes the cleared-task
14
+ resumption gate, so `task resume` is unnecessary for this request. Do not create
15
+ a production stage and then clear it to return to capture. Retain existing tasks,
16
+ drafts, approved content and source registrations. Stop after reporting the
17
+ selected capture results; resumption requires a request to produce knowledge.
18
+ The preparation and cleanup procedure below applies only when cleanup itself
19
+ is requested, not merely because the workspace previously completed a task.
20
+
9
21
  Agent policy: `context.gate.workspace_reset_restore`. A clear request to
10
22
  prepare this workspace authorizes the described task-state cleanup; clarify
11
23
  only an unresolved target or loss.
@@ -30,6 +30,10 @@ state.
30
30
 
31
31
  ## Sources
32
32
 
33
+ For optional directory inventories and recoverable registration, see
34
+ [Resumable source operations](../guides/source-batches.md). These operations do
35
+ not select or expand the current production scope.
36
+
33
37
  ```ts
34
38
  const repo = source("20260901", "component-lib");
35
39
  const docs = source("20260901/product-docs", { type: "file" });
@@ -9,6 +9,12 @@ mediaType: text/markdown
9
9
  Capture creates a reproducible local snapshot of a registered document source.
10
10
  It does not classify, summarize, approve, or build knowledge.
11
11
 
12
+ For an explicit capture-and-pause request, register the named sources before
13
+ starting article production. Do not call `task resume` or prepare/clear a
14
+ production stage merely to reach capture. Once the selected documents have
15
+ outcomes, report those outcomes and stop. Preserve unrelated pending sources
16
+ and unfinished production work; a Route does not broaden the user's scope.
17
+
12
18
  Before capture:
13
19
 
14
20
  1. every registered document module must have a matching capture declaration;
@@ -36,10 +42,17 @@ child sandbox. If the CLI reports an external-environment requirement, retry
36
42
  the same returned command through the host. Never downgrade credential
37
43
  protection as a recovery step.
38
44
 
39
- Capture targets are a batch. Process one current target, evaluate status again,
45
+ Capture targets are a batch. Process one current target, consume its freshly
46
+ returned Route if present, or evaluate status when no fresh Route is returned,
40
47
  and continue until the graph reports the batch complete. Never treat one
41
48
  successful module as completion of the whole batch.
42
49
 
50
+ Use the capture result's source identity, fidelity and resource-materialization
51
+ summary for the final report. Open the full audit file only for truncated output,
52
+ an unexplained outcome, or a requested investigation. Report previews as previews
53
+ and unavailable resources as unavailable; no additional Git inspection or source
54
+ lookup is required solely to repeat an already complete capture receipt.
55
+
43
56
  The CLI owns normalization, snapshot identity, hashes, manifests, and
44
57
  idempotency. For Lark sources it also owns embedded-resource download,
45
58
  structured export, completeness reporting, and link projection. Required
@@ -53,19 +66,26 @@ text or scan outside the confirmed boundary.
53
66
  For Lark reads, set `CONTEXT_LARK_IDENTITY=user|bot` in the environment of every
54
67
  Context invocation that may read Lark; the default is `user`. A host/Bot prompt
55
68
  setting alone is not an exported environment variable. User mode reads only
56
- as the current user. Bot mode reads as the configured application, then retries
57
- once as the current user on a credential, scope or access denial. Subsequent
58
- reads in that capture use the fallback identity, including pagination, synced
59
- references, media, Sheets, Base and whiteboards. Network, rate-limit and format
60
- errors do not switch identity. The diagnostic records any fallback.
69
+ as the current user. Bot mode may fall back once to the current user only when
70
+ reading the document body fails with a credential, scope or access denial.
71
+ The fallback restarts the entire body, including pagination; never combine body
72
+ pages from different identities. Once the body is available, its identity is
73
+ fixed for all media, synced references, Sheets, Base and whiteboard reads.
74
+ Resource failures do not request user authorization or restart the article.
75
+ Network, rate-limit and format errors do not switch identity.
76
+
77
+ An image download denied by permissions may use the official preview endpoint
78
+ once with the same identity. A captured preview is explicitly marked as such.
79
+ Unavailable resources retain their location and failure reason; continue with
80
+ other resources and usable body text. Never infer missing image contents or
81
+ present a partial snapshot as a complete original. Assess any evidence gaps
82
+ before approving conclusions that depend on those resources.
61
83
 
62
84
  This setting does not grant source access or change the intended audience of
63
85
  the resulting knowledge. Do not use another person's credentials. For direct
64
- host `lark-cli` reads, explicitly pass the selected `--as bot` or `--as user`
65
- on every business read, including Wiki resolution/listing and asset reads.
66
- If Bot access fails for the reasons above, retry that read once as user; stop
67
- and report a pending source if user authorization is required. In a managed
68
- runtime, use its authorization flow rather than repeatedly running `auth login`.
86
+ host reads, explicitly pass the article's selected identity on every read.
87
+ Only an article-level fallback may request the current user's authorization;
88
+ use the managed runtime's authorization flow once when needed.
69
89
  Local help and embedded skill discovery require no document authorization;
70
90
  do not request user OAuth just to read a CLI guide.
71
91
 
@@ -65,6 +65,13 @@ preview after replacement delivery, and repair its
65
65
  reported incoming references. Navigation removal alone does not remove content
66
66
  from search or packages. A renamed menu does not require a new article identity.
67
67
 
68
+ Before requesting human review, follow the report's navigation diagnostics.
69
+ Bind unplaced drafts to suitable existing categories using the returned adjustment
70
+ action, then regenerate the report. Draft placement does not require content
71
+ approval. Ask about placement only when the existing structure and task do not
72
+ establish a reasonable destination. Keep unplaced pages visible for diagnosis;
73
+ do not describe the report as ready while placement is unresolved.
74
+
68
75
  The report opens on a change overview, with the existing navigation and an
69
76
  expected workspace file tree. The CLI collects approved titles, navigation and
70
77
  candidate bodies; it renders their changes mechanically. Do not write a second
@@ -160,3 +167,9 @@ any fallback affecting reader understanding. Reuse the planning choice; do not
160
167
  turn image handling into another per-article approval. Missing image content must
161
168
  not be presented as read or fully covered. Build-only media fallbacks are reported
162
169
  in the build receipt and do not rewrite approved evidence.
170
+
171
+ Within the current revision scope, remove research-baseline prose (repository
172
+ commit IDs or capture revisions repeated in the article). Preserve source
173
+ references and exact citation destinations. Keep versions or comparison baselines
174
+ that explain business behavior, compatibility, migrations or measured performance.
175
+ Do not turn this editorial check into a keyword gate or an unrelated cleanup.
@@ -500,6 +500,12 @@ the user without blocking an independently supported local correction.
500
500
 
501
501
  ## Import a document response already read by the host
502
502
 
503
+ For complete snapshots produced by `context source fetch lark`, use the optional
504
+ `snapshot_dir` form described in [Lark resource reuse](../manuals/guides/lark-resources.md#reuse-a-complete-planning-snapshot).
505
+ It reuses saved bodies and all captured resources without remote reads, retaining
506
+ their original capture time and source revision. The response-file form below
507
+ remains supported when the host supplies its own full document responses.
508
+
503
509
  For a registered Lark source, retain the actual full JSON response from
504
510
  `lark-cli docs +fetch` and each returned continuation page. Do not reconstruct a
505
511
  response from a summary. Use the same source import command: