deepwork 0.4.0__py3-none-any.whl → 0.7.0__py3-none-any.whl

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 (67) hide show
  1. deepwork/__init__.py +1 -1
  2. deepwork/cli/hook.py +3 -4
  3. deepwork/cli/install.py +70 -117
  4. deepwork/cli/main.py +2 -2
  5. deepwork/cli/serve.py +133 -0
  6. deepwork/cli/sync.py +93 -58
  7. deepwork/core/adapters.py +91 -98
  8. deepwork/core/generator.py +19 -386
  9. deepwork/core/hooks_syncer.py +1 -1
  10. deepwork/core/parser.py +270 -1
  11. deepwork/hooks/README.md +0 -44
  12. deepwork/hooks/__init__.py +3 -6
  13. deepwork/hooks/check_version.sh +54 -21
  14. deepwork/mcp/__init__.py +23 -0
  15. deepwork/mcp/quality_gate.py +347 -0
  16. deepwork/mcp/schemas.py +263 -0
  17. deepwork/mcp/server.py +253 -0
  18. deepwork/mcp/state.py +422 -0
  19. deepwork/mcp/tools.py +394 -0
  20. deepwork/schemas/job.schema.json +347 -0
  21. deepwork/schemas/job_schema.py +27 -239
  22. deepwork/standard_jobs/deepwork_jobs/doc_specs/job_spec.md +9 -15
  23. deepwork/standard_jobs/deepwork_jobs/job.yml +146 -46
  24. deepwork/standard_jobs/deepwork_jobs/steps/define.md +100 -33
  25. deepwork/standard_jobs/deepwork_jobs/steps/errata.md +154 -0
  26. deepwork/standard_jobs/deepwork_jobs/steps/fix_jobs.md +207 -0
  27. deepwork/standard_jobs/deepwork_jobs/steps/fix_settings.md +177 -0
  28. deepwork/standard_jobs/deepwork_jobs/steps/implement.md +22 -138
  29. deepwork/standard_jobs/deepwork_jobs/steps/iterate.md +221 -0
  30. deepwork/standard_jobs/deepwork_jobs/steps/learn.md +2 -26
  31. deepwork/standard_jobs/deepwork_jobs/steps/test.md +154 -0
  32. deepwork/standard_jobs/deepwork_jobs/templates/job.yml.template +2 -0
  33. deepwork/templates/claude/AGENTS.md +38 -0
  34. deepwork/templates/claude/settings.json +16 -0
  35. deepwork/templates/claude/skill-deepwork.md.jinja +37 -0
  36. deepwork/templates/gemini/skill-deepwork.md.jinja +37 -0
  37. deepwork-0.7.0.dist-info/METADATA +317 -0
  38. deepwork-0.7.0.dist-info/RECORD +64 -0
  39. deepwork/cli/rules.py +0 -32
  40. deepwork/core/command_executor.py +0 -190
  41. deepwork/core/pattern_matcher.py +0 -271
  42. deepwork/core/rules_parser.py +0 -559
  43. deepwork/core/rules_queue.py +0 -321
  44. deepwork/hooks/rules_check.py +0 -759
  45. deepwork/schemas/rules_schema.py +0 -135
  46. deepwork/standard_jobs/deepwork_jobs/steps/review_job_spec.md +0 -208
  47. deepwork/standard_jobs/deepwork_jobs/templates/doc_spec.md.example +0 -86
  48. deepwork/standard_jobs/deepwork_rules/hooks/capture_prompt_work_tree.sh +0 -38
  49. deepwork/standard_jobs/deepwork_rules/hooks/global_hooks.yml +0 -8
  50. deepwork/standard_jobs/deepwork_rules/hooks/user_prompt_submit.sh +0 -16
  51. deepwork/standard_jobs/deepwork_rules/job.yml +0 -49
  52. deepwork/standard_jobs/deepwork_rules/rules/.gitkeep +0 -13
  53. deepwork/standard_jobs/deepwork_rules/rules/api-documentation-sync.md.example +0 -10
  54. deepwork/standard_jobs/deepwork_rules/rules/readme-documentation.md.example +0 -10
  55. deepwork/standard_jobs/deepwork_rules/rules/security-review.md.example +0 -11
  56. deepwork/standard_jobs/deepwork_rules/rules/skill-md-validation.md +0 -46
  57. deepwork/standard_jobs/deepwork_rules/rules/source-test-pairing.md.example +0 -13
  58. deepwork/standard_jobs/deepwork_rules/steps/define.md +0 -249
  59. deepwork/templates/claude/skill-job-meta.md.jinja +0 -77
  60. deepwork/templates/claude/skill-job-step.md.jinja +0 -251
  61. deepwork/templates/gemini/skill-job-meta.toml.jinja +0 -76
  62. deepwork/templates/gemini/skill-job-step.toml.jinja +0 -162
  63. deepwork-0.4.0.dist-info/METADATA +0 -381
  64. deepwork-0.4.0.dist-info/RECORD +0 -71
  65. {deepwork-0.4.0.dist-info → deepwork-0.7.0.dist-info}/WHEEL +0 -0
  66. {deepwork-0.4.0.dist-info → deepwork-0.7.0.dist-info}/entry_points.txt +0 -0
  67. {deepwork-0.4.0.dist-info → deepwork-0.7.0.dist-info}/licenses/LICENSE.md +0 -0
@@ -1,19 +1,53 @@
1
+ # yaml-language-server: $schema=.deepwork/schemas/job.schema.json
1
2
  name: deepwork_jobs
2
- version: "0.9.0"
3
- summary: "Creates and manages multi-step AI workflows. Use when defining, implementing, or improving DeepWork jobs."
3
+ version: "1.2.1"
4
+ summary: "Creates and manages multi-step AI workflows. Use when defining, implementing, testing, or improving DeepWork jobs."
4
5
  description: |
5
6
  Core commands for managing DeepWork jobs. These commands help you define new multi-step
6
- workflows and learn from running them.
7
+ workflows, test them on real use cases, and learn from running them.
7
8
 
8
- The `define` command guides you through an interactive process to create a new job by
9
- asking structured questions about your workflow, understanding each step's inputs and outputs,
10
- and generating all necessary files.
9
+ The `new_job` workflow guides you through the full lifecycle of creating a new job:
10
+ 1. **Define**: Gather requirements through structured questions and create job.yml
11
+ 2. **Implement**: Generate step instruction files and sync slash commands
12
+ 3. **Test**: Run the workflow on a real use case, critique output, and iterate with user
13
+ 4. **Iterate**: Review what happened and improve the job definition based on learnings
11
14
 
12
- The `learn` command reflects on conversations where DeepWork jobs were run, identifies
15
+ The `learn` skill reflects on conversations where DeepWork jobs were run, identifies
13
16
  confusion or inefficiencies, and improves job instructions. It also captures bespoke
14
17
  learnings specific to the current run into AGENTS.md files in the working folder.
15
18
 
19
+ workflows:
20
+ - name: new_job
21
+ summary: "Create a new DeepWork job from scratch through definition, implementation, testing, and iteration"
22
+ steps:
23
+ - define
24
+ - implement
25
+ - test
26
+ - iterate
27
+
28
+ - name: repair
29
+ summary: "Clean up and migrate DeepWork configurations from prior versions"
30
+ steps:
31
+ - fix_settings
32
+ - fix_jobs
33
+ - errata
34
+
35
+ - name: learn
36
+ summary: "Analyze conversation history to improve job instructions and capture learnings"
37
+ steps:
38
+ - learn
39
+
16
40
  changelog:
41
+ - version: "1.2.1"
42
+ changes: "Removed deprecated exposed field from learn step; added learn workflow to make step accessible via MCP"
43
+ - version: "1.2.0"
44
+ changes: "Added repair workflow with fix_settings, fix_jobs, and errata steps for migrating old DeepWork configurations to current format"
45
+ - version: "1.1.0"
46
+ changes: "Added test and iterate steps to new_job workflow; test runs the workflow on a real use case and gathers feedback; iterate improves the job definition based on what happened"
47
+ - version: "1.0.1"
48
+ changes: "Removed review_job_spec step from new_job workflow; implement now follows directly from define"
49
+ - version: "1.0.0"
50
+ changes: "Added workflows section to distinguish new_job workflow (define→review_job_spec→implement) from standalone learn skill"
17
51
  - version: "0.1.0"
18
52
  changes: "Initial version"
19
53
  - version: "0.2.0"
@@ -45,65 +79,73 @@ steps:
45
79
  - file: job.yml
46
80
  doc_spec: .deepwork/doc_specs/job_spec.md
47
81
  dependencies: []
82
+ - id: implement
83
+ name: "Implement Job Steps"
84
+ description: "Generates step instruction files and syncs slash commands from the job.yml specification. Use after defining a job."
85
+ instructions_file: steps/implement.md
86
+ inputs:
87
+ - file: job.yml
88
+ from_step: define
89
+ outputs:
90
+ - steps/
91
+ dependencies:
92
+ - define
48
93
  quality_criteria:
