You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Create job_spec.md DTD with 9 quality criteria for job.yml files
- Update install.py to copy DTDs from standard jobs to .deepwork/dtds/
- Reference DTD in deepwork_jobs define step output with document_type
- Bump deepwork_jobs version to 0.7.0
- Temporarily disable new-standard-job-warning rule (bug causes infinite loop)
The DTD ensures consistent quality for all job.yml files created via
/deepwork_jobs.define by validating: identifier format, semantic version,
summary length, description richness, changelog presence, step completeness,
dependency validity, input consistency, and output paths.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1. **User Understanding**: Did the agent fully understand the user's workflow by asking structured questions?
15
15
2. **Structured Questions Used**: Did the agent ask structured questions (using the AskUserQuestion tool) to gather user input?
16
-
3. **Clear Inputs/Outputs**: Does every step have clearly defined inputs and outputs?
17
-
4. **Logical Dependencies**: Do step dependencies make sense and avoid circular references?
18
-
5. **Concise Summary**: Is the summary under 200 characters and descriptive?
19
-
6. **Rich Description**: Does the description provide enough context for future refinement?
20
-
7. **Valid Schema**: Does the job.yml follow the required schema (name, version, summary, steps)?
21
-
8. **File Created**: Has the job.yml file been created in `.deepwork/jobs/[job_name]/job.yml`?
16
+
3. **Document Detection**: For document-oriented workflows, did the agent detect patterns and offer DTD creation?
17
+
4. **DTD Created (if applicable)**: If a DTD was needed, was it created in `.deepwork/dtds/[dtd_name].md` with proper quality criteria?
18
+
5. **DTD References**: Are document outputs properly linked to their DTDs using `{file, document_type}` format?
19
+
6. **Valid Against DTD**: Does the job.yml conform to the job.yml DTD quality criteria (valid identifier, semantic version, concise summary, rich description, complete steps, valid dependencies)?
20
+
7. **Clear Inputs/Outputs**: Does every step have clearly defined inputs and outputs?
21
+
8. **Logical Dependencies**: Do step dependencies make sense and avoid circular references?
22
+
9. **Concise Summary**: Is the summary under 200 characters and descriptive?
23
+
10. **Rich Description**: Does the description provide enough context for future refinement?
24
+
11. **Valid Schema**: Does the job.yml follow the required schema (name, version, summary, steps)?
25
+
12. **File Created**: Has the job.yml file been created in `.deepwork/jobs/[job_name]/job.yml`?
22
26
23
27
## Instructions
24
28
@@ -76,6 +80,55 @@ Start by asking structured questions to understand what the user wants to accomp
76
80
- What are the distinct stages from start to finish?
77
81
- Are there any dependencies between phases?
78
82
83
+
### Step 1.5: Detect Document-Oriented Workflows
84
+
85
+
**Check for document-focused patterns** in the user's description:
- Final deliverable is a specific document type (e.g., "AWS spending report", "competitive analysis", "sprint summary")
88
+
- Recurring documents with consistent structure
89
+
90
+
**If a document-oriented workflow is detected:**
91
+
92
+
1. Inform the user: "This workflow produces a specific document type. I recommend defining a Document Type Definition (DTD) first to ensure consistent quality."
93
+
94
+
2. Ask structured questions to understand if they want to:
95
+
- Create a DTD for the document type
96
+
- Use an existing DTD (if any exist in `.deepwork/dtds/`)
97
+
- Skip DTD and proceed with simple outputs
98
+
99
+
### Step 1.6: Define the Document Type Definition (if needed)
100
+
101
+
When creating a DTD, gather the following information:
102
+
103
+
1.**Document Identity**
104
+
- What is the document called? (e.g., "Monthly AWS Spending Report")
105
+
- Brief description of its purpose
106
+
- Where should these documents be stored? (path patterns like `finance/aws-reports/*.md`)
107
+
108
+
2.**Audience and Context**
109
+
- Who reads this document? (target audience)
110
+
- How often is it produced? (frequency)
111
+
112
+
3.**Quality Criteria** (3-5 criteria, each with name and description)
113
+
Examples for a spending report:
114
+
-**Visualization**: Must include charts showing spend breakdown by service
115
+
-**Variance Analysis**: Must compare current month against previous with percentages
116
+
-**Action Items**: Must include recommended cost optimization actions
117
+
118
+
4.**Document Structure**
119
+
- What sections should it have?
120
+
- Any required elements (tables, charts, summaries)?
121
+
122
+
### Step 1.7: Create the DTD File (if needed)
123
+
124
+
Create the DTD file at `.deepwork/dtds/[dtd_name].md`:
125
+
126
+
**Template reference**: See `.deepwork/jobs/deepwork_jobs/templates/dtd.md.template` for the standard structure.
127
+
128
+
**Complete example**: See `.deepwork/jobs/deepwork_jobs/templates/dtd.md.example` for a fully worked example.
129
+
130
+
After creating the DTD, proceed to Step 2 with the DTD reference for the final step's output.
131
+
79
132
### Step 2: Define Each Step
80
133
81
134
For each major phase they mentioned, ask structured questions to gather details:
@@ -97,6 +150,7 @@ For each major phase they mentioned, ask structured questions to gather details:
97
150
- Where should each output be saved? (filename/path)
98
151
- Should outputs be organized in subdirectories? (e.g., `reports/`, `data/`, `drafts/`)
99
152
- Will other steps need this output?
153
+
-**Does this output have a DTD?** If a DTD was created in Step 1.6/1.7, reference it for the appropriate output
100
154
101
155
4.**Step Dependencies**
102
156
- Which previous steps must complete before this one?
@@ -109,6 +163,18 @@ For each major phase they mentioned, ask structured questions to gather details:
109
163
110
164
**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.
111
165
166
+
#### DTD-Aware Output Format
167
+
168
+
When a step produces a document with a DTD reference, use this format in job.yml:
The DTD's quality criteria will automatically be included in the generated skill, ensuring consistent document quality.
177
+
112
178
### Capability Considerations
113
179
114
180
When defining steps, identify any that require specialized tools:
@@ -203,6 +269,8 @@ This creates:
203
269
204
270
(Where `[job_name]` is the name of the NEW job you're creating, e.g., `competitive_research`)
205
271
272
+
**Document Type Definition**: See `.deepwork/dtds/job_spec.md` for the complete specification with quality criteria.
273
+
206
274
**Template reference**: See `.deepwork/jobs/deepwork_jobs/templates/job.yml.template` for the standard structure.
207
275
208
276
**Complete example**: See `.deepwork/jobs/deepwork_jobs/templates/job.yml.example` for a fully worked example.
@@ -407,19 +475,206 @@ Use branch format: `deepwork/deepwork_jobs-[instance]-YYYYMMDD`
407
475
408
476
**Required outputs**:
409
477
- `job.yml`
478
+
**Document Type**: DeepWork Job Specification
479
+
> YAML specification file that defines a multi-step workflow job for AI agents
480
+
**Definition**: `.deepwork/dtds/job_spec.md`
481
+
**Target Audience**: AI agents executing jobs and developers defining workflows
482
+
**Quality Criteria**:
483
+
1. **Valid Identifier**: Job name must be lowercase with underscores, no spaces or special characters (e.g., `competitive_research`, `monthly_report`)
484
+
2. **Semantic Version**: Version must follow semantic versioning format X.Y.Z (e.g., `1.0.0`, `2.1.3`)
485
+
3. **Concise Summary**: Summary must be under 200 characters and clearly describe what the job accomplishes
486
+
4. **Rich Description**: Description must be multi-line and explain: the problem solved, the process, expected outcomes, and target users
487
+
5. **Changelog Present**: Must include a changelog array with at least the initial version entry
488
+
6. **Complete Steps**: Each step must have: id (lowercase_underscores), name, description, instructions_file, outputs (at least one), and dependencies array
489
+
7. **Valid Dependencies**: Dependencies must reference existing step IDs with no circular references
490
+
8. **Input Consistency**: File inputs with `from_step` must reference a step that is in the dependencies array
491
+
9. **Output Paths**: Outputs must be valid filenames or paths (e.g., `report.md` or `reports/analysis.md`)
492
+
493
+
<details>
494
+
<summary>Example Document Structure</summary>
495
+
496
+
```markdown
497
+
# DeepWork Job Specification: [job_name]
498
+
499
+
A `job.yml` file defines a complete multi-step workflow that AI agents can execute. Each job breaks down a complex task into reviewable steps with clear inputs and outputs.
500
+
501
+
## Required Fields
502
+
503
+
### Top-Level Metadata
504
+
505
+
```yaml
506
+
name: job_name # lowercase, underscores only
507
+
version: "1.0.0" # semantic versioning
508
+
summary: "Brief description" # max 200 characters
509
+
description: | # detailed multi-line explanation
510
+
[Explain what this workflow does, why it exists,
511
+
what outputs it produces, and who should use it]
512
+
```
513
+
514
+
### Changelog
515
+
516
+
```yaml
517
+
changelog:
518
+
- version: "1.0.0"
519
+
changes: "Initial job creation"
520
+
- version: "1.1.0"
521
+
changes: "Added quality validation hooks"
522
+
```
523
+
524
+
### Steps Array
525
+
526
+
```yaml
527
+
steps:
528
+
- id: step_id # unique, lowercase_underscores
529
+
name: "Human Readable Name"
530
+
description: "What this step accomplishes"
531
+
instructions_file: steps/step_id.md
532
+
inputs:
533
+
# User-provided inputs:
534
+
- name: param_name
535
+
description: "What the user provides"
536
+
# File inputs from previous steps:
537
+
- file: output.md
538
+
from_step: previous_step_id
539
+
outputs:
540
+
- filename.md # simple filename
541
+
- reports/analysis.md # path with directory
542
+
# With document type reference:
543
+
- file: report.md
544
+
document_type: .deepwork/dtds/report_type.md
545
+
dependencies:
546
+
- previous_step_id # steps that must complete first
547
+
```
548
+
549
+
## Optional Fields
550
+
551
+
### Exposed Steps
552
+
553
+
```yaml
554
+
steps:
555
+
- id: learn
556
+
exposed: true # Makes step available without running dependencies
557
+
```
558
+
559
+
### Quality Hooks
560
+
561
+
```yaml
562
+
steps:
563
+
- id: step_id
564
+
hooks:
565
+
after_agent:
566
+
# Inline prompt for quality validation:
567
+
- prompt: |
568
+
Verify the output meets criteria:
569
+
1. [Criterion 1]
570
+
2. [Criterion 2]
571
+
If ALL criteria are met, include `<promise>...</promise>`.
572
+
# External prompt file:
573
+
- prompt_file: hooks/quality_check.md
574
+
# Script for programmatic validation:
575
+
- script: hooks/run_tests.sh
576
+
```
577
+
578
+
### Stop Hooks (Legacy)
579
+
580
+
```yaml
581
+
steps:
582
+
- id: step_id
583
+
stop_hooks:
584
+
- prompt: "Validation prompt..."
585
+
- prompt_file: hooks/check.md
586
+
- script: hooks/validate.sh
587
+
```
588
+
589
+
## Validation Rules
590
+
591
+
1. **No circular dependencies**: Step A cannot depend on Step B if Step B depends on Step A
592
+
2. **File inputs require dependencies**: If a step uses `from_step: X`, then X must be in its dependencies
593
+
3. **Unique step IDs**: No two steps can have the same id
594
+
4. **Valid file paths**: Output paths must not contain invalid characters
595
+
5. **Instructions files exist**: Each `instructions_file` path should have a corresponding file created
Stop hooks will automatically validate your work. The loop continues until all criteria pass.
413
664
414
665
**Criteria (all must be satisfied)**:
415
666
1.**User Understanding**: Did the agent fully understand the user's workflow by asking structured questions?
416
667
2.**Structured Questions Used**: Did the agent ask structured questions (using the AskUserQuestion tool) to gather user input?
417
-
3. **Clear Inputs/Outputs**: Does every step have clearly defined inputs and outputs?
418
-
4. **Logical Dependencies**: Do step dependencies make sense and avoid circular references?
419
-
5. **Concise Summary**: Is the summary under 200 characters and descriptive?
420
-
6. **Rich Description**: Does the description provide enough context for future refinement?
421
-
7. **Valid Schema**: Does the job.yml follow the required schema (name, version, summary, steps)?
422
-
8. **File Created**: Has the job.yml file been created in `.deepwork/jobs/[job_name]/job.yml`?
668
+
3.**Document Detection**: For document-oriented workflows, did the agent detect patterns and offer DTD creation?
669
+
4.**DTD Created (if applicable)**: If a DTD was needed, was it created in `.deepwork/dtds/[dtd_name].md` with proper quality criteria?
670
+
5.**DTD References**: Are document outputs properly linked to their DTDs using `{file, document_type}` format?
671
+
6.**Valid Against DTD**: Does the job.yml conform to the job.yml DTD quality criteria (valid identifier, semantic version, concise summary, rich description, complete steps, valid dependencies)?
672
+
7.**Clear Inputs/Outputs**: Does every step have clearly defined inputs and outputs?
673
+
8.**Logical Dependencies**: Do step dependencies make sense and avoid circular references?
674
+
9.**Concise Summary**: Is the summary under 200 characters and descriptive?
675
+
10.**Rich Description**: Does the description provide enough context for future refinement?
676
+
11.**Valid Schema**: Does the job.yml follow the required schema (name, version, summary, steps)?
677
+
12.**File Created**: Has the job.yml file been created in `.deepwork/jobs/[job_name]/job.yml`?
423
678
424
679
425
680
**To complete**: Include `<promise>✓ Quality Criteria Met</promise>` in your final response only after verifying ALL criteria are satisfied.
0 commit comments