@c4a/context-cli 0.7.34 → 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 (82) hide show
  1. package/cli.js +2445 -641
  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-plan.md +12 -0
  26. package/plugins/claude/commands/context.md +125 -9
  27. package/plugins/claude/skills/context-plan/SKILL.md +110 -0
  28. package/plugins/claude/skills/context-plan/agents/openai.yaml +2 -0
  29. package/plugins/claude/skills/context-plan/references/project-planning.md +250 -0
  30. package/plugins/claude/skills/context-plan/references/resource-tools.md +100 -0
  31. package/plugins/claude/skills/context-plan/templates/PLAN.md +113 -0
  32. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  33. package/plugins/codex/skills/context/SKILL.md +125 -9
  34. package/plugins/codex/skills/context-plan/SKILL.md +109 -0
  35. package/plugins/codex/skills/context-plan/agents/openai.yaml +2 -0
  36. package/plugins/codex/skills/context-plan/references/project-planning.md +250 -0
  37. package/plugins/codex/skills/context-plan/references/resource-tools.md +100 -0
  38. package/plugins/codex/skills/context-plan/templates/PLAN.md +113 -0
  39. package/plugins/cursor/.cursor-plugin/plugin.json +3 -2
  40. package/plugins/cursor/commands/c4a-context-plan.md +9 -0
  41. package/plugins/cursor/commands/c4a-context.md +125 -9
  42. package/plugins/cursor/skills/context-plan/SKILL.md +110 -0
  43. package/plugins/cursor/skills/context-plan/agents/openai.yaml +2 -0
  44. package/plugins/cursor/skills/context-plan/references/project-planning.md +250 -0
  45. package/plugins/cursor/skills/context-plan/references/resource-tools.md +100 -0
  46. package/plugins/cursor/skills/context-plan/templates/PLAN.md +113 -0
  47. package/plugins/skills/context/SKILL.md +125 -9
  48. package/plugins/skills/context-code-indexer/references/indexer.md +17 -0
  49. package/plugins/skills/context-code-indexer/templates/articles/c01.md +1 -1
  50. package/plugins/skills/context-code-indexer/templates/articles/c07.md +1 -1
  51. package/plugins/skills/context-code-indexer/templates/articles/l02.md +1 -1
  52. package/plugins/skills/context-markdown-indexer/references/indexer.md +17 -0
  53. package/plugins/skills/context-markdown-indexer/templates/articles/c01.md +1 -1
  54. package/plugins/skills/context-markdown-indexer/templates/articles/c07.md +1 -1
  55. package/plugins/skills/context-markdown-indexer/templates/articles/l02.md +1 -1
  56. package/plugins/skills/context-note-indexer/references/writing.md +17 -0
  57. package/plugins/skills/context-note-indexer/templates/articles/c01.md +1 -1
  58. package/plugins/skills/context-note-indexer/templates/articles/c07.md +1 -1
  59. package/plugins/skills/context-note-indexer/templates/articles/l02.md +1 -1
  60. package/plugins/skills/context-plan/SKILL.md +109 -0
  61. package/plugins/skills/context-plan/agents/openai.yaml +2 -0
  62. package/plugins/skills/context-plan/references/project-planning.md +250 -0
  63. package/plugins/skills/context-plan/references/resource-tools.md +100 -0
  64. package/plugins/skills/context-plan/templates/PLAN.md +113 -0
  65. package/plugins/skills/context-sessions-indexer/references/writing.md +17 -0
  66. package/plugins/skills/context-sessions-indexer/templates/articles/c01.md +1 -1
  67. package/plugins/skills/context-sessions-indexer/templates/articles/c07.md +1 -1
  68. package/plugins/skills/context-sessions-indexer/templates/articles/l02.md +1 -1
  69. package/providers/context/actions/repair-project-entry.yaml +1 -0
  70. package/providers/context/graphs/workspace.yaml +1 -1
  71. package/providers/context/manifest.json +27 -23
  72. package/providers/context/provider.yaml +1 -1
  73. package/providers/context/resources/manuals/guides/knowledge-updates.md +6 -0
  74. package/providers/context/resources/manuals/guides/lark-resources.md +72 -1
  75. package/providers/context/resources/manuals/guides/source-batches.md +89 -0
  76. package/providers/context/resources/manuals/guides/workspace-prepare.md +12 -0
  77. package/providers/context/resources/manuals/reference/project-api.md +4 -0
  78. package/providers/context/resources/procedures/document-capture.md +14 -1
  79. package/providers/context/resources/procedures/knowledge-review.md +13 -0
  80. package/providers/context/resources/procedures/knowledge-updates.md +6 -0
  81. package/providers/context/resources/procedures/source-capture-detailed.md +40 -8
  82. 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.34"
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:ca488cf7d5c818b82c81ea2d9a058cb5e7b91b7de2656506dbc40f19c79fada8"
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:fea23e68a535ff1a567439fe8b05e027575762c4a8f04da2fd181c17e58076f4"
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:ba2618496299deb80171ab9e7472a26b09d9187083347f22bdf65294564acc5d"
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:ca488cf7d5c818b82c81ea2d9a058cb5e7b91b7de2656506dbc40f19c79fada8"
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:fea23e68a535ff1a567439fe8b05e027575762c4a8f04da2fd181c17e58076f4"
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:b68d36eaf96c10f0a19ed342e9b15dc21e8ebec3e5864586e66e5f4af8c198f6"
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.34
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,6 +14,56 @@ 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 |
@@ -22,7 +72,7 @@ resource checks; it does not fetch that supplied body again. See
22
72
  | Attachment | Download the original file and link it from the Markdown projection. |