49
- - "**User Understanding**: Did the agent fully understand the user's workflow by asking structured questions?"
50
- - "**Structured Questions Used**: Did the agent ask structured questions (using the AskUserQuestion tool) to gather user input?"
51
- - "**Document Detection**: For document-oriented workflows, did the agent detect patterns and offer doc spec creation?"
52
- - "**doc spec Created (if applicable)**: If a doc spec was needed, was it created in `.deepwork/doc_specs/[doc_spec_name].md` with proper quality criteria?"
53
- - "**doc spec References**: Are document outputs properly linked to their doc specs using `{file, doc_spec}` format?"
54
- - "**Valid Against doc spec**: Does the job.yml conform to the job.yml doc spec quality criteria (valid identifier, semantic version, concise summary, rich description, complete steps, valid dependencies)?"
55
- - "**Clear Inputs/Outputs**: Does every step have clearly defined inputs and outputs?"
56
- - "**Logical Dependencies**: Do step dependencies make sense and avoid circular references?"
57
- - "**Concise Summary**: Is the summary under 200 characters and descriptive?"
58
- - "**Rich Description**: Does the description provide enough context for future refinement?"
59
- - "**Valid Schema**: Does the job.yml follow the required schema (name, version, summary, steps)?"
60
- - "**File Created**: Has the job.yml file been created in `.deepwork/jobs/[job_name]/job.yml`?"
94
+ - "**Complete Instructions**: Are ALL step instruction files complete (not stubs or placeholders)?"
95
+ - "**Specific & Actionable**: Are instructions tailored to each step's purpose, not generic?"
96
+ - "**Output Examples**: Does each instruction file show what good output looks like?"
97
+ - "**Quality Criteria**: Does each instruction file define quality criteria for its outputs?"
98
+ - "**Ask Structured Questions**: Do step instructions that gather user input explicitly use the phrase \"ask structured questions\"?"
61
99
 
62
- - id: review_job_spec
63
- name: "Review Job Specification"
64
- description: "Reviews job.yml against quality criteria using a sub-agent for unbiased validation. Use after defining a job specification."
65
- instructions_file: steps/review_job_spec.md
100
+ - id: test
101
+ name: "Test the New Workflow"
102
+ description: "Tests the newly created workflow by running it on a real use case, critiquing the output, and iterating until the user is satisfied. Use after implementing a job."
103
+ instructions_file: steps/test.md
66
104
  inputs:
67
105
  - file: job.yml
68
106
  from_step: define
107
+ - file: steps/
108
+ from_step: implement
69
109
  outputs:
70
- - file: job.yml
71
- doc_spec: .deepwork/doc_specs/job_spec.md
110
+ - test_feedback.md
72
111
  dependencies:
73
112
  - define
113
+ - implement
74
114
  quality_criteria:
75
- - "**Sub-Agent Used**: Was a sub-agent spawned to provide unbiased review?"
76
- - "**All doc spec Criteria Evaluated**: Did the sub-agent assess all 9 quality criteria?"
77
- - "**Findings Addressed**: Were all failed criteria addressed by the main agent?"
78
- - "**Validation Loop Complete**: Did the review-fix cycle continue until all criteria passed?"
115
+ - "**User Informed**: Did the agent explain the workflow is ready and ask what to test it on?"
116
+ - "**Workflow Invoked**: Was the new workflow actually run on the user's test case via MCP?"
117
+ - "**Output Critiqued**: Did the agent identify up to 3 top issues with the output?"
118
+ - "**User Feedback Gathered**: Did the agent ask the user about each issue and gather additional feedback?"
119
+ - "**Corrections Made**: Were all requested corrections applied to the output?"
120
+ - "**User Satisfied**: Did the user confirm the output meets their needs?"
79
121
 
80
- - id: implement
81
- name: "Implement Job Steps"
82
- description: "Generates step instruction files and syncs slash commands from the job.yml specification. Use after job spec review passes."
83
- instructions_file: steps/implement.md
122
+ - id: iterate
123
+ name: "Iterate on Workflow Design"
124
+ description: "Reviews the test run conversation and improves the job definition based on what happened. Use after testing a newly created job."
125
+ instructions_file: steps/iterate.md
84
126
  inputs:
85
127
  - file: job.yml
86
- from_step: review_job_spec
128
+ from_step: define
129
+ - file: steps/
130
+ from_step: implement
87
131
  outputs:
132
+ - job.yml
88
133
  - steps/
89
134
  dependencies:
90
- - review_job_spec
135
+ - define
136
+ - implement
137
+ - test
91
138
  quality_criteria:
