Skip to content

Commit 3ea69e9

Browse files
nhortonclaude
andcommitted
Consolidate step instructions and remove deepwork_jobs.md reference
- Delete deepwork_jobs.md reference file (content moved to step files) - Reduce step instruction file sizes by consolidating content - Update generated commands for Claude and Gemini Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2ca186a commit 3ea69e9

File tree

17 files changed

+2804
-989
lines changed

17 files changed

+2804
-989
lines changed

.claude/commands/deepwork_jobs.define.md

Lines changed: 266 additions & 58 deletions
Large diffs are not rendered by default.

.claude/commands/deepwork_jobs.implement.md

Lines changed: 188 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -71,96 +71,238 @@ Please ensure these steps have been completed before proceeding.
7171

7272
## Objective
7373

74-
Generate step instruction files for each step based on the `job.yml` specification created in the define step.
75-
76-
**Reference**: See `deepwork_jobs.md` for job structure, step instruction format, and templates.
74+
Generate the DeepWork job directory structure and instruction files for each step based on the `job.yml` specification created in the previous step.
7775

7876
## Task
7977

80-
Read the `job.yml` specification and create instruction files to make the job functional.
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.
79+
80+
### Step 1: Create Directory Structure Using Script
8181

82-
### Step 1: Create Directory Structure (if needed)
82+
Run the `make_new_job.sh` script to create the standard directory structure:
8383

84-
If directory doesn't exist, run:
8584
```bash
8685
.deepwork/jobs/deepwork_jobs/make_new_job.sh [job_name]
8786
```
8887

89-
Or manually create missing directories:
88+
This creates:
89+
- `.deepwork/jobs/[job_name]/` - Main job directory
90+
- `.deepwork/jobs/[job_name]/steps/` - Step instruction files
91+
- `.deepwork/jobs/[job_name]/hooks/` - Custom validation scripts (with .gitkeep)
92+
- `.deepwork/jobs/[job_name]/templates/` - Example file formats (with .gitkeep)
93+
- `.deepwork/jobs/[job_name]/AGENTS.md` - Job management guidance
94+
95+
**Note**: If the directory already exists (e.g., job.yml was created by define step), you can skip this step or manually create the additional directories:
9096
```bash
9197
mkdir -p .deepwork/jobs/[job_name]/hooks .deepwork/jobs/[job_name]/templates
9298
touch .deepwork/jobs/[job_name]/hooks/.gitkeep .deepwork/jobs/[job_name]/templates/.gitkeep
9399
```
94100

95-
### Step 2: Read and Validate Specification
101+
### Step 2: Read and Validate the Specification
96102

97-
1. Read `.deepwork/jobs/[job_name]/job.yml`
98-
2. Validate schema (name, version, summary, description, steps)
99-
3. Check dependencies reference existing steps, no circular dependencies
100-
4. Extract job name, version, summary, description, and step details
103+
1. **Locate the job.yml file**
104+
- Read `.deepwork/jobs/[job_name]/job.yml` from the define step
105+
- Parse the YAML content
106+
107+
2. **Validate the specification**
108+
- Ensure it follows the schema (name, version, summary, description, steps)
109+
- Check that all dependencies reference existing steps
110+
- Verify no circular dependencies
111+
- Confirm file inputs match dependencies
112+
113+
3. **Extract key information**
114+
- Job name, version, summary, description
115+
- List of all steps with their details
116+
- Understand the workflow structure
101117

102118
### Step 3: Generate Step Instruction Files
103119

104-
For each step, create `.deepwork/jobs/[job_name]/steps/[step_id].md`.
120+
For each step in the job.yml, create a comprehensive instruction file at `.deepwork/jobs/[job_name]/steps/[step_id].md`.
121+
122+
**Template reference**: See `.deepwork/jobs/deepwork_jobs/templates/step_instruction.md.template` for the standard structure.
105123

106-
**Templates**: See `.deepwork/jobs/deepwork_jobs/templates/step_instruction.md.template` and `step_instruction.md.example`
124+
**Complete example**: See `.deepwork/jobs/deepwork_jobs/templates/step_instruction.md.example` for a fully worked example.
107125