23
73
  | Sheet | Read the complete selected sheet, render a Markdown table, and retain a CSV snapshot. |
24
74
  | Base | Read the selected table/view with pagination, render a Markdown table, and retain a canonical JSON snapshot. |
25
- | 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. |
26
76
  | Synced block | Resolve the exact source block, project its body, and retain a Markdown evidence snapshot. |
27
77
  | Poll | Preserve exported options and metadata as non-interactive Markdown; warn when the export omits them. |
28
78
  | Bookmark, citation, sub-document, chat, and generic embed | Preserve a stable navigation reference and provenance. |
@@ -45,6 +95,12 @@ resources remain explicit in the capture report. Unknown non-empty XML blocks
45
95
  stay auditable in the raw XML and receive a warning; the CLI does not infer
46
96
  their meaning.
47
97
 
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
+
48
104
  Document and resource reads share one access identity. The configured default is
49
105
  user. Bot mode permits one whole-document user fallback for a body authorization
50
106
  failure, restarting all pages. After the body is read, resources remain under
@@ -52,6 +108,21 @@ that identity. A resource failure never requests another identity's credentials.
52
108
  Legacy explicit auto mode may select Bot when user credentials are unavailable;
53
109
  all resources still use the identity that supplied the complete body.
54
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.
125
+
55
126
  ## Storage lifecycle
56
127
 
57
128
  Resources have three distinct locations:
@@ -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
@@ -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:
@@ -43,10 +43,21 @@ discussion, or register-only request is not permission, and an explicit refusal
43
43
  always wins.
44
44
  Register several file/Lark/repo sources with `context source add batch [date]
45
45
  --input <yaml|json|->`; do not launch multiple `source add` processes in
46
- parallel. Repo batch items require `module`; file/Lark items may omit it and use
46
+ parallel. Long authorized batches can add `--checkpoint --progress`; use the
47
+ returned status and resume commands after interruption instead of rebuilding
48
+ the input. The checkpoint is advisory; resume revalidates the original input
49
+ against current sources. Repo batch items require `module`; file/Lark items may omit it and use
47
50
  the module returned by the CLI. A write-lock error means another Context mutation is active: wait for
48
51
  it to finish and retry rather than editing registry files.
49
52
 
53
+ Register a supplied Lark document or Wiki URL directly. `title` and `module` are
54
+ optional: the CLI derives a stable module locally, and capture obtains the title
55
+ with the document body. Do not call Wiki metadata, resolve a document token, or
56
+ fetch a title separately just to prepare registration. Keep an already known
57
+ title when useful; otherwise omit it instead of delaying capture to discover it.
58
+ For several URLs, one batch payload can contain only `type: lark` and `url` for
59
+ each source. Registration itself does not fetch remote content or grant access.
60
+
50
61
 
