Skip to content

Commit 38f333e

Browse files
authored
Merge branch 'main' into claude/add-github-actions-X86q6
2 parents a6868a1 + c9be69f commit 38f333e

21 files changed

Lines changed: 2117 additions & 43 deletions

File tree

.claude/commands/deepwork_jobs.define.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,54 @@ After gathering information about all steps:
141141
- Job description (detailed multi-line explanation)
142142
- Version number (start with 1.0.0)
143143

144-
### Step 4: Create the job.yml Specification
144+
### Step 4: Define Quality Validation (Stop Hooks)
145+
146+
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.
147+
148+
**Ask the user about quality validation:**
149+
- "Are there specific quality criteria that must be met for this step?"
150+
- "Would you like the agent to validate its work before completing?"
151+
- "What would make you send the work back for revision?"
152+
153+
**Stop hooks are particularly valuable for:**
154+
- Steps with complex outputs that need multiple checks
155+
- Steps where quality is critical (final deliverables)
156+
- Steps with subjective quality criteria that benefit from AI self-review
157+
158+
**Three types of stop hooks are supported:**
159+
160+
1. **Inline Prompt** (`prompt`) - Best for simple quality criteria
161+
```yaml
162+
stop_hooks:
163+
- prompt: |
164+
Verify the output meets these criteria:
165+
1. Contains at least 5 competitors
166+
2. Each competitor has a description
167+
3. Selection rationale is clear
168+
```
169+
170+
2. **Prompt File** (`prompt_file`) - For detailed/reusable criteria
171+
```yaml
172+
stop_hooks:
173+
- prompt_file: hooks/quality_check.md
174+
```
175+
176+
3. **Script** (`script`) - For programmatic validation (tests, linting)
177+
```yaml
178+
stop_hooks:
179+
- script: hooks/run_tests.sh
180+
```
181+
182+
**Multiple hooks can be combined:**
183+
```yaml
184+
stop_hooks:
185+
- script: hooks/lint_output.sh
186+
- prompt: "Verify the content is comprehensive and well-organized"
187+
```
188+
189+
**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).
190+
191+
### Step 5: Create the job.yml Specification
145192

146193
Only after you have complete understanding, create the `job.yml` file:
147194

@@ -182,6 +229,13 @@ steps:
182229
outputs:
183230
- [output_filename_or_path] # e.g., "report.md" or "reports/analysis.md"
184231
dependencies: [] # List of step IDs that must complete first
232+
# Optional: Quality validation hooks
233+
stop_hooks:
234+
- prompt: |
235+
Verify this step's output meets quality criteria:
236+
1. [Criterion 1]
237+
2. [Criterion 2]
238+
If ALL criteria are met, include `<promise>QUALITY_COMPLETE</promise>`.
185239

186240
- id: [another_step]
187241
name: "[Another Step]"

.claude/commands/deepwork_jobs.implement.md

Lines changed: 112 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ hooks:
1616
3. **Specific & Actionable**: Are instructions tailored to each step's purpose, not generic?
1717
4. **Output Examples**: Does each instruction file show what good output looks like?
1818
5. **Quality Criteria**: Does each instruction file define quality criteria for its outputs?
19-
6. **Registry Updated**: Is `.deepwork/registry.yml` updated with the new job?
20-
7. **Sync Complete**: Has `deepwork sync` been run successfully?
21-
8. **Commands Available**: Are the slash-commands generated in `.claude/commands/`?
22-
9. **Summary Created**: Has `implementation_summary.md` been created?
19+
6. **Sync Complete**: Has `deepwork sync` been run successfully?
20+
7. **Commands Available**: Are the slash-commands generated in `.claude/commands/`?
21+
8. **Summary Created**: Has `implementation_summary.md` been created?
22+
9. **Policies Considered**: Have you thought about whether policies would benefit this job?
23+
- If relevant policies were identified, did you explain them and offer to run `/deepwork_policy.define`?
24+
- Not every job needs policies - only suggest when genuinely helpful.
2325
2426
If ANY criterion is not met, continue working to address it.
2527
If ALL criteria are satisfied, include `<promise>QUALITY_COMPLETE</promise>` in your response.
@@ -73,13 +75,12 @@ Generate the DeepWork job directory structure and instruction files for each ste
7375

7476
## Task
7577

76-
Read the `job.yml` specification file and create all the necessary files to make the job functional, including directory structure, step instruction files, and registry entry. Then sync the commands to make them available.
78+
Read the `job.yml` specification file and create all the necessary files to make the job functional, including directory structure and step instruction files. Then sync the commands to make them available.
7779

7880
### Step 1: Read and Validate the Specification
7981

