clawspec 1.0.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 (71) hide show
  1. package/README.md +908 -0
  2. package/README.zh-CN.md +914 -0
  3. package/index.ts +3 -0
  4. package/openclaw.plugin.json +129 -0
  5. package/package.json +52 -0
  6. package/skills/openspec-apply-change.md +146 -0
  7. package/skills/openspec-explore.md +75 -0
  8. package/skills/openspec-propose.md +102 -0
  9. package/src/acp/client.ts +693 -0
  10. package/src/config.ts +220 -0
  11. package/src/control/keywords.ts +72 -0
  12. package/src/dependencies/acpx.ts +221 -0
  13. package/src/dependencies/openspec.ts +148 -0
  14. package/src/execution/session.ts +56 -0
  15. package/src/execution/state.ts +125 -0
  16. package/src/index.ts +179 -0
  17. package/src/memory/store.ts +118 -0
  18. package/src/openspec/cli.ts +279 -0
  19. package/src/openspec/tasks.ts +40 -0
  20. package/src/orchestrator/helpers.ts +312 -0
  21. package/src/orchestrator/service.ts +2971 -0
  22. package/src/planning/journal.ts +118 -0
  23. package/src/rollback/store.ts +173 -0
  24. package/src/state/locks.ts +133 -0
  25. package/src/state/store.ts +527 -0
  26. package/src/types.ts +301 -0
  27. package/src/utils/args.ts +88 -0
  28. package/src/utils/channel-key.ts +66 -0
  29. package/src/utils/env-path.ts +31 -0
  30. package/src/utils/fs.ts +218 -0
  31. package/src/utils/markdown.ts +136 -0
  32. package/src/utils/messages.ts +5 -0
  33. package/src/utils/paths.ts +127 -0
  34. package/src/utils/shell-command.ts +227 -0
  35. package/src/utils/slug.ts +50 -0
  36. package/src/watchers/manager.ts +3042 -0
  37. package/src/watchers/notifier.ts +69 -0
  38. package/src/worker/prompts.ts +484 -0
  39. package/src/worker/skills.ts +52 -0
  40. package/src/workspace/store.ts +140 -0
  41. package/test/acp-client.test.ts +234 -0
  42. package/test/acpx-dependency.test.ts +112 -0
  43. package/test/assistant-journal.test.ts +136 -0
  44. package/test/command-surface.test.ts +23 -0
  45. package/test/config.test.ts +77 -0
  46. package/test/detach-attach.test.ts +98 -0
  47. package/test/file-lock.test.ts +78 -0
  48. package/test/fs-utils.test.ts +22 -0
  49. package/test/helpers/harness.ts +241 -0
  50. package/test/helpers.test.ts +108 -0
  51. package/test/keywords.test.ts +80 -0
  52. package/test/notifier.test.ts +29 -0
  53. package/test/openspec-dependency.test.ts +67 -0
  54. package/test/pause-cancel.test.ts +55 -0
  55. package/test/planning-journal.test.ts +69 -0
  56. package/test/plugin-registration.test.ts +35 -0
  57. package/test/project-memory.test.ts +42 -0
  58. package/test/proposal.test.ts +24 -0
  59. package/test/queue-planning.test.ts +247 -0
  60. package/test/queue-work.test.ts +110 -0
  61. package/test/recovery.test.ts +576 -0
  62. package/test/service-archive.test.ts +82 -0
  63. package/test/shell-command.test.ts +48 -0
  64. package/test/state-store.test.ts +74 -0
  65. package/test/tasks-and-checkpoint.test.ts +60 -0
  66. package/test/use-project.test.ts +19 -0
  67. package/test/watcher-planning.test.ts +504 -0
  68. package/test/watcher-work.test.ts +1741 -0
  69. package/test/worker-command.test.ts +66 -0
  70. package/test/worker-skills.test.ts +12 -0
  71. package/tsconfig.json +25 -0