51
62
  ## Repository boundaries before bulk work
52
63
 
@@ -89,14 +100,22 @@ separate artifacts: XML audit evidence and a deterministic readable Markdown
89
100
  projection. Do not treat raw XML as Markdown and do not rewrite it yourself.
90
101
  The CLI also materializes supported embedded resources and returns a closed
91
102
  `resource_materialization` report. Required images, attachments, Sheets, Bases,
92
- whiteboards, diagrams, and synced blocks must be materialized before downstream
93
- Review. Polls and navigation references remain explicit non-interactive
103
+ whiteboards, diagrams, and synced blocks are processed under the source's
104
+ effective resource policy. Polls and navigation references remain explicit non-interactive
94
105
  projections; video is reference-only unless the project SDK opts into bundling.
95
106
  If the remote API explicitly confirms that a referenced whiteboard or diagram
96
107
  no longer exists, preserve the unresolved placeholder and the structured
97
108
  `document.resource.source-missing` warning, then continue through the Route.
98
- This is an audited source-side deletion, not successful materialization. Access,
99
- network, parameter, and unknown resource failures still block downstream work.
109
+ This is an audited source-side deletion, not successful materialization.
110
+ For an explicitly recognized permission denial, the CLI tries a supported
111
+ same-identity fallback. A preview is retained as a preview; a resource that
112
+ remains inaccessible stays unavailable with its reference and reason. These
113
+ warnings do not block the preserved body or trigger resource-level identity
114
+ switching, authorization prompts, or requests to change application permissions.
115
+ Do not use unavailable resources as content evidence or claim that previews
116
+ contain the original's complete data. Network, parameter, and unknown failures
117
+ retain the CLI's failure classification; a generic HTTP 400 is not proof of a
118
+ permission error.
100
119
  Do not manually download resources or patch links. Approved resources move to
101
120
  `knowledge/assets/`, and package build projects selected resources to
102
121
  `others/assets/`.
@@ -219,9 +238,10 @@ Preserve commands, reason codes, ids, and diagnostics exactly; summarize
219
238
  successful capture results for the user instead of dumping raw JSON. After any
220
239
  capture result:
221
240
 
222
- - Run `context status --format json` and treat `workflow.current` as the
223
- current-step authority; if the route returns `configuration`, perform only
224
- that declared project edit and rerun status.
241
+ - Consume a fresh `workflow.current` returned with the command result as the
242
+ current-step authority. If no fresh workspace Route was returned, run
243
+ `context status --format json` once. If the route returns `configuration`,
244
+ perform only that declared project edit and rerun status.
225
245
  - If `workflow.current.commands` contains another capture command for the
226
246
  confirmed batch, execute it before asking another naming, collection, or
227
247
  read-permission question.
@@ -250,6 +270,18 @@ retrying capture.
250
270
 
251
271
  Report in the user's conversation language. Translate section headings into the user's language instead of copying the English labels below verbatim. Optimize for human readability: use document titles instead of source ids, package names instead of internal source id strings, and human-readable kind labels ("local markdown", "Feishu doc", "code package") instead of internal tokens. Do not surface content hashes, snapshot digests, internal payload identifiers, or absolute file paths.
252
272
 
273
+ Use the capture command's returned `source`, `documents`, `snapshot`, `fidelity`,
274
+ and `resource_materialization` for the completion summary. They already contain
275
+ the title, body line count, change flag, resource counts, and per-resource reasons;
276
+ `access_identity` records the identity actually used. Reuse `source.url` when
277
+ present, or the user's original URL; do not construct a host URL from an opaque
278
+ token. Count `document.resource.preview` items separately from original downloads,
279
+ and distinguish reference-only or unavailable resources from acquired evidence.
280
+ Do not reopen the manifest/report, inspect Git changes, or perform a separate
281
+ link lookup solely to repeat fields already returned. Open detailed evidence only
282
+ for a concrete missing fact, failure investigation, or requested audit. The
283
+ workspace Route, not a successful resource count, determines workflow readiness.
284
+
253
285
  Stable structure:
254
286
 
255
287
  1. Completion headline. Single line with the action verb plus core counts: how
@@ -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.