@jspg-ai/coding-bb 0.0.1
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.
- package/README.md +41 -0
- package/cbb/dev-standards/rules/cbb-ai-behavior.md +104 -0
- package/cbb/dev-standards/rules/cbb-coding-rule.md +50 -0
- package/cbb/dev-standards/rules/cbb-priority.md +56 -0
- package/cbb/dev-standards/skills/architecture-specs/SKILL.md +129 -0
- package/cbb/dev-standards/skills/coding-specs/SKILL.md +376 -0
- package/cbb/dev-standards/skills/coding-specs/references/concurrency.md +53 -0
- package/cbb/dev-standards/skills/coding-specs/references/config-center.md +16 -0
- package/cbb/dev-standards/skills/coding-specs/references/distributed.md +42 -0
- package/cbb/dev-standards/skills/coding-specs/references/es-coding.md +60 -0
- package/cbb/dev-standards/skills/coding-specs/references/scheduled-task.md +25 -0
- package/cbb/dev-standards/skills/coding-specs/references/security.md +11 -0
- package/cbb/dev-standards/skills/coding-specs/references/unit-testing.md +43 -0
- package/cbb/dev-standards/skills/es-design-specs/SKILL.md +104 -0
- package/cbb/dev-standards/skills/mysql-design-specs/SKILL.md +89 -0
- package/cbb/lib/install/claude-code.js +20 -0
- package/cbb/lib/install/cleanup.js +64 -0
- package/cbb/lib/install/init.js +1875 -0
- package/cbb/lib/install/qoder.js +20 -0
- package/cbb/lib/install/workspaces.js +232 -0
- package/cbb/lib/openspec/index.js +554 -0
- package/cbb/lib/superpowers/index.js +265 -0
- package/cbb/lib/utils/check-update.js +147 -0
- package/cbb/lib/utils/checkbox.js +383 -0
- package/cbb/lib/utils/gitignore.js +69 -0
- package/cbb/lib/utils/output.js +64 -0
- package/cbb/lib/utils/settings.js +119 -0
- package/cbb/lib/utils/version.js +135 -0
- package/cbb/lib/wiki/api-client.js +358 -0
- package/cbb/lib/wiki/cli.js +427 -0
- package/cbb/lib/wiki/convert.js +464 -0
- package/cbb/lib/wiki/index.js +218 -0
- package/cbb/lib/wiki/mermaid-guard.js +103 -0
- package/cbb/lib/wiki/split.js +131 -0
- package/cbb/tools/cbb-decompile-jar/SKILL.md +220 -0
- package/cbb/tools/cbb-decompile-jar/scripts/decompile.py +863 -0
- package/cbb/tools/cbb-design-to-wiki/SKILL.md +180 -0
- package/cbb/tools/cbb-mvn-guide/SKILL.md +281 -0
- package/cbb/tools/cbb-mvn-guide/scripts/mvn_jdk_manager.py +378 -0
- package/cbb/tools/cbb-mvn-guide/scripts/mvn_pom_jdk_reader.py +197 -0
- package/cbb/tools/cbb-plantuml-authoring/SKILL.md +448 -0
- package/cbb/tools/cbb-plantuml-authoring/references/drawing-templates.md +479 -0
- package/cbb/tools/cbb-wiki-ops/SKILL.md +134 -0
- package/cbb/tools/cbb-wiki-ops/scripts/check-auth.js +44 -0
- package/cbb/worktrees/_shared/scripts/find-target-worktree.js +96 -0
- package/cbb/worktrees/_shared/scripts/find-workspace-root.js +67 -0
- package/cbb/worktrees/_shared/scripts/push-core.js +136 -0
- package/cbb/worktrees/_shared/scripts/silence-popup.js +23 -0
- package/cbb/worktrees/commands/close.md +64 -0
- package/cbb/worktrees/commands/extend.md +65 -0
- package/cbb/worktrees/commands/init.md +55 -0
- package/cbb/worktrees/commands/push.md +42 -0
- package/cbb/worktrees/skills/openspec-close-worktree/SKILL.md +449 -0
- package/cbb/worktrees/skills/openspec-close-worktree/scripts/check-env.js +76 -0
- package/cbb/worktrees/skills/openspec-close-worktree/scripts/check-unarchived.js +48 -0
- package/cbb/worktrees/skills/openspec-close-worktree/scripts/delete-branches.js +136 -0
- package/cbb/worktrees/skills/openspec-close-worktree/scripts/discover-apps.js +76 -0
- package/cbb/worktrees/skills/openspec-close-worktree/scripts/find-target-worktree.js +96 -0
- package/cbb/worktrees/skills/openspec-close-worktree/scripts/find-workspace-root.js +67 -0
- package/cbb/worktrees/skills/openspec-close-worktree/scripts/remove-worktrees.js +124 -0
- package/cbb/worktrees/skills/openspec-close-worktree/scripts/safety-check.js +174 -0
- package/cbb/worktrees/skills/openspec-close-worktree/scripts/silence-popup.js +23 -0
- package/cbb/worktrees/skills/openspec-extend-worktree/SKILL.md +390 -0
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/check-env.js +95 -0
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/check-repos.js +98 -0
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/create-branches-and-worktrees.js +135 -0
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/find-target-worktree.js +96 -0
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/find-workspace-root.js +67 -0
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/install-ai.js +150 -0
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/list-available-apps.js +88 -0
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/push-core.js +136 -0
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/silence-popup.js +23 -0
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/sync-repos.js +93 -0
- package/cbb/worktrees/skills/openspec-init-worktree/SKILL.md +539 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/auto-open.js +136 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/check-env-deep.js +87 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/check-env.js +90 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/check-repos.js +171 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/create-branches.js +103 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/create-worktrees.js +154 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/find-workspace-root.js +67 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/generate-app-options.js +93 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/install-ai.js +177 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/parse-config.js +67 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/push-branches.js +101 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/push-core.js +136 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/silence-popup.js +23 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/sync-repos.js +95 -0
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/update-gitignore.js +134 -0
- package/cbb/worktrees/skills/openspec-push-worktrees/SKILL.md +307 -0
- package/cbb/worktrees/skills/openspec-push-worktrees/scripts/commit-worktrees.js +269 -0
- package/cbb/worktrees/skills/openspec-push-worktrees/scripts/find-target-worktree.js +96 -0
- package/cbb/worktrees/skills/openspec-push-worktrees/scripts/find-workspace-root.js +67 -0
- package/cbb/worktrees/skills/openspec-push-worktrees/scripts/push-core.js +136 -0
- package/cbb/worktrees/skills/openspec-push-worktrees/scripts/push-worktrees.js +159 -0
- package/cbb/worktrees/skills/openspec-push-worktrees/scripts/silence-popup.js +23 -0
- package/config/cbb.yaml +6 -0
- package/config/config.sample.json +16 -0
- package/config/openspec/config.yaml +28 -0
- package/config/openspec/schemas/spec-driven/schema.yaml +247 -0
- package/config/openspec/schemas/spec-driven/templates/design.md +475 -0
- package/config/openspec/schemas/spec-driven/templates/proposal.md +58 -0
- package/config/openspec/schemas/spec-driven/templates/spec.md +8 -0
- package/config/openspec/schemas/spec-driven/templates/tasks.md +9 -0
- package/config/workspaces.json +15 -0
- package/openspec/.version +6 -0
- package/openspec/commands/apply.md +182 -0
- package/openspec/commands/archive.md +223 -0
- package/openspec/commands/bulk-archive.md +334 -0
- package/openspec/commands/continue.md +112 -0
- package/openspec/commands/explore.md +206 -0
- package/openspec/commands/ff.md +111 -0
- package/openspec/commands/new.md +70 -0
- package/openspec/commands/onboard.md +555 -0
- package/openspec/commands/propose.md +157 -0
- package/openspec/commands/sync.md +256 -0
- package/openspec/commands/update.md +85 -0
- package/openspec/commands/verify.md +169 -0
- package/openspec/skills/openspec-apply-change/SKILL.md +187 -0
- package/openspec/skills/openspec-archive-change/SKILL.md +181 -0
- package/openspec/skills/openspec-bulk-archive-change/SKILL.md +338 -0
- package/openspec/skills/openspec-continue-change/SKILL.md +117 -0
- package/openspec/skills/openspec-explore/SKILL.md +342 -0
- package/openspec/skills/openspec-ff-change/SKILL.md +116 -0
- package/openspec/skills/openspec-new-change/SKILL.md +76 -0
- package/openspec/skills/openspec-onboard/SKILL.md +560 -0
- package/openspec/skills/openspec-propose/SKILL.md +162 -0
- package/openspec/skills/openspec-sync-specs/SKILL.md +261 -0
- package/openspec/skills/openspec-update-change/SKILL.md +90 -0
- package/openspec/skills/openspec-verify-change/SKILL.md +174 -0
- package/package.json +46 -0
- package/superpowers/.version +6 -0
- package/superpowers/skills/brainstorming/SKILL.md +250 -0
- package/superpowers/skills/brainstorming/scripts/frame-template.html +213 -0
- package/superpowers/skills/brainstorming/scripts/helper.js +167 -0
- package/superpowers/skills/brainstorming/scripts/server.cjs +723 -0
- package/superpowers/skills/brainstorming/scripts/start-server.sh +209 -0
- package/superpowers/skills/brainstorming/scripts/stop-server.sh +120 -0
- package/superpowers/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/superpowers/skills/brainstorming/visual-companion.md +299 -0
- package/superpowers/skills/dispatching-parallel-agents/SKILL.md +167 -0
- package/superpowers/skills/executing-plans/SKILL.md +64 -0
- package/superpowers/skills/finishing-a-development-branch/SKILL.md +225 -0
- package/superpowers/skills/receiving-code-review/SKILL.md +205 -0
- package/superpowers/skills/requesting-code-review/SKILL.md +95 -0
- package/superpowers/skills/requesting-code-review/code-reviewer.md +181 -0
- package/superpowers/skills/subagent-driven-development/SKILL.md +568 -0
- package/superpowers/skills/subagent-driven-development/implementer-prompt.md +154 -0
- package/superpowers/skills/subagent-driven-development/re-review-prompt.md +115 -0
- package/superpowers/skills/subagent-driven-development/scripts/review-package +46 -0
- package/superpowers/skills/subagent-driven-development/scripts/sdd-workspace +40 -0
- package/superpowers/skills/subagent-driven-development/scripts/task-brief +41 -0
- package/superpowers/skills/subagent-driven-development/task-reviewer-prompt.md +207 -0
- package/superpowers/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/superpowers/skills/systematic-debugging/SKILL.md +283 -0
- package/superpowers/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/superpowers/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/superpowers/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/superpowers/skills/systematic-debugging/find-polluter.sh +72 -0
- package/superpowers/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/superpowers/skills/systematic-debugging/test-academic.md +14 -0
- package/superpowers/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/superpowers/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/superpowers/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/superpowers/skills/test-driven-development/SKILL.md +320 -0
- package/superpowers/skills/test-driven-development/writing-good-tests.md +198 -0
- package/superpowers/skills/using-git-worktrees/SKILL.md +167 -0
- package/superpowers/skills/using-superpowers/SKILL.md +63 -0
- package/superpowers/skills/using-superpowers/references/antigravity-tools.md +23 -0
- package/superpowers/skills/using-superpowers/references/codex-tools.md +108 -0
- package/superpowers/skills/using-superpowers/references/gemini-tools.md +63 -0
- package/superpowers/skills/using-superpowers/references/hermes-tools.md +56 -0
- package/superpowers/skills/using-superpowers/references/pi-tools.md +16 -0
- package/superpowers/skills/verification-before-completion/SKILL.md +120 -0
- package/superpowers/skills/writing-plans/SKILL.md +171 -0
- package/superpowers/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/superpowers/skills/writing-skills/SKILL.md +679 -0
- package/superpowers/skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/superpowers/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/superpowers/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/superpowers/skills/writing-skills/persuasion-principles.md +187 -0
- package/superpowers/skills/writing-skills/render-graphs.js +169 -0
- package/superpowers/skills/writing-skills/testing-skills-with-subagents.md +384 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "OPSX: Bulk Archive"
|
|
3
|
+
description: Archive multiple completed changes at once
|
|
4
|
+
category: Workflow
|
|
5
|
+
tags: [workflow, archive, experimental, bulk]
|
|
6
|
+
---
|
|
7
|
+
Archive multiple completed changes in a single operation.
|
|
8
|
+
|
|
9
|
+
This skill allows you to batch-archive changes, handling spec conflicts intelligently by checking the codebase to determine what's actually implemented.
|
|
10
|
+
|
|
11
|
+
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`). Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
|
12
|
+
|
|
13
|
+
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
|
|
14
|
+
|
|
15
|
+
**Input**: None required (prompts for selection)
|
|
16
|
+
|
|
17
|
+
**Steps**
|
|
18
|
+
|
|
19
|
+
1. **Get active changes**
|
|
20
|
+
|
|
21
|
+
Run `openspec list --json` to get all active changes.
|
|
22
|
+
|
|
23
|
+
If no active changes exist, inform user and stop.
|
|
24
|
+
|
|
25
|
+
2. **Prompt for change selection**
|
|
26
|
+
|
|
27
|
+
Ask the user to choose changes (multi-select):
|
|
28
|
+
- Show each change with its schema
|
|
29
|
+
- Include an option for "All changes"
|
|
30
|
+
- Allow any number of selections (1+ works, 2+ is the typical use case)
|
|
31
|
+
|
|
32
|
+
**IMPORTANT**: Do NOT auto-select. Always let the user choose.
|
|
33
|
+
|
|
34
|
+
**Load current archive inputs once for the selected root before batch validation:**
|
|
35
|
+
|
|
36
|
+
Choose one selected change from this root and run
|
|
37
|
+
`openspec instructions archive --change "<selected-change>" --json` with the
|
|
38
|
+
same selected-root flags. This lookup is advisory and optional: it only supplies
|
|
39
|
+
extra prompt inputs, so it must never block the batch. If it fails or returns
|
|
40
|
+
invalid JSON — for example on an older CLI that does not support this command
|
|
41
|
+
yet — continue the batch with no context and no operation guidance. Do not
|
|
42
|
+
report an error and do not stop.
|
|
43
|
+
|
|
44
|
+
A valid response may omit `context` and `operationGuidance`. Treat
|
|
45
|
+
`context` as a required prompt-level input across the batch: read and consider
|
|
46
|
+
it, and apply relevant project facts, conventions, and constraints. Treat
|
|
47
|
+
`operationGuidance` as optional additive advice: read and consider every
|
|
48
|
+
entry, and follow entries that are applicable and compatible with the built-in
|
|
49
|
+
batch workflow.
|
|
50
|
+
|
|
51
|
+
Keep both fields separate from conflict analysis, explicit user choices,
|
|
52
|
+
resolved paths, CLI checks, and command contracts. If context conflicts with one
|
|
53
|
+
of those controlling inputs, report the conflict and preserve the controlling
|
|
54
|
+
value. If guidance is inapplicable or conflicts with a controlling input, do not
|
|
55
|
+
follow it and explain why. Do not infer skipped prompts, replacement paths, or
|
|
56
|
+
flags from either field, and do not copy their text verbatim into specs, changes,
|
|
57
|
+
or summaries. These are prompt-level behavior contracts, not enforceable checks.
|
|
58
|
+
|
|
59
|
+
3. **Batch validation - gather status for all selected changes**
|
|
60
|
+
|
|
61
|
+
For each selected change, collect:
|
|
62
|
+
|
|
63
|
+
a. **Artifact status** - Run `openspec status --change "<name>" --json`
|
|
64
|
+
- Parse `schemaName`, `artifacts`, `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`
|
|
65
|
+
- Note which artifacts are `done` vs other states
|
|
66
|
+
|
|
67
|
+
b. **Task completion** - Read `artifactPaths.tasks.existingOutputPaths` from status JSON
|
|
68
|
+
- Count `- [ ]` (incomplete) vs `- [x]` (complete)
|
|
69
|
+
- If no tasks file exists, note as "No tasks"
|
|
70
|
+
|
|
71
|
+
c. **Delta specs** - Check `artifactPaths.specs.existingOutputPaths` from status JSON
|
|
72
|
+
- List which capability specs exist
|
|
73
|
+
- For each, extract requirement names (lines matching `### Requirement: <name>`)
|
|
74
|
+
- Treat this list as the only delta-spec source. If the `specs` entry is
|
|
75
|
+
missing or the list is empty, perform no spec sync or specs-instruction
|
|
76
|
+
lookup for that change; do not infer deltas from unrelated artifacts.
|
|
77
|
+
- Evaluate this independently for every change, including mixed-schema
|
|
78
|
+
batches where some schemas have no `specs` artifact.
|
|
79
|
+
|
|
80
|
+
4. **Detect spec conflicts**
|
|
81
|
+
|
|
82
|
+
Build a map keyed by `<capability-path>`, the exact path relative to `specs/`:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
identity/user-auth -> [change-a, change-b] <- CONFLICT (2+ changes)
|
|
86
|
+
billing/user-auth -> [change-c] <- OK (different full path)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
A conflict exists when 2+ selected changes have delta specs for the exact same `<capability-path>`.
|
|
90
|
+
|
|
91
|
+
5. **Resolve conflicts agentically**
|
|
92
|
+
|
|
93
|
+
**For each conflict**, investigate the codebase:
|
|
94
|
+
|
|
95
|
+
a. **Read the delta specs** from each conflicting change to understand what each claims to add/modify
|
|
96
|
+
|
|
97
|
+
b. **Search the codebase** for implementation evidence:
|
|
98
|
+
- Look for code implementing requirements from each delta spec
|
|
99
|
+
- Check for related files, functions, or tests
|
|
100
|
+
|
|
101
|
+
c. **Determine resolution**:
|
|
102
|
+
- If only one change is actually implemented -> sync that one's specs
|
|
103
|
+
- If both implemented -> apply in chronological order (older first, newer overwrites)
|
|
104
|
+
- If neither implemented -> skip spec sync, warn user
|
|
105
|
+
|
|
106
|
+
d. **Record resolution** for each conflict:
|
|
107
|
+
- An inclusion or exclusion decision for every delta spec, keyed by change and `<capability-path>`
|
|
108
|
+
- Which included delta specs to apply and in what order
|
|
109
|
+
- Which delta specs to exclude from sync because their implementation is missing
|
|
110
|
+
- Rationale (what was found in codebase)
|
|
111
|
+
|
|
112
|
+
6. **Show consolidated status table**
|
|
113
|
+
|
|
114
|
+
Display a table summarizing all changes:
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
| Change | Artifacts | Tasks | Specs | Conflicts | Status |
|
|
118
|
+
|---------------------|-----------|-------|---------|-----------|--------|
|
|
119
|
+
| schema-management | Done | 5/5 | 2 delta | None | Ready |
|
|
120
|
+
| project-config | Done | 3/3 | 1 delta | None | Ready |
|
|
121
|
+
| add-oauth | Done | 4/4 | 1 delta | identity/user-auth (!) | Ready* |
|
|
122
|
+
| add-verify-skill | 1 left | 2/5 | None | None | Warn |
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
For conflicts, show the resolution:
|
|
126
|
+
```text
|
|
127
|
+
* Conflict resolution:
|
|
128
|
+
- identity/user-auth spec: Will apply add-oauth then add-jwt (both implemented, chronological order)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
For incomplete changes, show warnings:
|
|
132
|
+
```text
|
|
133
|
+
Warnings:
|
|
134
|
+
- add-verify-skill: 1 incomplete artifact, 3 incomplete tasks
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
7. **Confirm batch operation**
|
|
138
|
+
|
|
139
|
+
Ask the user a single confirmation question:
|
|
140
|
+
|
|
141
|
+
- "Archive N changes?" with options based on status
|
|
142
|
+
- Options might include:
|
|
143
|
+
- "Archive all N changes"
|
|
144
|
+
- "Archive only N ready changes (skip incomplete)"
|
|
145
|
+
- "Cancel"
|
|
146
|
+
|
|
147
|
+
If there are incomplete changes, make clear they'll be archived with warnings.
|
|
148
|
+
|
|
149
|
+
Route on the answer by intent, not by exact label — you wrote these labels,
|
|
150
|
+
so match what the user picked rather than the wording above:
|
|
151
|
+
- "Cancel" — stop, do not archive. Report that nothing was archived and skip the remaining steps.
|
|
152
|
+
- The archive-everything option — proceed with every selected change
|
|
153
|
+
- The ready-only option — proceed with only the changes the step 6 table marks `Ready` or `Ready*`, and record the rest as Skipped in step 8d. If a `Ready*` change's conflict partner is skipped, re-derive that conflict's resolution using only the changes being archived.
|
|
154
|
+
- Anything else — ask again rather than archiving
|
|
155
|
+
|
|
156
|
+
Before step 8 writes the first main spec or moves any change, fetch every
|
|
157
|
+
required specs-rule snapshot for the confirmed batch. For each change that will
|
|
158
|
+
sync concrete `artifactPaths.specs.existingOutputPaths`, run
|
|
159
|
+
`openspec instructions specs --change "<name>" --json` exactly once with the
|
|
160
|
+
same selected-root flags. Obtain all snapshots before the first write or move.
|
|
161
|
+
If any lookup exits non-zero or returns invalid artifact-instruction JSON,
|
|
162
|
+
identify the affected change, report the error, and stop the whole batch before
|
|
163
|
+
any main-spec write or change move. Do not treat lookup failure as omitted
|
|
164
|
+
rules. A valid response without `rules` is the no-rules case.
|
|
165
|
+
|
|
166
|
+
8. **Execute archive for each confirmed change**
|
|
167
|
+
|
|
168
|
+
Before processing, carry the recorded decisions from step 5 (after any step 7 re-derivation) into two per-delta sets:
|
|
169
|
+
- `includedDeltas`: all non-conflicting delta specs from confirmed changes plus conflict deltas selected for sync
|
|
170
|
+
- `excludedDeltas`: conflict deltas from confirmed changes excluded because their implementation is missing
|
|
171
|
+
- A single change can have both included and excluded delta specs. Keep the decision per delta; do not collapse it into a per-change sync flag.
|
|
172
|
+
|
|
173
|
+
Process changes in the determined order (respecting conflict resolution):
|
|
174
|
+
|
|
175
|
+
a. **Sync included delta specs**:
|
|
176
|
+
- Run the `/opsx:sync` workflow inline (agent-driven intelligent merge) only for changes with entries in `includedDeltas`, passing only the included delta paths and explicitly instructing it to ignore that change's `excludedDeltas`. Wait for it to finish.
|
|
177
|
+
- For conflicts, apply in resolved order.
|
|
178
|
+
- Pass that change's fetched specs-rule snapshot into inline sync; inline
|
|
179
|
+
sync must reuse it without fetching instructions again
|
|
180
|
+
- Apply artifact rules only to main specs produced by that change. They do
|
|
181
|
+
not change conflict resolution, archive behavior, or CLI contracts, and
|
|
182
|
+
their text is not copied into an output file
|
|
183
|
+
- Do not delegate to a background task — step 8c would move `changeRoot` out from under a sync that is still reading it.
|
|
184
|
+
- If a change has no included delta specs, do not run the sync workflow for it.
|
|
185
|
+
|
|
186
|
+
b. **Verify included delta specs before moving changeRoot**:
|
|
187
|
+
- Re-run the comparison only for delta specs in `includedDeltas` against main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (use the store-aware `planningHome.root` from step 3 status JSON, not a hardcoded repo path).
|
|
188
|
+
- Verify that main specs are updated:
|
|
189
|
+
- ADDED requirements present
|
|
190
|
+
- MODIFIED requirements carrying scenario and description changes named in the delta, with their other scenarios intact
|
|
191
|
+
- REMOVED requirements gone — and where this sync retired a capability (removed its last requirement, leaving `## Requirements` empty), its main spec deleted rather than left empty; a spec the sync deliberately kept and reported is also a match
|
|
192
|
+
- RENAMED requirements present under the new name and absent under the old one
|
|
193
|
+
- Do not verify delta specs in `excludedDeltas`; they are intentionally left unsynced.
|
|
194
|
+
- If sync failed or any capability does not match verification, report what differs and fail/skip moving that change's `changeRoot` — do not archive that change. `changeRoot` remains intact.
|
|
195
|
+
|
|
196
|
+
c. **Perform the archive**:
|
|
197
|
+
|
|
198
|
+
Target name: use the change name as-is when it already starts with a `YYYY-MM-DD-` prefix; otherwise prepend the current date as `YYYY-MM-DD-<name>` (same rule as `openspec archive`).
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
mkdir -p "<planningHome.changesDir>/archive"
|
|
202
|
+
mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
d. **Track outcome** for each change:
|
|
206
|
+
- Success: archived successfully
|
|
207
|
+
- Failed: error during archive or spec verification (record error)
|
|
208
|
+
- Skipped: user chose not to archive (if applicable)
|
|
209
|
+
- Sync skipped: for every delta in `excludedDeltas`, report `sync skipped` with the change, `<capability-path>`, and recorded reason. This is distinct from skipping the archive.
|
|
210
|
+
|
|
211
|
+
9. **Display summary**
|
|
212
|
+
|
|
213
|
+
Show final results:
|
|
214
|
+
|
|
215
|
+
```markdown
|
|
216
|
+
## Bulk Archive Complete
|
|
217
|
+
|
|
218
|
+
Archived 3 changes:
|
|
219
|
+
- schema-management-cli -> archive/2026-01-19-schema-management-cli/
|
|
220
|
+
- project-config -> archive/2026-01-19-project-config/
|
|
221
|
+
- add-oauth -> archive/2026-01-19-add-oauth/
|
|
222
|
+
|
|
223
|
+
Skipped 1 change:
|
|
224
|
+
- add-verify-skill (user chose not to archive incomplete)
|
|
225
|
+
|
|
226
|
+
Spec sync summary:
|
|
227
|
+
- 4 delta specs synced to main specs
|
|
228
|
+
- 1 delta spec sync skipped (add-jwt, identity/user-auth: implementation not found)
|
|
229
|
+
- 1 conflict resolved (identity/user-auth: synced add-oauth, skipped add-jwt)
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
If any failures:
|
|
233
|
+
```text
|
|
234
|
+
Failed 1 change:
|
|
235
|
+
- some-change: Archive directory already exists
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Conflict Resolution Examples**
|
|
239
|
+
|
|
240
|
+
Example 1: Only one implemented
|
|
241
|
+
```text
|
|
242
|
+
Conflict: <planningHome.root>/openspec/specs/auth/spec.md touched by [add-oauth, add-jwt]
|
|
243
|
+
|
|
244
|
+
Checking add-oauth:
|
|
245
|
+
- Delta adds "OAuth Provider Integration" requirement
|
|
246
|
+
- Searching codebase... found src/auth/oauth.ts implementing OAuth flow
|
|
247
|
+
|
|
248
|
+
Checking add-jwt:
|
|
249
|
+
- Delta adds "JWT Token Handling" requirement
|
|
250
|
+
- Searching codebase... no JWT implementation found
|
|
251
|
+
|
|
252
|
+
Resolution: Only add-oauth is implemented. Will sync add-oauth specs only.
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Example 2: Both implemented
|
|
256
|
+
```text
|
|
257
|
+
Conflict: <planningHome.root>/openspec/specs/api/spec.md touched by [add-rest-api, add-graphql]
|
|
258
|
+
|
|
259
|
+
Checking add-rest-api (created 2026-01-10):
|
|
260
|
+
- Delta adds "REST Endpoints" requirement
|
|
261
|
+
- Searching codebase... found src/api/rest.ts
|
|
262
|
+
|
|
263
|
+
Checking add-graphql (created 2026-01-15):
|
|
264
|
+
- Delta adds "GraphQL Schema" requirement
|
|
265
|
+
- Searching codebase... found src/api/graphql.ts
|
|
266
|
+
|
|
267
|
+
Resolution: Both implemented. Will apply add-rest-api specs first,
|
|
268
|
+
then add-graphql specs (chronological order, newer takes precedence).
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**Output On Success**
|
|
272
|
+
|
|
273
|
+
```markdown
|
|
274
|
+
## Bulk Archive Complete
|
|
275
|
+
|
|
276
|
+
Archived N changes:
|
|
277
|
+
- <change-1> -> archive/<target-name-1>/
|
|
278
|
+
- <change-2> -> archive/<target-name-2>/
|
|
279
|
+
|
|
280
|
+
Spec sync summary:
|
|
281
|
+
- N delta specs synced to main specs
|
|
282
|
+
- No conflicts (or: M conflicts resolved)
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Output On Partial Success**
|
|
286
|
+
|
|
287
|
+
```markdown
|
|
288
|
+
## Bulk Archive Complete (partial)
|
|
289
|
+
|
|
290
|
+
Archived N changes:
|
|
291
|
+
- <change-1> -> archive/<target-name-1>/
|
|
292
|
+
|
|
293
|
+
Skipped M changes:
|
|
294
|
+
- <change-2> (user chose not to archive incomplete)
|
|
295
|
+
|
|
296
|
+
Failed K changes:
|
|
297
|
+
- <change-3>: Archive directory already exists
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Output When No Changes**
|
|
301
|
+
|
|
302
|
+
```markdown
|
|
303
|
+
## No Changes to Archive
|
|
304
|
+
|
|
305
|
+
No active changes found. Create a new change to get started.
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**Guardrails**
|
|
309
|
+
- Allow any number of changes (1+ is fine, 2+ is the typical use case)
|
|
310
|
+
- Always prompt for selection, never auto-select
|
|
311
|
+
- Detect spec conflicts early and resolve by checking codebase
|
|
312
|
+
- When both changes are implemented, apply specs in chronological order
|
|
313
|
+
- Skip spec sync only when implementation is missing (warn user)
|
|
314
|
+
- Show clear per-change status before confirming
|
|
315
|
+
- Use single confirmation for entire batch
|
|
316
|
+
- Never archive after the user cancels the confirmation — a cancelled batch archives nothing
|
|
317
|
+
- Track and report all outcomes (success/skip/fail)
|
|
318
|
+
- Preserve .openspec.yaml when moving to archive
|
|
319
|
+
- Archive directory target uses current date: YYYY-MM-DD-<name>; a name that already starts with a `YYYY-MM-DD-` prefix is used as-is (never stack a second date)
|
|
320
|
+
- If archive target exists, fail that change but continue with others
|
|
321
|
+
- If sync is requested, run the `/opsx:sync` workflow inline (agent-driven) for each change with included delta specs
|
|
322
|
+
- Carry the per-delta `includedDeltas` and `excludedDeltas` decisions into execution; sync and verify only included deltas
|
|
323
|
+
- Report every excluded delta as `sync skipped` without treating the archive itself as skipped
|
|
324
|
+
- Never archive a change while a spec sync is still in flight — run the sync inline and verify main specs at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` before moving `changeRoot`
|
|
325
|
+
- Fetch archive inputs once per selected root before spec inspection or moves
|
|
326
|
+
- Fetch all required specs-rule snapshots before the batch's first main-spec write or move
|
|
327
|
+
- A failed archive-inputs lookup never blocks the batch; it proceeds with no context or guidance
|
|
328
|
+
- A failed specs instruction lookup stops the whole batch atomically
|
|
329
|
+
- Changes without concrete `artifactPaths.specs.existingOutputPaths` continue without spec sync
|
|
330
|
+
- Apply relevant runtime context across the batch and report conflicts
|
|
331
|
+
- Operation guidance remains advisory; consider every entry and explain rejected advice
|
|
332
|
+
- Keep runtime inputs, conflict analysis, CLI-derived values, and artifact rules separate
|
|
333
|
+
- Artifact rules constrain only written specs
|
|
334
|
+
- Never copy runtime input or artifact-rule text verbatim into output files
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "OPSX: Continue"
|
|
3
|
+
description: Continue working on a change - create the next artifact (Experimental)
|
|
4
|
+
category: Workflow
|
|
5
|
+
tags: [workflow, artifacts, experimental]
|
|
6
|
+
---
|
|
7
|
+
Continue working on a change by creating the next artifact.
|
|
8
|
+
|
|
9
|
+
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`). Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
|
10
|
+
|
|
11
|
+
**Input**: Optionally specify a change name after `/opsx:continue` (e.g., `/opsx:continue add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
12
|
+
|
|
13
|
+
**Steps**
|
|
14
|
+
|
|
15
|
+
1. **Select the change**
|
|
16
|
+
|
|
17
|
+
If a name is provided, use it. Otherwise:
|
|
18
|
+
- Infer from conversation context if the user mentioned a change
|
|
19
|
+
- Auto-select if only one active change exists
|
|
20
|
+
- If ambiguous, run `openspec list --json` to get available changes sorted by most recently modified, and ask the user to select one
|
|
21
|
+
|
|
22
|
+
When prompting, present the top 3-4 most recently modified changes as options, showing:
|
|
23
|
+
- Change name
|
|
24
|
+
- Schema (from `schema` field if present, otherwise "spec-driven")
|
|
25
|
+
- Status (e.g., "0/5 tasks", "complete", "no tasks")
|
|
26
|
+
- How recently it was modified (from `lastModified` field)
|
|
27
|
+
|
|
28
|
+
Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to continue.
|
|
29
|
+
|
|
30
|
+
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:continue <other>`).
|
|
31
|
+
|
|
32
|
+
2. **Check current status**
|
|
33
|
+
```bash
|
|
34
|
+
openspec status --change "<name>" --json
|
|
35
|
+
```
|
|
36
|
+
Parse the JSON to understand current state. The response includes:
|
|
37
|
+
- `schemaName`: The workflow schema being used (e.g., "spec-driven")
|
|
38
|
+
- `artifacts`: Array of artifacts with their status ("done", "skipped", "ready", "blocked")
|
|
39
|
+
- `isPlanningComplete`: Boolean indicating if all planning artifacts are complete. Older CLI versions expose the same value as `isComplete`.
|
|
40
|
+
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
|
|
41
|
+
|
|
42
|
+
3. **Act based on status**:
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
**If all planning artifacts are complete (`isPlanningComplete: true`, or legacy `isComplete: true`)**:
|
|
47
|
+
- Congratulate the user
|
|
48
|
+
- Show final status including the schema used
|
|
49
|
+
- Suggest: "Planning is complete! You can now implement this change with `/opsx:apply`. Once implementation and any tracked work are complete, archive it with `/opsx:archive`."
|
|
50
|
+
- STOP
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
**If artifacts are ready to create** (status shows artifacts with `status: "ready"`):
|
|
55
|
+
- Pick the FIRST artifact with `status: "ready"` from the status output
|
|
56
|
+
- Get its instructions:
|
|
57
|
+
```bash
|
|
58
|
+
openspec instructions <artifact-id> --change "<name>" --json
|
|
59
|
+
```
|
|
60
|
+
- Parse the JSON. The key fields are:
|
|
61
|
+
- `context`: Project background (constraints for you - do NOT include in output)
|
|
62
|
+
- `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
|
|
63
|
+
- `template`: The structure to use for your output file
|
|
64
|
+
- `instruction`: Schema-specific guidance
|
|
65
|
+
- `resolvedOutputPath`: Resolved path or pattern to write the artifact
|
|
66
|
+
- `dependencies`: Completed artifacts to read for context (entries with `skipped: true` have no files - do not look for them)
|
|
67
|
+
- `skipped`/`warning`: present when the change declares skip_specs and this artifact must NOT be created - pick another artifact
|
|
68
|
+
- **Create the artifact file**:
|
|
69
|
+
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
|
|
70
|
+
- If the `instruction` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at `resolvedOutputPath`
|
|
71
|
+
- Otherwise use `template` as the structure - fill in its sections
|
|
72
|
+
- Apply `context` and `rules` as constraints when writing - but do NOT copy them into the file
|
|
73
|
+
- Write to the `resolvedOutputPath` specified in instructions. If it is a glob pattern, choose the concrete file path using the schema instruction and the change's context
|
|
74
|
+
- Show what was created and what's now unlocked
|
|
75
|
+
- STOP after creating ONE artifact
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
**If no artifacts are ready (all blocked)**:
|
|
80
|
+
- This shouldn't happen with a valid schema
|
|
81
|
+
- Show status and suggest checking for issues
|
|
82
|
+
|
|
83
|
+
4. **After creating an artifact, show progress**
|
|
84
|
+
```bash
|
|
85
|
+
openspec status --change "<name>"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Output**
|
|
89
|
+
|
|
90
|
+
After each invocation, show:
|
|
91
|
+
- Which artifact was created
|
|
92
|
+
- Schema workflow being used
|
|
93
|
+
- Current progress (N/M complete)
|
|
94
|
+
- What artifacts are now unlocked
|
|
95
|
+
- Prompt: "Run `/opsx:continue` to create the next artifact"
|
|
96
|
+
|
|
97
|
+
**Artifact Creation Guidelines**
|
|
98
|
+
|
|
99
|
+
The artifact types and their purpose depend on the schema. The `instruction` field from the instructions output is the authoritative guidance for each artifact - follow it even when the artifact has a familiar name (proposal.md, tasks.md, etc.), since custom schemas may define different content or a different process for the same file names.
|
|
100
|
+
|
|
101
|
+
If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly.
|
|
102
|
+
|
|
103
|
+
**Guardrails**
|
|
104
|
+
- Create ONE artifact per invocation
|
|
105
|
+
- Always read dependency artifacts before creating a new one - re-read from disk, not from conversation memory (files may have changed since you last saw them)
|
|
106
|
+
- Never skip artifacts or create out of order
|
|
107
|
+
- If context is unclear, ask the user before creating
|
|
108
|
+
- Verify the artifact file exists after writing before marking progress
|
|
109
|
+
- Use the schema's artifact sequence, don't assume specific artifact names
|
|
110
|
+
- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
|
|
111
|
+
- Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
|
|
112
|
+
- These guide what you write, but should never appear in the output
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "OPSX: Explore"
|
|
3
|
+
description: Enter explore mode - think through ideas, investigate problems, clarify requirements
|
|
4
|
+
category: Workflow
|
|
5
|
+
tags: [workflow, explore, experimental, thinking]
|
|
6
|
+
---
|
|
7
|
+
Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
|
|
8
|
+
|
|
9
|
+
**IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, investigate the codebase, and run read-only commands or tools without confirmation, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create or update OpenSpec change artifacts (proposals, designs, specs) within a confirmed scope—that's capturing thinking, not implementing. Answering design or clarifying questions is never consent to write. Before the first write-capable action, name the artifacts or files you would change and what you would do, ask a direct yes/no question, and wait for the user's confirmation in a separate message. Confirmation covers only the scope you described; ask again before expanding it. For a new change, scaffold it first as described below.
|
|
10
|
+
|
|
11
|
+
**This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
|
|
12
|
+
|
|
13
|
+
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`). Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
|
14
|
+
|
|
15
|
+
**Input**: The argument after `/opsx:explore` is whatever the user wants to think about. Could be:
|
|
16
|
+
- A vague idea: "real-time collaboration"
|
|
17
|
+
- A specific problem: "the auth system is getting unwieldy"
|
|
18
|
+
- A change name: "add-dark-mode" (to explore in context of that change)
|
|
19
|
+
- A comparison: "postgres vs sqlite for this"
|
|
20
|
+
- Nothing (just enter explore mode)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## The Stance
|
|
25
|
+
|
|
26
|
+
- **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
|
|
27
|
+
- **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
|
|
28
|
+
- **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
|
|
29
|
+
- **Adaptive** - Follow interesting threads, pivot when new information emerges
|
|
30
|
+
- **Patient** - Don't rush to conclusions, let the shape of the problem emerge
|
|
31
|
+
- **Grounded** - Explore the actual codebase when relevant, don't just theorize
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
${PLANNING_GUIDANCE}
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## What You Might Do
|
|
40
|
+
|
|
41
|
+
Depending on what the user brings, you might:
|
|
42
|
+
|
|
43
|
+
**Explore the problem space**
|
|
44
|
+
- Ask clarifying questions that emerge from what they said
|
|
45
|
+
- Challenge assumptions
|
|
46
|
+
- Reframe the problem
|
|
47
|
+
- Find analogies
|
|
48
|
+
|
|
49
|
+
**Investigate the codebase**
|
|
50
|
+
- Map existing architecture relevant to the discussion
|
|
51
|
+
- Find integration points
|
|
52
|
+
- Identify patterns already in use
|
|
53
|
+
- Surface hidden complexity
|
|
54
|
+
|
|
55
|
+
**Compare options**
|
|
56
|
+
- Brainstorm multiple approaches
|
|
57
|
+
- Build comparison tables
|
|
58
|
+
- Sketch tradeoffs
|
|
59
|
+
- Recommend a path (if asked)
|
|
60
|
+
|
|
61
|
+
**Visualize**
|
|
62
|
+
```
|
|
63
|
+
+------------------------------------------+
|
|
64
|
+
| Use ASCII diagrams liberally |
|
|
65
|
+
+------------------------------------------+
|
|
66
|
+
| |
|
|
67
|
+
| [State A] -------> [State B] |
|
|
68
|
+
| | |
|
|
69
|
+
| v |
|
|
70
|
+
| [State C] |
|
|
71
|
+
| |
|
|
72
|
+
| System diagrams, state machines, |
|
|
73
|
+
| data flows, architecture sketches, |
|
|
74
|
+
| dependency graphs, comparison tables |
|
|
75
|
+
| |
|
|
76
|
+
+------------------------------------------+
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Draw with plain ASCII only** — borders `+` `-` `|`, arrows `-->` `<--` `^` `v`, markers `*` `x`.
|
|
80
|
+
Unicode diagram glyphs can render at different widths across terminals, fonts, and locales, so padded boxes and aligned tables can drift. Keep every diagram character ASCII.
|
|
81
|
+
|
|
82
|
+
**Surface risks and unknowns**
|
|
83
|
+
- Identify what could go wrong
|
|
84
|
+
- Find gaps in understanding
|
|
85
|
+
- Suggest spikes or investigations
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## OpenSpec Awareness
|
|
90
|
+
|
|
91
|
+
You have full context of the OpenSpec system. Use it naturally, don't force it.
|
|
92
|
+
|
|
93
|
+
### Check for context
|
|
94
|
+
|
|
95
|
+
At the start, quickly check what exists:
|
|
96
|
+
```bash
|
|
97
|
+
openspec list --json
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
This tells you:
|
|
101
|
+
- If there are active changes
|
|
102
|
+
- Their names, schemas, and status
|
|
103
|
+
- What the user might be working on
|
|
104
|
+
|
|
105
|
+
That is the *change* list - work in flight. It does not include the project's durable capabilities, so list those too:
|
|
106
|
+
```bash
|
|
107
|
+
openspec list --specs
|
|
108
|
+
```
|
|
109
|
+
Add `--json` for ids and requirement counts, and append `--store "<id>"` only for a registered standalone store. This is the inventory of what the project already claims to do, and `openspec list` on its own never shows it. To look at one, run `openspec show "<spec-id>" --type spec --json --no-scenarios` (same `--store` rule) - it returns that capability's purpose and requirement texts without pulling the whole spec file into context, and `--type spec` stops a change of the same name from making it ambiguous.
|
|
110
|
+
|
|
111
|
+
The filtered read is only an overview. Before deciding what is already covered or what should change, read each relevant spec in full, including scenarios, with `openspec show "<spec-id>" --type spec` (same `--store` rule).
|
|
112
|
+
|
|
113
|
+
Then read the project's own context from the resolved root - `<root.path>/openspec/config.yaml` (or `config.yml`). Use the `root.path` returned above, and skip this if neither file exists:
|
|
114
|
+
- `context`: project background - tech stack, conventions, constraints
|
|
115
|
+
- `rules`: keyed by artifact id - the entries for an artifact apply only when you write that artifact
|
|
116
|
+
|
|
117
|
+
Ground your thinking in these. They are constraints for you to follow, not content to reproduce: do NOT copy them into the conversation or into any artifact you create.
|
|
118
|
+
|
|
119
|
+
If the user mentioned a specific change name, read its artifacts for context.
|
|
120
|
+
|
|
121
|
+
### When no change exists
|
|
122
|
+
|
|
123
|
+
Think freely. When insights crystallize, you might offer:
|
|
124
|
+
|
|
125
|
+
- "This feels solid enough to start a change. Want me to create a proposal?"
|
|
126
|
+
- Or keep exploring - no pressure to formalize
|
|
127
|
+
|
|
128
|
+
If the user asks you to capture the exploration as a new change, transition seamlessly into the requested capture:
|
|
129
|
+
|
|
130
|
+
1. Run `openspec new change "<name>"` (with `--store <id>` when applicable) before creating any artifacts. Never create a new change directory under `openspec/changes/` by hand; the CLI scaffold creates required metadata such as `.openspec.yaml`. Keep the selected `--store <id>` on every applicable follow-up `status` and `instructions` command.
|
|
131
|
+
2. Run `openspec status --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store), then process the requested artifacts in dependency order. For each requested artifact that is `ready`, run `openspec instructions "<artifact-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store). Before creating a requested artifact, evaluate any condition in its own `instruction` against the explored change; record a deliberate skip instead when the condition does not apply. If a requested artifact is blocked by a direct prerequisite the user did not request, run `openspec instructions "<prerequisite-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) for that prerequisite whether it is `ready` or `blocked`. If its own `instruction` states a condition, evaluate that condition against the explored change and record a deliberate skip only when the condition does not apply. If the condition applies, or the prerequisite is not conditional, treat it as a normal prerequisite and ask before expanding the capture. Do not create an unrequested prerequisite unless the user approves.
|
|
132
|
+
3. Follow the returned `template` and `instruction` fields. Read completed dependency files listed in `dependencies`, and apply `context` and `rules` as constraints without copying them into the artifact. If the instruction delegates creation to a specific skill or command, invoke it; otherwise write the artifact to `resolvedOutputPath`, using the instruction to choose a concrete path when it is a glob. Verify that the selected concrete output exists.
|
|
133
|
+
4. After creating each artifact, re-run `openspec status --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) and continue until every requested artifact is `done`, `skipped`, or was deliberately skipped because its own `instruction` stated a condition that did not apply. Tell the user about a deliberate conditional skip, remember it, and do not reconsider it. Dependencies are enablers, not gates: if a requested artifact is still `blocked` only because you deliberately skipped a conditional prerequisite, run `openspec instructions "<artifact-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) despite the blocked status, then create it using step 3 only when those recorded conditional skips are its sole missing dependencies. If a requested artifact is blocked by a prerequisite the user did not ask to capture and cannot be conditionally skipped, explain that dependency and ask before expanding the capture.
|
|
134
|
+
|
|
135
|
+
Capture the artifact(s) the user requested without asking them to invoke another workflow command. If they asked only to start a change, stop after scaffolding and show its status.
|
|
136
|
+
|
|
137
|
+
### When a change exists
|
|
138
|
+
|
|
139
|
+
If the user mentions a change or you detect one is relevant:
|
|
140
|
+
|
|
141
|
+
1. **Resolve and read existing artifacts for context**
|
|
142
|
+
- Run `openspec status --change "<name>" --json`.
|
|
143
|
+
- Use `changeRoot`, `artifactPaths`, and `actionContext` from the status JSON.
|
|
144
|
+
- Read existing files from `artifactPaths.<artifact>.existingOutputPaths`.
|
|
145
|
+
|
|
146
|
+
2. **Reference them naturally in conversation**
|
|
147
|
+
- "Your design mentions using Redis, but we just realized SQLite fits better..."
|
|
148
|
+
- "The proposal scopes this to premium users, but we're now thinking everyone..."
|
|
149
|
+
|
|
150
|
+
3. **Offer to capture when decisions are made**
|
|
151
|
+
|
|
152
|
+
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
|
|
153
|
+
|
|
154
|
+
| Insight Type | Where to Capture |
|
|
155
|
+
|----------------------------|-------------------------------------|
|
|
156
|
+
| New requirement discovered | `specs/<capability-path>/spec.md` |
|
|
157
|
+
| Requirement changed | `specs/<capability-path>/spec.md` |
|
|
158
|
+
| Design decision made | `design.md` |
|
|
159
|
+
| Scope changed | `proposal.md` |
|
|
160
|
+
| New work identified | `tasks.md` |
|
|
161
|
+
| Assumption invalidated | Relevant artifact |
|
|
162
|
+
|
|
163
|
+
Example offers:
|
|
164
|
+
- "That's a design decision. Capture it in design.md?"
|
|
165
|
+
- "This is a new requirement. Add it to specs?"
|
|
166
|
+
- "This changes scope. Update the proposal?"
|
|
167
|
+
|
|
168
|
+
4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## What You Don't Have To Do
|
|
173
|
+
|
|
174
|
+
- Follow a script
|
|
175
|
+
- Ask the same questions every time
|
|
176
|
+
- Produce a specific artifact
|
|
177
|
+
- Reach a conclusion
|
|
178
|
+
- Stay on topic if a tangent is valuable
|
|
179
|
+
- Be brief (this is thinking time)
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Ending Discovery
|
|
184
|
+
|
|
185
|
+
There's no required ending. Discovery might:
|
|
186
|
+
|
|
187
|
+
- **Flow into a proposal**: "Ready to start? I can create a change proposal."
|
|
188
|
+
- **Result in artifact updates**: "Updated design.md with these decisions"
|
|
189
|
+
- **Just provide clarity**: User has what they need, moves on
|
|
190
|
+
- **Continue later**: "We can pick this up anytime"
|
|
191
|
+
|
|
192
|
+
When things crystallize, you might offer a summary - but it's optional. Sometimes the thinking IS the value.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Guardrails
|
|
197
|
+
|
|
198
|
+
- **Don't implement** - Never write code or implement features. Workflow configuration counts too: creating or editing schemas, templates, or `openspec/config.yaml` is a change, not thinking. Creating or updating OpenSpec change artifacts within the confirmed scope is fine, writing anything else is not.
|
|
199
|
+
- **Don't fake understanding** - If something is unclear, dig deeper
|
|
200
|
+
- **Don't rush** - Discovery is thinking time, not task time
|
|
201
|
+
- **Don't force structure** - Let patterns emerge naturally
|
|
202
|
+
- **Don't auto-capture** - Offer to save insights, don't just do it. Read-only commands and tools need no confirmation. Before the first write-capable action—including `openspec new change` or another command that writes files—name the artifacts or files and proposed changes, ask a direct yes/no question, and wait for explicit confirmation in a separate user message. That confirmation covers only the described scope; ask again before expanding it. Answers to design or clarifying questions are never consent to write.
|
|
203
|
+
- **Don't manually scaffold changes** - Never create a new change directory under `openspec/changes/` by hand. Always use `openspec new change "<name>"` (with `--store <id>` when applicable) so required metadata such as `.openspec.yaml` is created before writing artifacts.
|
|
204
|
+
- **Do visualize** - A good diagram is worth many paragraphs
|
|
205
|
+
- **Do explore the codebase** - Ground discussions in reality
|
|
206
|
+
- **Do question assumptions** - Including the user's and your own
|