108-
**Guidelines:**
109-
- Use the job description for context
110-
- Be specific, not generic
111-
- Provide output examples
112-
- Explain the "why"
113-
- Align quality criteria with stop hooks
126+
**Available templates in `.deepwork/jobs/deepwork_jobs/templates/`:**
127+
- `job.yml.template` - Job specification structure
128+
- `step_instruction.md.template` - Step instruction file structure
129+
- `agents.md.template` - AGENTS.md file structure
130+
- `job.yml.example` - Complete job specification example
131+
- `step_instruction.md.example` - Complete step instruction example
132+
133+
**Guidelines for generating instructions:**
134+
135+
1. **Use the job description** - The detailed description from job.yml provides crucial context
136+
2. **Be specific** - Don't write generic instructions; tailor them to the step's purpose
137+
3. **Provide examples** - Show what good output looks like
138+
4. **Explain the "why"** - Help the user understand the step's role in the workflow
139+
5. **Quality over quantity** - Detailed, actionable instructions are better than vague ones
140+
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
114141

115142
### Handling Stop Hooks
116143

117-
If step has `stop_hooks`, the instruction file's Quality Criteria section must match what hooks validate. Include the promise pattern: `<promise>✓ Quality Criteria Met</promise>`
144+
If a step in the job.yml has `stop_hooks` defined, the generated instruction file should:
145+
146+
1. **Mirror the quality criteria** - The "Quality Criteria" section should match what the stop hooks will validate
147+
2. **Be explicit about success** - Help the agent understand when the step is truly complete
148+
3. **Include the promise pattern** - Mention that `<promise>✓ Quality Criteria Met</promise>` should be included when criteria are met
149+
150+
**Example: If the job.yml has:**
151+
```yaml
152+
- id: research_competitors
153+
name: "Research Competitors"
154+
stop_hooks:
155+
- prompt: |
156+
Verify the research meets criteria:
157+
1. Each competitor has at least 3 data points
158+
2. Sources are cited
159+
3. Information is current (within last year)
160+
```
118161
119-
### Step 4: Sync Commands
162+
**The instruction file should include:**
163+
```markdown
164+
## Quality Criteria
165+
166+
- Each competitor has at least 3 distinct data points
167+
- All information is sourced with citations
168+
- Data is current (from within the last year)
169+
- When all criteria are met, include `<promise>✓ Quality Criteria Met</promise>` in your response
170+
```
171+
172+
This alignment ensures the AI agent knows exactly what will be validated and can self-check before completing.
173+
174+
### Using Supplementary Reference Files
175+
176+
Step instructions can include additional `.md` files in the `steps/` directory for detailed examples, templates, or reference material. Reference them using the full path from the project root.
177+
178+
See `.deepwork/jobs/deepwork_jobs/steps/supplemental_file_references.md` for detailed documentation and examples.
179+
180+
### Step 4: Verify job.yml Location
181+
182+
Verify that `job.yml` is in the correct location at `.deepwork/jobs/[job_name]/job.yml`. The define step should have created it there. If for some reason it's not there, you may need to create or move it.
183+
184+
### Step 5: Sync Commands
185+
186+
Run `deepwork sync` to generate the slash-commands for this job:
120187

121188
```bash
122189
deepwork sync
123190
```
124191