package/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ import plugin from "./src/index.ts";
2
+
3
+ export default plugin;
@@ -0,0 +1,129 @@
1
+ {
2
+ "id": "clawspec",
3
+ "name": "ClawSpec",
4
+ "description": "OpenSpec-aware project orchestration for OpenClaw channels",
5
+ "configSchema": {
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "enabled": {
10
+ "type": "boolean",
11
+ "description": "Enable or disable the ClawSpec plugin"
12
+ },
13
+ "allowedChannels": {
14
+ "type": "array",
15
+ "description": "Optional list of channel ids allowed to use /clawspec",
16
+ "items": {
17
+ "type": "string"
18
+ }
19
+ },
20
+ "maxAutoContinueTurns": {
21
+ "type": "integer",
22
+ "minimum": 1,
23
+ "maximum": 50,
24
+ "description": "Deprecated no-op retained for backward compatibility with older configs"
25
+ },
26
+ "maxNoProgressTurns": {
27
+ "type": "integer",
28
+ "minimum": 1,
29
+ "maximum": 10,
30
+ "description": "Deprecated no-op retained for backward compatibility with older configs"
31
+ },
32
+ "openSpecTimeoutMs": {
33
+ "type": "integer",
34
+ "minimum": 5000,
35
+ "maximum": 600000,
36
+ "description": "Timeout in milliseconds for each OpenSpec CLI invocation"
37
+ },
38
+ "workerWaitTimeoutMs": {
39
+ "type": "integer",
40
+ "minimum": 10000,
41
+ "maximum": 3600000,
42
+ "description": "Deprecated no-op retained for backward compatibility with older configs"
43
+ },
44
+ "workerAgentId": {
45
+ "type": "string",
46
+ "description": "ACP agent id used for background planning and implementation"
47
+ },
48
+ "workerBackendId": {
49
+ "type": "string",
50
+ "description": "Optional ACP backend id used for background worker sessions"
51
+ },
52
+ "watcherPollIntervalMs": {
53
+ "type": "integer",
54
+ "minimum": 1000,
55
+ "maximum": 60000,
56
+ "description": "Background watcher recovery poll interval in milliseconds"
57
+ },
58
+ "subagentLane": {
59
+ "type": "string",
60
+ "description": "Deprecated no-op retained for backward compatibility with older configs"
61
+ },
62
+ "archiveDirName": {
63
+ "type": "string",
64
+ "description": "Directory name used under .openclaw/clawspec/ for archived runs"
65
+ },
66
+ "defaultWorkspace": {
67
+ "type": "string",
68
+ "description": "Base directory used for default project browsing and relative /clawspec path inputs"
69
+ }
70
+ }
71
+ },
72
+ "uiHints": {
73
+ "enabled": {
74
+ "label": "Enable ClawSpec",
75
+ "help": "Enable or disable the ClawSpec plugin"
76
+ },
77
+ "allowedChannels": {
78
+ "label": "Allowed Channels",
79
+ "help": "Optional list of channel ids allowed to use /clawspec"
80
+ },
81
+ "maxAutoContinueTurns": {
82
+ "label": "Deprecated Auto Turns",
83
+ "help": "Deprecated no-op retained for backward compatibility"
84
+ },
85
+ "maxNoProgressTurns": {
86
+ "label": "Deprecated No Progress",
87
+ "help": "Deprecated no-op retained for backward compatibility"
88
+ },
89
+ "openSpecTimeoutMs": {
90
+ "label": "OpenSpec Timeout",
91
+ "help": "Timeout in milliseconds for each OpenSpec command",
92
+ "advanced": true
93
+ },
94
+ "workerWaitTimeoutMs": {
95
+ "label": "Deprecated Worker Timeout",
96
+ "help": "Deprecated no-op retained for backward compatibility",
97
+ "advanced": true
98
+ },
99
+ "workerAgentId": {
100
+ "label": "Worker Agent",
101
+ "help": "ACP agent id used for background planning and implementation turns",
102
+ "advanced": true
103
+ },
104
+ "workerBackendId": {
105
+ "label": "Worker ACP Backend",
106
+ "help": "Optional ACP backend id used for background worker sessions",
107
+ "advanced": true
108
+ },
109
+ "watcherPollIntervalMs": {
110
+ "label": "Watcher Poll Interval",
111
+ "help": "Background watcher recovery poll interval in milliseconds",
112
+ "advanced": true
113
+ },
114
+ "subagentLane": {
115
+ "label": "Deprecated Lane Hint",
116
+ "help": "Deprecated no-op retained for backward compatibility",
117
+ "advanced": true
118
+ },
119
+ "archiveDirName": {
120
+ "label": "Archive Folder",
121
+ "help": "Directory name used for archived run bundles",
122
+ "advanced": true
123
+ },
124
+ "defaultWorkspace": {
125
+ "label": "Default Workspace",
126
+ "help": "Base directory used for `/clawspec workspace` and `/clawspec use`"
127
+ }
128
+ }
129
+ }
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "clawspec",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "OpenClaw plugin that orchestrates OpenSpec project workflows with visible main-agent execution.",
6
+ "keywords": [
7
+ "openclaw",
8
+ "openspec",
9
+ "plugin",
10
+ "project-orchestration",
11
+ "agent"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/bytegh/clawspec.git"
16
+ },
17
+ "homepage": "https://github.com/bytegh/clawspec#readme",
18
+ "bugs": {
19
+ "url": "https://github.com/bytegh/clawspec/issues"
20
+ },
21
+ "license": "MIT",
22
+ "files": [
23
+ "index.ts",
24
+ "src",
25
+ "skills",
26
+ "test",
27
+ "README.md",
28
+ "README.zh-CN.md",
29
+ "openclaw.plugin.json",
30
+ "tsconfig.json"
31
+ ],
32
+ "openclaw": {
33
+ "extensions": [
34
+ "./index.ts"
35
+ ]
36
+ },
37
+ "peerDependencies": {
38
+ "openclaw": ">=0.0.0"
39
+ },
40
+ "devDependencies": {
41
+ "openclaw": "2026.3.24"
42
+ },
43
+ "scripts": {
44
+ "check": "node --experimental-strip-types -e \"import('./index.ts')\"",
45
+ "test": "node --experimental-strip-types --test --test-reporter spec test/*.test.ts",
46
+ "test:fast": "node --experimental-strip-types --test --test-reporter spec test/acp-client.test.ts test/acpx-dependency.test.ts test/assistant-journal.test.ts test/command-surface.test.ts test/config.test.ts test/detach-attach.test.ts test/file-lock.test.ts test/fs-utils.test.ts test/helpers.test.ts test/keywords.test.ts test/notifier.test.ts test/openspec-dependency.test.ts test/pause-cancel.test.ts test/planning-journal.test.ts test/plugin-registration.test.ts test/project-memory.test.ts test/proposal.test.ts test/queue-planning.test.ts test/queue-work.test.ts test/service-archive.test.ts test/shell-command.test.ts test/state-store.test.ts test/tasks-and-checkpoint.test.ts test/use-project.test.ts test/worker-command.test.ts test/worker-skills.test.ts",
47
+ "test:slow": "node --experimental-strip-types --test --test-reporter spec test/watcher-planning.test.ts test/watcher-work.test.ts test/recovery.test.ts"
48
+ },
49
+ "engines": {
50
+ "node": ">=24.0.0"
51
+ }
52
+ }
@@ -0,0 +1,146 @@
1
+ ---
2
+ name: openspec-apply-change
3
+ description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
4
+ license: MIT
5
+ compatibility: Requires openspec CLI.
6
+ metadata:
7
+ author: openspec
8
+ version: "1.0"
9
+ generatedBy: "1.2.0"
10
+ ---
11
+
12
+ Implement tasks from an OpenSpec change.
13
+
14
+ Input: Optionally specify a change name. If omitted, infer it from context when possible. If ambiguous, ask the user to choose from available changes.
15
+
16
+ Steps
17
+
18
+ 1. Select the change
19
+
20
+ - If a name is provided, use it.
21
+ - Otherwise infer it from the conversation.
22
+ - If only one active change exists, auto-select it.
23
+ - If still ambiguous, run `openspec list --json` and ask the user to choose.
24
+ - Always announce: `Using change: <name>`.
25
+
26
+ 2. Check status
27
+
28
+ ```bash
29
+ openspec status --change "<name>" --json
30
+ ```
31
+
32
+ Use the JSON to understand:
33
+
34
+ - `schemaName`
35
+ - which artifact contains tasks
36
+
37
+ 3. Get apply instructions
38
+
39
+ ```bash
40
+ openspec instructions apply --change "<name>" --json
41
+ ```
42
+
43
+ Use the returned data for:
44
+
45
+ - `contextFiles`
46
+ - task progress
47
+ - remaining tasks
48
+ - dynamic instruction text
49
+
50
+ Handle states:
51
+
52
+ - If `state` is `blocked`, explain the blocker and suggest continuing after planning/artifact fixes.
53
+ - If `state` is `all_done`, report completion and suggest archiving.
54
+ - Otherwise proceed to implementation.
55
+
56
+ 4. Read context files
57
+
58
+ - Read every file listed in `contextFiles`.
59
+ - Do not assume fixed filenames; trust the CLI output.
60
+
61
+ 5. Show progress
62
+
63
+ Display:
64
+
65
+ - schema
66
+ - `N/M tasks complete`
67
+ - remaining task overview
68
+ - the current apply instruction
69
+
70
+ 6. Implement tasks
71
+
72
+ For each pending task:
73
+
74
+ - announce the task
75
+ - make the minimal focused code changes
76
+ - update the task checkbox in the tasks file from `- [ ]` to `- [x]` immediately after completion
77
+ - continue to the next task
78
+
79
+ Pause if:
80
+
81
+ - a task is ambiguous
82
+ - the implementation exposes a design problem
83
+ - an error or blocker is encountered
84
+ - the user interrupts
85
+
86
+ 7. Finish or pause cleanly
87
+
88
+ When stopping, display:
89
+
90
+ - tasks completed in this session
91
+ - overall progress
92
+ - whether the change is complete or paused
93
+ - the next action needed
94
+
95
+ Output during implementation
96
+
97
+ ```text
98
+ ## Implementing: <change-name> (schema: <schema-name>)
99
+
100
+ Working on task 3/7: <task description>
101
+ [...implementation...]
102
+ Task complete
103
+ ```
104
+
105
+ Output on completion
106
+
107
+ ```text
108
+ ## Implementation Complete
109
+
110
+ Change: <change-name>
111
+ Schema: <schema-name>
112
+ Progress: 7/7 tasks complete
113
+
114
+ Completed This Session
115
+ - [x] Task 1
116
+ - [x] Task 2
117
+
118
+ All tasks complete. Ready to archive.
119
+ ```
120
+
121
+ Output on pause
122
+
123
+ ```text
124
+ ## Implementation Paused
125
+
126
+ Change: <change-name>
127
+ Schema: <schema-name>
128
+ Progress: 4/7 tasks complete
129
+
130
+ Issue Encountered
131
+ <description>
132
+
133
+ Options:
134
+ 1. <option 1>
135
+ 2. <option 2>
136
+ 3. Other approach
137
+ ```
138
+
139
+ Guardrails
140
+
141
+ - Keep going until done or truly blocked.
142
+ - Always read the context files first.
143
+ - Keep changes minimal and scoped.
144
+ - Do not guess through ambiguous requirements.
145
+ - Update the task checkbox immediately after each completed task.
146
+ - If implementation reveals planning problems, stop and suggest updating artifacts first.
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: openspec-explore
3
+ description: Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.
4
+ license: MIT
5
+ compatibility: Requires openspec CLI.
6
+ metadata:
7
+ author: openspec
8
+ version: "1.0"
9
+ generatedBy: "1.2.0"
10
+ ---
11
+
12
+ Enter explore mode.
13
+
14
+ Important: explore mode is for thinking, not implementing. You may read files, inspect the codebase, and reason about architecture, but you must not implement product code in this mode.
15
+
16
+ Stance
17
+
18
+ - Curious, not prescriptive
19
+ - Open multiple lines of thought
20
+ - Use diagrams when helpful
21
+ - Ground the discussion in the real codebase
22
+ - Do not rush to a conclusion
23
+
24
+ What you might do
25
+
26
+ - clarify the problem
27
+ - investigate current architecture
28
+ - compare options and tradeoffs
29
+ - surface risks and unknowns
30
+ - suggest what should be captured in OpenSpec artifacts
31
+
32
+ OpenSpec awareness
33
+
34
+ At the start, you may inspect:
35
+
36
+ ```bash
37
+ openspec list --json
38
+ ```
39
+
40
+ When a relevant change exists:
41
+
42
+ - read proposal, design, tasks, or spec files for context
43
+ - reference those artifacts naturally in discussion
44
+ - offer to capture new decisions in the appropriate artifact
45
+
46
+ Typical capture targets
47
+
48
+ - scope changes -> `proposal.md`
49
+ - design decisions -> `design.md`
50
+ - new or changed requirements -> `specs/.../spec.md`
51
+ - new work items -> `tasks.md`
52
+
53
+ Behavior rules
54
+
55
+ - Do not follow a rigid script.
56
+ - Do not auto-capture decisions unless the user asks.
57
+ - Do not implement code.
58
+ - Do not fake certainty when something is unclear.
59
+ - Use codebase evidence where possible.
60
+
61
+ Helpful ending style
62
+
63
+ If the discussion reaches a useful stopping point, you may summarize:
64
+
65
+ ```text
66
+ ## What We Figured Out
67
+
68
+ The problem: ...
69
+ The likely approach: ...
70
+ Open questions: ...
71
+ Next steps:
72
+ - keep exploring
73
+ - capture this in artifacts
74
+ - start a change proposal
75
+ ```
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: openspec-propose
3
+ description: Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.
4
+ license: MIT
5
+ compatibility: Requires openspec CLI.
6
+ metadata:
7
+ author: openspec
8
+ version: "1.0"
9
+ generatedBy: "1.2.0"
10
+ ---
11
+
12
+ Propose a new change and generate the planning artifacts needed for implementation.
13
+
14
+ Artifacts created:
15
+
16
+ - `proposal.md`
17
+ - `design.md`
18
+ - `tasks.md`
19
+
20
+ When ready to implement, run the apply workflow.
21
+
22
+ Input
23
+
24
+ - A change name in kebab-case, or
25
+ - a description of what should be built
26
+
27
+ Steps
28
+
29
+ 1. Confirm the intended change
30
+
31
+ - If the request is vague, ask what should be built or fixed.
32
+ - Derive a kebab-case change name when needed.
33
+ - Do not proceed until the intended change is understood.
34
+
35
+ 2. Create the change
36
+
37
+ ```bash
38
+ openspec new change "<name>"
39
+ ```
40
+
41
+ 3. Inspect workflow status
42
+
43
+ ```bash
44
+ openspec status --change "<name>" --json
45
+ ```
46
+
47
+ Use it to identify:
48
+
49
+ - `applyRequires`
50
+ - artifact dependency order
51
+ - artifact readiness
52
+
53
+ 4. Build artifacts in dependency order
54
+
55
+ For each ready artifact:
56
+
57
+ ```bash
58
+ openspec instructions <artifact-id> --change "<name>" --json
59
+ ```
60
+
61
+ Use the returned data to:
62
+
63
+ - read completed dependency artifacts
64
+ - follow the provided template
65
+ - follow artifact-specific instruction text
66
+ - write the artifact to the provided output path
67
+
68
+ After each artifact:
69
+
70
+ - report brief progress
71
+ - re-run `openspec status --change "<name>" --json`
72
+ - continue until every required apply artifact is complete
73
+
74
+ 5. Handle ambiguity
75
+
76
+ - If the context is critically unclear, ask the user.
77
+ - Prefer keeping momentum when the answer is reasonably inferable.
78
+
79
+ 6. Show final status
80
+
81
+ - change name and location
82
+ - artifacts created
83
+ - readiness for implementation
84
+
85
+ Suggested completion summary
86
+
87
+ ```text
88
+ Created change: <name>
89
+ Artifacts:
90
+ - proposal.md
91
+ - design.md
92
+ - tasks.md
93
+
94
+ All artifacts created. Ready for implementation.
95
+ ```
96
+
97
+ Guardrails
98
+
99
+ - Create every artifact required for implementation readiness.
100
+ - Always read dependency artifacts before creating the next one.
101
+ - Do not copy raw instruction metadata blocks into the artifact output.
102
+ - If the change already exists, clarify whether to continue it or create a new one.