deepwork 0.2.0__py3-none-any.whl → 0.3.1__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 (54) hide show
  1. deepwork/cli/install.py +116 -71
  2. deepwork/cli/sync.py +20 -20
  3. deepwork/core/adapters.py +88 -51
  4. deepwork/core/command_executor.py +173 -0
  5. deepwork/core/generator.py +148 -31
  6. deepwork/core/hooks_syncer.py +51 -25
  7. deepwork/core/parser.py +8 -0
  8. deepwork/core/pattern_matcher.py +271 -0
  9. deepwork/core/rules_parser.py +559 -0
  10. deepwork/core/rules_queue.py +321 -0
  11. deepwork/hooks/README.md +181 -0
  12. deepwork/hooks/__init__.py +77 -1
  13. deepwork/hooks/claude_hook.sh +55 -0
  14. deepwork/hooks/gemini_hook.sh +55 -0
  15. deepwork/hooks/rules_check.py +700 -0
  16. deepwork/hooks/wrapper.py +363 -0
  17. deepwork/schemas/job_schema.py +14 -1
  18. deepwork/schemas/rules_schema.py +135 -0
  19. deepwork/standard_jobs/deepwork_jobs/job.yml +35 -53
  20. deepwork/standard_jobs/deepwork_jobs/steps/define.md +9 -6
  21. deepwork/standard_jobs/deepwork_jobs/steps/implement.md +28 -26
  22. deepwork/standard_jobs/deepwork_jobs/steps/learn.md +2 -2
  23. deepwork/standard_jobs/deepwork_rules/hooks/capture_prompt_work_tree.sh +30 -0
  24. deepwork/standard_jobs/deepwork_rules/hooks/global_hooks.yml +8 -0
  25. deepwork/standard_jobs/deepwork_rules/job.yml +47 -0
  26. deepwork/standard_jobs/deepwork_rules/rules/.gitkeep +13 -0
  27. deepwork/standard_jobs/deepwork_rules/rules/api-documentation-sync.md.example +10 -0
  28. deepwork/standard_jobs/deepwork_rules/rules/readme-documentation.md.example +10 -0
  29. deepwork/standard_jobs/deepwork_rules/rules/security-review.md.example +11 -0
  30. deepwork/standard_jobs/deepwork_rules/rules/skill-md-validation.md +46 -0
  31. deepwork/standard_jobs/deepwork_rules/rules/source-test-pairing.md.example +13 -0
  32. deepwork/standard_jobs/deepwork_rules/steps/define.md +249 -0
  33. deepwork/templates/claude/skill-job-meta.md.jinja +70 -0
  34. deepwork/templates/claude/skill-job-step.md.jinja +198 -0
  35. deepwork/templates/gemini/skill-job-meta.toml.jinja +76 -0
  36. deepwork/templates/gemini/skill-job-step.toml.jinja +147 -0
  37. {deepwork-0.2.0.dist-info → deepwork-0.3.1.dist-info}/METADATA +56 -25
  38. deepwork-0.3.1.dist-info/RECORD +62 -0
  39. deepwork/core/policy_parser.py +0 -295
  40. deepwork/hooks/evaluate_policies.py +0 -376
  41. deepwork/schemas/policy_schema.py +0 -78
  42. deepwork/standard_jobs/deepwork_policy/hooks/capture_prompt_work_tree.sh +0 -27
  43. deepwork/standard_jobs/deepwork_policy/hooks/global_hooks.yml +0 -8
  44. deepwork/standard_jobs/deepwork_policy/hooks/policy_stop_hook.sh +0 -56
  45. deepwork/standard_jobs/deepwork_policy/job.yml +0 -35
  46. deepwork/standard_jobs/deepwork_policy/steps/define.md +0 -195
  47. deepwork/templates/claude/command-job-step.md.jinja +0 -210
  48. deepwork/templates/default_policy.yml +0 -53
  49. deepwork/templates/gemini/command-job-step.toml.jinja +0 -169
  50. deepwork-0.2.0.dist-info/RECORD +0 -49
  51. /deepwork/standard_jobs/{deepwork_policy → deepwork_rules}/hooks/user_prompt_submit.sh +0 -0
  52. {deepwork-0.2.0.dist-info → deepwork-0.3.1.dist-info}/WHEEL +0 -0
  53. {deepwork-0.2.0.dist-info → deepwork-0.3.1.dist-info}/entry_points.txt +0 -0
  54. {deepwork-0.2.0.dist-info → deepwork-0.3.1.dist-info}/licenses/LICENSE.md +0 -0
