Skip to content

Comments

Refactor job discovery to support multiple job folders#210

Merged
nhorton merged 7 commits intomainfrom
claude/multiple-job-folders-ZE6M8
Feb 13, 2026
Merged

Refactor job discovery to support multiple job folders#210
nhorton merged 7 commits intomainfrom
claude/multiple-job-folders-ZE6M8

Conversation

@nhorton
Copy link
Contributor

@nhorton nhorton commented Feb 13, 2026

Summary

This PR refactors job discovery to support loading jobs from multiple configurable directories instead of only from .deepwork/jobs/. It introduces a new deepwork.core.jobs module that centralizes job folder resolution and provides utilities for discovering and loading jobs across all configured sources.

Key Changes

  • New deepwork.core.jobs module: Provides three main functions:

    • get_job_folders(): Returns the ordered list of directories to scan for jobs (project-local, standard, and environment-configured)
    • load_all_jobs(): Discovers and parses all job definitions across all folders, with first-folder-wins deduplication
    • find_job_dir(): Locates a specific job by name across all folders
  • Environment variable support: Added DEEPWORK_ADDITIONAL_JOBS_FOLDERS environment variable to allow appending custom job directories (colon-delimited paths)

  • Standard jobs now loaded from package: Standard jobs are no longer copied into .deepwork/jobs/ during installation. Instead, they are loaded directly from src/deepwork/standard_jobs/ at runtime via the new job discovery system

  • Updated sync.py:

    • Uses new get_job_folders() to discover jobs across all sources
    • Added _migrate_remove_synced_standard_jobs() to clean up legacy synced standard jobs from existing installations
    • Collects hooks from all job folders with deduplication
  • Updated mcp/tools.py:

    • Replaced direct .deepwork/jobs/ access with load_all_jobs() and find_job_dir()
    • Removed self.jobs_dir attribute in favor of dynamic folder discovery
  • Comprehensive test coverage: Added 215 lines of unit tests covering job folder discovery, loading, and finding with various scenarios (duplicates, missing folders, invalid jobs, environment variables)

Implementation Details

  • Job discovery respects folder order for priority: project-local jobs override standard jobs, which can be overridden by environment-configured folders
  • Invalid jobs are logged as warnings and skipped rather than failing the entire discovery process
  • The migration helper gracefully removes the legacy deepwork_jobs folder from existing installations
  • All job folder operations include existence checks to handle non-existent paths gracefully

https://claude.ai/code/session_01KU818enCNqHLbrqtdyCXUV

…ERS env var

Job discovery now searches multiple directories instead of only
.deepwork/jobs/. The default search path is:

1. <project>/.deepwork/jobs  (project-local / user-created jobs)
2. <package>/standard_jobs   (built-in jobs shipped with DeepWork)

Additional folders can be appended via the DEEPWORK_ADDITIONAL_JOBS_FOLDERS
environment variable (colon-delimited list of paths).

Standard jobs are no longer copied into .deepwork/jobs/ during install;
they are loaded directly from the package source. The sync command
removes the legacy .deepwork/jobs/deepwork_jobs copy for migration.

https://claude.ai/code/session_01KU818enCNqHLbrqtdyCXUV
…_dir in MCP

- Add `job_dir` field to `ActiveStepInfo` so agents know the absolute
  path to the job directory (needed to find templates, scripts, etc.)
- Remove stale `make_new_job.sh` permission from settings.json template
- Update all standard job step instructions to use `<job_dir>/` instead
  of hardcoded `.deepwork/jobs/deepwork_jobs/` paths
- Update AGENTS.md to reflect the single-location model
- Update fix_settings quality criterion for stale permission cleanup
- Delete the legacy .deepwork/jobs/deepwork_jobs/ directory (migration)
- Update mcp_interface.md documentation

https://claude.ai/code/session_01KU818enCNqHLbrqtdyCXUV
These functions copied standard jobs into .deepwork/jobs/ during install,
which is no longer done — standard jobs are loaded directly from the
package at runtime.

https://claude.ai/code/session_01KU818enCNqHLbrqtdyCXUV
Artifacts from running the test_job_flow workflow which exercised the
full job creation pipeline end-to-end.

https://claude.ai/code/session_01KU818enCNqHLbrqtdyCXUV
@nhorton nhorton added this pull request to the merge queue Feb 13, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 13, 2026
* feat: support multiple job folders with DEEPWORK_ADDITIONAL_JOBS_FOLDERS env var

Job discovery now searches multiple directories instead of only
.deepwork/jobs/. The default search path is:

1. <project>/.deepwork/jobs  (project-local / user-created jobs)
2. <package>/standard_jobs   (built-in jobs shipped with DeepWork)

Additional folders can be appended via the DEEPWORK_ADDITIONAL_JOBS_FOLDERS
environment variable (colon-delimited list of paths).

Standard jobs are no longer copied into .deepwork/jobs/ during install;
they are loaded directly from the package source. The sync command
removes the legacy .deepwork/jobs/deepwork_jobs copy for migration.

https://claude.ai/code/session_01KU818enCNqHLbrqtdyCXUV

* fix: remove stale .deepwork/jobs/deepwork_jobs references, expose job_dir in MCP

- Add `job_dir` field to `ActiveStepInfo` so agents know the absolute
  path to the job directory (needed to find templates, scripts, etc.)
- Remove stale `make_new_job.sh` permission from settings.json template
- Update all standard job step instructions to use `<job_dir>/` instead
  of hardcoded `.deepwork/jobs/deepwork_jobs/` paths
- Update AGENTS.md to reflect the single-location model
- Update fix_settings quality criterion for stale permission cleanup
- Delete the legacy .deepwork/jobs/deepwork_jobs/ directory (migration)
- Update mcp_interface.md documentation

https://claude.ai/code/session_01KU818enCNqHLbrqtdyCXUV

* chore: remove unused _inject_standard_job and _inject_deepwork_jobs

These functions copied standard jobs into .deepwork/jobs/ during install,
which is no longer done — standard jobs are loaded directly from the
package at runtime.

https://claude.ai/code/session_01KU818enCNqHLbrqtdyCXUV

* style: ruff format

https://claude.ai/code/session_01KU818enCNqHLbrqtdyCXUV

* style: migrate str+Enum to StrEnum (UP042)

https://claude.ai/code/session_01KU818enCNqHLbrqtdyCXUV

* chore: update coverage to 79.91% from test_job_flow run

Artifacts from running the test_job_flow workflow which exercised the
full job creation pipeline end-to-end.

https://claude.ai/code/session_01KU818enCNqHLbrqtdyCXUV

---------

Co-authored-by: Claude <noreply@anthropic.com>
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 13, 2026
The merge queue run timed out at 3 minutes due to API latency.
Previous successful runs took ~1.5 minutes, but 3 minutes is too
tight for flaky conditions. Increasing to 6 minutes for headroom.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nhorton nhorton enabled auto-merge February 13, 2026 21:50
@nhorton nhorton added this pull request to the merge queue Feb 13, 2026
Merged via the queue into main with commit 123a054 Feb 13, 2026
4 checks passed
@nhorton nhorton deleted the claude/multiple-job-folders-ZE6M8 branch February 13, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants