Skip to content

Commit 12fb39f

Browse files
nhortonclaude
andcommitted
Add commit job with script-only hooks for test and format validation
Introduces a new bespoke commit job for this repo with three steps: test, format, and reconcile_and_push. The job validates code quality before pushing changes by running pytest and ruff checks. Uses script hooks (not prompt hooks) for the test and format steps, with guidance on interpreting hook output included in the step instructions. This simpler approach lets the agent handle results directly rather than requiring a separate prompt-based evaluator. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5a1e561 commit 12fb39f

53 files changed

Lines changed: 2500 additions & 401 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/add_platform.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,29 @@ This job has 4 step(s):
4646

4747
## Instructions
4848

49-
Determine what the user wants to do and route to the appropriate step.
49+
This is a **multi-step workflow**. Determine the starting point and run through the steps in sequence.
5050

5151
1. **Analyze user intent** from the text that follows `/add_platform`
5252

53-
2. **Match intent to a step**:
53+
2. **Identify the starting step** based on intent:
5454
- research: Capture CLI configuration and hooks system documentation for the new platform
5555
- add_capabilities: Update job schema and adapters with any new hook events the platform supports
5656
- implement: Add platform adapter, templates, tests with 100% coverage, and README documentation
5757
- verify: Set up platform directories and verify deepwork install works correctly
5858

59-
3. **Invoke the matched step** using the Skill tool:
60-
```
61-
Skill: <step_command_name>
62-
```
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
6363

64-
4. **If intent is ambiguous**, ask the user which step they want:
64+
4. **If intent is ambiguous**, ask the user which step to start from:
6565
- Present the available steps as numbered options
6666
- Use AskUserQuestion to let them choose
6767

68-
**Critical**: You MUST invoke the step using the Skill tool. Do not copy/paste the step's instructions. The Skill tool invocation ensures the step's quality validation hooks fire.
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.
6972

7073
## Context Files
7174