@@ -0,0 +1,70 @@
1
+ {#
2
+ Template: skill-job-meta.md.jinja
3
+ Purpose: Generates the job overview skill file for Claude Code
4
+
5
+ Template Variables:
6
+ - job_name: string - Job identifier (e.g., "competitive_research")
7
+ - job_summary: string - Short one-line summary of the job
8
+ - job_description: string|null - Full description (optional)
9
+ - total_steps: int - Number of steps in the job
10
+ - steps: list - Array of step objects:
11
+ - id: string - Step identifier
12
+ - name: string - Human-readable step name
13
+ - description: string - What the step does
14
+ - command_name: string - Slash command (e.g., "job_name.step_id")
15
+ - dependencies: list[string]|null - Required prior steps
16
+ #}
17
+ ---
18
+ name: {{ job_name }}
19
+ description: "{{ job_summary }}"
20
+ ---
21
+
22
+ # {{ job_name }}
23
+
24
+ **Multi-step workflow**: {{ job_summary }}
25
+
26
+ > **CRITICAL**: Always invoke steps using the Skill tool. Never copy/paste step instructions directly.
27
+
28
+ {% if job_description %}
29
+ {{ job_description }}
30
+ {% endif %}
31
+
32
+ ## Available Steps
33
+
34
+ {% for step in steps %}
35
+ {{ loop.index }}. **{{ step.id }}** - {{ step.description }}{% if step.dependencies %} (requires: {{ step.dependencies | join(', ') }}){% endif %}
36
+
37
+ {% endfor %}
38
+
39
+ ## Execution Instructions
40
+
41
+ ### Step 1: Analyze Intent
42
+
43
+ Parse any text following `/{{ job_name }}` to determine user intent:
44
+ {% for step in steps %}
45
+ - "{{ step.id }}" or related terms → start at `{{ step.command_name }}`
46
+ {% endfor %}
47
+
48
+ ### Step 2: Invoke Starting Step
49
+
50
+ Use the Skill tool to invoke the identified starting step:
51
+ ```
52
+ Skill tool: {{ steps[0].command_name }}
53
+ ```
54
+
55
+ ### Step 3: Continue Workflow Automatically
56
+
57
+ After each step completes:
58
+ 1. Check if there's a next step in the sequence
59
+ 2. Invoke the next step using the Skill tool
60
+ 3. Repeat until workflow is complete or user intervenes
61
+
62
+ ### Handling Ambiguous Intent
63
+
64
+ If user intent is unclear, use AskUserQuestion to clarify:
65
+ - Present available steps as numbered options
66
+ - Let user select the starting point
67
+
68
+ ## Context Files
69
+
70
+ - Job definition: `.deepwork/jobs/{{ job_name }}/job.yml`
@@ -0,0 +1,198 @@
1
+ {#
2
+ Template: skill-job-step.md.jinja
3
+ Purpose: Generates individual step skill files for Claude Code
4
+
5
+ Template Variables:
6
+ Job Context:
7
+ - job_name: string - Job identifier
8
+ - job_summary: string - Short job summary
9
+ - job_description: string|null - Full job description
10
+
11
+ Step Metadata:
12
+ - step_id: string - Step identifier
13
+ - step_description: string - What this step does
14
+ - step_number: int - Position in workflow (1-indexed)
15
+ - total_steps: int - Total steps in job
16
+ - is_standalone: bool - True if step can run independently
17
+ - exposed: bool - True if user can invoke directly (default: true)
18
+ - dependencies: list[string]|null - Required prior step IDs
19
+ - next_step: string|null - Next step ID in workflow
20
+ - instructions_file: string - Path to step instructions file
21
+
22
+ Step Content:
23
+ - instructions_content: string - Full instructions markdown
24
+ - user_inputs: list|null - User parameters to gather:
25
+ - name: string - Parameter name
26
+ - description: string - What to ask for
27
+ - file_inputs: list|null - Files from previous steps:
28
+ - file: string - File path
29
+ - from_step: string - Source step ID
30
+ - outputs: list[string]|null - Output file paths
31
+
32
+ Quality & Hooks:
33
+ - quality_criteria: list[string]|null - Criteria for completion
34
+ - stop_hooks: list|null - Stop hook configurations:
35
+ - type: "script"|"prompt"
36
+ - path: string (for script)
37
+ - content: string (for prompt)
38
+ - hooks: dict|null - All hooks by event name (Stop, PreToolUse, etc.)
39
+ #}
40
+ ---
41
+ name: {{ job_name }}.{{ step_id }}
42
+ description: "{{ step_description }}"
43
+ {% if not exposed %}
44
+ user-invocable: false
45
+ {% endif %}
46
+ {% if quality_criteria or hooks %}
47
+ hooks:
48
+ {% if quality_criteria %}
49
+ Stop:
50
+ - hooks:
51
+ - type: prompt
52
+ prompt: |
53
+ You must evaluate whether Claude has met all the below quality criteria for the request.
54
+
55
+ ## Quality Criteria
56
+
57
+ {% for criterion in quality_criteria %}
58
+ {{ loop.index }}. {{ criterion }}
59
+ {% endfor %}
60
+
61
+ ## Instructions
62
+
63
+ Review the conversation and determine if ALL quality criteria above have been satisfied.
64
+ Look for evidence that each criterion has been addressed.
65
+
66
+ If the agent has included `<promise>✓ Quality Criteria Met</promise>` in their response AND
67
+ all criteria appear to be met, respond with: {"ok": true}
68
+
69
+ If criteria are NOT met OR the promise tag is missing, respond with:
70
+ {"ok": false, "reason": "**AGENT: TAKE ACTION** - [which criteria failed and why]"}
71
+ {% endif %}
72
+ {% for event_name, event_hooks in hooks.items() %}
73
+ {% if not (event_name == "Stop" and quality_criteria) %}
74
+ {{ event_name }}:
75
+ - hooks:
76
+ {% for hook in event_hooks %}
77
+ {% if hook.type == "script" %}
78
+ - type: command
79
+ command: ".deepwork/jobs/{{ job_name }}/{{ hook.path }}"
80
+ {% else %}
81
+ - type: prompt
82
+ prompt: |
83
+ {{ hook.content | indent(12) }}
84
+ {% endif %}
85
+ {% endfor %}
86
+ {% endif %}
87
+ {% endfor %}
88
+ {% endif %}
89
+ ---
90
+
91
+ # {{ job_name }}.{{ step_id }}
92
+
93
+ {% if is_standalone %}
94
+ **Standalone skill** - can be run anytime
95
+ {% else %}
96
+ **Step {{ step_number }}/{{ total_steps }}** in **{{ job_name }}** workflow
97
+ {% endif %}
98
+
99
+ > {{ job_summary }}
100
+
101
+ {% if dependencies %}
102
+ ## Prerequisites (Verify First)
103
+
104
+ Before proceeding, confirm these steps are complete:
105
+ {% for dep in dependencies %}
106
+ - `/{{ job_name }}.{{ dep }}`
107
+ {% endfor %}
108
+ {% endif %}
109
+
110
+ ## Instructions
111
+
112
+ **Goal**: {{ step_description }}
113
+
114
+ {{ instructions_content }}
115
+
116
+ {% if job_description %}
117
+ ### Job Context
118
+
119
+ {{ job_description }}
120
+ {% endif %}
121
+
122
+ {% if user_inputs or file_inputs %}
123
+ ## Required Inputs
124
+
125
+ {% if user_inputs %}
126
+ **User Parameters** - Gather from user before starting:
127
+ {% for input in user_inputs %}
128
+ - **{{ input.name }}**: {{ input.description }}
129
+ {% endfor %}
130
+ {% endif %}
131
+
132
+ {% if file_inputs %}
133
+ **Files from Previous Steps** - Read these first:
134
+ {% for input in file_inputs %}
135
+ - `{{ input.file }}` (from `{{ input.from_step }}`)
136
+ {% endfor %}
137
+ {% endif %}
138
+ {% endif %}
139
+
140
+ ## Work Branch
141
+
142
+ Use branch format: `deepwork/{{ job_name }}-[instance]-YYYYMMDD`
143
+
144
+ - If on a matching work branch: continue using it
145
+ - If on main/master: create new branch with `git checkout -b deepwork/{{ job_name }}-[instance]-$(date +%Y%m%d)`
146
+
147
+ ## Outputs
148
+
149
+ {% if outputs %}
150
+ **Required outputs**:
151
+ {% for output in outputs %}
152
+ - `{{ output }}`{% if output.endswith('/') %} (directory){% endif %}
153
+ {% endfor %}
154
+ {% else %}
155
+ No specific file outputs required.
156
+ {% endif %}
157
+
158
+ {% if quality_criteria or stop_hooks %}
159
+ ## Quality Validation
160
+
161
+ Stop hooks will automatically validate your work. The loop continues until all criteria pass.
162
+
163
+ {% if quality_criteria %}
164
+ **Criteria (all must be satisfied)**:
165
+ {% for criterion in quality_criteria %}
166
+ {{ loop.index }}. {{ criterion }}
167
+ {% endfor %}
168
+ {% endif %}
169
+
170
+ {% for hook in stop_hooks %}
171
+ {% if hook.type == "script" %}
172
+ **Validation script**: `.deepwork/jobs/{{ job_name }}/{{ hook.path }}` (runs automatically)
173
+ {% endif %}
174
+ {% endfor %}
175
+
176
+ **To complete**: Include `<promise>✓ Quality Criteria Met</promise>` in your final response only after verifying ALL criteria are satisfied.
177
+
178
+ {% endif %}
179
+ ## On Completion
180
+
181
+ {% if is_standalone %}
182
+ 1. Verify outputs are created
183
+ 2. Inform user: "{{ step_id }} complete{% if outputs %}, outputs: {{ outputs | join(', ') }}{% endif %}"
184
+
185
+ This standalone skill can be re-run anytime.
186
+ {% else %}
187
+ 1. Verify outputs are created
188
+ 2. Inform user: "Step {{ step_number }}/{{ total_steps }} complete{% if outputs %}, outputs: {{ outputs | join(', ') }}{% endif %}"
189
+ {% if next_step %}
190
+ 3. **Continue workflow**: Use Skill tool to invoke `/{{ job_name }}.{{ next_step }}`
191
+ {% else %}
192
+ 3. **Workflow complete**: All steps finished. Consider creating a PR to merge the work branch.
193
+ {% endif %}
194
+ {% endif %}
195
+
196
+ ---
197
+
198
+ **Reference files**: `.deepwork/jobs/{{ job_name }}/job.yml`, `.deepwork/jobs/{{ job_name }}/{{ instructions_file }}`
@@ -0,0 +1,76 @@
1
+ {#
2
+ Template: skill-job-meta.toml.jinja
3
+ Purpose: Generates the job overview skill file for Gemini CLI
4
+
5
+ Template Variables:
6
+ - job_name: string - Job identifier (e.g., "competitive_research")
7
+ - job_summary: string - Short one-line summary of the job
8
+ - job_description: string|null - Full description (optional)
9
+ - total_steps: int - Number of steps in the job
10
+ - steps: list - Array of step objects:
11
+ - id: string - Step identifier
12
+ - name: string - Human-readable step name
13
+ - description: string - What the step does
14
+ - command_name: string - Slash command (e.g., "job_name:step_id")
15
+ - dependencies: list[string]|null - Required prior steps
16
+
17
+ Note: Gemini uses TOML format with description + prompt fields.
18
+ Commands use colon separator (/job_name:step_id) not period.
19
+ #}
20
+ # {{ job_name }}
21
+ #
22
+ # {{ job_summary }}
23
+ #
24
+ # Generated by DeepWork - do not edit manually
25
+
26
+ description = "{{ job_summary | replace('"', '\\"') }}"
27
+
28
+ prompt = """
29
+ # {{ job_name }}
30
+
31
+ **Multi-step workflow**: {{ job_summary }}
32
+
33
+ > **NOTE**: Gemini CLI requires manual command invocation. After each step, tell the user which command to run next.
34
+
35
+ {% if job_description %}
36
+ {{ job_description }}
37
+ {% endif %}
38
+
39
+ ## Available Steps
40
+
41
+ {% for step in steps %}
42
+ {{ loop.index }}. **{{ step.id }}** - {{ step.description }}{% if step.dependencies %} (requires: {{ step.dependencies | join(', ') }}){% endif %}
43
+
44
+ Command: `/{{ step.command_name }}`
45
+ {% endfor %}
46
+
47
+ ## Execution Instructions
48
+
49
+ ### Step 1: Analyze Intent
50
+
51
+ Parse any text following `/{{ job_name }}` to determine user intent:
52
+ {% for step in steps %}
53
+ - "{{ step.id }}" or related terms → start at `/{{ step.command_name }}`
54
+ {% endfor %}
55
+
56
+ ### Step 2: Direct User to Starting Step
57
+
58
+ Tell the user which command to run:
59
+ ```
60
+ /{{ steps[0].command_name }}
61
+ ```
62
+
63
+ ### Step 3: Guide Through Workflow
64
+
65
+ After each step completes, tell the user the next command to run until workflow is complete.
66
+
67
+ ### Handling Ambiguous Intent
68
+
69
+ If user intent is unclear:
70
+ - Present available steps as numbered options
71
+ - Ask user to select the starting point
72
+
73
+ ## Reference
74
+
75
+ - Job definition: `.deepwork/jobs/{{ job_name }}/job.yml`
76
+ """
@@ -0,0 +1,147 @@
1
+ {#
2
+ Template: skill-job-step.toml.jinja
3
+ Purpose: Generates individual step skill files for Gemini CLI
4
+
5
+ Template Variables:
6
+ Job Context:
7
+ - job_name: string - Job identifier
8
+ - job_summary: string - Short job summary
9
+ - job_description: string|null - Full job description
10
+
11
+ Step Metadata:
12
+ - step_id: string - Step identifier
13
+ - step_description: string - What this step does
14
+ - step_number: int - Position in workflow (1-indexed)
15
+ - total_steps: int - Total steps in job
16
+ - is_standalone: bool - True if step can run independently
17
+ - dependencies: list[string]|null - Required prior step IDs
18
+ - next_step: string|null - Next step ID in workflow
19
+ - instructions_file: string - Path to step instructions file
20
+
21
+ Step Content:
22
+ - instructions_content: string - Full instructions markdown
23
+ - user_inputs: list|null - User parameters to gather:
24
+ - name: string - Parameter name
25
+ - description: string - What to ask for
26
+ - file_inputs: list|null - Files from previous steps:
27
+ - file: string - File path
28
+ - from_step: string - Source step ID
29
+ - outputs: list[string]|null - Output file paths
30
+
31
+ Quality:
32
+ - quality_criteria: list[string]|null - Criteria for completion
33
+ - stop_hooks: list|null - Stop hook configurations (note: Gemini
34
+ does not support automated hooks, so these are for manual verification)
35
+
36
+ Note: Gemini uses TOML format with description + prompt fields.
37
+ Commands use colon separator (/job_name:step_id) not period.
38
+ #}
39
+ # {{ job_name }}:{{ step_id }}
40
+ #
41
+ # {{ step_description }}
42
+ #
43
+ # Generated by DeepWork - do not edit manually
44
+
45
+ description = "{{ step_description | replace('"', '\\"') }}"
46
+
47
+ prompt = """
48
+ # {{ job_name }}:{{ step_id }}
49
+
50
+ {% if is_standalone %}
51
+ **Standalone command** - can be run anytime
52
+ {% else %}
53
+ **Step {{ step_number }}/{{ total_steps }}** in **{{ job_name }}** workflow
54
+ {% endif %}
55
+
56
+ > {{ job_summary }}
57
+
58
+ {% if dependencies %}
59
+ ## Prerequisites (Verify First)
60
+
61
+ Before proceeding, confirm these steps are complete:
62
+ {% for dep in dependencies %}
63
+ - `/{{ job_name }}:{{ dep }}`
64
+ {% endfor %}
65
+ {% endif %}
66
+
67
+ ## Instructions
68
+
69
+ **Goal**: {{ step_description }}
70
+
71
+ {{ instructions_content }}
72
+
73
+ {% if job_description %}
74
+ ### Job Context
75
+
76
+ {{ job_description }}
77
+ {% endif %}
78
+
79
+ {% if user_inputs or file_inputs %}
80
+ ## Required Inputs
81
+
82
+ {% if user_inputs %}
83
+ **User Parameters** - Gather from user before starting:
84
+ {% for input in user_inputs %}
85
+ - **{{ input.name }}**: {{ input.description }}
86
+ {% endfor %}
87
+ {% endif %}
88
+
89
+ {% if file_inputs %}
90
+ **Files from Previous Steps** - Read these first:
91
+ {% for input in file_inputs %}
92
+ - `{{ input.file }}` (from `{{ input.from_step }}`)
93
+ {% endfor %}
94
+ {% endif %}
95
+ {% endif %}
96
+
97
+ ## Work Branch
98
+
99
+ Use branch format: `deepwork/{{ job_name }}-[instance]-YYYYMMDD`
100
+
101
+ - If on a matching work branch: continue using it
102
+ - If on main/master: create new branch with `git checkout -b deepwork/{{ job_name }}-[instance]-$(date +%Y%m%d)`
103
+
104
+ ## Outputs
105
+
106
+ {% if outputs %}
107
+ **Required outputs**:
108
+ {% for output in outputs %}
109
+ - `{{ output }}`{% if output.endswith('/') %} (directory){% endif %}
110
+ {% endfor %}
111
+ {% else %}
112
+ No specific file outputs required.
113
+ {% endif %}
114
+
115
+ {% if quality_criteria or stop_hooks %}
116
+ ## Quality Validation (Manual)
117
+
118
+ **NOTE**: Gemini CLI does not support automated validation. Manually verify criteria before completing.
119
+
120
+ {% if quality_criteria %}
121
+ **Criteria (all must be satisfied)**:
122
+ {% for criterion in quality_criteria %}
123
+ {{ loop.index }}. {{ criterion }}
124
+ {% endfor %}
125
+ {% endif %}
126
+ {% endif %}
127
+ ## On Completion
128
+
129
+ {% if is_standalone %}
130
+ 1. Verify outputs are created
131
+ 2. Inform user: "{{ step_id }} complete{% if outputs %}, outputs: {{ outputs | join(', ') }}{% endif %}"
132
+
133
+ This standalone command can be re-run anytime.
134
+ {% else %}
135
+ 1. Verify outputs are created
136
+ 2. Inform user: "Step {{ step_number }}/{{ total_steps }} complete{% if outputs %}, outputs: {{ outputs | join(', ') }}{% endif %}"
137
+ {% if next_step %}
138
+ 3. **Tell user next command**: `/{{ job_name }}:{{ next_step }}`
139
+ {% else %}
140
+ 3. **Workflow complete**: All steps finished. Consider creating a PR to merge the work branch.
141
+ {% endif %}
142
+ {% endif %}
143
+
144
+ ---
145
+
146
+ **Reference files**: `.deepwork/jobs/{{ job_name }}/job.yml`, `.deepwork/jobs/{{ job_name }}/{{ instructions_file }}`
147
+ """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepwork
3
- Version: 0.2.0
3
+ Version: 0.3.1
4
4
  Summary: Framework for enabling AI agents to perform complex, multi-step work tasks
5
5
  Project-URL: Homepage, https://github.com/deepwork/deepwork
6
6
  Project-URL: Documentation, https://github.com/deepwork/deepwork#readme
@@ -50,7 +50,7 @@ DeepWork is a tool for defining and executing multi-step workflows with AI codin
50
50
  | OpenCode | Planned | Markdown | No |
51
51
  | GitHub Copilot CLI | Planned | Markdown | No (tool permissions only) |
52
52
 
53
- > **Tip:** New to DeepWork? Claude Code has the most complete feature support, including quality validation hooks and automated policies. For browser automation, Claude in Chrome (Anthropic's browser extension) works well with DeepWork workflows.
53
+ > **Tip:** New to DeepWork? Claude Code has the most complete feature support, including quality validation hooks and automated rules. For browser automation, Claude in Chrome (Anthropic's browser extension) works well with DeepWork workflows.
54
54
 
55
55
  ## Easy Installation
56
56
  In your Agent CLI (ex. `claude`), ask:
@@ -96,8 +96,7 @@ This will:
96
96
  - Create `.deepwork/` directory structure
97
97
  - Generate core DeepWork jobs
98
98
  - Install DeepWork jobs for your AI assistant
99
- - Configure hooks for your AI assistant to enable policies
100
- - Create a `.deepwork.policy.yml` template file with example policies
99
+ - Configure hooks for your AI assistant to enable rules
101
100
 
102
101
  ## Quick Start
103
102
 
@@ -204,7 +203,7 @@ DeepWork follows a **Git-native, installation-only** design:
204
203
 
205
204
  - **No runtime daemon**: DeepWork is purely a CLI tool
206
205
  - **Git-based workflow**: All work happens on dedicated branches
207
- - **Skills as interface**: AI agents interact via generated markdown skill files
206
+ - **Skills as interface**: AI agents interact via generated skill files
208
207
  - **Platform-agnostic**: Works with any AI coding assistant that supports skills
209
208
 
210
209
  ### Directory Structure
@@ -213,16 +212,20 @@ DeepWork follows a **Git-native, installation-only** design:
213
212
  your-project/
214
213
  ├── .deepwork/
215
214
  │ ├── config.yml # Platform configuration
215
+ │ ├── rules/ # Rule definitions (v2 format)
216
+ │ │ └── rule-name.md # Individual rule files
217
+ │ ├── tmp/ # Temporary state (gitignored)
218
+ │ │ └── rules/queue/ # Rule evaluation queue
216
219
  │ └── jobs/ # Job definitions
217
220
  │ └── job_name/
218
221
  │ ├── job.yml # Job metadata
219
222
  │ └── steps/ # Step instructions
220
- ├── .claude/ # Claude Code commands (auto-generated)
221
- │ └── commands/
223
+ ├── .claude/ # Claude Code skills (auto-generated)
224
+ │ └── skills/
222
225
  │ ├── deepwork_jobs.define.md
223
226
  │ └── job_name.step_name.md
224
- └── .gemini/ # Gemini CLI commands (auto-generated)
225
- └── commands/
227
+ └── .gemini/ # Gemini CLI skills (auto-generated)
228
+ └── skills/
226
229
  └── job_name/
227
230
  └── step_name.toml
228
231
  ```
@@ -243,49 +246,76 @@ deepwork/
243
246
  │ ├── core/ # Core functionality
244
247
  │ │ ├── parser.py # Job definition parsing
245
248
  │ │ ├── detector.py # Platform detection
246
- │ │ └── generator.py # Skill file generation
249
+ │ │ ├── generator.py # Skill file generation
250
+ │ │ ├── rules_parser.py # Rule parsing
251
+ │ │ ├── pattern_matcher.py # Variable pattern matching
252
+ │ │ ├── rules_queue.py # Rule state queue
253
+ │ │ └── command_executor.py # Command action execution
254
+ │ ├── hooks/ # Cross-platform hook wrappers
255
+ │ │ ├── wrapper.py # Input/output normalization
256
+ │ │ ├── rules_check.py # Rule evaluation hook
257
+ │ │ ├── claude_hook.sh # Claude Code adapter
258
+ │ │ └── gemini_hook.sh # Gemini CLI adapter
247
259
  │ ├── templates/ # Jinja2 templates
248
260
  │ │ ├── claude/ # Claude Code templates
249
261
  │ │ └── gemini/ # Gemini CLI templates
250
262
  │ ├── schemas/ # JSON schemas
251
263
  │ └── utils/ # Utilities (fs, yaml, git, validation)
252
264
  ├── tests/
253
- │ ├── unit/ # Unit tests (147 tests)
254
- │ ├── integration/ # Integration tests (19 tests)
265
+ │ ├── unit/ # Unit tests
266
+ │ ├── integration/ # Integration tests
255
267
  │ └── fixtures/ # Test fixtures
256
268
  └── doc/ # Documentation
257
269
  ```
258
270
 
259
271
  ## Features
260
272
 
261
- ### 📋 Job Definition
273
+ ### Job Definition
262
274
  Define structured, multi-step workflows where each step has clear requirements and produces specific results.
263
275
  - **Dependency Management**: Explicitly link steps with automatic sequence handling and cycle detection.
264
276
  - **Artifact Passing**: Seamlessly use file outputs from one step as inputs for future steps.
265
277
  - **Dynamic Inputs**: Support for both fixed file references and interactive user parameters.
266
278
  - **Human-Readable YAML**: Simple, declarative job definitions that are easy to version and maintain.
267
279
 
268
- ### 🌿 Git-Native Workflow
280
+ ### Git-Native Workflow
269
281
  Maintain a clean repository with automatic branch management and isolation.
270
282
  - **Automatic Branching**: Every job execution happens on a dedicated work branch (e.g., `deepwork/my-job-2024`).
271
283
  - **Namespace Isolation**: Run multiple concurrent jobs or instances without versioning conflicts.
272
284
  - **Full Traceability**: All AI-generated changes, logs, and artifacts are tracked natively in your Git history.
273
285
 
274
- ### 🛡️ Automated Policies
275
- Enforce project standards and best practices without manual oversight. Policies monitor file changes and automatically prompt your AI assistant to follow specific guidelines when relevant code is modified.
276
- - **Automatic Triggers**: Detect when specific files or directories are changed to fire relevant policies.
286
+ ### Automated Rules
287
+ Enforce project standards and best practices without manual oversight. Rules monitor file changes and automatically prompt your AI assistant to follow specific guidelines when relevant code is modified.
288
+ - **Automatic Triggers**: Detect when specific files or directories are changed to fire relevant rules.
289
+ - **File Correspondence**: Define bidirectional (set) or directional (pair) relationships between files.
290
+ - **Command Actions**: Run idempotent commands (formatters, linters) automatically when files change.
277
291
  - **Contextual Guidance**: Instructions are injected directly into the AI's workflow at the right moment.
278
- - **Common Use Cases**: Keep documentation in sync, enforce security reviews, or automate changelog updates.
279
292
 
280
- **Example Policy**:
281
- ```yaml
282
- # Enforce documentation updates when config changes
283
- - name: "Update docs on config changes"
284
- trigger: "app/config/**/*"
285
- instructions: "Configuration files changed. Please update docs/install_guide.md."
293
+ **Example Rule** (`.deepwork/rules/source-test-pairing.md`):
294
+ ```markdown
295
+ ---
296
+ name: Source/Test Pairing
297
+ set:
298
+ - src/{path}.py
299
+ - tests/{path}_test.py
300
+ compare_to: base
301
+ ---
302
+ When source files change, corresponding test files should also change.
303
+ Please create or update tests for the modified source files.
304
+ ```
305
+
306
+ **Example Command Rule** (`.deepwork/rules/format-python.md`):
307
+ ```markdown
308
+ ---
309
+ name: Format Python
310
+ trigger: "**/*.py"
311
+ action:
312
+ command: "ruff format {file}"
313
+ run_for: each_match
314
+ compare_to: prompt
315
+ ---
286
316
  ```
287
317
 
288
- ### 🚀 Multi-Platform Support
318
+ ### Multi-Platform Support
289
319
  Generate native commands and skills tailored for your AI coding assistant.
290
320
  - **Native Integration**: Works directly with the skill/command formats of supported agents.
291
321
  - **Context-Aware**: Skills include all necessary context (instructions, inputs, and dependencies) for the AI.
@@ -311,3 +341,4 @@ For commercial use or questions about licensing, please contact legal@unsupervis
311
341
  ## Credits
312
342
 
313
343
  - Inspired by [GitHub's spec-kit](https://github.com/github/spec-kit)
344
+