8082
1. **Locate the job.yml file**
81-
- Read `deepwork/[job_name]/job.yml` from the define step
82-
- (Where `[job_name]` is the name of the new job that was created in the define step)
83+
- Read `deepwork/[job_name]/job.yml` from the define step (Where `[job_name]` is the name of the new job that was created in the define step)
8384
- Parse the YAML content
8485

8586
2. **Validate the specification**
@@ -178,30 +179,49 @@ Each instruction file should follow this structure:
178179
3. **Provide examples** - Show what good output looks like
179180
4. **Explain the "why"** - Help the user understand the step's role in the workflow
180181
5. **Quality over quantity** - Detailed, actionable instructions are better than vague ones
182+
6. **Align with stop hooks** - If the step has `stop_hooks` defined, ensure the quality criteria in the instruction file match the validation criteria in the hooks
181183

182-
### Step 4: Copy job.yml to Job Directory
184+
### Handling Stop Hooks
183185

184-
Copy the validated `job.yml` from the work directory to `.deepwork/jobs/[job_name]/job.yml`:
186+
If a step in the job.yml has `stop_hooks` defined, the generated instruction file should:
185187

186-
```bash
187-
cp deepwork/[job_name]/job.yml .deepwork/jobs/[job_name]/job.yml
188-
```
188+
1. **Mirror the quality criteria** - The "Quality Criteria" section should match what the stop hooks will validate
189+
2. **Be explicit about success** - Help the agent understand when the step is truly complete
190+
3. **Include the promise pattern** - Mention that `<promise>QUALITY_COMPLETE</promise>` should be included when criteria are met
189191

