deepwork 0.1.0__tar.gz

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 (124) hide show
  1. deepwork-0.1.0/.claude/commands/AGENTS.md +5 -0
  2. deepwork-0.1.0/.claude/commands/add_platform.add_capabilities.md +290 -0
  3. deepwork-0.1.0/.claude/commands/add_platform.implement.md +393 -0
  4. deepwork-0.1.0/.claude/commands/add_platform.research.md +337 -0
  5. deepwork-0.1.0/.claude/commands/add_platform.verify.md +261 -0
  6. deepwork-0.1.0/.claude/commands/deepwork_jobs.define.md +503 -0
  7. deepwork-0.1.0/.claude/commands/deepwork_jobs.implement.md +595 -0
  8. deepwork-0.1.0/.claude/commands/deepwork_jobs.refine.md +595 -0
  9. deepwork-0.1.0/.claude/commands/deepwork_policy.define.md +264 -0
  10. deepwork-0.1.0/.claude/settings.json +117 -0
  11. deepwork-0.1.0/.deepwork/.gitignore +3 -0
  12. deepwork-0.1.0/.deepwork/config.yml +4 -0
  13. deepwork-0.1.0/.deepwork/jobs/add_platform/job.yml +136 -0
  14. deepwork-0.1.0/.deepwork/jobs/add_platform/steps/add_capabilities.md +135 -0
  15. deepwork-0.1.0/.deepwork/jobs/add_platform/steps/implement.md +226 -0
  16. deepwork-0.1.0/.deepwork/jobs/add_platform/steps/research.md +188 -0
  17. deepwork-0.1.0/.deepwork/jobs/add_platform/steps/verify.md +111 -0
  18. deepwork-0.1.0/.deepwork/jobs/deepwork_jobs/job.yml +102 -0
  19. deepwork-0.1.0/.deepwork/jobs/deepwork_jobs/steps/define.md +359 -0
  20. deepwork-0.1.0/.deepwork/jobs/deepwork_jobs/steps/implement.md +435 -0
  21. deepwork-0.1.0/.deepwork/jobs/deepwork_jobs/steps/refine.md +447 -0
  22. deepwork-0.1.0/.deepwork/jobs/deepwork_policy/hooks/capture_work_tree.sh +26 -0
  23. deepwork-0.1.0/.deepwork/jobs/deepwork_policy/hooks/get_changed_files.sh +30 -0
  24. deepwork-0.1.0/.deepwork/jobs/deepwork_policy/hooks/global_hooks.yml +8 -0
  25. deepwork-0.1.0/.deepwork/jobs/deepwork_policy/hooks/policy_stop_hook.sh +72 -0
  26. deepwork-0.1.0/.deepwork/jobs/deepwork_policy/hooks/user_prompt_submit.sh +17 -0
  27. deepwork-0.1.0/.deepwork/jobs/deepwork_policy/job.yml +35 -0
  28. deepwork-0.1.0/.deepwork/jobs/deepwork_policy/steps/define.md +174 -0
  29. deepwork-0.1.0/.deepwork.policy.yml +43 -0
  30. deepwork-0.1.0/.gemini/commands/add_platform/add_capabilities.toml +240 -0
  31. deepwork-0.1.0/.gemini/commands/add_platform/implement.toml +335 -0
  32. deepwork-0.1.0/.gemini/commands/add_platform/research.toml +285 -0
  33. deepwork-0.1.0/.gemini/commands/add_platform/verify.toml +211 -0
  34. deepwork-0.1.0/.gemini/commands/deepwork_jobs/define.toml +448 -0
  35. deepwork-0.1.0/.gemini/commands/deepwork_jobs/implement.toml +532 -0
  36. deepwork-0.1.0/.gemini/commands/deepwork_jobs/refine.toml +538 -0
  37. deepwork-0.1.0/.gemini/commands/deepwork_policy/define.toml +271 -0
  38. deepwork-0.1.0/.github/CLA_SETUP.md +171 -0
  39. deepwork-0.1.0/.github/CLA_SIGNATORIES.md +27 -0
  40. deepwork-0.1.0/.github/workflows/cla.yml +43 -0
  41. deepwork-0.1.0/.github/workflows/release.yml +52 -0
  42. deepwork-0.1.0/.github/workflows/validate.yml +33 -0
  43. deepwork-0.1.0/.gitignore +85 -0
  44. deepwork-0.1.0/CHANGELOG.md +12 -0
  45. deepwork-0.1.0/CLA.md +124 -0
  46. deepwork-0.1.0/CONTRIBUTING.md +531 -0
  47. deepwork-0.1.0/LICENSE.md +60 -0
  48. deepwork-0.1.0/PKG-INFO +389 -0
  49. deepwork-0.1.0/README.md +354 -0
  50. deepwork-0.1.0/claude.md +207 -0
  51. deepwork-0.1.0/doc/architecture.md +1145 -0
  52. deepwork-0.1.0/doc/platforms/gemini/cli_configuration.md +206 -0
  53. deepwork-0.1.0/doc/platforms/gemini/hooks_system.md +183 -0
  54. deepwork-0.1.0/job_library/README.md +67 -0
  55. deepwork-0.1.0/pyproject.toml +110 -0
  56. deepwork-0.1.0/shell.nix +67 -0
  57. deepwork-0.1.0/src/deepwork/__init__.py +25 -0
  58. deepwork-0.1.0/src/deepwork/cli/__init__.py +1 -0
  59. deepwork-0.1.0/src/deepwork/cli/install.py +290 -0
  60. deepwork-0.1.0/src/deepwork/cli/main.py +25 -0
  61. deepwork-0.1.0/src/deepwork/cli/sync.py +176 -0
  62. deepwork-0.1.0/src/deepwork/core/__init__.py +1 -0
  63. deepwork-0.1.0/src/deepwork/core/adapters.py +373 -0
  64. deepwork-0.1.0/src/deepwork/core/detector.py +93 -0
  65. deepwork-0.1.0/src/deepwork/core/generator.py +290 -0
  66. deepwork-0.1.0/src/deepwork/core/hooks_syncer.py +206 -0
  67. deepwork-0.1.0/src/deepwork/core/parser.py +310 -0
  68. deepwork-0.1.0/src/deepwork/core/policy_parser.py +285 -0
  69. deepwork-0.1.0/src/deepwork/hooks/__init__.py +1 -0
  70. deepwork-0.1.0/src/deepwork/hooks/evaluate_policies.py +159 -0
  71. deepwork-0.1.0/src/deepwork/schemas/__init__.py +1 -0
  72. deepwork-0.1.0/src/deepwork/schemas/job_schema.py +212 -0
  73. deepwork-0.1.0/src/deepwork/schemas/policy_schema.py +68 -0
  74. deepwork-0.1.0/src/deepwork/standard_jobs/deepwork_jobs/job.yml +102 -0
  75. deepwork-0.1.0/src/deepwork/standard_jobs/deepwork_jobs/steps/define.md +359 -0
  76. deepwork-0.1.0/src/deepwork/standard_jobs/deepwork_jobs/steps/implement.md +435 -0
  77. deepwork-0.1.0/src/deepwork/standard_jobs/deepwork_jobs/steps/refine.md +447 -0
  78. deepwork-0.1.0/src/deepwork/standard_jobs/deepwork_policy/hooks/capture_work_tree.sh +26 -0
  79. deepwork-0.1.0/src/deepwork/standard_jobs/deepwork_policy/hooks/get_changed_files.sh +30 -0
  80. deepwork-0.1.0/src/deepwork/standard_jobs/deepwork_policy/hooks/global_hooks.yml +8 -0
  81. deepwork-0.1.0/src/deepwork/standard_jobs/deepwork_policy/hooks/policy_stop_hook.sh +72 -0
  82. deepwork-0.1.0/src/deepwork/standard_jobs/deepwork_policy/hooks/user_prompt_submit.sh +17 -0
  83. deepwork-0.1.0/src/deepwork/standard_jobs/deepwork_policy/job.yml +35 -0
  84. deepwork-0.1.0/src/deepwork/standard_jobs/deepwork_policy/steps/define.md +174 -0
  85. deepwork-0.1.0/src/deepwork/templates/__init__.py +1 -0
  86. deepwork-0.1.0/src/deepwork/templates/claude/command-job-step.md.jinja +210 -0
  87. deepwork-0.1.0/src/deepwork/templates/gemini/command-job-step.toml.jinja +169 -0
  88. deepwork-0.1.0/src/deepwork/utils/__init__.py +1 -0
  89. deepwork-0.1.0/src/deepwork/utils/fs.py +128 -0
  90. deepwork-0.1.0/src/deepwork/utils/git.py +164 -0
  91. deepwork-0.1.0/src/deepwork/utils/validation.py +31 -0
  92. deepwork-0.1.0/src/deepwork/utils/yaml_utils.py +89 -0
  93. deepwork-0.1.0/tests/__init__.py +1 -0
  94. deepwork-0.1.0/tests/conftest.py +59 -0
  95. deepwork-0.1.0/tests/fixtures/jobs/complex_job/job.yml +78 -0
  96. deepwork-0.1.0/tests/fixtures/jobs/complex_job/steps/comparative_report.md +7 -0
  97. deepwork-0.1.0/tests/fixtures/jobs/complex_job/steps/identify_competitors.md +7 -0
  98. deepwork-0.1.0/tests/fixtures/jobs/complex_job/steps/primary_research.md +7 -0
  99. deepwork-0.1.0/tests/fixtures/jobs/complex_job/steps/secondary_research.md +7 -0
  100. deepwork-0.1.0/tests/fixtures/jobs/invalid_job/job.yml +13 -0
  101. deepwork-0.1.0/tests/fixtures/jobs/simple_job/job.yml +24 -0
  102. deepwork-0.1.0/tests/fixtures/jobs/simple_job/steps/single_step.md +10 -0
  103. deepwork-0.1.0/tests/fixtures/policies/empty_policy.yml +1 -0
  104. deepwork-0.1.0/tests/fixtures/policies/instructions/security_review.md +8 -0
  105. deepwork-0.1.0/tests/fixtures/policies/invalid_missing_instructions.yml +2 -0
  106. deepwork-0.1.0/tests/fixtures/policies/invalid_missing_trigger.yml +3 -0
  107. deepwork-0.1.0/tests/fixtures/policies/multiple_policies.yml +21 -0
  108. deepwork-0.1.0/tests/fixtures/policies/policy_with_instructions_file.yml +3 -0
  109. deepwork-0.1.0/tests/fixtures/policies/valid_policy.yml +6 -0
  110. deepwork-0.1.0/tests/integration/test_full_workflow.py +139 -0
  111. deepwork-0.1.0/tests/integration/test_install_flow.py +156 -0
  112. deepwork-0.1.0/tests/unit/test_adapters.py +316 -0
  113. deepwork-0.1.0/tests/unit/test_detector.py +98 -0
  114. deepwork-0.1.0/tests/unit/test_evaluate_policies.py +101 -0
  115. deepwork-0.1.0/tests/unit/test_fs.py +265 -0
  116. deepwork-0.1.0/tests/unit/test_generator.py +199 -0
  117. deepwork-0.1.0/tests/unit/test_git.py +221 -0
  118. deepwork-0.1.0/tests/unit/test_hooks_syncer.py +268 -0
  119. deepwork-0.1.0/tests/unit/test_parser.py +333 -0
  120. deepwork-0.1.0/tests/unit/test_policy_parser.py +355 -0
  121. deepwork-0.1.0/tests/unit/test_stop_hooks.py +622 -0
  122. deepwork-0.1.0/tests/unit/test_validation.py +213 -0
  123. deepwork-0.1.0/tests/unit/test_yaml_utils.py +286 -0
  124. deepwork-0.1.0/uv.lock +813 -0