92
- - "**Directory Structure**: Is `.deepwork/jobs/[job_name]/` created correctly?"
93
- - "**Complete Instructions**: Are ALL step instruction files complete (not stubs or placeholders)?"
94
- - "**Specific & Actionable**: Are instructions tailored to each step's purpose, not generic?"
95
- - "**Output Examples**: Does each instruction file show what good output looks like?"
96
- - "**Quality Criteria**: Does each instruction file define quality criteria for its outputs?"
97
- - "**Ask Structured Questions**: Do step instructions that gather user input explicitly use the phrase \"ask structured questions\"?"
98
- - "**Sync Complete**: Has `deepwork sync` been run successfully?"
99
- - "**Commands Available**: Are the slash-commands generated in `.claude/commands/`?"
100
- - "**Rules Considered**: Has the agent thought about whether rules would benefit this job? If relevant rules were identified, did they explain them and offer to run `/deepwork_rules.define`? Not every job needs rules - only suggest when genuinely helpful."
139
+ - "**Conversation Reviewed**: Did the agent analyze the test run for inefficiencies and issues?"
140
+ - "**Instructions Improved**: Were step instructions updated to address identified problems?"
141
+ - "**Quality Criteria Updated**: Were quality criteria adjusted to better match user expectations?"
142
+ - "**Tool Usage Considered**: Did the agent consider if different tools would improve the workflow?"
143
+ - "**Recap Provided**: Did the agent summarize what was improved and why?"
101
144
 
102
145
  - id: learn
103
146
  name: "Learn from Job Execution"
104
147
  description: "Analyzes conversation history to improve job instructions and capture learnings. Use after running a job to refine it."
105
148
  instructions_file: steps/learn.md
106
- exposed: true
107
149
  inputs:
108
150
  - name: job_name
109
151
  description: "Name of the job that was run (optional - will auto-detect from conversation)"
@@ -122,4 +164,62 @@ steps:
122
164
  - "**File References Used**: Do AGENTS.md entries reference other files where appropriate?"
123
165
  - "**Working Folder Correct**: Is AGENTS.md in the correct working folder for the job?"
124
166
  - "**Generalizable Separated**: Are generalizable improvements in instructions, not AGENTS.md?"
125
- - "**Sync Complete**: Has `deepwork sync` been run if instructions were modified?"
167
+
168
+ - id: fix_settings
169
+ name: "Fix Settings Files"
170
+ description: "Cleans up .claude/settings.json and related configuration files, removing legacy permissions, duplicate hooks, and hardcoded paths from prior DeepWork versions."
171
+ instructions_file: steps/fix_settings.md
172
+ inputs: []
173
+ outputs:
174
+ - .claude/settings.json
175
+ dependencies: []
176
+ quality_criteria:
177
+ - "**DeepWork Skills Removed**: Are `Skill(...)` entries matching jobs in `.deepwork/jobs/` removed?"
178
+ - "**Non-DeepWork Skills Preserved**: Are skills NOT matching DeepWork jobs left intact?"
179
+ - "**make_new_job.sh Preserved**: Is the `Bash(...)` permission for `make_new_job.sh` preserved (if present)?"
180
+ - "**Rules Hooks Removed**: Are all DeepWork Rules hooks and permissions removed?"
181
+ - "**Duplicate Hooks Removed**: Are duplicate hook entries consolidated or removed?"
182
+ - "**Hardcoded Paths Removed**: Are user-specific hardcoded paths (like `/Users/*/...`) removed?"
183
+ - "**Deprecated Commands Removed**: Are deprecated commands like `deepwork hook *` removed?"
184
+ - "**Valid JSON**: Is settings.json still valid JSON after modifications?"
185
+ - "**Backup Created**: Was a backup of the original settings created before modifications?"
186
+
187
+ - id: fix_jobs
188
+ name: "Fix Job Definitions"
189
+ description: "Updates job.yml files and step instructions to current DeepWork format, removing deprecated fields and migrating to new structures."
190
+ instructions_file: steps/fix_jobs.md
191
+ inputs:
192
+ - file: .claude/settings.json
193
+ from_step: fix_settings
194
+ outputs:
195
+ - .deepwork/jobs/
196
+ dependencies:
197
+ - fix_settings
198
+ quality_criteria:
199
+ - "**Exposed Field Addressed**: Are `exposed: true` fields removed or noted as deprecated?"
200
+ - "**Stop Hooks Migrated**: Are `stop_hooks` migrated to `hooks.after_agent` format?"
201
+ - "**Removed Steps Cleaned**: Are references to removed steps (like `review_job_spec`) updated?"
202
+ - "**Orphaned Steps Fixed**: For jobs with no workflows, is there a single workflow (named after the job) containing all steps? For jobs with existing workflows, does each orphan get its own workflow (named after the step)?"
203
+ - "**Valid YAML**: Are all job.yml files valid YAML?"
204
+
205
+ - id: errata
206
+ name: "Clean Up Errata"
207
+ description: "Removes obsolete files and folders from prior DeepWork versions, including old skill directories, temp files, and deprecated configurations."
208
+ instructions_file: steps/errata.md
209
+ inputs:
210
+ - file: .deepwork/jobs/
211
+ from_step: fix_jobs
212
+ outputs:
213
+ - repair_summary.md
214
+ dependencies:
215
+ - fix_settings
216
+ - fix_jobs
217
+ quality_criteria:
218
+ - "**Legacy Job Skills Removed**: Are legacy skill folders for each job removed from `.claude/skills/` and `.gemini/skills/`?"
219
+ - "**Deepwork Skill Preserved**: Does the `deepwork` skill folder still exist in `.claude/skills/deepwork/`?"
220
+ - "**Temp Files Cleaned**: Are `.deepwork/tmp/` contents cleaned appropriately?"
221
+ - "**Rules Folder Removed**: Is `.deepwork/rules/` folder backed up and removed (fully deprecated)?"
222
+ - "**Rules Job Removed**: Is `.deepwork/jobs/deepwork_rules/` removed if present?"
223
+ - "**Config Version Updated**: Is `.deepwork/config.yml` using current version format?"
224
+ - "**Summary Provided**: Is a repair_summary.md file created documenting all changes made?"
225
+ - "**Git Status Clean**: Are changes ready to be committed (no untracked garbage files)?"
@@ -61,11 +61,16 @@ When creating a doc spec, gather the following information:
61
61
  - How often is it produced? (frequency)