.claude/commands/commit.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
description: Validate, format, and push changes with tests passing
3+
---
4+
5+
# commit
6+
7+
You are executing the **commit** job. Validate, format, and push changes with tests passing
8+
9+
A pre-commit workflow that ensures code quality before pushing changes.
10+
11+
This job runs through three validation and preparation steps:
12+
1. Runs the test suite and fixes any failures until all tests pass (max 5 attempts)
13+
2. Runs ruff formatting and linting, fixing issues until clean (max 5 attempts)
14+
3. Fetches from remote, rebases if needed, generates a simple commit message,
15+
commits changes, and pushes to the remote branch
16+
17+
Each step uses a quality validation loop to ensure it completes successfully
18+
before moving to the next step. The format step runs as a subagent to
19+
minimize token usage.
20+
21+
Key behaviors:
22+
- Rebase strategy when remote has changes (keeps linear history)
23+
- Simple summary commit messages (no conventional commits format)
24+
- Maximum 5 fix attempts before stopping
25+
26+
Designed for developers who want a reliable pre-push workflow that catches
27+
issues early and ensures consistent code quality.
28+
29+
30+
## Available Steps
31+
32+
This job has 3 step(s):
33+
34+
### test
35+
**Run Tests**: Run pytest and fix any failures until all tests pass (max 5 attempts)
36+
- Command: `uw.commit.test`
37+
### format
38+
**Format Code**: Run ruff formatting and linting, fix issues until clean (max 5 attempts, runs as subagent)
39+
- Command: `uw.commit.format`
40+
- Requires: test
41+
### reconcile_and_push
42+
**Reconcile and Push**: Fetch remote, rebase if needed, commit with simple summary message, and push
43+
- Command: `uw.commit.reconcile_and_push`
44+
- Requires: format
45+
46+
## Instructions
47+
48+
This is a **multi-step workflow**. Determine the starting point and run through the steps in sequence.
49+
50+
1. **Analyze user intent** from the text that follows `/commit`
51+
52+
2. **Identify the starting step** based on intent:
53+
- test: Run pytest and fix any failures until all tests pass (max 5 attempts)
54+
- format: Run ruff formatting and linting, fix issues until clean (max 5 attempts, runs as subagent)
55+
- reconcile_and_push: Fetch remote, rebase if needed, commit with simple summary message, and push
56+
57+
3. **Run the workflow** starting from the identified step:
58+
- Invoke the starting step using the Skill tool
59+
- When that step completes, **automatically continue** to the next step in the workflow
60+
- Continue until the workflow is complete or the user intervenes
61+
62+
4. **If intent is ambiguous**, ask the user which step to start from:
63+
- Present the available steps as numbered options
64+
- Use AskUserQuestion to let them choose
65+
66+
**Critical**:
67+
- You MUST invoke each step using the Skill tool. Do not copy/paste step instructions.
68+
- After each step completes, check if there's a next step and invoke it automatically.
69+
- The workflow continues until all dependent steps are complete.
70+
71+
## Context Files
72+
73+
- Job definition: `.deepwork/jobs/commit/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-
**AGENT: TAKE ACTION** - 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-
**AGENT: TAKE ACTION** - 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 @@ This step uses an iterative quality validation loop. After completing your work,
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: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,28 @@ This job has 3 step(s):
3535

3636
## Instructions
3737

38-
Determine what the user wants to do and route to the appropriate step.
38+
This is a **multi-step workflow**. Determine the starting point and run through the steps in sequence.
3939

4040
1. **Analyze user intent** from the text that follows `/deepwork_jobs`
4141

42-
2. **Match intent to a step**:
42+
2. **Identify the starting step** based on intent:
4343
- define: Create the job.yml specification file by understanding workflow requirements
4444
- implement: Generate instruction files for each step based on the job.yml specification
4545
- learn: Reflect on conversation to improve job instructions and capture learnings
4646

47-
3. **Invoke the matched step** using the Skill tool:
48-
```
49-
Skill: <step_command_name>
50-
```
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
5151

52-
4. **If intent is ambiguous**, ask the user which step they want:
52+
4. **If intent is ambiguous**, ask the user which step to start from:
5353
- Present the available steps as numbered options
5454
- Use AskUserQuestion to let them choose
5555

56-
**Critical**: You MUST invoke the step using the Skill tool. Do not copy/paste the step's instructions. The Skill tool invocation ensures the step's quality validation hooks fire.
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.
5760

5861
## Context Files
5962

.claude/commands/deepwork_policy.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,26 @@ This job has 1 step(s):
3333

3434
## Instructions
3535

36-
Determine what the user wants to do and route to the appropriate step.
36+
This is a **multi-step workflow**. Determine the starting point and run through the steps in sequence.
3737

3838
1. **Analyze user intent** from the text that follows `/deepwork_policy`
3939

40-
2. **Match intent to a step**:
40+
2. **Identify the starting step** based on intent:
4141
- define: Create or update policy entries in .deepwork.policy.yml
4242

43-
3. **Invoke the matched step** using the Skill tool:
44-
```
45-
Skill: <step_command_name>
46-
```
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
4747

48-
4. **If intent is ambiguous**, ask the user which step they want:
48+
4. **If intent is ambiguous**, ask the user which step to start from:
4949
- Present the available steps as numbered options
5050
- Use AskUserQuestion to let them choose
5151

52-
**Critical**: You MUST invoke the step using the Skill tool. Do not copy/paste the step's instructions. The Skill tool invocation ensures the step's quality validation hooks fire.
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.
5356

5457
## Context Files
5558

.claude/commands/update.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,26 @@ This job has 1 step(s):
3131

3232
## Instructions
3333

34-
Determine what the user wants to do and route to the appropriate step.
34+
This is a **multi-step workflow**. Determine the starting point and run through the steps in sequence.
3535

3636
1. **Analyze user intent** from the text that follows `/update`
3737

38-
2. **Match intent to a step**:
38+
2. **Identify the starting step** based on intent:
3939
- job: Edit standard job source files and sync to installed locations
4040

41-
3. **Invoke the matched step** using the Skill tool:
42-
```
43-
Skill: <step_command_name>
44-
```
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
4545

46-
4. **If intent is ambiguous**, ask the user which step they want:
46+
4. **If intent is ambiguous**, ask the user which step to start from:
4747
- Present the available steps as numbered options
4848
- Use AskUserQuestion to let them choose
4949

50-
**Critical**: You MUST invoke the step using the Skill tool. Do not copy/paste the step's instructions. The Skill tool invocation ensures the step's quality validation hooks fire.
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.
5154

5255
## Context Files
5356

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

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@ hooks:
99
1010
## Quality Criteria
1111
12-
**AGENT: TAKE ACTION** - Verify the capability additions meet ALL criteria:
13-
1. Any new hooks from the platform (for slash commands only) are added to src/deepwork/schemas/job_schema.py
14-
2. All existing adapters in src/deepwork/adapters.py are updated with the new hook fields
15-
(set to None/null if the platform doesn't support that hook)
16-
3. Only hooks available on slash command definitions are added (not general CLI hooks)
17-
4. job_schema.py remains valid Python with no syntax errors
18-
5. adapters.py remains consistent - all adapters have the same hook fields
19-
6. If no new hooks are needed, document why in a comment
20-
21-
If ALL criteria are met, include `<promise>✓ Quality Criteria Met</promise>`.
22-
12+
1. Are any new hooks from the platform (for slash commands only) added to src/deepwork/schemas/job_schema.py?
13+
2. Are all existing adapters in src/deepwork/adapters.py updated with the new hook fields? (set to None/null if the platform doesn't support that hook)
14+
3. Are only hooks available on slash command definitions added (not general CLI hooks)?
15+
4. Does job_schema.py remain valid Python with no syntax errors?
16+
5. Is adapters.py consistent - all adapters have the same hook fields?
17+
6. If no new hooks are needed, is there documentation explaining why?
2318
2419
## Instructions
2520
@@ -29,8 +24,8 @@ hooks:
2924
If the agent has included `<promise>✓ Quality Criteria Met</promise>` in their response AND
3025
all criteria appear to be met, respond with: {"ok": true}
3126
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]"}
27+
If criteria are NOT met OR the promise tag is missing, respond with:
28+
{"ok": false, "reason": "**AGENT: TAKE ACTION** - [which criteria failed and why]"}
3429
---
3530

3631
# add_platform.add_capabilities
@@ -242,16 +237,13 @@ Ensure all outputs are:
242237
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.
243238

244239
### Quality Criteria
245-
**AGENT: TAKE ACTION** - 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>`.
240+
241+
1. Are any new hooks from the platform (for slash commands only) added to src/deepwork/schemas/job_schema.py?
242+
2. Are all existing adapters in src/deepwork/adapters.py updated with the new hook fields? (set to None/null if the platform doesn't support that hook)
243+
3. Are only hooks available on slash command definitions added (not general CLI hooks)?
244+
4. Does job_schema.py remain valid Python with no syntax errors?
245+
5. Is adapters.py consistent - all adapters have the same hook fields?
246+
6. If no new hooks are needed, is there documentation explaining why?
255247

256248

257249
### Completion Promise

0 commit comments

Comments
 (0)