Skip to content

Commit 88424be

Browse files
ncrmroclaude
andauthored
fix(deepwork_jobs): shared_jobs references library jobs instead of copying, clean up readmes (#275)
* feat: update shared jobs * feat(library): add Quick Start snippets to job readmes and rewrite shared jobs intro Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(deepwork_jobs): shared_jobs references library jobs instead of copying them The sync_shared_jobs workflow now configures DEEPWORK_ADDITIONAL_JOBS_FOLDERS to reference library jobs in-place (from a local checkout or sparse clone) rather than copying job directories into .deepwork/jobs/. The shellHook example prefers ../deepwork when available, falling back to sparse checkout. Also updates the learn workflow to detect external job repos and handle commits/pushes separately. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(library): remove redundant deepwork_jobs prefix from README invocations Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(library): remove redundant deepwork_jobs prefix from job readmes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(library): simplify Quick Start examples to show actual usage Drop the shared_jobs setup step and show natural invocations instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(library): add job/workflow comments to Quick Start examples Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(library): add descriptive context to Quick Start code comments Explain what job/workflow is invoked and what it does, so readers understand the mapping between the command and the workflow. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(library): move Quick Start context above code blocks Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(library): add Claude skill creation examples to Quick Start sections Show how to create shortcut skills like /repo.setup, /research.deep, /platform.investigate, /spec.specify for quick access to workflows. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(library): complete Quick Start with shared_jobs prereq and skill usage examples Each Quick Start now shows: (1) shared_jobs setup if needed, (2) direct /deepwork invocation, (3) how to create a shortcut skill, (4) calling the shortcut skill with arguments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(deepwork_jobs): address PR review comments - Remove network operations (git clone/pull) from shellHook examples; keep shellHook to env var detection only, document explicit sync command - Define $LOCAL_PATH and $REPO_ROOT before using them in step instructions - Validate env var paths exist and contain job.yml files - Append to DEEPWORK_ADDITIONAL_JOBS_FOLDERS (colon-delimited) instead of overwriting - Use repo-relative paths for git add in learn workflow's external repo handling - Align source input values (local/remote/custom-path) with user-facing options - Rename installed_jobs output to available_jobs (no longer installing/copying) - Fix broken /docs/ links to use relative paths (./research, ./repo, etc.) - Soften "never copied" claim to allow customization via copy Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent af29eb1 commit 88424be

9 files changed

Lines changed: 345 additions & 106 deletions

File tree

library/jobs/README.md

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,40 @@
1-
# Job Library
1+
# Shared Jobs
22

3-
This directory contains a public library of example jobs that you can use as starting points for your own workflows. Each job demonstrates best practices for structuring multi-step tasks with DeepWork.
3+
DeepWork includes a library of reusable jobs that any project can adopt. These are pre-built, multi-step workflows covering common tasks like research, repository setup, platform engineering, and spec-driven development.
4+
5+
## Enabling Shared Jobs
6+
7+
The fastest way to add shared jobs to your project is with the `/deepwork` skill:
8+
9+
```
10+
/deepwork shared_jobs
11+
```
12+
13+
This walks you through configuring `DEEPWORK_ADDITIONAL_JOBS_FOLDERS` so the DeepWork plugin discovers library jobs at runtime alongside your local jobs. By default, jobs are referenced in-place from a checkout of the DeepWork repo, so you always get the latest version, though you can still copy them into your project when you want to customize them.
14+
15+
## Available Jobs
16+
17+
| Job | Description |
18+
|-----|-------------|
19+
| [Research](./research) | Multi-workflow research suite — deep investigation, quick summaries, material ingestion, and reproduction planning |
20+
| [Platform Engineer](./platform_engineer) | Incident response, observability, CI/CD, releases, security, cost management, and infrastructure |
21+
| [Repo](./repo) | Audit and configure repositories — labels, branch protection, milestones, and boards |
22+
| [Spec-Driven Development](./spec_driven_development) | Build features through executable specifications: constitution, specify, clarify, plan, tasks, implement |
23+
24+
## How It Works
25+
26+
Shared jobs are stored in the `library/jobs/` directory of the DeepWork repository. When you run the `shared_jobs` workflow, it:
27+
28+
1. **Detects your setup** — checks for an existing local DeepWork checkout or sparse clone
29+
2. **Configures the source** — sets up a sparse checkout in `.deepwork/upstream/` or points to an existing local clone
30+
3. **Sets the environment variable** — adds `DEEPWORK_ADDITIONAL_JOBS_FOLDERS` to your `flake.nix` shellHook (or shell profile)
31+
4. **Discovers jobs** — library jobs appear in `/deepwork` alongside your local and standard jobs
432

533
## Purpose
634

735
The job library provides:
836

9-
- **Inspiration**: See how others have structured complex workflows
37+
- **Ready-to-use workflows**: Start using proven multi-step workflows immediately
1038
- **Templates**: Copy and adapt jobs for your own use cases
1139
- **Learning**: Understand the job definition format through real examples
1240

@@ -131,20 +159,33 @@ git clone https://github.com/Unsupervisedcom/deepwork.git .deepwork/upstream
131159
shellHook = ''
132160
export REPO_ROOT=$(git rev-parse --show-toplevel)
133161
134-
# Clone DeepWork library jobs if not present
135-
if [ ! -d "$REPO_ROOT/.deepwork/upstream" ]; then
136-
git clone --sparse --filter=blob:none \
137-
https://github.com/Unsupervisedcom/deepwork.git \
138-
"$REPO_ROOT/.deepwork/upstream"
139-
git -C "$REPO_ROOT/.deepwork/upstream" sparse-checkout set --cone library/jobs/
162+
# Prefer local deepwork checkout, fall back to existing sparse checkout
163+
if [ -d "$REPO_ROOT/../deepwork/library/jobs" ]; then
164+
export DEEPWORK_ADDITIONAL_JOBS_FOLDERS="''${DEEPWORK_ADDITIONAL_JOBS_FOLDERS:+$DEEPWORK_ADDITIONAL_JOBS_FOLDERS:}$REPO_ROOT/../deepwork/library/jobs"
165+
elif [ -d "$REPO_ROOT/.deepwork/upstream/library/jobs" ]; then
166+
export DEEPWORK_ADDITIONAL_JOBS_FOLDERS="''${DEEPWORK_ADDITIONAL_JOBS_FOLDERS:+$DEEPWORK_ADDITIONAL_JOBS_FOLDERS:}$REPO_ROOT/.deepwork/upstream/library/jobs"
167+
else
168+
echo "DeepWork library jobs not found. Run '/deepwork shared_jobs' to set them up." >&2
140169
fi
141-
142-
export DEEPWORK_ADDITIONAL_JOBS_FOLDERS="$REPO_ROOT/.deepwork/upstream/library/jobs"
143170
'';
144171
```
145172

146173
Library jobs now appear in `/deepwork` alongside your local and standard jobs.
147174

175+
To initially set up or update the sparse checkout:
176+
177+
```bash
178+
REPO_ROOT="$(git rev-parse --show-toplevel)"
179+
if [ ! -d "$REPO_ROOT/.deepwork/upstream" ]; then
180+
git clone --sparse --filter=blob:none \
181+
https://github.com/Unsupervisedcom/deepwork.git \
182+
"$REPO_ROOT/.deepwork/upstream"
183+
git -C "$REPO_ROOT/.deepwork/upstream" sparse-checkout set --cone library/jobs/
184+
else
185+
git -C "$REPO_ROOT/.deepwork/upstream" pull --ff-only
186+
fi
187+
```
188+
148189
### Sparse Checkout (Specific Jobs Only)
149190

150191
If you only need certain library jobs, use a sparse checkout to minimize disk usage:
@@ -177,7 +218,7 @@ When you use a library job and discover improvements, you can contribute them ba
177218
### The Learn Flow
178219

179220
1. Run the library job in your project as normal
180-
2. Run `/deepwork deepwork_jobs learn` — the learn step classifies improvements as:
221+
2. Run `/deepwork learn` — the learn step classifies improvements as:
181222
- **Generalizable**: Improvements that benefit all users (update the library job)
182223
- **Bespoke**: Improvements specific to your project (update your local `AGENTS.md`)
183224

library/jobs/platform_engineer/readme.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,30 @@ This job covers the full lifecycle of platform engineering work:
1616
- **Infrastructure**: Audit documentation, plan migrations, convert imperative to declarative
1717
- **Error tracking**: Set up exception monitoring (Sentry, etc.)
1818

19+
## Quick Start
20+
21+
If you haven't already, enable shared library jobs in your project:
22+
23+
```
24+
/deepwork shared_jobs
25+
```
26+
27+
Natural language is matched to the `platform_engineer` job's `incident_investigation` workflow. Triages the incident, gathers logs and metrics, and produces a structured incident report.
28+
29+
```
30+
/deepwork the staging deploy is returning 502s, investigate
31+
```
32+
33+
Or create a Claude skill for quick access, then use it:
34+
35+
```
36+
/deepwork create a /platform.investigate skill that runs the platform_engineer job's incident_investigation workflow
37+
```
38+
39+
```
40+
/platform.investigate the staging deploy is returning 502s
41+
```
42+
1943
## Workflows
2044

2145
| Workflow | When to Use |

library/jobs/repo/readme.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,30 @@ Two workflows are provided:
1111
1. **setup** — Make a repo ready for work: create missing labels, check branch protection, verify milestones and boards
1212
2. **doctor** — Audit existing state and fix drift: find duplicates, enable missing protections, correct label drift, reconcile board items
1313

14+
## Quick Start
15+
16+
If you haven't already, enable shared library jobs in your project:
17+
18+
```
19+
/deepwork shared_jobs
20+
```
21+
22+
Runs the `setup` workflow from the `repo` job. Detects your git provider and ensures labels, branch protection, milestones, and boards match team conventions.
23+
24+
```
25+
/deepwork repo setup
26+
```
27+
28+
Or create a Claude skill for quick access, then use it:
29+
30+
```
31+
/deepwork create a /repo.setup skill that runs the repo job's setup workflow
32+
```
33+
34+
```
35+
/repo.setup
36+
```
37+
1438
## Provider Support
1539

1640
The job detects the provider from `git remote get-url origin`:

library/jobs/research/readme.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,30 @@ Ingest research material, analyze for reproducible claims, and create an enginee
4444
ingest_material → analyze → plan
4545
```
4646

47+
## Quick Start
48+
49+
If you haven't already, enable shared library jobs in your project:
50+
51+
```
52+
/deepwork shared_jobs
53+
```
54+
55+
Natural language is matched to the `research` job's `research` workflow. Scopes the question, gathers from multiple platforms, synthesizes findings, and produces a report with bibliography.
56+
57+
```
58+
/deepwork do a deep research run on growing plants in lunar regolith
59+
```
60+
61+
Or create a Claude skill for quick access, then use it:
62+
63+
```
64+
/deepwork create a /research.deep skill that runs the research job's research workflow
65+
```
66+
67+
```
68+
/research.deep growing plants in lunar regolith
69+
```
70+
4771
## Prerequisites
4872

4973
- For **research** workflow: Browser tool access if using external platforms (Gemini, ChatGPT, etc.)

library/jobs/spec_driven_development/readme.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,30 @@ The workflow progresses through six steps:
1515
5. **Tasks** - Break the plan into ordered, actionable development tasks
1616
6. **Implement** - Execute tasks to deliver the complete feature
1717

18+
## Quick Start
19+
20+
If you haven't already, enable shared library jobs in your project:
21+
22+
```
23+
/deepwork shared_jobs
24+
```
25+
26+
Runs the `spec_driven_development` workflow starting at the `specify` step. Walks through constitution, specify, clarify, plan, tasks, and implement.
27+
28+
```
29+
/deepwork spec_driven_development specify
30+
```
31+
32+
Or create a Claude skill for quick access, then use it:
33+
34+
```
35+
/deepwork create a /spec.specify skill that runs the spec_driven_development job's specify workflow
36+
```
37+
38+
```
39+
/spec.specify
40+
```
41+
1842
## When to Use
1943

2044
This workflow is ideal for:

src/deepwork/standard_jobs/deepwork_jobs/AGENTS.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,18 @@ Key details:
8282
- Bump patch version (0.0.x) for instruction improvements
8383
- Bump minor version (0.x.0) for new features or structural changes
8484

85+
### Learn Workflow: External Job Repo Handling (v1.7.0)
86+
87+
The learn workflow now detects when a job being updated lives in an external git repository (via `DEEPWORK_ADDITIONAL_JOBS_FOLDERS`) and handles commits/pushes to that repo separately.
88+
89+
Key design decisions:
90+
- Uses `job_dir` from MCP response as the authoritative path — never assumes `.deepwork/jobs/`
91+
- Detects external repos by comparing `git rev-parse --show-toplevel` of job_dir vs project root
92+
- Asks user preference for push strategy (direct to main, PR from branch, PR from fork)
93+
- Designed for keystone development mode where `~/.keystone/*/deepwork/library/jobs/` is the additional folder
94+
- Quality criteria "External Repo Handled" auto-passes for local jobs
95+
8596
## Last Updated
8697

87-
- Date: 2026-03-21
88-
- From conversation about: Adding library job Nix devshell detection to the repair workflow's errata step
98+
- Date: 2026-03-23
99+
- From conversation about: Adding DEEPWORK_ADDITIONAL_JOBS_FOLDERS awareness to the learn workflow

src/deepwork/standard_jobs/deepwork_jobs/job.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# yaml-language-server: $schema=.deepwork/schemas/job.schema.json
22
name: deepwork_jobs
3-
version: "1.6.0"
3+
version: "1.7.0"
44
summary: "Creates and manages multi-step AI workflows. Use when defining, implementing, testing, or improving DeepWork jobs."
55
common_job_info_provided_to_all_steps_at_runtime: |
66
Core commands for managing DeepWork jobs. These commands help you define new multi-step
@@ -199,6 +199,7 @@ steps:
199199
"Bespoke Learnings Captured": "Run-specific learnings were added to AGENTS.md."
200200
"File References Used": "AGENTS.md entries reference other files where appropriate."
201201
"Working Folder Correct": "AGENTS.md is in the correct working folder for the job."
202+
"External Repo Handled": "If the job lives in an external repo (via DEEPWORK_ADDITIONAL_JOBS_FOLDERS), changes were committed and pushed per the user's preference. If the job is local, this criterion auto-passes."
202203

203204
- id: fix_settings
204205
name: "Fix Settings Files"
@@ -276,21 +277,21 @@ steps:
276277

277278
- id: sync_shared_jobs
278279
name: "Sync Shared Jobs"
279-
description: "Installs library jobs from the DeepWork shared job library into the project. Supports remote (GitHub) and local source paths."
280+
description: "Configures DEEPWORK_ADDITIONAL_JOBS_FOLDERS to reference library jobs from a local checkout or sparse clone. Never copies jobs into .deepwork/jobs/."
280281
instructions_file: steps/sync_shared_jobs.md
281282
inputs:
282283
- name: source
283-
description: "Source for library jobs: 'remote' for GitHub, or a local path to a DeepWork repo checkout"
284+
description: "Source for library jobs: 'local' for an existing deepwork checkout, 'remote' for sparse-checkout clone, or a custom path"
284285
outputs:
285-
installed_jobs:
286+
available_jobs:
286287
type: files
287-
description: "The job.yml files of newly installed library jobs"
288+
description: "The job.yml files available via the configured library path"
288289
required: true
289290
dependencies: []
290291
reviews:
291-
- run_each: installed_jobs
292+
- run_each: available_jobs
292293
quality_criteria:
293294
"Valid Job Definition": "The job.yml is valid YAML with required fields (name, version, summary, steps)."
294295
"Step Files Present": "All instructions_file paths referenced in job.yml exist."
295-
"No Conflict": "Existing job handling was clean (new install, or user approved overwrite)."
296-
"Sync Completed": "deepwork sync was run after installation."
296+
"Referenced Not Copied": "Library jobs are referenced via DEEPWORK_ADDITIONAL_JOBS_FOLDERS, not copied into .deepwork/jobs/."
297+
"Env Var Configured": "DEEPWORK_ADDITIONAL_JOBS_FOLDERS is set for persistence (flake.nix, shellHook, or equivalent)."

src/deepwork/standard_jobs/deepwork_jobs/steps/learn.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,20 @@ Analyze the conversation history to extract learnings and improvements, then app
1717
- Identify which jobs and steps were executed
1818
- Note the order of execution
1919

20-
2. **Identify the target folder**
20+
2. **Locate the job directory using `job_dir`**
21+
- The MCP server returns `job_dir` (absolute path) when starting workflows — use this as the authoritative location
22+
- The job may live in `.deepwork/jobs/`, `src/deepwork/standard_jobs/`, or an **external folder** via `DEEPWORK_ADDITIONAL_JOBS_FOLDERS`
23+
- Check if `job_dir` is inside the current project's git repo or in a **separate git repository** (e.g. a library checkout at `~/.keystone/*/deepwork/library/jobs/`)
24+
- If `job_dir` is in a different git repo, note this — you'll need to handle commits/pushes separately in Step 8
25+
26+
3. **Identify the AGENTS.md target folder**
2127
- This should be the deepest common folder that would contain all work on the topic in the future
2228
- Should be clear from conversation history where work was done
2329
- If unclear, run `git diff` to see where changes were made on the branch
2430

25-
3. **If no job was specified**, ask the user:
31+
4. **If no job was specified**, ask the user:
2632
- "Which DeepWork job would you like me to learn from?"
27-
- List available jobs from `.deepwork/jobs/`
33+
- List available jobs (call `get_workflows` to see all discovered jobs)
2834

2935
### Step 2: Identify Points of Confusion and Inefficiency
3036

@@ -80,8 +86,9 @@ For each learning identified, determine if it is:
8086

8187
For each generalizable learning:
8288

83-
1. **Locate the instruction file**
84-
- Path: `.deepwork/jobs/[job_name]/steps/[step_id].md`
89+
1. **Locate the instruction file using `job_dir`**
90+
- Path: `<job_dir>/steps/[step_id].md` (where `job_dir` was identified in Step 1)
91+
- Do NOT assume `.deepwork/jobs/` — the job may live in an external folder
8592

8693
2. **Make targeted improvements**
8794
- Add missing context or clarification
@@ -109,7 +116,7 @@ Review all instruction files for the job and identify content that:
109116

110117
**Extract to shared files:**
111118

112-
1. **Create shared files** in `.deepwork/jobs/[job_name]/steps/shared/`
119+
1. **Create shared files** in `<job_dir>/steps/shared/`
113120
- `conventions.md` - Coding/formatting conventions used across steps
114121
- `examples.md` - Common examples referenced by multiple steps
115122
- `schemas.md` - Data structures or formats used throughout
@@ -172,6 +179,31 @@ If instruction files were modified:
172179
- Patch version (0.0.x) for instruction improvements
173180
- Minor version (0.x.0) if quality criteria changed
174181

182+
### Step 8: Commit and Push Changes to External Job Repos
183+
184+
If `job_dir` is in a **separate git repository** (outside the current project), you need to commit and push those changes independently.
185+
186+
1. **Detect the external repo**
187+
- Run `git -C <job_dir> rev-parse --show-toplevel` to find the repo root
188+
- If it differs from the current project root, the job lives in an external repo
189+
190+
2. **Commit changes in the external repo**
191+
- `cd` to the external repo root
192+
- Stage only the changed job files using a repo-relative path (e.g. `git -C <repo_root> add <relative_job_dir>/`)
193+
- Create a commit following Conventional Commits: `fix(jobs): improve <job_name> instructions from learn workflow`
194+
195+
3. **Push strategy — ask the user**
196+
- Ask: "The job `<job_name>` lives in an external repo at `<repo_root>`. How would you like to push these changes?"
197+
- **Direct push to main**: Commit on main and push (for collaborators who prefer clean history)
198+
- **PR from branch**: Create a feature branch, push, and open a PR (for non-collaborators or when review is desired)
199+
- **PR from fork**: Fork the repo, push to fork, and open a PR (for non-collaborators without write access)
200+
- If the user has previously expressed a preference, follow it without asking again
201+
202+
4. **Execute the chosen strategy**
203+
- For direct push: `git push origin main`
204+
- For PR: Create branch `deepwork/learn-<job_name>`, push with `-u`, open PR via `gh pr create`
205+
- For fork PR: Use `gh repo fork`, push to fork, open PR against upstream
206+
175207
## File Reference Patterns
176208

177209
When adding entries to AGENTS.md, prefer these patterns:

0 commit comments

Comments
 (0)