spec-ctx 0.0.0-stage → 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 (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +245 -2
  3. package/action.yml +33 -0
  4. package/dist/adopt/config-write.js +59 -0
  5. package/dist/adopt/plan.js +276 -0
  6. package/dist/adopt/write.js +126 -0
  7. package/dist/assets.generated.js +14 -0
  8. package/dist/baseline/baseline.js +65 -0
  9. package/dist/check/check.js +126 -0
  10. package/dist/check/evidence.js +70 -0
  11. package/dist/check/hints.js +26 -0
  12. package/dist/cli/args.js +90 -0
  13. package/dist/cli/commands.js +275 -0
  14. package/dist/cli/errors.js +3 -0
  15. package/dist/cli/gate.js +187 -0
  16. package/dist/cli/help.js +230 -0
  17. package/dist/cli/root.js +32 -0
  18. package/dist/cli/status.js +116 -0
  19. package/dist/cli/workflow.js +274 -0
  20. package/dist/cli.js +13 -0
  21. package/dist/config.js +119 -0
  22. package/dist/graph/bundle.js +94 -0
  23. package/dist/graph/query.js +31 -0
  24. package/dist/graph/related.js +76 -0
  25. package/dist/handoff/handoff.js +148 -0
  26. package/dist/ids/ids.js +115 -0
  27. package/dist/index/build.js +57 -0
  28. package/dist/index/canonical.js +44 -0
  29. package/dist/index/scan.js +357 -0
  30. package/dist/index/types.js +2 -0
  31. package/dist/init/init.js +141 -0
  32. package/dist/lint/cli.js +253 -0
  33. package/dist/lint/py.js +152 -0
  34. package/dist/lint/selftest.js +246 -0
  35. package/dist/lint/ste.js +395 -0
  36. package/dist/lint/tells.js +116 -0
  37. package/dist/main.js +74 -0
  38. package/dist/stats/stats.js +143 -0
  39. package/dist/stats/write.js +26 -0
  40. package/dist/tasks/evidence.js +102 -0
  41. package/dist/tasks/tasks.js +105 -0
  42. package/dist/util/glob.js +43 -0
  43. package/dist/util/hash.js +14 -0
  44. package/dist/util/json.js +16 -0
  45. package/dist/util/pystr.js +67 -0
  46. package/dist/util/time.js +11 -0
  47. package/dist/verify/parse.js +58 -0
  48. package/dist/verify/run.js +42 -0
  49. package/dist/version.js +2 -0
  50. package/package.json +50 -4
  51. package/schemas/spec-driven-ids/README.md +18 -0
  52. package/schemas/spec-driven-ids/config-fragment.yaml +25 -0
  53. package/schemas/spec-driven-ids/schema.yaml +301 -0
  54. package/schemas/spec-driven-ids/templates/design.md +22 -0
  55. package/schemas/spec-driven-ids/templates/proposal.md +34 -0
  56. package/schemas/spec-driven-ids/templates/spec.md +15 -0
  57. package/schemas/spec-driven-ids/templates/tasks.md +10 -0
  58. package/skills/specctx-bootstrap/SKILL.md +27 -0
  59. package/skills/specctx-done/SKILL.md +25 -0
  60. package/skills/specctx-next/SKILL.md +23 -0
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "spec-ctx",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Deterministic context engine and task workflow for OpenSpec projects.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "bin": {
8
+ "specctx": "dist/cli.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "schemas",
13
+ "skills",
14
+ "action.yml"
15
+ ],
16
+ "engines": {
17
+ "node": ">=22"
18
+ },
19
+ "scripts": {
20
+ "build": "npm run prepare",
21
+ "build:bin": "bun build src/cli.ts --compile --outfile build/specctx",
22
+ "typecheck": "tsc -p tsconfig.json",
23
+ "test": "bun test",
24
+ "test:node": "vitest run",
25
+ "lint": "bash scripts/lint-md.sh",
26
+ "ctx": "node dist/cli.js",
27
+ "gen": "node scripts/gen-assets.mjs",
28
+ "prepublishOnly": "bun run build",
29
+ "prepare": "node scripts/gen-assets.mjs && tsc -p tsconfig.build.json && node scripts/chmod-bin.mjs",
30
+ "ci:local": "bash scripts/ci-local.sh"
31
+ },
32
+ "dependencies": {
33
+ "smol-toml": "^1.9.1"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "^22.20.5",
37
+ "typescript": "^5.9.3",
38
+ "vitest": "^5.0.5"
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "git+https://github.com/sonqh/spec-ctx.git"
43
+ },
44
+ "homepage": "https://github.com/sonqh/spec-ctx#readme",
45
+ "keywords": [
46
+ "openspec",
47
+ "spec-driven",
48
+ "ai-agents",
49
+ "context",
50
+ "cli"
51
+ ]
52
+ }
@@ -0,0 +1,18 @@
1
+ # spec-driven-ids
2
+
3
+ A fork of the OpenSpec `spec-driven` schema. It adds stable IDs from spec-ctx to every artifact.
4
+
5
+ - The spec template starts each requirement with `REQ-<CAP>-NNN` and each scenario with `SCN-<CAP>-NNN-<n>`.
6
+ - The instructions tell the agent to get IDs from `specctx id new` and to link IDs with `Refs:` lines.
7
+ - The tasks template cites REQ IDs and puts the `Verify:` command in a code span, so `specctx task done` can run it.
8
+ - `config-fragment.yaml` holds the `rules` and `operations` that `specctx init --schema` adds to `openspec/config.yaml`.
9
+
10
+ Forked from OpenSpec 1.14.3 with `openspec schema fork spec-driven spec-driven-ids`. CI validates it against that version.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ npx spec-ctx init --schema
16
+ ```
17
+
18
+ The command copies this folder to `openspec/schemas/spec-driven-ids/` and sets `schema: spec-driven-ids` in `openspec/config.yaml`.
@@ -0,0 +1,25 @@
1
+ # spec-ctx fragment for openspec/config.yaml. specctx init --schema adds each top-level key
2
+ # that the project config does not have yet. It never changes a key that exists.
3
+ rules:
4
+ specs:
5
+ - Every requirement header starts with its ID, e.g. "### Requirement: REQ-ABC-001 Name". Get the ID from `specctx id new REQ ABC`.
6
+ - Every scenario header starts with its ID, e.g. "#### Scenario: SCN-ABC-001-1 Name".
7
+ - A requirement may end with a line "Refs: REQ-ABC-002, ADR-001" to link related IDs.
8
+ - Requirement text stays under 500 characters. Move detail into scenarios.
9
+ design:
10
+ - Each decision is one bullet under "## Decisions". Add new decisions at the end.
11
+ tasks:
12
+ - Every task cites at least one REQ ID in square brackets, e.g. "[REQ-ABC-001]".
13
+ - Every task states its verification as a command in a code span after "Verify:".
14
+
15
+ operations:
16
+ apply:
17
+ guidance:
18
+ - Start each task with `specctx task start <id>` and read the bundle it prints before you read specs.
19
+ - Tag code with the REQ ID it implements (a comment `// REQ-ABC-001`). Tag tests with `// Covers: REQ-ABC-001`.
20
+ - Close each task with `specctx task done <id>`. Never tick a checkbox by hand.
21
+ - Run `specctx check --strict` after each task group.
22
+ archive:
23
+ guidance:
24
+ - Run `specctx check --strict` and `openspec validate --all --strict`. Both must pass before archive.
25
+ - Run `openspec validate --all --strict` again after archive and before push.
@@ -0,0 +1,301 @@
1
+ name: spec-driven-ids
2
+ version: 1
3
+ description: OpenSpec spec-driven workflow with stable IDs from spec-ctx - proposal → specs → design → tasks
4
+ artifacts:
5
+ - id: proposal
6
+ generates: proposal.md
7
+ description: Initial proposal document outlining the change
8
+ template: proposal.md
9
+ instruction: |
10
+ Create the proposal document that establishes WHY this change is needed.
11
+
12
+ Sections:
13
+ - **Why**: 1-2 sentences on the problem or opportunity. What problem does this solve? Why now?
14
+ - **What Changes**: Bullet list of changes. Be specific about new capabilities, modifications, or removals. Mark breaking changes with **BREAKING**.
15
+ - **Capabilities**: Identify which specs will be created or modified:
16
+ - **New Capabilities**: List capabilities being introduced. Each becomes a new `specs/<capability-path>/spec.md`. Name each capability for a durable system behavior (for example, `user-auth`), not the work in this change (for example, `add-login-endpoint`). Choose a cohesive boundary that can own related requirements as the system evolves; avoid broad catch-all capabilities. Use kebab-case for path segments you introduce (e.g., `user-auth` or `identity/user-auth`) and follow the project's existing spec organization.
17
+ - **Modified Capabilities**: List existing capabilities whose REQUIREMENTS are changing. Only include if spec-level behavior changes (not just implementation details). Each needs a delta spec file. Use the exact existing path under `openspec/specs/`. Leave empty if no requirement changes.
18
+ - **Impact**: Affected code, APIs, dependencies, or systems.
19
+
20
+ IMPORTANT: The Capabilities section is critical. It creates the contract between
21
+ proposal and specs phases. Research existing specs before filling this in:
22
+ run `openspec list --specs` for the project's capability inventory, then
23
+ `openspec show "<spec-id>" --type spec --json --no-scenarios` for any that
24
+ look related - that returns a capability's purpose and requirement texts
25
+ without pulling whole spec files into context. Append `--store "<id>"` to
26
+ both commands only for a registered standalone store, and keep `--type
27
+ spec`: a change and a spec sharing a name is otherwise an ambiguous-item
28
+ error. `openspec list` without `--specs` lists in-flight changes, not
29
+ specs - it never shows what the project already covers. Reuse an existing
30
+ capability's exact path instead of introducing a near-duplicate name.
31
+ The filtered read is only an overview. Before deciding what is already
32
+ covered or what should change, read each relevant spec in full, including
33
+ scenarios, with `openspec show "<spec-id>" --type spec` (same `--store` rule).
34
+ Each capability listed here will need a corresponding spec file.
35
+
36
+ Every change must either declare at least one capability (new or
37
+ modified) or explicitly opt out of specs: `openspec validate` rejects a
38
+ change with zero deltas unless the change's `.openspec.yaml` sets
39
+ `skip_specs: true`. Use `skip_specs: true` only when no spec-level
40
+ behavior changes (pure refactor, tooling, docs) - specs describe
41
+ behavior, so if behavior does not change, no spec should change either.
42
+ Do not invent a requirement just to satisfy validation.
43
+
44
+ Keep it concise (1-2 pages). Focus on the "why" not the "how" -
45
+ implementation details belong in design.md.
46
+
47
+ This is the foundation - specs, design, and tasks all build on this.
48
+ requires: []
49
+
50
+ - id: specs
51
+ generates: "specs/**/*.md"
52
+ description: Detailed specifications for the change
53
+ template: spec.md
54
+ instruction: |
55
+ Create specification files that define WHAT the system should do.
56
+
57
+ A spec is a behavior contract, not an implementation plan.
58
+
59
+ Good spec content:
60
+ - Observable behavior users or downstream systems rely on
61
+ - Inputs, outputs, and error conditions
62
+ - External constraints (security, privacy, reliability, compatibility)
63
+ - Scenarios that can be tested or explicitly validated
64
+
65
+ Avoid in specs:
66
+ - Internal class/function names
67
+ - Library or framework choices
68
+ - Step-by-step implementation details
69
+ - Detailed execution plans (those belong in design.md or tasks.md)
70
+
71
+ Quick test: if the implementation can change without changing externally
72
+ visible behavior, it likely does not belong in the spec.
73
+
74
+ Create one spec file per capability listed in the proposal's Capabilities section.
75
+ `<capability-path>` is the spec directory relative to `specs/` (for example,
76
+ `user-auth` or `identity/user-auth`). Preserve the full path:
77
+ - New capabilities: use the exact path from the proposal at `specs/<capability-path>/spec.md`. Any path segment newly introduced in the proposal must be kebab-case. Follow the project's existing organization; do not add a new domain level when the project uses a flat layout.
78
+ - Modified capabilities: use the exact existing path from `openspec/specs/<capability-path>/` when creating the delta at `specs/<capability-path>/spec.md`. Run `openspec list --specs` to confirm that path before writing the delta, appending `--store "<id>"` only for a registered standalone store - a mistyped or invented path targets a capability that does not exist rather than the one you meant. Do not move or rename the capability.
79
+
80
+ Write the spec files one at a time, so the user sees progress and an
81
+ interrupted run keeps the files it already wrote:
82
+ - Before writing anything, compare the capabilities the proposal lists
83
+ with the `specs/<capability-path>/spec.md` files that already exist,
84
+ and start with the first capability that has no file. Do not rewrite
85
+ an existing file unless the user asks you to.
86
+ - Before each file, say in one line which capability you are writing.
87
+ - Write each file as soon as you have drafted it. Do not plan every file
88
+ before writing the first.
89
+ - Stop when every capability the proposal lists has its file.
90
+
91
+ There must be at least one spec file unless the change's `.openspec.yaml`
92
+ sets `skip_specs: true` (no spec-level behavior change) - `openspec validate`
93
+ rejects a zero-delta change without that marker. If the proposal lists no
94
+ capabilities and `skip_specs` is not set, revisit the proposal first.
95
+
96
+ Delta operations (use ## headers):
97
+ - **ADDED Requirements**: New capabilities
98
+ - **MODIFIED Requirements**: Changed behavior - MUST include full updated content
99
+ - **REMOVED Requirements**: Deprecated features - MUST include **Reason** and **Migration**
100
+ - **RENAMED Requirements**: Name changes only - use FROM:/TO: format
101
+
102
+ Format requirements:
103
+ - Each requirement: `### Requirement: <name>` followed by description
104
+ - Use SHALL/MUST for normative requirements (avoid should/may)
105
+ - Each scenario: `#### Scenario: <name>` with WHEN/THEN format
106
+ - **CRITICAL**: Scenarios MUST use exactly 4 hashtags (`####`). Using 3 hashtags or bullets will fail silently.
107
+ - Every requirement MUST have at least one scenario.
108
+ - Keep each requirement's description (the text between `### Requirement:` and its first scenario) to 500 characters or fewer. `openspec validate` flags longer descriptions in ADDED requirements and in the main spec. This is a warning: normal validation still passes, but `openspec validate --strict` fails on it. When writing a new requirement, state one behavior per requirement: move examples and edge cases into scenarios, and split a requirement that covers several behaviors into separate `### Requirement:` blocks, each with its own scenarios. Under MODIFIED, keep the existing requirement block whole; never split, trim or rewrite existing text just to meet the length. Split an existing long requirement only when the user asks for it, in a change made for that purpose: under MODIFIED, keep its header and every scenario and cut its description down to one behavior without changing its meaning, then add each behavior you removed as its own ADDED requirement with its own scenarios.
109
+
110
+ New capabilities only: the delta spec's first section is `## Purpose` -
111
+ one or two sentences (50+ characters, or `openspec validate --strict`
112
+ reports it as too brief) describing what the capability is for. Archive
113
+ copies it into the main spec it creates; without it the new main spec is
114
+ left with a `TBD ... Update Purpose after archive` placeholder to fill in
115
+ by hand. Do NOT add `## Purpose` to a delta for an existing capability -
116
+ that spec already has one and the delta's is ignored. To change an
117
+ existing capability's Purpose - including a leftover `TBD` placeholder -
118
+ edit `<planningHome.root>/openspec/specs/<capability-path>/spec.md`
119
+ directly. `planningHome.root` comes from the `openspec instructions ...
120
+ --json` response. Always use it rather than a repo-relative path: it
121
+ resolves to the store whenever the change lives in one - whether that
122
+ came from `--store`, a project `store:` pointer, or a global default
123
+ store - and to the current repository otherwise. Do not try to work out
124
+ which case applies; the field already has.
125
+
126
+ MODIFIED requirements workflow:
127
+ 1. Locate the existing requirement in `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (the same store-aware root as above)
128
+ 2. Copy the ENTIRE requirement block (from `### Requirement:` through all scenarios)
129
+ 3. Paste under `## MODIFIED Requirements` and edit to reflect new behavior
130
+ 4. Ensure header text matches exactly (whitespace-insensitive)
131
+
132
+ Common pitfall: Using MODIFIED with partial content loses detail at archive time.
133
+ If adding new concerns without changing existing behavior, use ADDED instead.
134
+
135
+ Example (a new capability, so its first section is `## Purpose`):
136
+ ```
137
+ # Spec Delta
138
+
139
+ ## Purpose
140
+
141
+ Lets users take their data out of the product in a portable format.
142
+
143
+ ## ADDED Requirements
144
+
145
+ ### Requirement: User can export data
146
+ The system SHALL allow users to export their data in CSV format.
147
+
148
+ #### Scenario: Successful export
149
+ - **WHEN** user clicks "Export" button
150
+ - **THEN** system downloads a CSV file with all user data
151
+
152
+ ## REMOVED Requirements
153
+
154
+ ### Requirement: Legacy export
155
+ **Reason**: Replaced by new export system
156
+ **Migration**: Use new export endpoint at /api/v2/export
157
+ ```
158
+
159
+
160
+ Stable IDs (spec-ctx):
161
+ - Every requirement header starts with an ID: `### Requirement: REQ-<CAP>-NNN <name>`.
162
+ Get a new ID from `specctx id new REQ <CAP>`. Never count numbers by hand.
163
+ `<CAP>` is a capability code from `[ids] caps` in `spec-ctx.toml`.
164
+ - Every scenario header starts with an ID: `#### Scenario: SCN-<CAP>-NNN-<n> <name>`.
165
+ Get it from `specctx id new SCN <CAP> --for REQ-<CAP>-NNN`.
166
+ - Under MODIFIED, REMOVED, or RENAMED, keep the existing ID. An ID never changes.
167
+ - Link related IDs with one line `Refs: ID, ID` after the requirement text.
168
+ - Replace every placeholder of the template. `specctx check` reports a header with
169
+ no ID as `missing-id`.
170
+
171
+ Specs should be testable - each scenario is a potential test case.
172
+ requires:
173
+ - proposal
174
+
175
+ - id: design
176
+ generates: design.md
177
+ description: Technical design document with implementation details
178
+ template: design.md
179
+ instruction: |
180
+ Create the design document that explains HOW to implement the change.
181
+
182
+ When to include design.md (create only if any apply):
183
+ - Cross-cutting change (multiple services/modules) or new architectural pattern
184
+ - New external dependency or significant data model changes
185
+ - Security, performance, or migration complexity
186
+ - Ambiguity that benefits from technical decisions before coding
187
+
188
+ Sections:
189
+ - **Context**: Only the current state and constraints needed to explain the approach. Reference the proposal for motivation instead of restating it (e.g., "See proposal.md - Why").
190
+ - **Goals / Non-Goals**: What this design achieves and explicitly excludes. Don't restate the proposal's scope - add only design-level boundaries.
191
+ - **Decisions**: Key technical choices with rationale (why X over Y?). Include alternatives considered for each decision.
192
+ - **Risks / Trade-offs**: Known limitations, things that could go wrong. Format: [Risk] → Mitigation
193
+ - **Migration Plan**: Steps to deploy, rollback strategy (if applicable)
194
+ - **Open Questions**: Unknowns that can safely be answered later without
195
+ changing the specs, the approach, or the task breakdown. Omit if none.
196
+
197
+ Open questions are for genuinely deferrable unknowns, not decisions you
198
+ skipped. If a question would change the specs, the chosen approach, or
199
+ the task breakdown, resolve it now - ask the user instead of guessing.
200
+
201
+ Focus on architecture and approach, not line-by-line implementation.
202
+ The proposal covers why and what; design covers how. Reference the
203
+ proposal for motivation and, once written, the specs for requirements -
204
+ if a section would only restate them, point to them instead.
205
+
206
+
207
+ Stable IDs (spec-ctx):
208
+ - Each bullet under `## Decisions` is one decision. Its ID is `<change number>/D<n>`
209
+ by position, so add new decisions at the end and never reorder them.
210
+ - End a decision with `Refs: ` and the REQ or ADR IDs it serves. Then `specctx bundle`
211
+ prints the decision with those requirements.
212
+
213
+ Good design docs explain the "why" behind technical decisions.
214
+ requires:
215
+ - proposal
216
+
217
+ - id: tasks
218
+ generates: tasks.md
219
+ description: Implementation checklist with trackable tasks
220
+ template: tasks.md
221
+ instruction: |
222
+ Create the task list that breaks down the implementation work.
223
+
224
+ Before writing tasks, check design.md for Open Questions. If any of them
225
+ would change what gets built, resolve them with the user first - do not
226
+ bake an unstated assumption into the task list.
227
+
228
+ **IMPORTANT: Follow the template below for tracked tasks.** The apply phase parses
229
+ checkbox format to track progress. A box holding only `x` counts as done,
230
+ upper or lower case and with any spacing, so `- [ x]` is done too. Every
231
+ other marker, including `- [~]`, `- [-]` and an empty `- []`, reads as
232
+ unfinished. A line with no checkbox is not tracked at all.
233
+
234
+ Guidelines:
235
+ - Group related tracked tasks under ## numbered headings
236
+ - Each tracked task MUST be a checkbox: `- [ ] X.Y Task description`
237
+ - Tasks should be small enough to complete in one session
238
+ - Order tasks by dependency (what must be done first?)
239
+ - Track implementation and verification work that can be completed before
240
+ archive. If the requested workflow includes archive or work that requires
241
+ this change to be archived, preserve those steps as plain bullets in an
242
+ optional `## Workflow follow-up` section at the end of tasks.md. These
243
+ bullets are reference information outside tracked task progress.
244
+ - Each task MUST state how to verify completion (a test, command,
245
+ observable behavior, or delivered artifact). Put the verification in
246
+ that task's checkbox description. Use a separate verification task only
247
+ when it checks broader integration or system behavior that spans
248
+ multiple implementation tasks.
249
+ - Each task group MUST land the tests and documentation its own work
250
+ calls for. Do NOT collect testing or documentation into a final group -
251
+ when a late group first exercises work from an early one, the failures
252
+ cascade back through every group in between and force rework. A group
253
+ whose work calls for neither, such as scaffolding or dependency setup,
254
+ carries neither. A final group is for integration checks only, not for
255
+ the tests and docs an earlier group owed.
256
+
257
+ Example:
258
+ ```
259
+ # Tasks
260
+
261
+ ## 1. Setup
262
+
263
+ - [ ] 1.1 Create new module structure and verify expected files are present
264
+ - [ ] 1.2 Add dependencies to package.json and verify package installation succeeds
265
+
266
+ ## 2. Core Implementation
267
+
268
+ - [ ] 2.1 Implement data export function and verify the export test passes
269
+ - [ ] 2.2 Add CSV formatting utilities and verify unit tests cover quoting and delimiters
270
+ - [ ] 2.3 Document the export API in docs/export.md and verify the documented command runs as written
271
+ ```
272
+
273
+ When applicable, append workflow follow-up as plain bullets, for example:
274
+ ```
275
+ ## Workflow follow-up
276
+
277
+ - Archive the change after the project's review requirements are satisfied.
278
+ - Verify the archived result.
279
+ ```
280
+
281
+
282
+ Stable IDs and Verify (spec-ctx):
283
+ - Every task cites at least one requirement in square brackets: `[REQ-<CAP>-NNN]`.
284
+ - Every task ends with `Verify:` and the command in a code span, for example
285
+ ``Verify: `npm test -- tests/export.test.ts` ``. Two spans run joined with `&&`.
286
+ - Use prose after `Verify:` only when no command can check the work. Then
287
+ `specctx task done <id> --manual "<note>"` records it.
288
+ - Close a task only with `specctx task done <id>`. It runs the command, writes
289
+ evidence under `.ctx/evidence/`, and sets the checkbox.
290
+
291
+ Reference specs for what needs to be built, design for how to build it.
292
+ requires:
293
+ - specs
294
+ - design
295
+
296
+ apply:
297
+ requires: [ tasks ]
298
+ tracks: tasks.md
299
+ instruction: |
300
+ Read context files, work through pending tasks, mark complete as you go.
301
+ Pause if you hit blockers or need clarification.
@@ -0,0 +1,22 @@
1
+ # Design
2
+
3
+ ## Context
4
+
5
+ <!-- The current state and the constraints that shape the approach. The proposal holds the motivation. -->
6
+
7
+ ## Goals / Non-Goals
8
+
9
+ **Goals:**
10
+ <!-- What this design gives -->
11
+
12
+ **Non-Goals:**
13
+ <!-- What stays out of scope -->
14
+
15
+ ## Decisions
16
+
17
+ <!-- One bullet per decision. The ID of a decision is <change number>/D<n> by position. Add new ones at the end. -->
18
+ - <!-- The decision, the alternative, and why. --> Refs: <!-- REQ-<CAP>-NNN, ADR-NNN -->
19
+
20
+ ## Risks / Trade-offs
21
+
22
+ <!-- Known risks and the mitigation for each -->
@@ -0,0 +1,34 @@
1
+ # Proposal
2
+
3
+ ## Why
4
+
5
+ <!-- Explain the motivation for this change. What problem does this solve? Why now? -->
6
+
7
+ ## What Changes
8
+
9
+ <!-- Describe what will change. Be specific about new capabilities, modifications, or removals. -->
10
+
11
+ ## Capabilities
12
+
13
+ ### New Capabilities
14
+ <!-- Capabilities being introduced. Name each capability for a cohesive system
15
+ behavior that can own related requirements as the system evolves. Do not name
16
+ implementation tasks or proposal sections. Avoid broad catch-all names. Use
17
+ kebab-case for path segments you introduce (e.g., user-auth or identity/user-auth)
18
+ that follow the project's existing spec organization. Each creates
19
+ specs/<capability-path>/spec.md. -->
20
+ - `<capability-path>`: <brief description of what this capability covers>
21
+
22
+ ### Modified Capabilities
23
+ <!-- Existing capabilities whose REQUIREMENTS are changing (not just implementation).
24
+ Only list here if spec-level behavior changes. Each needs a delta spec file.
25
+ Use the exact existing path under openspec/specs/. Leave empty if no requirement
26
+ changes. A change with no capabilities at all (pure refactor, tooling, docs)
27
+ must set `skip_specs: true` in its .openspec.yaml - openspec validate rejects
28
+ a zero-delta change without that marker. Do not invent a requirement just to
29
+ satisfy validation. -->
30
+ - `<existing-capability-path>`: <what requirement is changing>
31
+
32
+ ## Impact
33
+
34
+ <!-- Affected code, APIs, dependencies, systems -->
@@ -0,0 +1,15 @@
1
+ # Spec Delta
2
+
3
+ ## Purpose
4
+ <!-- New capability only. Write one or two sentences of 50 characters or more. Delete this section for an existing capability. -->
5
+
6
+ ## ADDED Requirements
7
+
8
+ ### Requirement: REQ-<CAP>-NNN <!-- requirement name -->
9
+ <!-- Requirement text. Replace REQ-<CAP>-NNN with the output of `specctx id new REQ <CAP>`. -->
10
+
11
+ Refs: <!-- related IDs such as ADR-001. Delete this line when there are none. -->
12
+
13
+ #### Scenario: SCN-<CAP>-NNN-1 <!-- scenario name. Get the ID from `specctx id new SCN <CAP> --for REQ-<CAP>-NNN`. -->
14
+ - **WHEN** <!-- condition -->
15
+ - **THEN** <!-- expected outcome -->
@@ -0,0 +1,10 @@
1
+ # Tasks
2
+
3
+ ## 1. <!-- Task group name -->
4
+
5
+ - [ ] 1.1 <!-- Task description --> [REQ-<CAP>-NNN] Verify: `<!-- command -->`
6
+ - [ ] 1.2 <!-- Task description --> [REQ-<CAP>-NNN] Verify: `<!-- command -->`
7
+
8
+ ## 2. <!-- Task group name -->
9
+
10
+ - [ ] 2.1 <!-- Task description --> [REQ-<CAP>-NNN] Verify: `<!-- command -->`
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: specctx-bootstrap
3
+ description: Start a session in an OpenSpec project that uses spec-ctx. Use at the start of every session, and on "start", "bootstrap", or "what should I work on". Loads only the spec text that the next task needs.
4
+ ---
5
+
6
+ # specctx-bootstrap
7
+
8
+ Load the minimum context for one task. Run `specctx` as `npx spec-ctx` when it is not installed.
9
+
10
+ ## Steps
11
+
12
+ 1. Run `specctx status`. It rebuilds a stale index first. Note the active change, the current task, and the count of open questions. The last line `next: <step>` names the next step. Exit 2 with `not an OpenSpec project` means the folder has no `openspec/`. Tell the user to run `npx -y @fission-ai/openspec@latest init` and stop.
13
+ 2. Read `.ctx/handoff.md` if it exists. Note `current`, `reopened`, and `open_questions`.
14
+ 3. If `status` prints `no active change`, show the open questions to the user. Ask which change to start. Stop here.
15
+ 4. Pick the task. Use `current` from the handoff, then the user's message, then the output of `specctx task next`.
16
+ 5. Run `specctx task start <task>`. It prints the bundle for the REQ IDs of the task and sets the current task.
17
+ 6. Read the bundle. Each block starts with `-- <id> | <file>:<line> | <status> | <reason>`. A `modified` block is the pending text of an active change. Trust it over the main spec.
18
+ 7. If the bundle ends with `truncated: N entries omitted: <ids>`, run `specctx bundle <id>` for each ID that the task needs.
19
+ 8. Say in one line which task you are on and which IDs you loaded. Then start the work.
20
+
21
+ ## Rules
22
+
23
+ - Do not open `openspec/specs/` or `openspec/changes/*/specs/` by hand. Use `specctx bundle` or `specctx task start`.
24
+ - Read at most 10,000 characters of spec text before the first code edit.
25
+ - Tag code with `// REQ-ABC-001` and tests with `// Covers: REQ-ABC-001`.
26
+ - Get a new ID from `specctx id new REQ <CAP>`. Never count numbers by hand.
27
+ - Close the task with the `specctx-done` skill.
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: specctx-done
3
+ description: Close a task in an OpenSpec project that uses spec-ctx. Runs the Verify command, writes evidence, sets the checkbox, writes the handoff, and shows the metrics. Use when the work of a task is complete, or on "done", "close the task", and "end the session".
4
+ ---
5
+
6
+ # specctx-done
7
+
8
+ Close the current task with evidence. Run `specctx` as `npx spec-ctx` when it is not installed.
9
+
10
+ ## Steps
11
+
12
+ 1. Run `specctx task done <task>`. It runs the `Verify:` command of the task in the project root.
13
+ 2. On exit 0 it writes `.ctx/evidence/<change>/<task>.json` and sets `[x]` on the task line. Nothing else in `tasks.md` changes.
14
+ 3. On a failure it prints the last 20 lines of output and exits 1. The task stays open. Fix the cause and run step 1 again.
15
+ 4. If the task has prose after `Verify:` and no command, run `specctx task done <task> --manual "<what you checked>"`.
16
+ 5. After the last task of a group, run `specctx check --strict`. Fix every finding before the next group.
17
+ 6. Run `specctx handoff write`. It writes `.ctx/handoff.md` from the index, the evidence, and the open questions.
18
+ 7. Run `specctx stats --change <change>`. Report the five metrics of the change in one line each.
19
+ 8. Commit the work together with `.ctx/`. Leave `.ctx/index.json` out of git.
20
+
21
+ ## Rules
22
+
23
+ - Never tick a checkbox by hand. `check --strict` reports a ticked task with no evidence as `done-without-evidence`.
24
+ - If a spec changed after you closed a task, run `specctx task reopen <task> "<reason>"`.
25
+ - To leave a question for the next session, run `specctx handoff ask "<question>"` before step 6.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: specctx-next
3
+ description: Pick and start the next task in the middle of a session in an OpenSpec project that uses spec-ctx. Use after you close a task, or on "next task" and "what is next".
4
+ ---
5
+
6
+ # specctx-next
7
+
8
+ Move to the next open task. Run `specctx` as `npx spec-ctx` when it is not installed.
9
+
10
+ ## Steps
11
+
12
+ 1. Run `specctx task next`. It prints the task ID and text, then `reqs:` and `verify:`.
13
+ 2. If it prints `no open task. Every task in the active changes is done. Next: archive <change>.`, every task of the active changes has its checkbox set. Run `specctx status`. Its last line is `next: archive <change>`. Tell the user that the change is ready for `specctx check --strict` and archive. Stop here.
14
+ 3. Run `specctx task start <task>`. It prints the bundle for the REQ IDs of the task and sets the current task in `.ctx/current.json`.
15
+ 4. Read the bundle. Request an omitted ID with `specctx bundle <id>` only when the task needs it.
16
+ 5. Run `specctx task verify <task>` once before the work. It runs the `Verify:` command and writes nothing. A failure now shows what the work must fix.
17
+ 6. Say in one line which task you are on. Then start the work.
18
+
19
+ ## Rules
20
+
21
+ - Take the tasks in the order that `specctx task next` gives. Earlier tasks in a group come first.
22
+ - A question that blocks you goes to `specctx handoff ask "<question>"`. Then continue with what you can do.
23
+ - Close the task with the `specctx-done` skill.