62
62
 
63
63
  3. **Quality Criteria** (3-5 criteria, each with name and description)
64
+
65
+ **Important**: Doc spec quality criteria define requirements for the **output document itself**, not the process of creating it. Focus on what the finished document must contain or achieve.
66
+
64
67
  Examples for a spending report:
65
68
  - **Visualization**: Must include charts showing spend breakdown by service
66
69
  - **Variance Analysis**: Must compare current month against previous with percentages
67
70
  - **Action Items**: Must include recommended cost optimization actions
68
71
 
72
+ **Note**: When a doc spec is created for a step's output, the step should generally NOT have separate `quality_criteria` in the job.yml. The doc spec's criteria cover output quality. Only add step-level quality_criteria if there are essential process requirements (e.g., "must use specific tool"), and minimize these when possible.
73
+
69
74
  4. **Document Structure**
70
75
  - What sections should it have?
71
76
  - Any required elements (tables, charts, summaries)?
@@ -76,7 +81,7 @@ Create the doc spec file at `.deepwork/doc_specs/[doc_spec_name].md`:
76
81
 
77
82
  **Template reference**: See `.deepwork/jobs/deepwork_jobs/templates/doc_spec.md.template` for the standard structure.
78
83
 
79
- **Complete example**: See `.deepwork/jobs/deepwork_jobs/templates/doc_spec.md.example` for a fully worked example.
84
+ **Complete example**: See `.deepwork/doc_specs/job_spec.md` for a fully worked example (the doc spec for job.yml files).
80
85
 
81
86
  After creating the doc spec, proceed to Step 2 with the doc spec reference for the final step's output.
82
87
 
@@ -101,10 +106,63 @@ For each major phase they mentioned, ask structured questions to gather details:
101
106
  - Where should each output be saved? (filename/path)
102
107
  - Should outputs be organized in subdirectories? (e.g., `reports/`, `data/`, `drafts/`)
103
108
  - Will other steps need this output?
104
-
105
- **Important**: Output paths should always be within the main repository directory structure, not in dot-directories like `.deepwork/`. Dot-directories are for configuration and job definitions, not for job outputs. Use paths like `research/competitors/report.md` rather than `.deepwork/outputs/report.md`.
106
109
  - **Does this output have a doc spec?** If a doc spec was created in Step 1.6/1.7, reference it for the appropriate output
107
110
 
