@weave-tools/weave-it 0.1.0

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 (34) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +868 -0
  3. package/dist/cli.d.ts +5 -0
  4. package/dist/cli.js +4538 -0
  5. package/dist/cli.js.map +1 -0
  6. package/package.json +65 -0
  7. package/templates/opencode/commands/weave-architect.md +7 -0
  8. package/templates/opencode/commands/weave-capture.md +7 -0
  9. package/templates/opencode/commands/weave-clarify.md +7 -0
  10. package/templates/opencode/commands/weave-execute.md +7 -0
  11. package/templates/opencode/commands/weave-explore.md +7 -0
  12. package/templates/opencode/commands/weave-issues.md +7 -0
  13. package/templates/opencode/commands/weave-knowledge.md +7 -0
  14. package/templates/opencode/commands/weave-new.md +7 -0
  15. package/templates/opencode/commands/weave-next.md +7 -0
  16. package/templates/opencode/commands/weave-prd.md +7 -0
  17. package/templates/opencode/commands/weave-prepare.md +7 -0
  18. package/templates/skills/weave-architect/SKILL.md +291 -0
  19. package/templates/skills/weave-architect/api-contract-template.md +21 -0
  20. package/templates/skills/weave-architect/frontend-backend-template.md +21 -0
  21. package/templates/skills/weave-architect/index-template.md +24 -0
  22. package/templates/skills/weave-architect/schema-template.md +21 -0
  23. package/templates/skills/weave-capture/SKILL.md +398 -0
  24. package/templates/skills/weave-clarify/SKILL.md +513 -0
  25. package/templates/skills/weave-execute/SKILL.md +215 -0
  26. package/templates/skills/weave-explore/SKILL.md +434 -0
  27. package/templates/skills/weave-issues/SKILL.md +441 -0
  28. package/templates/skills/weave-knowledge/SKILL.md +161 -0
  29. package/templates/skills/weave-knowledge/knowledge-templates.md +63 -0
  30. package/templates/skills/weave-new/SKILL.md +76 -0
  31. package/templates/skills/weave-next/SKILL.md +216 -0
  32. package/templates/skills/weave-prd/SKILL.md +419 -0
  33. package/templates/skills/weave-prd/prd-template.md +186 -0
  34. package/templates/skills/weave-prepare/SKILL.md +94 -0