125-
### Step 5: Relay Reload Instructions
192+
This will:
193+
- Parse the job definition
194+
- Generate slash-commands for each step
195+
- Make the commands available in `.claude/commands/` (or appropriate platform directory)
196+
197+
### Step 6: Relay Reload Instructions
198+
199+
After running `deepwork sync`, look at the "To use the new commands" section in the output. **Relay these exact reload instructions to the user** so they know how to pick up the new commands. Don't just reference the sync output - tell them directly what they need to do (e.g., "Type 'exit' then run 'claude --resume'" for Claude Code, or "Run '/memory refresh'" for Gemini CLI).
200+
201+
### Step 7: Consider Policies for the New Job
202+
203+
After implementing the job, consider whether there are **policies** that would help enforce quality or consistency when working with this job's domain.
204+
205+
**What are policies?**
206+
207+
Policies are automated guardrails defined in `.deepwork.policy.yml` that trigger when certain files change during an AI session. They help ensure:
208+
- Documentation stays in sync with code
209+
- Team guidelines are followed
210+
- Architectural decisions are respected
211+
- Quality standards are maintained
212+
213+
**When to suggest policies:**
214+
215+
Think about the job you just implemented and ask:
216+
- Does this job produce outputs that other files depend on?
217+
- Are there documentation files that should be updated when this job's outputs change?
218+
- Are there quality checks or reviews that should happen when certain files in this domain change?
219+
- Could changes to the job's output files impact other parts of the project?
220+
221+
**Examples of policies that might make sense:**
222+
223+
| Job Type | Potential Policy |
224+
|----------|------------------|
225+
| API Design | "Update API docs when endpoint definitions change" |
226+
| Database Schema | "Review migrations when schema files change" |
227+
| Competitive Research | "Update strategy docs when competitor analysis changes" |
228+
| Feature Development | "Update changelog when feature files change" |
229+
| Configuration Management | "Update install guide when config files change" |
230+
231+
**How to offer policy creation:**
232+
233+
If you identify one or more policies that would benefit the user, explain:
234+
1. **What the policy would do** - What triggers it and what action it prompts
235+
2. **Why it would help** - How it prevents common mistakes or keeps things in sync
236+
3. **What files it would watch** - The trigger patterns
237+
238+
Then ask the user:
239+
240+
> "Would you like me to create this policy for you? I can run `/deepwork_policy.define` to set it up."
241+
242+
If the user agrees, invoke the `/deepwork_policy.define` command to guide them through creating the policy.
243+
244+
**Example dialogue:**
245+
246+
```
247+
Based on the competitive_research job you just created, I noticed that when
248+
competitor analysis files change, it would be helpful to remind you to update
249+
your strategy documentation.
250+
251+
I'd suggest a policy like:
252+
- **Name**: "Update strategy when competitor analysis changes"
253+
- **Trigger**: `**/positioning_report.md`
254+
- **Action**: Prompt to review and update `docs/strategy.md`
255+
256+
Would you like me to create this policy? I can run `/deepwork_policy.define` to set it up.
257+
```
258+
259+
**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.
126260
127-
Tell user how to reload commands:
128-
- **Claude Code**: Type `exit` then run `claude --resume`
129-
- **Gemini CLI**: Run `/memory refresh`
261+
## Example Implementation
130262
131-
### Step 6: Consider Policies
263+
For a complete worked example showing a job.yml and corresponding step instruction file, see:
264+
- **Job specification**: `.deepwork/jobs/deepwork_jobs/templates/job.yml.example`
265+
- **Step instruction**: `.deepwork/jobs/deepwork_jobs/templates/step_instruction.md.example`
132266
133-
Think about whether policies would help maintain consistency for this job's domain.
267+
## Important Guidelines
134268
135-
**Policies** are guardrails in `.deepwork.policy.yml` that trigger when files change.
269+
1. **Read the spec carefully** - Understand the job's intent from the description
270+
2. **Generate complete instructions** - Don't create placeholder or stub files
271+
3. **Maintain consistency** - Use the same structure for all step instruction files
272+
4. **Provide examples** - Show what good output looks like
273+
5. **Use context** - The job description provides valuable context for each step
274+
6. **Be specific** - Tailor instructions to the specific step, not generic advice
136275
137-
Consider:
138-
- Does this job produce outputs other files depend on?
139-
- Should documentation be updated when outputs change?
140-
- Are there quality checks that should happen on certain file changes?
276+
## Validation Before Sync
141277
142-
If policies would help, explain what they'd do and offer to run `/deepwork_policy.define`.
278+
Before running `deepwork sync`, verify:
279+
- All directories exist
280+
- `job.yml` is in place
281+
- All step instruction files exist (one per step)
282+
- No file system errors
143283
144284
## Completion Checklist
145285
146-
- [ ] job.yml validated
147-
- [ ] All step instruction files created (complete, not stubs)
148-
- [ ] Each instruction is specific and actionable
149-
- [ ] Output examples provided
150-
- [ ] `deepwork sync` executed
151-
- [ ] User informed about reload instructions
152-
- [ ] Policies considered (suggest if relevant)
286+
Before marking this step complete, ensure:
287+
- [ ] job.yml validated and copied to job directory
288+
- [ ] All step instruction files created
289+
- [ ] Each instruction file is complete and actionable
290+
- [ ] `deepwork sync` executed successfully
291+
- [ ] Commands generated in platform directory
292+
- [ ] User informed to follow reload instructions from `deepwork sync`
293+
- [ ] Considered whether policies would benefit this job (Step 7)
294+
- [ ] If policies suggested, offered to run `/deepwork_policy.define`
153295
154296
## Quality Criteria
155297
156-
- Job directory structure correct
157-
- All instruction files complete (not stubs)
158-
- Instructions specific and actionable
159-
- Output examples provided
298+
- Job directory structure is correct
299+
- All instruction files are complete (not stubs)
300+
- Instructions are specific and actionable
301+
- Output examples are provided in each instruction file
160302
- Quality criteria defined for each step
161303
- Sync completed successfully
162304
- Commands available for use
163-
- Policies thoughtfully considered
305+
- Thoughtfully considered relevant policies for the job domain
164306
165307
166308
## Inputs

0 commit comments

Comments
 (0)