Skip to content

Commit 79b36ad

Browse files
nhortonclaude
andauthored
Surgically rebase metacommand changes onto main (#65)
* Add meta-command architecture for job entry points This commit adds a meta-command system to DeepWork that provides: 1. Meta-commands: Job-level entry points (e.g., /job_name) that route user intent to the appropriate step 2. Hidden step commands: Step commands now use uw. prefix by default to indicate they are internal/hidden from the main command list 3. Exposed steps: Steps can opt into visibility with `exposed: true` 4. Quality criteria: Declarative quality criteria on steps rendered with standard evaluation framing in stop hooks Key changes: - Added `exposed` and `quality_criteria` fields to Step schema/parser - Added get_meta_command_filename() and updated get_step_command_filename() with exposed parameter in adapters - Added generate_meta_command() and updated generate_all_commands() in generator to create meta-commands first, then hidden step commands - Added new meta-command templates for Claude and Gemini - Updated step templates to support quality_criteria - Updated deepwork_jobs standard job to use exposed: true on learn step and declarative quality_criteria instead of hooks - Added exposed_step_job test fixture - Updated all tests to account for new file naming scheme Generated files updated via `deepwork install`. * Apply ruff formatting --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent b7f8cdb commit 79b36ad

49 files changed

Lines changed: 1275 additions & 915 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/commands/AGENTS.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.claude/commands/add_platform.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
description: Add a new AI platform to DeepWork with adapter, templates, and tests
3+
---
4+
5+
# add_platform
6+
7+
You are executing the **add_platform** job. Add a new AI platform to DeepWork with adapter, templates, and tests
8+
9+
A workflow for adding support for a new AI platform (like Cursor, Windsurf, etc.) to DeepWork.
10+
11+
This job guides you through four phases:
12+
1. **Research**: Capture the platform's CLI configuration and hooks system documentation
13+
2. **Add Capabilities**: Update the job schema and adapters with any new hook events
14+
3. **Implement**: Create the platform adapter, templates, tests (100% coverage), and README updates
15+
4. **Verify**: Ensure installation works correctly and produces expected files
16+
17+
The workflow ensures consistency across all supported platforms and maintains
18+
comprehensive test coverage for new functionality.
19+
20+
**Important Notes**:
21+
- Only hooks available on slash command definitions should be captured
22+
- Each existing adapter must be updated when new hooks are added (typically with null values)
23+
- Tests must achieve 100% coverage for any new functionality
24+
- Installation verification confirms the platform integrates correctly with existing jobs
25+
26+
27+
## Available Steps
28+
29+
This job has 4 step(s):
30+
31+
### research
32+
**Research Platform Documentation**: Capture CLI configuration and hooks system documentation for the new platform
33+
- Command: `uw.add_platform.research`
34+
### add_capabilities
35+
**Add Hook Capabilities**: Update job schema and adapters with any new hook events the platform supports
36+
- Command: `uw.add_platform.add_capabilities`
37+
- Requires: research
38+
### implement
39+
**Implement Platform Support**: Add platform adapter, templates, tests with 100% coverage, and README documentation
40+
- Command: `uw.add_platform.implement`
41+
- Requires: research, add_capabilities
42+
### verify
43+
**Verify Installation**: Set up platform directories and verify deepwork install works correctly
44+
- Command: `uw.add_platform.verify`
45+
- Requires: implement
46+
47+
## Instructions
48+
49+
This is a **multi-step workflow**. Determine the starting point and run through the steps in sequence.
50+
51+
1. **Analyze user intent** from the text that follows `/add_platform`
52+
53+
2. **Identify the starting step** based on intent:
54+
- research: Capture CLI configuration and hooks system documentation for the new platform
55+
- add_capabilities: Update job schema and adapters with any new hook events the platform supports
56+
- implement: Add platform adapter, templates, tests with 100% coverage, and README documentation
57+
- verify: Set up platform directories and verify deepwork install works correctly
58+
59+
3. **Run the workflow** starting from the identified step:
60+
- Invoke the starting step using the Skill tool
61+
- When that step completes, **automatically continue** to the next step in the workflow
62+
- Continue until the workflow is complete or the user intervenes
63+
64+
4. **If intent is ambiguous**, ask the user which step to start from:
65+
- Present the available steps as numbered options
66+
- Use AskUserQuestion to let them choose
67+
68+
**Critical**:
69+
- You MUST invoke each step using the Skill tool. Do not copy/paste step instructions.
70+
- After each step completes, check if there's a next step and invoke it automatically.
71+
- The workflow continues until all dependent steps are complete.
72+
73+
## Context Files
74+
75+
- Job definition: `.deepwork/jobs/add_platform/job.yml`

.claude/commands/deepwork_jobs.learn.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ hooks:
99
1010
## Quality Criteria
1111
12-
Verify the learning process meets ALL quality criteria before completing:
13-
14-
1. **Conversation Analyzed**: Did you review the conversation for DeepWork job executions?
15-
2. **Confusion Identified**: Did you identify points of confusion, errors, or inefficiencies?
12+
1. **Conversation Analyzed**: Did the agent review the conversation for DeepWork job executions?
13+
2. **Confusion Identified**: Did the agent identify points of confusion, errors, or inefficiencies?
1614
3. **Instructions Improved**: Were job instructions updated to address identified issues?
1715
4. **Instructions Concise**: Are instructions free of redundancy and unnecessary verbosity?
1816
5. **Shared Content Extracted**: Is lengthy/duplicated content extracted into referenced files?
@@ -22,10 +20,6 @@ hooks:
2220
9. **Generalizable Separated**: Are generalizable improvements in instructions, not AGENTS.md?
2321
10. **Sync Complete**: Has `deepwork sync` been run if instructions were modified?
2422
25-
If ANY criterion is not met, continue working to address it.
26-
If ALL criteria are satisfied, include `<promise>✓ Quality Criteria Met</promise>` in your response.
27-
28-
2923
## Instructions
3024
3125
Review the conversation and determine if ALL quality criteria above have been satisfied.
@@ -34,8 +28,8 @@ hooks:
3428
If the agent has included `<promise>✓ Quality Criteria Met</promise>` in their response AND
3529
all criteria appear to be met, respond with: {"ok": true}
3630
37-
If criteria are NOT met AND the promise tag is missing, respond with:
38-
{"ok": false, "reason": "Continue working. [specific feedback on what's wrong]"}
31+
If criteria are NOT met OR the promise tag is missing, respond with:
32+
{"ok": false, "reason": "**AGENT: TAKE ACTION** - [which criteria failed and why]"}
3933
---
4034

4135
# deepwork_jobs.learn
@@ -386,10 +380,9 @@ Ensure all outputs are:
386380
This step uses an iterative quality validation loop. After completing your work, stop hook(s) will evaluate whether the outputs meet quality criteria. If criteria are not met, you will be prompted to continue refining.
387381

388382
### Quality Criteria
389-
Verify the learning process meets ALL quality criteria before completing:
390383

391-
1. **Conversation Analyzed**: Did you review the conversation for DeepWork job executions?
392-
2. **Confusion Identified**: Did you identify points of confusion, errors, or inefficiencies?
384+
1. **Conversation Analyzed**: Did the agent review the conversation for DeepWork job executions?
385+
2. **Confusion Identified**: Did the agent identify points of confusion, errors, or inefficiencies?
393386
3. **Instructions Improved**: Were job instructions updated to address identified issues?
394387
4. **Instructions Concise**: Are instructions free of redundancy and unnecessary verbosity?
395388
5. **Shared Content Extracted**: Is lengthy/duplicated content extracted into referenced files?
@@ -399,9 +392,6 @@ Verify the learning process meets ALL quality criteria before completing:
399392
9. **Generalizable Separated**: Are generalizable improvements in instructions, not AGENTS.md?
400393
10. **Sync Complete**: Has `deepwork sync` been run if instructions were modified?
401394

402-
If ANY criterion is not met, continue working to address it.
403-
If ALL criteria are satisfied, include `<promise>✓ Quality Criteria Met</promise>` in your response.
404-
405395

406396
### Completion Promise
407397

.claude/commands/deepwork_jobs.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
description: DeepWork job management commands
3+
---
4+
5+
# deepwork_jobs
6+
7+
You are executing the **deepwork_jobs** job. DeepWork job management commands
8+
9+
Core commands for managing DeepWork jobs. These commands help you define new multi-step
10+
workflows and learn from running them.
11+
12+
The `define` command guides you through an interactive process to create a new job by
13+
asking structured questions about your workflow, understanding each step's inputs and outputs,
14+
and generating all necessary files.
15+
16+
The `learn` command reflects on conversations where DeepWork jobs were run, identifies
17+
confusion or inefficiencies, and improves job instructions. It also captures bespoke
18+
learnings specific to the current run into AGENTS.md files in the working folder.
19+
20+
21+
## Available Steps
22+
23+
This job has 3 step(s):
24+
25+
### define
26+
**Define Job Specification**: Create the job.yml specification file by understanding workflow requirements
27+
- Command: `uw.deepwork_jobs.define`
28+
### implement
29+
**Implement Job Steps**: Generate instruction files for each step based on the job.yml specification
30+
- Command: `uw.deepwork_jobs.implement`
31+
- Requires: define
32+
### learn
33+
**Learn from Job Execution**: Reflect on conversation to improve job instructions and capture learnings
34+
- Command: `deepwork_jobs.learn`
35+
36+
## Instructions
37+
38+
This is a **multi-step workflow**. Determine the starting point and run through the steps in sequence.
39+
40+
1. **Analyze user intent** from the text that follows `/deepwork_jobs`
41+
42+
2. **Identify the starting step** based on intent:
43+
- define: Create the job.yml specification file by understanding workflow requirements
44+
- implement: Generate instruction files for each step based on the job.yml specification
45+
- learn: Reflect on conversation to improve job instructions and capture learnings
46+
47+
3. **Run the workflow** starting from the identified step:
48+
- Invoke the starting step using the Skill tool
49+
- When that step completes, **automatically continue** to the next step in the workflow
50+
- Continue until the workflow is complete or the user intervenes
51+
52+
4. **If intent is ambiguous**, ask the user which step to start from:
53+
- Present the available steps as numbered options
54+
- Use AskUserQuestion to let them choose
55+
56+
**Critical**:
57+
- You MUST invoke each step using the Skill tool. Do not copy/paste step instructions.
58+
- After each step completes, check if there's a next step and invoke it automatically.
59+
- The workflow continues until all dependent steps are complete.
60+
61+
## Context Files
62+
63+
- Job definition: `.deepwork/jobs/deepwork_jobs/job.yml`

.claude/commands/deepwork_rules.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
description: Rules enforcement for AI agent sessions
3+
---
4+
5+
# deepwork_rules
6+
7+
You are executing the **deepwork_rules** job. Rules enforcement for AI agent sessions
8+
9+
Manages rules that automatically trigger when certain files change during an AI agent session.
10+
Rules help ensure that code changes follow team guidelines, documentation is updated,
11+
and architectural decisions are respected.
12+
13+
Rules are stored as individual markdown files with YAML frontmatter in the `.deepwork/rules/`
14+
directory. Each rule file specifies:
15+
- Detection mode: trigger/safety, set (bidirectional), or pair (directional)
16+
- Patterns: Glob patterns for matching files, with optional variable capture
17+
- Instructions: Markdown content describing what the agent should do
18+
19+
Example use cases:
20+
- Update installation docs when configuration files change
21+
- Require security review when authentication code is modified
22+
- Ensure API documentation stays in sync with API code
23+
- Enforce source/test file pairing
24+
25+
26+
## Available Steps
27+
28+
This job has 1 step(s):
29+
30+
### define
31+
**Define Rule**: Create a new rule file in .deepwork/rules/
32+
- Command: `uw.deepwork_rules.define`
33+
34+
## Instructions
35+
36+
This is a **multi-step workflow**. Determine the starting point and run through the steps in sequence.
37+
38+
1. **Analyze user intent** from the text that follows `/deepwork_rules`
39+
40+
2. **Identify the starting step** based on intent:
41+
- define: Create a new rule file in .deepwork/rules/
42+
43+
3. **Run the workflow** starting from the identified step:
44+
- Invoke the starting step using the Skill tool
45+
- When that step completes, **automatically continue** to the next step in the workflow
46+
- Continue until the workflow is complete or the user intervenes
47+
48+
4. **If intent is ambiguous**, ask the user which step to start from:
49+
- Present the available steps as numbered options
50+
- Use AskUserQuestion to let them choose
51+
52+
**Critical**:
53+
- You MUST invoke each step using the Skill tool. Do not copy/paste step instructions.
54+
- After each step completes, check if there's a next step and invoke it automatically.
55+
- The workflow continues until all dependent steps are complete.
56+
57+
## Context Files
58+
59+
- Job definition: `.deepwork/jobs/deepwork_rules/job.yml`

.claude/commands/update.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
description: Update standard jobs in src/ and sync to installed locations
3+
---
4+
5+
# update
6+
7+
You are executing the **update** job. Update standard jobs in src/ and sync to installed locations
8+
9+
A workflow for maintaining standard jobs bundled with DeepWork. Standard jobs
10+
(like `deepwork_jobs` and `deepwork_rules`) are source-controlled in
11+
`src/deepwork/standard_jobs/` and must be edited there—never in `.deepwork/jobs/`
12+
or `.claude/commands/` directly.
13+
14+
This job guides you through:
15+
1. Identifying which standard job(s) to update from conversation context
16+
2. Making changes in the correct source location (`src/deepwork/standard_jobs/[job_name]/`)
17+
3. Running `deepwork install` to propagate changes to `.deepwork/` and command directories
18+
4. Verifying the sync completed successfully
19+
20+
Use this job whenever you need to modify job.yml files, step instructions, or hooks
21+
for any standard job in the DeepWork repository.
22+
23+
24+
## Available Steps
25+
26+
This job has 1 step(s):
27+
28+
### job
29+
**Update Standard Job**: Edit standard job source files and sync to installed locations
30+
- Command: `uw.update.job`
31+
32+
## Instructions
33+
34+
This is a **multi-step workflow**. Determine the starting point and run through the steps in sequence.
35+
36+
1. **Analyze user intent** from the text that follows `/update`
37+
38+
2. **Identify the starting step** based on intent:
39+
- job: Edit standard job source files and sync to installed locations
40+
41+
3. **Run the workflow** starting from the identified step:
42+
- Invoke the starting step using the Skill tool
43+
- When that step completes, **automatically continue** to the next step in the workflow
44+
- Continue until the workflow is complete or the user intervenes
45+
46+
4. **If intent is ambiguous**, ask the user which step to start from:
47+
- Present the available steps as numbered options
48+
- Use AskUserQuestion to let them choose
49+
50+
**Critical**:
51+
- You MUST invoke each step using the Skill tool. Do not copy/paste step instructions.
52+
- After each step completes, check if there's a next step and invoke it automatically.
53+
- The workflow continues until all dependent steps are complete.
54+
55+
## Context Files
56+
57+
- Job definition: `.deepwork/jobs/update/job.yml`

.claude/commands/add_platform.add_capabilities.md renamed to .claude/commands/uw.add_platform.add_capabilities.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ hooks:
55
- hooks:
66
- type: prompt
77
prompt: |
8-
You must evaluate whether Claude has met all the below quality criteria for the request.
9-
10-
## Quality Criteria
11-
128
Verify the capability additions meet ALL criteria:
139
1. Any new hooks from the platform (for slash commands only) are added to src/deepwork/schemas/job_schema.py
1410
2. All existing adapters in src/deepwork/adapters.py are updated with the new hook fields
@@ -20,17 +16,6 @@ hooks:
2016
2117
If ALL criteria are met, include `<promise>✓ Quality Criteria Met</promise>`.
2218
23-
24-
## Instructions
25-
26-
Review the conversation and determine if ALL quality criteria above have been satisfied.
27-
Look for evidence that each criterion has been addressed.
28-
29-
If the agent has included `<promise>✓ Quality Criteria Met</promise>` in their response AND
30-
all criteria appear to be met, respond with: {"ok": true}
31-
32-
If criteria are NOT met AND the promise tag is missing, respond with:
33-
{"ok": false, "reason": "Continue working. [specific feedback on what's wrong]"}
3419
---
3520

3621
# add_platform.add_capabilities
@@ -241,17 +226,6 @@ Ensure all outputs are:
241226

242227
This step uses an iterative quality validation loop. After completing your work, stop hook(s) will evaluate whether the outputs meet quality criteria. If criteria are not met, you will be prompted to continue refining.
243228

244-
### Quality Criteria
245-
Verify the capability additions meet ALL criteria:
246-
1. Any new hooks from the platform (for slash commands only) are added to src/deepwork/schemas/job_schema.py
247-
2. All existing adapters in src/deepwork/adapters.py are updated with the new hook fields
248-
(set to None/null if the platform doesn't support that hook)
249-
3. Only hooks available on slash command definitions are added (not general CLI hooks)
250-
4. job_schema.py remains valid Python with no syntax errors
251-
5. adapters.py remains consistent - all adapters have the same hook fields
252-
6. If no new hooks are needed, document why in a comment
253-
254-
If ALL criteria are met, include `<promise>✓ Quality Criteria Met</promise>`.
255229

256230

257231
### Completion Promise

0 commit comments

Comments
 (0)