111
+ #### Work Product Storage Guidelines
112
+
113
+ **Key principle**: Job outputs belong in the main repository directory structure, not in dot-directories. The `.deepwork/` directory is for job definitions and configuration only.
114
+
115
+ **Why this matters**:
116
+ - **Version control**: Work products in the main repo are tracked by git and visible in PRs
117
+ - **Discoverability**: Team members can find outputs without knowing about DeepWork internals
118
+ - **Tooling compatibility**: IDEs, search tools, and CI/CD work naturally with standard paths
119
+ - **Glob patterns**: Well-structured paths enable powerful file matching (e.g., `competitive_research/**/*.md`)
120
+
121
+ **Good output path patterns**:
122
+ ```
123
+ competitive_research/competitors_list.md
124
+ competitive_research/acme_corp/research.md
125
+ operations/reports/2026-01/spending_analysis.md
126
+ docs/api/endpoints.md
127
+ ```
128
+
129
+ **Avoid these patterns**:
130
+ ```
131
+ .deepwork/outputs/report.md # Hidden in dot-directory
132
+ output.md # Too generic, no context
133
+ research.md # Unclear which research
134
+ temp/draft.md # Transient-sounding paths
135
+ ```
136
+
137
+ **Organizing multi-file outputs**:
138
+ - Use the job name as a top-level folder when outputs are job-specific
139
+ - Use parameterized paths for per-entity outputs: `competitive_research/[competitor_name]/`
140
+ - Match existing project conventions when extending a codebase
141
+
142
+ **When to include dates in paths**:
143
+ - **Include date** for periodic outputs where each version is retained (e.g., monthly reports, quarterly reviews, weekly summaries). These accumulate over time and historical versions remain useful.
144
+ ```
145
+ operations/reports/2026-01/spending_analysis.md # Monthly report - keep history
146
+ hr/employees/[employee_name]/quarterly_reviews/2026-Q1.pdf # Per-employee quarterly review
147
+ ```
148
+ - **Omit date** for current-state outputs that represent the latest understanding and get updated in place. Previous versions live in git history, not separate files.
149
+ ```
150
+ competitive_research/acme_corp/swot.md # Current SWOT - updated over time
151
+ docs/architecture/overview.md # Living document
152
+ ```
153
+
154
+ **Supporting materials and intermediate outputs**:
155
+ - Content generated in earlier steps to support the final output (research notes, data extracts, drafts) should be placed in a `_dataroom` folder that is a peer to the final output
156
+ - Name the dataroom folder by replacing the file extension with `_dataroom`
157
+ ```
158
+ operations/reports/2026-01/spending_analysis.md # Final output
159
+ operations/reports/2026-01/spending_analysis_dataroom/ # Supporting materials
160
+ raw_data.csv
161
+ vendor_breakdown.md
162
+ notes.md
163
+ ```
164
+ - This keeps supporting materials organized and discoverable without cluttering the main output location
165
+
108
166
  4. **Step Dependencies**
109
167
  - Which previous steps must complete before this one?
110
168
  - Are there any ordering constraints?
@@ -114,6 +172,21 @@ For each major phase they mentioned, ask structured questions to gather details:
114
172
  - Are there any quality checks or validation needed?
115
173
  - What makes a good vs. bad output for this step?
116
174
 
175
+ **Important**: Quality criteria belong in the `quality_criteria` field of job.yml, NOT in the step details. When skills are generated, quality criteria are automatically included in the output. Do not duplicate them in step instructions or details—this causes redundancy and confusion.
176
+
177
+ 6. **Agent Delegation** (optional)
178
+ - Should this step be executed by a specific agent type?
179
+ - Use the `agent` field when the step should run in a forked context with a specific agent
180
+ - When `agent` is set, the generated skill automatically includes `context: fork`
181
+ - Available agent types:
182
+ - `general-purpose` - Standard agent for multi-step tasks
183
+
184
+ ```yaml
185
+ steps:
186
+ - id: research_step
187
+ agent: general-purpose # Delegates to the general-purpose agent
188
+ ```
189
+
117
190
  **Note**: You're gathering this information to understand what instructions will be needed, but you won't create the instruction files yet - that happens in the `implement` step.
118
191
 
119
192
  #### Doc Spec-Aware Output Format
@@ -154,49 +227,53 @@ After gathering information about all steps:
154
227
  - Job description (detailed multi-line explanation)
155
228
  - Version number (start with 1.0.0)
156
229
 
157
- ### Step 4: Define Quality Validation (Stop Hooks)
230
+ ### Step 4: Define Quality Validation Hooks
158
231
 
159
- For each step, consider whether it would benefit from **quality validation loops**. Stop hooks allow the AI agent to iteratively refine its work until quality criteria are met.
232
+ For each step, consider whether it would benefit from **quality validation loops**. Quality hooks allow the AI agent to iteratively refine its work until quality criteria are met.
160
233
 
161
234
  **Ask structured questions about quality validation:**
162
235
  - "Are there specific quality criteria that must be met for this step?"
163
236
  - "Would you like the agent to validate its work before completing?"
164
237
  - "What would make you send the work back for revision?"
165
238
 
166
- **Stop hooks are particularly valuable for:**
239
+ **Quality hooks are particularly valuable for:**
167
240
  - Steps with complex outputs that need multiple checks
168
241
  - Steps where quality is critical (final deliverables)
169
242
  - Steps with subjective quality criteria that benefit from AI self-review
170
243
 
171
- **Three types of stop hooks are supported:**
244
+ **Three types of hooks are supported:**
172
245
 
173
246
  1. **Inline Prompt** (`prompt`) - Best for simple quality criteria