190-
### Step 5: Register the Job
192+
**Example: If the job.yml has:**
193+
```yaml
194+
- id: research_competitors
195+
name: "Research Competitors"
196+
stop_hooks:
197+
- prompt: |
198+
Verify the research meets criteria:
199+
1. Each competitor has at least 3 data points
200+
2. Sources are cited
201+
3. Information is current (within last year)
202+
```
191203
192-
Update `.deepwork/registry.yml` to register the new job:
204+
**The instruction file should include:**
205+
```markdown
206+
## Quality Criteria
193207

194-
```yaml
195-
jobs:
196-
[job_name]:
197-
version: "[version]"
198-
summary: "[summary]"
199-
path: "[job_name]"
208+
- Each competitor has at least 3 distinct data points
209+
- All information is sourced with citations
210+
- Data is current (from within the last year)
211+
- When all criteria are met, include `<promise>QUALITY_COMPLETE</promise>` in your response
200212
```
201213
202-
**Important**: Don't overwrite existing jobs in the registry - add to it.
214+
This alignment ensures the AI agent knows exactly what will be validated and can self-check before completing.
203215
204-
### Step 6: Sync Commands
216+
### Step 4: Copy job.yml to Job Directory
217+
218+
Copy the validated `job.yml` from the work directory to `.deepwork/jobs/[job_name]/job.yml`:
219+
220+
```bash
221+
cp deepwork/[job_name]/job.yml .deepwork/jobs/[job_name]/job.yml
222+
```
223+
224+
### Step 5: Sync Commands
205225

206226
Run `deepwork sync` to generate the slash-commands for this job:
207227

@@ -214,12 +234,72 @@ This will:
214234
- Generate slash-commands for each step
215235
- Make the commands available in `.claude/commands/` (or appropriate platform directory)
216236

217-
### Step 7: Reload Commands
237+
### Step 6: Reload Commands
218238

219239
Instruct the user to reload commands in their current session:
220240
- Run `/reload` command (if available)
221241
- Or restart the Claude session
222242

243+
### Step 7: Consider Policies for the New Job
244+
245+
After implementing the job, consider whether there are **policies** that would help enforce quality or consistency when working with this job's domain.
246+
247+
**What are policies?**
248+
249+
Policies are automated guardrails defined in `.deepwork.policy.yml` that trigger when certain files change during an AI session. They help ensure:
250+
- Documentation stays in sync with code
251+
- Team guidelines are followed
252+
- Architectural decisions are respected
253+
- Quality standards are maintained
254+
255+
**When to suggest policies:**
256+
257+
Think about the job you just implemented and ask:
258+
- Does this job produce outputs that other files depend on?
259+
- Are there documentation files that should be updated when this job's outputs change?
260+
- Are there quality checks or reviews that should happen when certain files in this domain change?
261+
- Could changes to the job's output files impact other parts of the project?
262+
263+
**Examples of policies that might make sense:**
264+
265+
| Job Type | Potential Policy |
266+
|----------|------------------|
267+
| API Design | "Update API docs when endpoint definitions change" |
268+
| Database Schema | "Review migrations when schema files change" |
269+
| Competitive Research | "Update strategy docs when competitor analysis changes" |
270+
| Feature Development | "Update changelog when feature files change" |
271+
| Configuration Management | "Update install guide when config files change" |
272+
273+
**How to offer policy creation:**
274+
275+
If you identify one or more policies that would benefit the user, explain:
276+
1. **What the policy would do** - What triggers it and what action it prompts
277+
2. **Why it would help** - How it prevents common mistakes or keeps things in sync
278+
3. **What files it would watch** - The trigger patterns
279+
280+
Then ask the user:
281+
282+
> "Would you like me to create this policy for you? I can run `/deepwork_policy.define` to set it up."
283+
284+
If the user agrees, invoke the `/deepwork_policy.define` command to guide them through creating the policy.
285+
286+
**Example dialogue:**
287+
288+
```
289+
Based on the competitive_research job you just created, I noticed that when
290+
competitor analysis files change, it would be helpful to remind you to update
291+
your strategy documentation.
292+
293+
I'd suggest a policy like:
294+
- **Name**: "Update strategy when competitor analysis changes"
295+
- **Trigger**: `deepwork/competitive_research-*/report.md`
296+
- **Action**: Prompt to review and update `docs/strategy.md`
297+
298+
Would you like me to create this policy? I can run `/deepwork_policy.define` to set it up.
299+
```
300+
301+
**Note:** Not every job needs policies. Only suggest them when they would genuinely help maintain consistency or quality. Don't force policies where they don't make sense.
302+
223303
## Example Implementation
224304
225305
**Given this job.yml:**
@@ -344,7 +424,6 @@ Before running `deepwork sync`, verify:
344424
- All directories exist
345425
- `job.yml` is in place
346426
- All step instruction files exist (one per step)
347-
- Registry is updated
348427
- No file system errors
349428

350429
## Output Format
@@ -374,8 +453,6 @@ Successfully implemented the **[job_name]** workflow with [N] steps.
374453
- `.deepwork/jobs/[job_name]/steps/[step2_id].md`
375454
[... list all step files ...]
376455

377-
### Registry
378-
- Updated `.deepwork/registry.yml` with job registration
379456

380457
## Generated Commands
381458

@@ -412,11 +489,12 @@ Before marking this step complete, ensure:
412489
- [ ] job.yml validated and copied to job directory
413490
- [ ] All step instruction files created
414491
- [ ] Each instruction file is complete and actionable
415-
- [ ] Registry updated with new job
416492
- [ ] `deepwork sync` executed successfully
417493
- [ ] Commands generated in platform directory
418494
- [ ] User informed of next steps (reload commands)
419495
- [ ] implementation_summary.md created
496+
- [ ] Considered whether policies would benefit this job (Step 7)
497+
- [ ] If policies suggested, offered to run `/deepwork_policy.define`
420498

421499
## Quality Criteria
422500

@@ -425,9 +503,9 @@ Before marking this step complete, ensure:
425503
- Instructions are specific and actionable
426504
- Output examples are provided in each instruction file
427505
- Quality criteria defined for each step
428-
- Registry properly updated
429506
- Sync completed successfully
430507
- Commands available for use
508+
- Thoughtfully considered relevant policies for the job domain
431509

432510

433511
## Inputs
@@ -480,10 +558,12 @@ Verify the implementation meets ALL quality criteria before completing:
480558
3. **Specific & Actionable**: Are instructions tailored to each step's purpose, not generic?
481559
4. **Output Examples**: Does each instruction file show what good output looks like?
482560
5. **Quality Criteria**: Does each instruction file define quality criteria for its outputs?
483-
6. **Registry Updated**: Is `.deepwork/registry.yml` updated with the new job?
484-
7. **Sync Complete**: Has `deepwork sync` been run successfully?
485-
8. **Commands Available**: Are the slash-commands generated in `.claude/commands/`?
486-
9. **Summary Created**: Has `implementation_summary.md` been created?
561+
6. **Sync Complete**: Has `deepwork sync` been run successfully?
562+
7. **Commands Available**: Are the slash-commands generated in `.claude/commands/`?
563+
8. **Summary Created**: Has `implementation_summary.md` been created?
564+
9. **Policies Considered**: Have you thought about whether policies would benefit this job?
565+
- If relevant policies were identified, did you explain them and offer to run `/deepwork_policy.define`?
566+
- Not every job needs policies - only suggest when genuinely helpful.
487567

488568
If ANY criterion is not met, continue working to address it.
489569
If ALL criteria are satisfied, include `<promise>QUALITY_COMPLETE</promise>` in your response.

0 commit comments

Comments
 (0)