@cogfoundry/loomloom 0.4.3 → 0.4.6

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.
@@ -0,0 +1,291 @@
1
+ # TemplateSpec
2
+
3
+ Use this reference when creating, modifying, versioning, or explaining a private template or TemplateSpec.
4
+
5
+ ## Contents
6
+
7
+ - [Documentation sources](#documentation-sources)
8
+ - [Conversation flow](#conversation-flow)
9
+ - [Usage mode](#usage-mode)
10
+ - [TemplatePlan](#templateplan)
11
+ - [Modeling and input rules](#modeling-and-input-rules)
12
+ - [Legacy v1 semantic preservation](#legacy-v1-semantic-preservation)
13
+ - [Creation and versioning](#creation-and-versioning)
14
+
15
+ ## Documentation Sources
16
+
17
+ Before writing TemplateSpec, read the current CLI-bundled documentation:
18
+
19
+ ```bash
20
+ loomloom template-spec docs spec
21
+ loomloom template-spec docs examples
22
+ loomloom template-spec docs conversation
23
+ loomloom capability resolve --input <modality> --output-modality <modality> --output json
24
+ ```
25
+
26
+ - `spec` is the current JSON contract.
27
+ - `examples` contains examples and implementation patterns.
28
+ - `conversation` defines natural-language authoring behavior.
29
+
30
+ TemplateSpec docs default to English and are also available in Chinese. For example:
31
+
32
+ ```bash
33
+ loomloom template-spec docs spec --lang zh-CN
34
+ ```
35
+
36
+ Select the documentation language as appropriate for the conversation and task.
37
+
38
+ The installed Skill may contain a `generated-template-spec/` backup. Prefer the CLI docs command because it matches the currently installed CLI. Once each Step's business modalities are known, use `capability resolve`; its server response is the primary authority-backed selection result. Bundled docs are never authority for changing Profile definitions, operational defaults, eligible models, ports, or fixed contracts.
39
+
40
+ ## Conversation Flow
41
+
42
+ When the request modifies, copies, or appends to an existing private template,
43
+ first run `loomloom template-spec get <template-id> --output json` and
44
+ `loomloom template-spec versions <template-id> --output json`. Resolve the exact
45
+ target version and inspect its server-returned `specVersion` before drafting.
46
+ For `template-spec/v1`, switch to the legacy upgrade gate in `SKILL.md`: keep
47
+ the historical version unchanged, export it only as source material, and draft
48
+ a new v2 version against current authoring facts. Do not apply this authoring
49
+ gate when the user only wants to execute the existing historical version.
50
+
51
+ When a user describes a reusable workflow:
52
+
53
+ 1. Ask business questions, not TemplateSpec-field questions.
54
+ 2. Ask one missing-detail question at a time.
55
+ 3. For long-form material, explicitly ask whether future users will paste the content or upload a file; do not infer the transport from words such as "document" or "material".
56
+ 4. Avoid user-facing terms such as `inputBindings`, `portId`, `fan-in`, `execution`, `outputSchema`, `provider`, and `mode`.
57
+ 5. Restate complex workflows in business language.
58
+ 6. Determine whether different roles or steps need different processing requirements.
59
+ 7. Choose the future usage mode before drafting.
60
+ 8. Draft a TemplatePlan first.
61
+ 9. Show the TemplatePlan and wait for confirmation.
62
+ 10. Generate TemplateSpec only after plan confirmation.
63
+ 11. Run `loomloom template-spec check <spec.json>` against the same selected
64
+ Server where the version will be created. This is the server-authoritative
65
+ contract check, not an offline schema check.
66
+ 12. Ask for a separate creation confirmation.
67
+ 13. Create only after explicit creation confirmation.
68
+
69
+ Offer options when asking questions and include a reasonable default.
70
+
71
+ ## Usage Mode
72
+
73
+ For multi-role, multi-step, multi-perspective, multi-style, or multi-channel templates, ask:
74
+
75
+ ```text
76
+ When other people use this template later, how should the review/generation requirements be handled?
77
+
78
+ 1. Preset in the template: users only fill the core material, and the system follows your predefined requirements automatically.
79
+ 2. Let users fill them: users can fill or modify the requirements for each step/role.
80
+ 3. Generate both versions: one simple version and one customizable version.
81
+
82
+ If you are unsure, choose 1 first to make a simple, usable standard template.
83
+ ```
84
+
85
+ Do not expose `prompt`, `binding`, `reference`, `field`, `hidden`, `portId`, or `inputBindings` in this question.
86
+
87
+ Typical triggers include:
88
+
89
+ - multi-perspective PRD review
90
+ - multi-role contract review
91
+ - multi-agent event planning
92
+ - rewriting content in multiple styles
93
+ - resume review from multiple interviewer perspectives
94
+ - marketing content for multiple channels
95
+
96
+ ### Simple mode
97
+
98
+ - Users fill only core material.
99
+ - Role/step processing requirements are preset by the template author.
100
+ - Processing requirements are not user-visible input columns.
101
+
102
+ ### Custom mode
103
+
104
+ - Users fill core material and role/step processing requirements.
105
+ - Each requirement is visible and editable.
106
+
107
+ ### Both versions
108
+
109
+ - Draft two TemplatePlans.
110
+ - Distinguish names with labels such as `Standard Version` and `Custom Version`.
111
+ - Confirm both plans before generating two TemplateSpecs.
112
+ - Each remote creation still requires its own explicit creation confirmation.
113
+
114
+ ## TemplatePlan
115
+
116
+ Cover:
117
+
118
+ - template name and goal
119
+ - what one workbook row represents
120
+ - user input fields
121
+ - workflow steps and each step's goal
122
+ - serial, parallel, and summary relationships
123
+ - usage mode
124
+ - user-visible intermediate outputs
125
+ - final outputs
126
+ - failure policy when upstream steps fail or partially complete
127
+ - system error display in Excel
128
+ - default model selection
129
+ - special requirements
130
+
131
+ For separate product, engineering, and risk reviews followed by a summary:
132
+
133
+ - Model the reviews as parallel Steps with explicit execution bindings.
134
+ - Model the summary as a downstream Step.
135
+ - Declare `dependsOn`, then connect each consumed result with an explicit `stepOutput` input binding.
136
+ - Use `triggerPolicy=require_all` when every review is required, or `allow_partial` when the summary may run with the successful subset.
137
+ - For independently processed dynamic items, use one workbook row per item. For a fixed number of parallel branches, declare multiple Steps. TemplateSpec v2 does not provide dynamic-cardinality Step fan-out.
138
+
139
+ Add result and error columns for every user-visible step by default. If partial completion is allowed, make missing upstream results understandable and expose failed-step error columns.
140
+
141
+ Keep `provider` and `mode` internal.
142
+
143
+ ## Modeling And Input Rules
144
+
145
+ ### Template inputs and transport
146
+
147
+ Apply the canonical input rules consistently:
148
+
149
+ - Pasted text: declare a value Template Input and bind it to the target contract input port (`TS-IN-001`).
150
+ - Uploaded text file: declare an Artifact Template Input with compatible MIME types and bind it to the target Artifact port (`TS-IN-002`).
151
+ - Reject a design that declares a string value, tells users to enter an asset ID, and binds it as text (`TS-IN-003`).
152
+
153
+ Before showing TemplateSpec, verify that Template Input descriptions, Workbook sample rows, value or Artifact definitions, and bindings all describe the same transport.
154
+
155
+ ### Contract rules
156
+
157
+ - Author only `template-spec/v2`; v1 is historical and read-only.
158
+ - Use lowerCamel fields such as `meta.name`, `templateInputs`, `steps[].stepId`, and `steps[].inputBindings`.
159
+ - Put user-facing inputs in the top-level `templateInputs` map. Put instructions and sample rows under `workbook`.
160
+ - Bind an exact model with `executionBinding.kind=fixedModelContract` and a real `subjectRevisionId` from the target environment.
161
+ - Prefer the exact contract returned by `loomloom capability resolve`; use `loomloom template-spec contracts <model-id> --output json` only for lower-level inspection. Do not infer contracts from the model catalog.
162
+ - Bind a replaceable model set with `executionBinding.kind=capabilityProfile`; also declare the separate Step-level `modelSelection` rule.
163
+ - Treat every `inputBindings` map key as the target contract `portId`. Never guess a port ID or use a role, file name, native JSON pointer, or shared field name as its identity.
164
+ - A target port has exactly one binding. Use `templateInput`, `stepOutput`, `literal`, `platformContext`, `composeValue`, `sequence`, or `merge` according to the current bundled documentation.
165
+ - Connect upstream values with both `dependsOn` and a `stepOutput` source that names the upstream stable output `portId`.
166
+ - Use `sequence` for one ordered heterogeneous multimodal value. Use `merge` for homogeneous Artifact collections; do not treat these as interchangeable.
167
+ - Do not bind `provider`, routing mode, complete contracts, or provider-native request objects.
168
+ - Never guess Step IDs, authority IDs, or port IDs.
169
+
170
+ ### Capability Profile Steps
171
+
172
+ A Capability Profile exposes one fixed input/output interface and a live set of
173
+ currently eligible models. It may represent standard text generation, image
174
+ understanding, image generation, video generation, or another capability
175
+ returned by the current Server. The model set can change without changing the
176
+ Profile ports, so adding or removing a model cannot change Step connections.
177
+ Capabilities a model has beyond the Profile definition are not exposed through
178
+ that Step.
179
+
180
+ For a replaceable-model Step:
181
+
182
+ 1. Run `loomloom capability resolve` with the Step's input and output
183
+ modalities. Choose a `capabilityProfile` match returned by that exact target
184
+ environment. Do not restrict Profile use to text Steps.
185
+ 2. Set `executionBinding.kind=capabilityProfile` and use the response's stable
186
+ `profileId`. Omit `profileRevision`; a dynamic Profile does not accept it.
187
+ Do not require or fabricate a `subjectRevisionId` for a Profile Step.
188
+ 3. Build `inputBindings` and downstream `stepOutput` connections from the
189
+ returned fixed `definition`. Bind Artifact ports as Artifacts and honor MIME
190
+ and cardinality constraints. Never infer ports from a model name or Provider
191
+ endpoint.
192
+ 4. Keep model choice in the separate `modelSelection` Template Input. For the
193
+ current TemplateSpec v2 request shape, set `defaultModelId` from
194
+ `operations.defaultModelId` and verify both `defaultModelAvailable=true` and
195
+ membership in `eligibleModels` before creation. A blank model cell uses the
196
+ Profile's current operational default at run time; an explicit value must be
197
+ in the current eligible set.
198
+ 5. If the current default is unavailable, stop and report
199
+ `profile_default_model_unavailable`; the first release does not silently
200
+ choose a replacement. If no models are currently eligible, stop and report
201
+ `profile_has_no_eligible_models`.
202
+
203
+ Text models remain special only in how their capability facts are certified:
204
+ standard text models do not require one `fixedModelContract` or Certification
205
+ Subject per model. An empty result from
206
+ `template-spec contracts <text-model-id>` is expected and does **not** mean the
207
+ model is unavailable when it appears in a returned text Profile.
208
+
209
+ Use `fixedModelContract` when the user requires one exact model or a dedicated
210
+ interface that no returned Profile represents. If `capability resolve` returns
211
+ both a Profile and Fixed Model Contracts for the same standard capability,
212
+ choose from the user's model policy rather than assuming multimedia always
213
+ means fixed model.
214
+
215
+ ## Legacy v1 Semantic Preservation
216
+
217
+ A v2 candidate is not an upgrade merely because `template-spec check` returns
218
+ `valid=true`. Check validates the v2 contract against the current Server; it
219
+ does not compare business meaning with the historical v1 source.
220
+
221
+ Before drafting, record a semantic ledger for every v1 Step:
222
+
223
+ - Step ID, display purpose, dependencies, trigger policy, and user-visible
224
+ output;
225
+ - the length or digest of every non-empty `Instruction`, and the exact v2
226
+ model-bound input that will carry it;
227
+ - default model and `AllowModelOverride` policy;
228
+ - every initial-input and step-output binding, including its text or Artifact
229
+ transport;
230
+ - static parameters and failure/partial-completion behavior.
231
+
232
+ Apply these migration rules:
233
+
234
+ 1. A non-empty v1 `Instruction` must not disappear. For a Capability Profile,
235
+ normally bind it to `systemInstruction`. `workbook.instructions` is not sent
236
+ to the model.
237
+ 2. Preserve fixed model selection. If v1 has `AllowModelOverride=false`, use
238
+ `modelSelection.source=fixed`; do not add a model selector Template Input.
239
+ 3. Map a v1 image/file/media reference to a compatible Artifact port. Never
240
+ append an Artifact input to `prompt` or `systemInstruction` as a string.
241
+ 4. Preserve ordered text composition and author precedence. Use `composeValue`
242
+ or `merge` only where the current binding contract supports it.
243
+ 5. After `check`, compare the candidate with the semantic ledger. A missing or
244
+ changed item requires explicit human review and must be reported as
245
+ `semantic_review_required` before any version creation.
246
+
247
+ The creation confirmation must describe both the semantic diff and pointer
248
+ impact. The current LoomLoom `create-version` behavior makes the new version
249
+ both latest and published; read back `latestVersionId`, `publishedVersionId`,
250
+ and the full version list after creation.
251
+
252
+ ### Legacy v1 migration routing
253
+
254
+ Before translating a v1 Step, resolve its business input and output modalities
255
+ with `loomloom capability resolve`. Use `loomloom model types --output json`
256
+ only when diagnosing the lower-level execution-unit inventory.
257
+
258
+ | v1 Step shape | v2 route |
259
+ | --- | --- |
260
+ | caller may choose among compatible models | returned `capabilityProfile` match |
261
+ | original behavior requires one exact model or dedicated interface | returned `fixedModelContract` match |
262
+ | no compatible match returned | stop with `needs_authoring_capability` |
263
+
264
+ Preserve the original model-selection policy. If the historical Step forbids
265
+ model override, require the exact model's returned Fixed Model Contract; if it
266
+ is absent, report `missing_fixed_contract`. Use a returned dynamic Profile only
267
+ when the intended v2 behavior allows a replaceable model set. Never invent a
268
+ `subjectRevisionId`, silently switch models, or call `create-version` when the
269
+ required match is absent.
270
+
271
+ ## Creation And Versioning
272
+
273
+ Before creation:
274
+
275
+ 1. Generate the spec only after TemplatePlan confirmation.
276
+ 2. Check it locally.
277
+ 3. Explain the template name, purpose, and check result in business language.
278
+ 4. For a v1 migration, show the semantic preservation ledger and state that
279
+ the current Server will advance latest and published pointers.
280
+ 5. Ask for explicit creation confirmation.
281
+ 6. Run `loomloom template-spec create <spec.json>` only after confirmation.
282
+
283
+ Configuration, environment variables, tokens, "create a template", and "generate spec" do not constitute remote creation confirmation.
284
+
285
+ For changes to an existing template, do not promise in-place mutation of historical versions. Use:
286
+
287
+ ```bash
288
+ loomloom template-spec create-version <template-id> <spec.json>
289
+ ```
290
+
291
+ Later workbooks and runs must use the returned new `version_id`.
@@ -0,0 +1,39 @@
1
+ {
2
+ "releaseTag": "v0.4.6",
3
+ "version": "0.4.6",
4
+ "source": "agent-guidance/loomloom",
5
+ "files": [
6
+ {
7
+ "path": "references/billing.md",
8
+ "sha256": "42316e75545d257f3ec4749fd392e1f9ea974b57b533f7e6772af5b848f36893"
9
+ },
10
+ {
11
+ "path": "references/cli.md",
12
+ "sha256": "a01167ab02960290813459ee558b005d5eb3738da14842ed08615054a4e7263b"
13
+ },
14
+ {
15
+ "path": "references/execution.md",
16
+ "sha256": "bbb626ce282f13e567efa2558dfa6de523364678f3581de647c70708b66fbc43"
17
+ },
18
+ {
19
+ "path": "references/local-skills.md",
20
+ "sha256": "86272be4a95c6a4355ce1e48410d0d02ef067e04509fa36babbf121f6aa29ebd"
21
+ },
22
+ {
23
+ "path": "references/market.md",
24
+ "sha256": "89f32d1d163a73452347f674300867e05e08c682ae84031ebe188813fc81fa2a"
25
+ },
26
+ {
27
+ "path": "references/setup.md",
28
+ "sha256": "77b11609fccaf8a6ca80184c04c859d040e093be758634e716e1e712e3471ce3"
29
+ },
30
+ {
31
+ "path": "references/template-spec.md",
32
+ "sha256": "329fe2a1f4c3dfa07fe5c019f4964aa05d7ac00eae1a359337c72f3ad6ffe46a"
33
+ },
34
+ {
35
+ "path": "SKILL.md",
36
+ "sha256": "02b93b4f840aa3a80356f4f7d52acce2297b8696eee1a76c0ffa0cab8cd60540"
37
+ }
38
+ ]
39
+ }