174
247
  ```yaml
175
- stop_hooks:
176
- - prompt: |
177
- Verify the output meets these criteria:
178
- 1. Contains at least 5 competitors
179
- 2. Each competitor has a description
180
- 3. Selection rationale is clear
248
+ hooks:
249
+ after_agent:
250
+ - prompt: |
251
+ Verify the output meets these criteria:
252
+ 1. Contains at least 5 competitors
253
+ 2. Each competitor has a description
254
+ 3. Selection rationale is clear
181
255
  ```
182
256
 
183
257
  2. **Prompt File** (`prompt_file`) - For detailed/reusable criteria
184
258
  ```yaml
185
- stop_hooks:
186
- - prompt_file: hooks/quality_check.md
259
+ hooks:
260
+ after_agent:
261
+ - prompt_file: hooks/quality_check.md
187
262
  ```
188
263
 
189
264
  3. **Script** (`script`) - For programmatic validation (tests, linting)
190
265
  ```yaml
191
- stop_hooks:
192
- - script: hooks/run_tests.sh
266
+ hooks:
267
+ after_agent:
268
+ - script: hooks/run_tests.sh
193
269
  ```
194
270
 
195
271
  **Multiple hooks can be combined:**
196
272
  ```yaml
197
- stop_hooks:
198
- - script: hooks/lint_output.sh
199
- - prompt: "Verify the content is comprehensive and well-organized"
273
+ hooks:
274
+ after_agent:
275
+ - script: hooks/lint_output.sh
276
+ - prompt: "Verify the content is comprehensive and well-organized"
200
277
  ```
201
278
 
202
279
  **Encourage prompt-based hooks** - They leverage the AI's ability to understand context and make nuanced quality judgments. Script hooks are best for objective checks (syntax, format, tests).
@@ -343,7 +420,7 @@ Claude: Great! Creating the job.yml specification now...
343
420
  - .deepwork/jobs/competitive_research/job.yml
344
421
 
345
422
  **Next step:**