@@ -0,0 +1,5 @@
1
+ # Auto-Generated Commands
2
+
3
+ All command files in this directory are auto-generated by `deepwork-sync` and should not be manually edited. Changes will be overwritten on the next sync.
4
+
5
+ If you need to modify a command, update the source configuration and re-run the sync process.
@@ -0,0 +1,290 @@
1
+ ---
2
+ description: Update job schema and adapters with any new hook events the platform supports
3
+ hooks:
4
+ Stop:
5
+ - hooks:
6
+ - type: prompt
7
+ prompt: |
8
+ You must evaluate whether Claude has met all the below quality criteria for the request.
9
+
10
+ ## Quality Criteria
11
+
12
+ Verify the capability additions meet ALL criteria:
13
+ 1. Any new hooks from the platform (for slash commands only) are added to src/deepwork/schemas/job_schema.py
14
+ 2. All existing adapters in src/deepwork/adapters.py are updated with the new hook fields
15
+ (set to None/null if the platform doesn't support that hook)
16
+ 3. Only hooks available on slash command definitions are added (not general CLI hooks)
17
+ 4. job_schema.py remains valid Python with no syntax errors
18
+ 5. adapters.py remains consistent - all adapters have the same hook fields
19
+ 6. If no new hooks are needed, document why in a comment
20
+
21
+ If ALL criteria are met, include `<promise>✓ Quality Criteria Met</promise>`.
22
+
23
+
24
+ ## Instructions
25
+
26
+ Review the conversation and determine if ALL quality criteria above have been satisfied.
27
+ Look for evidence that each criterion has been addressed.
28
+
29
+ If the agent has included `<promise>✓ Quality Criteria Met</promise>` in their response AND
30
+ all criteria appear to be met, respond with: {"ok": true}
31
+
32
+ If criteria are NOT met AND the promise tag is missing, respond with:
33
+ {"ok": false, "reason": "Continue working. [specific feedback on what's wrong]"}
34
+ ---
35
+
36
+ # add_platform.add_capabilities
37
+
38
+ **Step 2 of 4** in the **add_platform** workflow
39
+
40
+ **Summary**: Add a new AI platform to DeepWork with adapter, templates, and tests
41
+
42
+ ## Job Overview
43
+
44
+ A workflow for adding support for a new AI platform (like Cursor, Windsurf, etc.) to DeepWork.
45
+
46
+ This job guides you through four phases:
47
+ 1. **Research**: Capture the platform's CLI configuration and hooks system documentation
48
+ 2. **Add Capabilities**: Update the job schema and adapters with any new hook events
49
+ 3. **Implement**: Create the platform adapter, templates, tests (100% coverage), and README updates
50
+ 4. **Verify**: Ensure installation works correctly and produces expected files
51
+
52
+ The workflow ensures consistency across all supported platforms and maintains
53
+ comprehensive test coverage for new functionality.
54
+
55
+ **Important Notes**:
56
+ - Only hooks available on slash command definitions should be captured
57
+ - Each existing adapter must be updated when new hooks are added (typically with null values)
58
+ - Tests must achieve 100% coverage for any new functionality
59
+ - Installation verification confirms the platform integrates correctly with existing jobs
60
+
61
+
62
+ ## Prerequisites
63
+
64
+ This step requires completion of the following step(s):
65
+ - `/add_platform.research`
66
+
67
+ Please ensure these steps have been completed before proceeding.
68
+
69
+ ## Instructions
70
+
71
+ # Add Hook Capabilities
72
+
73
+ ## Objective
74
+
75
+ Update the DeepWork job schema and platform adapters to support any new hook events that the new platform provides for slash command definitions.
76
+
77
+ ## Task
78
+
79
+ Analyze the hooks documentation from the research step and update the codebase to support any new hook capabilities, ensuring consistency across all existing adapters.
80
+
81
+ ### Prerequisites
82
+
83
+ Read the hooks documentation created in the previous step:
84
+ - `doc/platforms/<platform_name>/hooks_system.md`
85
+
86
+ Also review the existing schema and adapters:
87
+ - `src/deepwork/schemas/job_schema.py`
88
+ - `src/deepwork/adapters.py`
89
+
90
+ ### Process
91
+
92
+ 1. **Analyze the new platform's hooks**
93
+ - Read `doc/platforms/<platform_name>/hooks_system.md`
94
+ - List all hooks available for slash command definitions
95
+ - Compare with hooks already in `job_schema.py`
96
+ - Identify any NEW hooks not currently supported
97
+
98
+ 2. **Determine if schema changes are needed**
99
+ - If the platform has hooks that DeepWork doesn't currently support, add them
100
+ - If all hooks are already supported, document this finding
101
+ - Remember: Only add hooks that are available on slash command definitions
102
+
103
+ 3. **Update job_schema.py (if needed)**
104
+ - Add new hook fields to the step schema
105
+ - Follow existing patterns for hook definitions
106
+ - Add appropriate type hints and documentation
107
+ - Example addition:
108
+ ```python
109
+ # New hook from <platform>
110
+ new_hook_name: Optional[List[HookConfig]] = None
111
+ ```
112
+
113
+ 4. **Update all existing adapters**
114
+ - Open `src/deepwork/adapters.py`
115
+ - For EACH existing adapter class:
116
+ - Add the new hook field (set to `None` if not supported)
117
+ - This maintains consistency across all adapters
118
+ - Document why each adapter does or doesn't support the hook
119
+
120
+ 5. **Validate the changes**
121
+ - Run Python syntax check: `python -m py_compile src/deepwork/schemas/job_schema.py`
122
+ - Run Python syntax check: `python -m py_compile src/deepwork/adapters.py`
123
+ - Ensure no import errors
124
+
125
+ 6. **Document the decision**
126
+ - If no new hooks were added, add a comment explaining why
127
+ - If new hooks were added, ensure they're documented in the schema
128
+
129
+ ## Output Format
130
+
131
+ ### job_schema.py
132
+
133
+ Location: `src/deepwork/schemas/job_schema.py`
134
+
135
+ If new hooks are added:
136
+ ```python
137
+ @dataclass
138
+ class StepDefinition:
139
+ # ... existing fields ...
140
+
141
+ # New hook from <platform_name> - [description of what it does]
142
+ new_hook_name: Optional[List[HookConfig]] = None
143
+ ```
144
+
145
+ ### adapters.py
146
+
147
+ Location: `src/deepwork/adapters.py`
148
+
149
+ For each existing adapter, add the new hook field:
150
+ ```python
151
+ class ExistingPlatformAdapter(PlatformAdapter):
152
+ # ... existing code ...
153
+
154
+ def get_hook_support(self) -> dict:
155
+ return {
156
+ # ... existing hooks ...
157
+ "new_hook_name": None, # Not supported by this platform
158
+ }
159
+ ```
160
+
161
+ Or if no changes are needed, add a documentation comment:
162
+ ```python
163
+ # NOTE: <platform_name> hooks reviewed on YYYY-MM-DD
164
+ # No new hooks to add - all <platform_name> command hooks are already
165
+ # supported by the existing schema (stop_hooks covers their validation pattern)
166
+ ```
167
+
168
+ ## Quality Criteria
169
+
170
+ - Hooks documentation from research step has been reviewed
171
+ - If new hooks exist:
172
+ - Added to `src/deepwork/schemas/job_schema.py` with proper typing
173
+ - ALL existing adapters updated in `src/deepwork/adapters.py`
174
+ - Each adapter indicates support level (implemented, None, or partial)
175
+ - If no new hooks needed:
176
+ - Decision documented with a comment explaining the analysis
177
+ - Only hooks available on slash command definitions are considered
178
+ - `job_schema.py` has no syntax errors (verified with py_compile)
179
+ - `adapters.py` has no syntax errors (verified with py_compile)
180
+ - All adapters have consistent hook fields (same fields across all adapters)
181
+ - When all criteria are met, include `<promise>✓ Quality Criteria Met</promise>` in your response
182
+
183
+ ## Context
184
+
185
+ DeepWork supports multiple AI platforms, and each platform may have different capabilities for hooks within command definitions. The schema defines what hooks CAN exist, while adapters define what each platform actually SUPPORTS.
186
+
187
+ This separation allows:
188
+ - Job definitions to use any hook (the schema is the superset)
189
+ - Platform-specific generation to only use supported hooks (adapters filter)
190
+ - Future platforms to add new hooks without breaking existing ones
191
+
192
+ Maintaining consistency is critical - all adapters must have the same hook fields, even if they don't support them (use `None` for unsupported).
193
+
194
+ ## Common Hook Types
195
+
196
+ For reference, here are common hook patterns across platforms:
197
+
198
+ | Hook Type | Purpose | Example Platforms |
199
+ |-----------|---------|-------------------|
200
+ | `stop_hooks` | Quality validation loops | Claude Code |
201
+ | `pre_hooks` | Run before command | Various |
202
+ | `post_hooks` | Run after command | Various |
203
+ | `validation_hooks` | Validate inputs/outputs | Various |
204
+
205
+ When you find a new hook type, consider whether it maps to an existing pattern or is genuinely new functionality.
206
+
207
+
208
+ ## Inputs
209
+
210
+
211
+ ### Required Files
212
+
213
+ This step requires the following files from previous steps:
214
+ - `hooks_system.md` (from step `research`)
215
+
216
+ Make sure to read and use these files as context for this step.
217
+
218
+ ## Work Branch Management
219
+
220
+ All work for this job should be done on a dedicated work branch:
221
+
222
+ 1. **Check current branch**:
223
+ - If already on a work branch for this job (format: `deepwork/add_platform-[instance]-[date]`), continue using it
224
+ - If on main/master, create a new work branch
225
+
226
+ 2. **Create work branch** (if needed):
227
+ ```bash
228
+ git checkout -b deepwork/add_platform-[instance]-$(date +%Y%m%d)
229
+ ```
230
+ Replace `[instance]` with a descriptive identifier (e.g., `acme`, `q1-launch`, etc.)
231
+
232
+ ## Output Requirements
233
+
234
+ Create the following output(s):
235
+ - `job_schema.py`- `adapters.py`
236
+ Ensure all outputs are:
237
+ - Well-formatted and complete
238
+ - Ready for review or use by subsequent steps
239
+
240
+ ## Quality Validation Loop
241
+
242
+ This step uses an iterative quality validation loop. After completing your work, stop hook(s) will evaluate whether the outputs meet quality criteria. If criteria are not met, you will be prompted to continue refining.
243
+
244
+ ### Quality Criteria
245
+ Verify the capability additions meet ALL criteria:
246
+ 1. Any new hooks from the platform (for slash commands only) are added to src/deepwork/schemas/job_schema.py
247
+ 2. All existing adapters in src/deepwork/adapters.py are updated with the new hook fields
248
+ (set to None/null if the platform doesn't support that hook)
249
+ 3. Only hooks available on slash command definitions are added (not general CLI hooks)
250
+ 4. job_schema.py remains valid Python with no syntax errors
251
+ 5. adapters.py remains consistent - all adapters have the same hook fields
252
+ 6. If no new hooks are needed, document why in a comment
253
+
254
+ If ALL criteria are met, include `<promise>✓ Quality Criteria Met</promise>`.
255
+
256
+
257
+ ### Completion Promise
258
+
259
+ To signal that all quality criteria have been met, include this tag in your final response:
260
+
261
+ ```
262
+ <promise>✓ Quality Criteria Met</promise>
263
+ ```
264
+
265
+ **Important**: Only include this promise tag when you have verified that ALL quality criteria above are satisfied. The validation loop will continue until this promise is detected.
266
+
267
+ ## Completion
268
+
269
+ After completing this step:
270
+
271
+ 1. **Verify outputs**: Confirm all required files have been created
272
+
273
+ 2. **Inform the user**:
274
+ - Step 2 of 4 is complete
275
+ - Outputs created: job_schema.py, adapters.py
276
+ - Ready to proceed to next step: `/add_platform.implement`
277
+
278
+ ## Next Step
279
+
280
+ To continue the workflow, run:
281
+ ```
282
+ /add_platform.implement
283
+ ```
284
+
285
+ ---
286
+
287
+ ## Context Files
288
+
289
+ - Job definition: `.deepwork/jobs/add_platform/job.yml`
290
+ - Step instructions: `.deepwork/jobs/add_platform/steps/add_capabilities.md`
@@ -0,0 +1,393 @@
1
+ ---
2
+ description: Add platform adapter, templates, tests with 100% coverage, and README documentation
3
+ hooks:
4
+ Stop:
5
+ - hooks:
6
+ - type: command
7
+ command: ".deepwork/jobs/add_platform/hooks/run_tests.sh"
8
+ - type: prompt
9
+ prompt: |
10
+ You must evaluate whether Claude has met all the below quality criteria for the request.
11
+
12
+ ## Quality Criteria
13
+
14
+ Verify the implementation meets ALL criteria:
15
+ 1. Platform adapter class is added to src/deepwork/adapters.py
16
+ 2. Templates exist in src/deepwork/templates/<platform>/ with appropriate command structure
17
+ 3. Tests exist for all new functionality
18
+ 4. Test coverage is 100% for new code (run: uv run pytest --cov)
19
+ 5. All tests pass
20
+ 6. README.md is updated with:
21
+ - New platform listed in supported platforms
22
+ - Installation instructions for the platform
23
+ - Any platform-specific notes
24
+
25
+ If ALL criteria are met, include `<promise>✓ Quality Criteria Met</promise>`.
26
+
27
+
28
+ ## Instructions
29
+
30
+ Review the conversation and determine if ALL quality criteria above have been satisfied.
31
+ Look for evidence that each criterion has been addressed.
32
+
33
+ If the agent has included `<promise>✓ Quality Criteria Met</promise>` in their response AND
34
+ all criteria appear to be met, respond with: {"ok": true}
35
+
36
+ If criteria are NOT met AND the promise tag is missing, respond with:
37
+ {"ok": false, "reason": "Continue working. [specific feedback on what's wrong]"}
38
+ ---
39
+
40
+ # add_platform.implement
41
+
42
+ **Step 3 of 4** in the **add_platform** workflow
43
+
44
+ **Summary**: Add a new AI platform to DeepWork with adapter, templates, and tests
45
+
46
+ ## Job Overview
47
+
48
+ A workflow for adding support for a new AI platform (like Cursor, Windsurf, etc.) to DeepWork.
49
+
50
+ This job guides you through four phases:
51
+ 1. **Research**: Capture the platform's CLI configuration and hooks system documentation
52
+ 2. **Add Capabilities**: Update the job schema and adapters with any new hook events
53
+ 3. **Implement**: Create the platform adapter, templates, tests (100% coverage), and README updates
54
+ 4. **Verify**: Ensure installation works correctly and produces expected files
55
+
56
+ The workflow ensures consistency across all supported platforms and maintains
57
+ comprehensive test coverage for new functionality.
58
+
59
+ **Important Notes**:
60
+ - Only hooks available on slash command definitions should be captured
61
+ - Each existing adapter must be updated when new hooks are added (typically with null values)
62
+ - Tests must achieve 100% coverage for any new functionality
63
+ - Installation verification confirms the platform integrates correctly with existing jobs
64
+
65
+
66
+ ## Prerequisites
67
+
68
+ This step requires completion of the following step(s):
69
+ - `/add_platform.research`
70
+ - `/add_platform.add_capabilities`
71
+
72
+ Please ensure these steps have been completed before proceeding.
73
+
74
+ ## Instructions
75
+
76
+ # Implement Platform Support
77
+
78
+ ## Objective
79
+
80
+ Create the complete platform implementation including the adapter class, command templates, comprehensive tests, and documentation updates.
81
+
82
+ ## Task
83
+
84
+ Build the full platform support by implementing the adapter, creating templates, writing tests with 100% coverage, and updating the README.
85
+
86
+ ### Prerequisites
87
+
88
+ Read the outputs from previous steps:
89
+ - `doc/platforms/<platform_name>/cli_configuration.md` - For template structure
90
+ - `src/deepwork/schemas/job_schema.py` - For current schema
91
+ - `src/deepwork/adapters.py` - For adapter patterns
92
+
93
+ Also review existing implementations for reference:
94
+ - `src/deepwork/templates/claude/` - Example templates
95
+ - `tests/` - Existing test patterns
96
+
97
+ ### Process
98
+
99
+ 1. **Create the platform adapter class**
100
+
101
+ Add a new adapter class to `src/deepwork/adapters.py`:
102
+
103
+ ```python
104
+ class NewPlatformAdapter(PlatformAdapter):
105
+ """Adapter for <Platform Name>."""
106
+
107
+ platform_name = "<platform_name>"
108
+ command_directory = "<path to commands>" # e.g., ".cursor/commands"
109
+ command_extension = ".md" # or appropriate extension
110
+
111
+ def get_hook_support(self) -> dict:
112
+ """Return which hooks this platform supports."""
113
+ return {
114
+ "stop_hooks": True, # or False/None
115
+ # ... other hooks
116
+ }
117
+
118
+ def generate_command(self, step: StepDefinition, job: JobDefinition) -> str:
119
+ """Generate command file content for this platform."""
120
+ # Use Jinja2 template
121
+ template = self.env.get_template(f"{self.platform_name}/command.md.j2")
122
+ return template.render(step=step, job=job)
123
+ ```
124
+
125
+ 2. **Create command templates**
126
+
127
+ Create templates in `src/deepwork/templates/<platform_name>/`:
128
+
129
+ - `command.md.j2` - Main command template
130
+ - Any other templates needed for the platform's format
131
+
132
+ Use the CLI configuration documentation to ensure the template matches the platform's expected format.
133
+
134
+ 3. **Register the adapter**
135
+
136
+ Update the adapter registry in `src/deepwork/adapters.py`:
137
+
138
+ ```python
139
+ PLATFORM_ADAPTERS = {
140
+ "claude": ClaudeAdapter,
141
+ "<platform_name>": NewPlatformAdapter,
142
+ # ... other adapters
143
+ }
144
+ ```
145
+
146
+ 4. **Write comprehensive tests**
147
+
148
+ Create tests in `tests/` that cover:
149
+
150
+ - Adapter instantiation
151
+ - Hook support detection
152
+ - Command generation
153
+ - Template rendering
154
+ - Edge cases (empty inputs, special characters, etc.)
155
+ - Integration with the sync command
156
+
157
+ **Critical**: Tests must achieve 100% coverage of new code.
158
+
159
+ 5. **Update README.md**
160
+
161
+ Add the new platform to `README.md`:
162
+
163
+ - Add to "Supported Platforms" list
164
+ - Add installation instructions:
165
+ ```bash
166
+ deepwork install --platform <platform_name>
167
+ ```
168
+ - Document any platform-specific notes or limitations
169
+
170
+ 6. **Run tests and verify coverage**
171
+
172
+ ```bash
173
+ uv run pytest --cov=src/deepwork --cov-report=term-missing
174
+ ```
175
+
176
+ - All tests must pass
177
+ - New code must have 100% coverage
178
+ - If coverage is below 100%, add more tests
179
+
180
+ 7. **Iterate until tests pass with full coverage**
181
+
182
+ This step has a `stop_hooks` script that runs tests. Keep iterating until:
183
+ - All tests pass
184
+ - Coverage is 100% for new functionality
185
+
186
+ ## Output Format
187
+
188
+ ### templates/
189
+
190
+ Location: `src/deepwork/templates/<platform_name>/`
191
+
192
+ Create the following files:
193
+
194
+ **command.md.j2**:
195
+ ```jinja2
196
+ {# Template for <platform_name> command files #}
197
+ {# Follows the platform's expected format from cli_configuration.md #}
198
+
199
+ [Platform-specific frontmatter or metadata]
200
+
201
+ # {{ step.name }}
202
+
203
+ {{ step.description }}
204
+
205
+ ## Instructions
206
+
207
+ {{ step.instructions_content }}
208
+
209
+ [... rest of template based on platform format ...]
210
+ ```
211
+
212
+ ### tests/
213
+
214
+ Location: `tests/test_<platform_name>_adapter.py`
215
+
216
+ ```python
217
+ """Tests for the <platform_name> adapter."""
218
+ import pytest
219
+ from deepwork.adapters import NewPlatformAdapter
220
+
221
+ class TestNewPlatformAdapter:
222
+ """Test suite for NewPlatformAdapter."""
223
+
224
+ def test_adapter_initialization(self):
225
+ """Test adapter can be instantiated."""
226
+ adapter = NewPlatformAdapter()
227
+ assert adapter.platform_name == "<platform_name>"
228
+
229
+ def test_hook_support(self):
230
+ """Test hook support detection."""
231
+ adapter = NewPlatformAdapter()
232
+ hooks = adapter.get_hook_support()
233
+ assert "stop_hooks" in hooks
234
+ # ... more assertions
235
+
236
+ def test_command_generation(self):
237
+ """Test command file generation."""
238
+ # ... test implementation
239
+
240
+ # ... more tests for 100% coverage
241
+ ```
242
+
243
+ ### README.md
244
+
245
+ Add to the existing README.md:
246
+
247
+ ```markdown
248
+ ## Supported Platforms
249
+
250
+ - **Claude Code** - Anthropic's CLI for Claude
251
+ - **<Platform Name>** - [Brief description]
252
+
253
+ ## Installation
254
+
255
+ ### <Platform Name>
256
+
257
+ ```bash
258
+ deepwork install --platform <platform_name>
259
+ ```
260
+
261
+ [Any platform-specific notes]
262
+ ```
263
+
264
+ ## Quality Criteria
265
+
266
+ - Platform adapter class added to `src/deepwork/adapters.py`:
267
+ - Inherits from `PlatformAdapter`
268
+ - Implements all required methods
269
+ - Registered in `PLATFORM_ADAPTERS`
270
+ - Templates created in `src/deepwork/templates/<platform_name>/`:
271
+ - `command.md.j2` exists and renders correctly
272
+ - Format matches platform's expected command format
273
+ - Tests created in `tests/`:
274
+ - Cover all new adapter functionality
275
+ - Cover template rendering
276
+ - All tests pass
277
+ - Test coverage is 100% for new code:
278
+ - Run `uv run pytest --cov=src/deepwork --cov-report=term-missing`
279
+ - No uncovered lines in new code
280
+ - README.md updated:
281
+ - Platform listed in supported platforms
282
+ - Installation command documented
283
+ - Any platform-specific notes included
284
+ - When all criteria are met, include `<promise>✓ Quality Criteria Met</promise>` in your response
285
+
286
+ ## Context
287
+
288
+ This is the core implementation step. The adapter you create will be responsible for:
289
+ - Determining where command files are placed
290
+ - Generating command file content from job definitions
291
+ - Handling platform-specific features and hooks
292
+
293
+ The templates use Jinja2 and should produce files that match exactly what the platform expects. Reference the CLI configuration documentation frequently to ensure compatibility.
294
+
295
+ ## Tips
296
+
297
+ - Study the existing `ClaudeAdapter` as a reference implementation
298
+ - Run tests frequently as you implement
299
+ - Use `--cov-report=html` for a detailed coverage report
300
+ - If a test is hard to write, the code might need refactoring
301
+ - Template syntax errors often show up at runtime - test early
302
+
303
+
304
+ ## Inputs
305
+
306
+
307
+ ### Required Files
308
+
309
+ This step requires the following files from previous steps:
310
+ - `job_schema.py` (from step `add_capabilities`)
311
+ - `adapters.py` (from step `add_capabilities`)
312
+ - `cli_configuration.md` (from step `research`)
313
+
314
+ Make sure to read and use these files as context for this step.
315
+
316
+ ## Work Branch Management
317
+
318
+ All work for this job should be done on a dedicated work branch:
319
+
320
+ 1. **Check current branch**:
321
+ - If already on a work branch for this job (format: `deepwork/add_platform-[instance]-[date]`), continue using it
322
+ - If on main/master, create a new work branch
323
+
324
+ 2. **Create work branch** (if needed):
325
+ ```bash
326
+ git checkout -b deepwork/add_platform-[instance]-$(date +%Y%m%d)
327
+ ```
328
+ Replace `[instance]` with a descriptive identifier (e.g., `acme`, `q1-launch`, etc.)
329
+
330
+ ## Output Requirements
331
+
332
+ Create the following output(s):
333
+ - `templates/` (directory)- `tests/` (directory)- `README.md`
334
+ Ensure all outputs are:
335
+ - Well-formatted and complete
336
+ - Ready for review or use by subsequent steps
337
+
338
+ ## Quality Validation Loop
339
+
340
+ This step uses an iterative quality validation loop. After completing your work, stop hook(s) will evaluate whether the outputs meet quality criteria. If criteria are not met, you will be prompted to continue refining.
341
+
342
+ **Validation Script**: `.deepwork/jobs/add_platform/hooks/run_tests.sh`
343
+
344
+ The validation script will be executed automatically when you attempt to complete this step.
345
+ ### Quality Criteria (2)
346
+ Verify the implementation meets ALL criteria:
347
+ 1. Platform adapter class is added to src/deepwork/adapters.py
348
+ 2. Templates exist in src/deepwork/templates/<platform>/ with appropriate command structure
349
+ 3. Tests exist for all new functionality
350
+ 4. Test coverage is 100% for new code (run: uv run pytest --cov)
351
+ 5. All tests pass
352
+ 6. README.md is updated with:
353
+ - New platform listed in supported platforms
354
+ - Installation instructions for the platform
355
+ - Any platform-specific notes
356
+
357
+ If ALL criteria are met, include `<promise>✓ Quality Criteria Met</promise>`.
358
+
359
+
360
+ ### Completion Promise
361
+
362
+ To signal that all quality criteria have been met, include this tag in your final response:
363
+
364
+ ```
365
+ <promise>✓ Quality Criteria Met</promise>
366
+ ```
367
+
368
+ **Important**: Only include this promise tag when you have verified that ALL quality criteria above are satisfied. The validation loop will continue until this promise is detected.
369
+
370
+ ## Completion
371
+
372
+ After completing this step:
373
+
374
+ 1. **Verify outputs**: Confirm all required files have been created
375
+
376
+ 2. **Inform the user**:
377
+ - Step 3 of 4 is complete
378
+ - Outputs created: templates/, tests/, README.md
379
+ - Ready to proceed to next step: `/add_platform.verify`
380
+
381
+ ## Next Step
382
+
383
+ To continue the workflow, run:
384
+ ```
385
+ /add_platform.verify
386
+ ```
387
+
388
+ ---
389
+
390
+ ## Context Files
391
+
392
+ - Job definition: `.deepwork/jobs/add_platform/job.yml`
393
+ - Step instructions: `.deepwork/jobs/add_platform/steps/implement.md`