@@ -0,0 +1,398 @@
1
+ ---
2
+ name: weave-capture
3
+ description: Capture the current discussion into a structured session note for a Weave change, optionally updating the active change artifact.
4
+ last_changed_in: 0.1.0
5
+ ---
6
+
7
+ # Purpose
8
+
9
+ Capture the current discussion into the active Weave change context.
10
+
11
+ Use this when the user wants to preserve discussion rationale, decisions, options considered, unresolved points, user preferences, agent recommendations, and the next resume point without storing a raw transcript.
12
+
13
+ There are two capture modes:
14
+
15
+ - Artifact capture: bare `weave-capture` creates a structured session note, promotes pending session context for the selected lane, and updates the selected live artifact.
16
+ - Session-only capture: `weave-capture session [exploration|prd|architecture]` creates a lane-aware structured session note and does not create or update any live artifact.
17
+
18
+ The session file is a continuation aid. Live artifacts remain the durable current truth.
19
+
20
+ # Workflow
21
+
22
+ 1. Run:
23
+
24
+ ```bash
25
+ weave workspace --json
26
+ weave change current --json
27
+ ```
28
+
29
+ 2. Resolve the capture mode and lane.
30
+
31
+ If the user invoked session-only mode, such as:
32
+
33
+ ```text
34
+ weave-capture session
35
+ weave-capture session exploration
36
+ weave-capture session prd
37
+ weave-capture session architecture
38
+ ```
39
+
40
+ use session-only behavior for this invocation.
41
+
42
+ In session-only mode, an explicit lane wins over stored artifact context:
43
+
44
+ ```text
45
+ exploration
46
+ prd
47
+ architecture
48
+ ```
49
+
50
+ If the user invoked `weave-capture session` without a lane, run:
51
+
52
+ ```bash
53
+ weave artifact current --json
54
+ ```
55
+
56
+ Use the current artifact context only when it is valid for the active change.
57
+
58
+ If no valid lane exists, stop before writing and ask:
59
+
60
+ ```text
61
+ Which lane should I capture this session under: exploration, prd, or architecture?
62
+ ```
63
+
64
+ If the user did not invoke session-only mode, use artifact capture behavior.
65
+
66
+ 3. For artifact capture, resolve the capture target.
67
+
68
+ If the user explicitly named an artifact target, use it for this invocation. Supported targets are:
69
+
70
+ ```text
71
+ exploration
72
+ prd
73
+ architecture
74
+ ```
75
+
76
+ If the user did not name a target, run:
77
+
78
+ ```bash
79
+ weave artifact current --json
80
+ ```
81
+
82
+ Use the current artifact context only when it is valid for the active change.
83
+
84
+ If no valid context exists, stop before writing and ask:
85
+
86
+ ```text
87
+ Which artifact should I capture this into: exploration, prd, or architecture?
88
+ ```
89
+
90
+ # Defensive Lane Verification
91
+
92
+ Before writing any session note or artifact, defensively verify that the resolved lane matches the substance of the conversation being captured.
93
+
94
+ Compare:
95
+
96
+ - the resolved lane (from explicit user input, `weave artifact current --json`, or `weave-capture session <lane>`)
97
+ - and the dominant subject of the discussion being captured (exploration: product discovery and stress-tested requirements; prd: user-facing requirements, acceptance criteria, scope, open questions; architecture: engineering design, module boundaries, tradeoffs, technical risks)
98
+
99
+ If the resolved lane and the dominant subject clearly disagree (for example, the stored artifact context is `prd` but the conversation is heavily architectural; or the user invoked `weave-capture session exploration` after a long architectural discussion), do not write. Stop and ask:
100
+
101
+ ```text
102
+ Stored artifact context is <lane>, but the conversation reads as <observed-lane>.
103
+ Capture this into: <lane> (keep stored context), <observed-lane> (switch), or another lane?
104
+ ```
105
+
106
+ Wait for the user's choice. Use the user's reply as the resolved lane for the rest of this invocation. Do not silently override the stored context.
107
+
108
+ If the lane and the conversation substance are aligned (or if the conversation is too short or mixed to judge), proceed with the resolved lane without asking.
109
+
110
+ 4. Identify the active change folder:
111
+
112
+ ```text
113
+ wiki/changes/<change-id>/
114
+ ```
115
+
116
+ 5. Ensure the sessions folder exists:
117
+
118
+ ```text
119
+ wiki/changes/<change-id>/sessions/
120
+ ```
121
+
122
+ If it is missing in an older change, create it before writing the session note.
123
+
124
+ 6. Create a new structured session file:
125
+
126
+ ```text
127
+ wiki/changes/<change-id>/sessions/YYYYMMDD-HHMMSS-<4-char-id>-<artifact>.md
128
+ ```
129
+
130
+ Use the local timestamp for `YYYYMMDD-HHMMSS`. Use a 4-character lowercase alphanumeric id and retry if the filename already exists.
131
+
132
+ Existing session files using `yyyy-mm-dd-<4-char-id>-<artifact>.md` remain valid historical notes.
133
+
134
+ 7. Write structured session notes with this shape:
135
+
136
+ ```md
137
+ ---
138
+ artifact: <exploration|prd|architecture>
139
+ capture_mode: <artifact|session>
140
+ captured_at: <YYYY-MM-DDTHH:mm:ss.sssZ>
141
+ facets: []
142
+ ---
143
+
144
+ # Session Capture: <Artifact> - <YYYY-MM-DD>
145
+
146
+ ## Summary
147
+
148
+ ## Decisions Made
149
+
150
+ ## Options Considered
151
+
152
+ ## Rejected Approaches
153
+
154
+ ## User Preferences
155
+
156
+ ## Agent Recommendations
157
+
158
+ ## Unresolved Points
159
+
160
+ ## Live Artifact Updates Applied
161
+
162
+ ## Next Resume Point
163
+ ```
164
+
165
+ Do not copy or store the raw transcript. Summarize and structure the discussion.
166
+
167
+ Set `capture_mode: session` for session-only capture. Set `capture_mode: artifact` for regular artifact capture.
168
+
169
+ For architecture captures, set `facets: [...]` to the architecture concerns discussed, such as `index`, `schema`, `api-contract`, `frontend-backend`, or user-named facet slugs. For non-architecture captures, use `facets: []`.
170
+
171
+ For session-only capture, write `None; session-only capture` or equivalent under `Live Artifact Updates Applied`.
172
+
173
+ 8. For session-only capture, stop after writing the session note.
174
+
175
+ Do not create or update:
176
+
177
+ ```text
178
+ wiki/changes/<change-id>/exploration.md
179
+ wiki/changes/<change-id>/prd.md
180
+ wiki/changes/<change-id>/architecture.md
181
+ wiki/changes/<change-id>/architecture/
182
+ ```
183
+
184
+ Session-only capture is resume context only. It is not canonical artifact truth. It does not require the lane's live artifact to exist and does not require upstream prerequisite artifacts.
185
+
186
+ 9. For artifact capture, create or merge durable content into the selected live artifact:
187
+
188
+ ```text
189
+ exploration -> wiki/changes/<change-id>/exploration.md
190
+ prd -> wiki/changes/<change-id>/prd.md
191
+ architecture -> wiki/changes/<change-id>/architecture.md or wiki/changes/<change-id>/architecture/index.md plus facets
192
+ ```
193
+
194
+ For architecture targets, resolve artifact shape before writing:
195
+
196
+ - If only `architecture.md` exists, preserve legacy file mode unless the user explicitly asks to move to folder mode or create a separate facet.
197
+ - If `architecture/` exists, use folder mode. Treat `architecture/index.md` as the canonical entry point and direct child `architecture/*.md` files as facets.
198
+ - If neither exists and architecture content is being captured, create folder mode at `architecture/index.md` by default.
199
+ - If both `architecture.md` and `architecture/` exist, stop before writing and ask whether to keep legacy file mode, migrate to folder mode, or reconcile the conflict with `weave-clarify`.
200
+ - Facet-only folder mode is valid. If a user explicitly asks to capture a concern into its own file and no matching template exists, create the facet file without a template and link or mention it from `index.md` when useful.
201
+
202
+ Before writing the live artifact, inspect pending session notes for the selected lane:
203
+
204
+ ```text
205
+ wiki/changes/<change-id>/sessions/*-<artifact>.md
206
+ ```
207
+
208
+ Pending session notes are session captures that may contain durable discoveries, decisions, constraints, rejected approaches, unresolved questions, risks, preferences, or next-resume context that has not yet been reflected in the live artifact.
209
+
210
+ Selection rules:
211
+
212
+ - If the selected live artifact does not exist, consider all matching lane session notes.
213
+ - If the selected live artifact exists, consider matching lane session notes newer than the artifact `updated_at` timestamp.
214
+ - Determine session time from YAML `captured_at` first. If missing, derive it from the timestamped filename. For legacy `yyyy-mm-dd-<id>-<artifact>.md` notes or ambiguous session time, include the note conservatively when it might be newer than the artifact.
215
+ - Do not reconsider older matching notes after their durable content is reflected in a live artifact update; future bare captures use the live artifact `updated_at` cutoff.
216
+ - Do not read session notes for other lanes.
217
+
218
+ Only merge artifact-relevant current truth:
219
+
220
+ - decisions
221
+ - clarified requirements
222
+ - accepted constraints
223
+ - important rejected approaches
224
+ - unresolved questions
225
+ - risks or edge cases relevant to the artifact
226
+ - next-phase-relevant context
227
+
228
+ When the live artifact already exists, preserve its template structure and lifecycle frontmatter. When the live artifact is missing but allowed by the target rules below, create it with appropriate lifecycle frontmatter and the normal artifact structure for that lane.
229
+
230
+ For folder-mode architecture, discover direct child template resources in the installed skill directory:
231
+
232
+ ```text
233
+ <agent-skills-dir>/weave-architect/*-template.md
234
+ ```
235
+
236
+ Use templates by convention only. `index-template.md` is for `architecture/index.md`; `<facet>-template.md` is for `architecture/<facet>.md`. If no relevant template exists, fit content into existing architecture docs wherever it belongs. Create a new no-template facet only when the user explicitly asks for a separate facet file or the current capture cannot be represented honestly in existing docs.
237
+
238
+ Do not add transcript-style discussion to the live artifact.
239
+
240
+ 10. For artifact capture, after successfully creating or updating the live artifact, run lifecycle progress for the selected artifact:
241
+
242
+ ```bash
243
+ weave change progress exploration --source discussion --json
244
+ weave change progress prd --source exploration --source sessions --json
245
+ weave change progress architecture --source prd --source codebase --json
246
+ ```
247
+
248
+ Run only the command matching the selected artifact and pass only sources that actually informed the live artifact. If lifecycle progress fails, do not rewrite the session note or live artifact just to recover. Report the progress failure in the completion response.
249
+
250
+ # Target Rules
251
+
252
+ ## Session-Only Capture
253
+
254
+ - Session-only mode is selected by invocations like `weave-capture session`, `weave-capture session exploration`, `weave-capture session prd`, or `weave-capture session architecture`.
255
+ - Explicit session-only lane wins over stored artifact context for this invocation.
256
+ - Supported lanes are `exploration`, `prd`, and `architecture`.
257
+ - `weave-capture session` without an explicit lane uses stored artifact context only when it points to the active change.
258
+ - If no valid lane exists, ask which lane to use before writing.
259
+ - Session-only capture requires a valid active change.
260
+ - Session-only capture does not require the selected live artifact to exist.
261
+ - Session-only capture does not enforce upstream prerequisite artifacts.
262
+ - Session-only capture must not create or update `exploration.md`, `prd.md`, `architecture.md`, or `architecture/`.
263
+
264
+ ## Artifact Capture
265
+
266
+ - An explicit user target wins over stored artifact context for this invocation.
267
+ - `weave-explore` maps to `exploration`.
268
+ - `weave-prd` maps to `prd`.
269
+ - `weave-architect` maps to `architecture`.
270
+ - Stored context must point to the active change. If it points elsewhere, treat it as invalid and ask for a target.
271
+ - If the selected live artifact does not exist, create it only when the active change, target context, and selected-lane context are sufficient:
272
+ - missing `exploration.md`: create it for the valid active change
273
+ - missing `prd.md`: create it from current discussion, PRD sessions, and useful exploration context when enough product truth exists
274
+ - missing architecture artifact: create `architecture/index.md` from current discussion, architecture sessions, useful PRD context, and codebase/technical context when enough engineering truth exists
275
+ - Treat upstream artifacts as optional sources, not prerequisites.
276
+ - If selected-lane context is insufficient, write the session note and stop before creating the live artifact. Tell the user which lane conversation or interview is needed next.
277
+
278
+ # Missing Artifact Creation
279
+
280
+ Creating a missing live artifact is allowed only for the selected capture target. The captured discussion supplies the current lane context, and upstream artifacts supply optional product or technical context when they exist and are useful.
281
+
282
+ - For `exploration.md`, synthesize the artifact from the current discussion and mark unresolved discovery points clearly.
283
+ - For `prd.md`, synthesize the artifact from current discussion, PRD sessions, and useful exploration context. Do not require `exploration.md`.
284
+ - For architecture, synthesize `architecture/index.md` and any explicit or template-backed facet files from current discussion, architecture sessions, useful PRD context, and codebase/technical context. A just-completed Plan Mode `weave-architect` discussion is valid source material for the first architecture draft.
285
+ - If the current discussion does not contain enough durable content for the selected missing artifact, write the session note and stop before creating the live artifact. Tell the user which lane conversation is needed next.
286
+
287
+ # Behavior Rules
288
+
289
+ - The CLI owns active change lookup and artifact context lookup.
290
+ - The skill owns discussion synthesis, session note writing, and live artifact merging.
291
+ - Bare `weave-capture` is the only v1 flow that promotes pending session-only context into live artifacts.
292
+ - Do not create a new change unless the user explicitly asks for a new change.
293
+ - Do not create `exploration.md`, `prd.md`, `architecture.md`, or `architecture/` in session-only mode.
294
+ - Do not create `exploration.md`, `prd.md`, `architecture.md`, or `architecture/` in artifact capture mode without a valid active change, valid target context, and enough selected-lane context.
295
+ - Do not store raw transcripts in v1.
296
+ - Do not remove existing lifecycle frontmatter.
297
+ - Do not call lifecycle progress in session-only mode.
298
+ - Do not hand-edit `status.yml`; use `weave change progress <lane> --json` after successful artifact capture.
299
+ - Do not update `reviewed_at`, `approved_at`, or `approved_by` unless a future approval flow defines that behavior.
300
+ - Keep unresolved choices explicit in the session note and live artifact where relevant.
301
+
302
+ # Completion Response
303
+
304
+ For artifact capture, report both outputs:
305
+
306
+ ```text
307
+ Captured session: wiki/changes/<change-id>/sessions/<filename>.md
308
+ Updated artifact: wiki/changes/<change-id>/<artifact-path>
309
+ ```
310
+
311
+ For session-only capture, report the session and explicitly state that no live artifact was updated:
312
+
313
+ ```text
314
+ Captured session: wiki/changes/<change-id>/sessions/<filename>.md
315
+ Updated artifact: none (session-only capture)
316
+ ```
317
+
318
+ ---
319
+
320
+ # Silent Weave Command Output
321
+
322
+ Weave skills run Weave CLI commands silently by default. Use command results
323
+ as internal context, not response content.
324
+
325
+ Do not show raw stdout, JSON payloads, command echoes, lifecycle payloads,
326
+ internal state-write confirmations, or verbatim notice text unless the user
327
+ explicitly asks for diagnostic output.
328
+
329
+ Surface only information that changes what the user or agent should do next:
330
+ blockers, failures, missing relevant repos, branch or task outcomes,
331
+ lifecycle failures, package-outdated notices, relevant outdated or modified
332
+ skills, and user-required actions.
333
+
334
+ Notice handling:
335
+
336
+ - `package_outdated`: show only when present. Say exactly:
337
+ `A newer Weave version is available. Run \`weave status\` for details, then upgrade Weave when convenient.`
338
+ - `skills_outdated`: suppress unrelated skills. If the invoked skill is outdated, say:
339
+ `The installed \`<skill-name>\` skill appears older than the bundled template. Run \`weave status\` for details, then \`weave agent update --all\` when you want to refresh installed skills.`
340
+ - `skills_outdated`: if multiple skills used in this workflow are outdated, say:
341
+ `Some installed skills used in this workflow appear older than the bundled templates: \`<skill-a>\`, \`<skill-b>\`. Run \`weave status\` for details, then \`weave agent update --all\` when you want to refresh them.`
342
+ - `skills_modified`: suppress unless the invoked skill is modified locally or the user is asking about skill updates. If the invoked skill is modified, say:
343
+ `The installed \`<skill-name>\` skill has local edits, so its behavior may differ from the bundled template. Run \`weave status\` or \`weave agent diff\` if you want to inspect the difference.`
344
+ - `skills_modified`: if the user asks to update skills and installed skills have local edits, say:
345
+ `Some installed skills have local edits. \`weave agent update\` may skip or protect them; run \`weave status\` or \`weave agent diff\` before updating.`
346
+
347
+ Do not say `Notices: ...`, `The command returned notices`, raw
348
+ `notices[].message`, full notice JSON, or full skill lists unless the user
349
+ asks for diagnostics.
350
+
351
+ ---
352
+
353
+ # Lifecycle Staleness Verification
354
+
355
+ Before calling `weave change progress`, verify content-sync of every artifact
356
+ that would otherwise be marked stale by the default pessimistic propagation.
357
+
358
+ The `--source` arguments of `weave change progress` declare causal influence,
359
+ not strict-DAG dependency. Pessimistic staleness propagation is the safe default,
360
+ not the only correct answer. When the clarification this skill just performed is
361
+ narrowly contained (a typo fix, a sentence rewording, an open-question
362
+ resolution), dependents may already be in content sync; flagging them stale
363
+ creates churn the user did not ask for.
364
+
365
+ Procedure:
366
+
367
+ 1. Identify the set of structural dependents of the lane being progressed. Read
368
+ `wiki/changes/<change-id>/status.yml` and compute which lanes list this
369
+ lane in their `artifacts.<lane>.sources`.
370
+ 2. For each dependent lane, read both the dependent artifact and the artifact
371
+ just being progressed. Decide whether the change you just made invalidates
372
+ the dependent's content. The judgement is binary per lane: invalidates, or
373
+ does not invalidate.
374
+ 3. Select the appropriate progress invocation:
375
+
376
+ - Every dependent is invalidated (or there are no dependents):
377
+ `weave change progress <lane> --source <list> --json` (default, no new flags)
378
+ - No dependent is invalidated:
379
+ `weave change progress <lane> --source <list> --no-invalidate --json`
380
+ - Some dependents are invalidated, some are not:
381
+ `weave change progress <lane> --source <list> --invalidate=<comma-list> --json`
382
+
383
+ 4. If a previously-stale dependent is now in content sync (because the upstream
384
+ change has been absorbed but the stale flag still lingers from an earlier
385
+ pessimistic propagation), clear it explicitly:
386
+
387
+ `weave change clear-stale <lane> --reason "<one-sentence verification>" --json`
388
+
389
+ Always pass `--reason` so the audit entry in `stale_history` carries the
390
+ verification rationale. Do not clear flags without reading both artifacts.
391
+
392
+ 5. Never edit `status.yml` by hand to manipulate stale state. Use the CLI.
393
+
394
+ Failure mode: if you are uncertain whether a dependent is in content sync,
395
+ prefer the pessimistic default (omit `--no-invalidate` and `--invalidate`).
396
+ The user can always run `weave-clarify <lane>` later. A false-positive stale
397
+ flag is recoverable; silently leaving a real downstream artifact mismatched is
398
+ not.