346
- Run `/deepwork_jobs.review_job_spec` to validate the specification against quality criteria.
423
+ Implement the job to generate step instruction files.
347
424
  ```
348
425
 
349
426
  ## Important Guidelines
@@ -383,15 +460,5 @@ The complete YAML specification file (example shown in Step 5 above).
383
460
  After creating the file:
384
461
  1. Inform the user that the specification is complete
385
462
  2. Recommend that they review the job.yml file
386
- 3. Tell them to run `/deepwork_jobs.review_job_spec` next
387
-
388
- ## Quality Criteria
389
-
390
- - Asked structured questions to fully understand user requirements
391
- - User fully understands what job they're creating
392
- - All steps have clear inputs and outputs
393
- - Dependencies make logical sense
394
- - Summary is concise and descriptive
395
- - Description provides rich context for future refinement
396
- - Specification is valid YAML and follows the schema
397
- - Ready for implementation step
463
+ 3. Tell them the next step is to implement the job (generate step instruction files)
464
+
@@ -0,0 +1,154 @@
1
+ # Clean Up Errata
2
+
3
+ ## Objective
4
+
5
+ Remove obsolete files and folders from prior DeepWork versions. This final step cleans up artifacts that are no longer used by the MCP-based system.
6
+
7
+ ## Task
8
+
9
+ Identify and clean up deprecated files and folders.
10
+
11
+ ### Step 1: Remove Legacy Job Skill Folders
12
+
13
+ Old DeepWork versions created individual skill folders for each job and step. These need to be removed while preserving the main `deepwork` skill folder.
14
+
15
+ **Process:**
16
+
17
+ 1. **List all jobs** in `.deepwork/jobs/`:
18
+ ```bash
19
+ ls .deepwork/jobs/
20
+ ```
21
+
22
+ 2. **For each job**, kick off a sub-agent to find and remove legacy skill folders. The sub-agent should:
23
+ - Search in both `.claude/skills/` and `.gemini/skills/`
24
+ - Find folders matching:
25
+ - `{job_name}/` - folder named exactly like the job
26
+ - `{job_name}.*/` - folders starting with the job name followed by a period (e.g., `my_job.step1/`, `my_job.step2/`)
27
+ - Remove each matching folder
28
+ - Report what was removed
29
+
30
+ **Example commands for a job named `competitive_research`:**
31
+ ```bash
32
+ # Find and remove from .claude/skills/
33
+ rm -rf .claude/skills/competitive_research/ 2>/dev/null
34
+ rm -rf .claude/skills/competitive_research.*/ 2>/dev/null
35
+
36
+ # Find and remove from .gemini/skills/
37
+ rm -rf .gemini/skills/competitive_research/ 2>/dev/null
38
+ rm -rf .gemini/skills/competitive_research.*/ 2>/dev/null
39
+ ```
40
+
41
+ 3. **Run sub-agents in parallel** - one for each job to speed up the process.
42
+
43
+ 4. **Verify the `deepwork` skill folder remains:**
44
+ ```bash
45
+ ls -d .claude/skills/deepwork/ 2>/dev/null || echo "ERROR: deepwork skill missing!"
46
+ ls -d .gemini/skills/deepwork/ 2>/dev/null || echo "WARNING: gemini deepwork skill missing (may not have been installed)"
47
+ ```
48
+
49
+ **CRITICAL:** The `deepwork` skill folder in `.claude/skills/deepwork/` MUST still exist after cleanup. If it is missing, something went wrong - do NOT proceed and investigate what happened.
50
+
51
+ **What this removes:**
52
+ ```
53
+ .claude/skills/
54
+ ├── competitive_research/ <- REMOVE (legacy job folder)
55
+ ├── competitive_research.discover/ <- REMOVE (legacy step folder)
56
+ ├── competitive_research.analyze/ <- REMOVE (legacy step folder)
57
+ ├── deepwork/ <- KEEP (current MCP entry point)
58
+ └── some_other_job/ <- REMOVE (legacy job folder)
59
+ ```
60
+
61
+ **Do NOT remove:**
62
+ - `.claude/skills/deepwork/` - This is the current MCP-based skill entry point
63
+ - `.gemini/skills/deepwork/` - Same for Gemini
64
+ - Any skill folders that don't match job names in `.deepwork/jobs/`
65
+
66
+ ### Step 2: Clean Temp Files
67
+
68
+ Check `.deepwork/tmp/` for accumulated temporary files:
69
+
70
+ ```bash
71
+ ls -la .deepwork/tmp/ 2>/dev/null || echo "No tmp folder"
72
+ ```
73
+
74
+ **Safe to delete:**
75
+ - `.deepwork/tmp/rules/queue/*.json` - Old rules queue files
76
+ - Any files older than 7 days
77
+ - Empty subdirectories
78
+
79
+ **Be careful with:**
80
+ - Files that might be in-progress work
81
+ - Anything with recent modification times
82
+
83
+ ```bash
84
+ # Clean old queue files
85
+ rm -rf .deepwork/tmp/rules/queue/*.json 2>/dev/null
86
+
87
+ # Remove empty directories
88
+ find .deepwork/tmp -type d -empty -delete 2>/dev/null
89
+ ```
90
+
91
+ ### Step 3: Remove Rules Folder (Fully Deprecated)
92
+
93
+ DeepWork Rules have been completely removed from the system. Delete the `.deepwork/rules/` folder and all related items:
94
+
95
+ ```bash
96
+ rm -rf .deepwork/rules/ 2>/dev/null
97
+ rm -rf .deepwork/tmp/rules/ 2>/dev/null
98
+ rm -rf .deepwork/jobs/deepwork_rules/ 2>/dev/null
99
+ ```
100
+
101
+ ### Step 4: Update Config Version
102
+
103
+ Check `.deepwork/config.yml` for outdated version format:
104
+
105
+ ```bash
106
+ cat .deepwork/config.yml
107
+ ```
108
+
109
+ **Old format:**
110
+ ```yaml
111
+ version: 1.0.0
112
+ platforms:
113
+ - claude
114
+ ```
115
+
116
+ **Current format:**
117
+ ```yaml
118
+ version: "1.0"
119
+ platforms:
120
+ - claude
121
+ ```
122
+
123
+ Update if needed to match current schema expectations.
124
+
125
+ ### Step 5: Remove Other Obsolete Files
126
+
127
+ Check for and remove other obsolete files:
128
+
129
+ | File/Pattern | Description | Action |
130
+ |--------------|-------------|--------|
131
+ | `.deepwork/.last_head_ref` | Git state tracking | Keep (used by MCP) |
132
+ | `.deepwork/.last_work_tree` | Git state tracking | Keep (used by MCP) |
133
+ | `.deepwork/.gitignore` | Ignore patterns | Review and update |
134
+ | `.claude/commands/` | Generated commands | Keep (current system) |
135
+ | `.claude/settings.local.json` | Local overrides | Keep (user settings) |
136
+
137
+ ### Step 6: Verify Git Status
138
+
139
+ Check that the cleanup hasn't left untracked garbage:
140
+
141
+ ```bash
142
+ git status
143
+ ```
144
+
145
+ **Review:**
146
+ - Deleted files should show as deleted
147
+ - No new untracked files should appear (unless intentionally created)
148
+ - Backup files (`.backup`) should be in `.gitignore` or cleaned up
149
+
150
+ ## Important Notes
151
+
152
+ 1. **Always back up before deleting** - User data is irreplaceable
153
+ 2. **Ask before destructive actions** - When in doubt, ask the user
154
+ 3. **Don't auto-commit** - Let the user review and commit changes themselves