Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .claude/skills/deepwork_jobs.define/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,19 @@ For each major phase they mentioned, ask structured questions to gather details:
- Are there any quality checks or validation needed?
- What makes a good vs. bad output for this step?

6. **Agent Delegation** (optional)
- Should this step be executed by a specific agent type?
- Use the `agent` field when the step should run in a forked context with a specific agent
- When `agent` is set, the generated skill automatically includes `context: fork`
- Available agent types:
- `general-purpose` - Standard agent for multi-step tasks

```yaml
steps:
- id: research_step
agent: general-purpose # Delegates to the general-purpose agent
```

**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.

#### Doc Spec-Aware Output Format
Expand Down Expand Up @@ -578,6 +591,19 @@ Use branch format: `deepwork/deepwork_jobs-[instance]-YYYYMMDD`
exposed: true # Makes step available without running dependencies
```

### Agent Delegation

When a step should be executed by a specific agent type, use the `agent` field. This automatically sets `context: fork` in the generated skill.

```yaml
steps:
- id: research_step
agent: general-purpose # Delegates to the general-purpose agent
```

Available agent types:
- `general-purpose` - Standard agent for multi-step tasks

### Quality Hooks

```yaml
Expand Down
13 changes: 13 additions & 0 deletions .claude/skills/deepwork_jobs.review_job_spec/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,19 @@ Use branch format: `deepwork/deepwork_jobs-[instance]-YYYYMMDD`
exposed: true # Makes step available without running dependencies
```

### Agent Delegation

When a step should be executed by a specific agent type, use the `agent` field. This automatically sets `context: fork` in the generated skill.

```yaml
steps:
- id: research_step
agent: general-purpose # Delegates to the general-purpose agent
```

Available agent types:
- `general-purpose` - Standard agent for multi-step tasks

### Quality Hooks

```yaml
Expand Down
13 changes: 13 additions & 0 deletions .deepwork/doc_specs/job_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ steps:
exposed: true # Makes step available without running dependencies
```

### Agent Delegation

When a step should be executed by a specific agent type, use the `agent` field. This automatically sets `context: fork` in the generated skill.

```yaml
steps:
- id: research_step
agent: general-purpose # Delegates to the general-purpose agent
```

Available agent types:
- `general-purpose` - Standard agent for multi-step tasks

### Quality Hooks

```yaml
Expand Down
13 changes: 13 additions & 0 deletions .deepwork/jobs/deepwork_jobs/doc_specs/job_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ steps:
exposed: true # Makes step available without running dependencies
```

### Agent Delegation

When a step should be executed by a specific agent type, use the `agent` field. This automatically sets `context: fork` in the generated skill.

```yaml
steps:
- id: research_step
agent: general-purpose # Delegates to the general-purpose agent
```

Available agent types:
- `general-purpose` - Standard agent for multi-step tasks

### Quality Hooks

```yaml
Expand Down
13 changes: 13 additions & 0 deletions .deepwork/jobs/deepwork_jobs/steps/define.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,19 @@ For each major phase they mentioned, ask structured questions to gather details:
- Are there any quality checks or validation needed?
- What makes a good vs. bad output for this step?

6. **Agent Delegation** (optional)
- Should this step be executed by a specific agent type?
- Use the `agent` field when the step should run in a forked context with a specific agent
- When `agent` is set, the generated skill automatically includes `context: fork`
- Available agent types:
- `general-purpose` - Standard agent for multi-step tasks

```yaml
steps:
- id: research_step
agent: general-purpose # Delegates to the general-purpose agent
```

**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.

#### Doc Spec-Aware Output Format
Expand Down
2 changes: 2 additions & 0 deletions .deepwork/jobs/deepwork_jobs/templates/job.yml.template
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ steps:
outputs:
- [output_filename_or_path] # e.g., "report.md" or "reports/analysis.md"
dependencies: [] # List of step IDs that must complete first
# Optional: Delegate to a specific agent type (uses context: fork)
# agent: general-purpose # or other agent type
# Optional: Quality validation hooks
hooks:
after_agent:
Expand Down
13 changes: 13 additions & 0 deletions .gemini/skills/deepwork_jobs/define.toml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,19 @@ For each major phase they mentioned, ask structured questions to gather details:
- Are there any quality checks or validation needed?
- What makes a good vs. bad output for this step?

6. **Agent Delegation** (optional)
- Should this step be executed by a specific agent type?
- Use the `agent` field when the step should run in a forked context with a specific agent
- When `agent` is set, the generated skill automatically includes `context: fork`
- Available agent types:
- `general-purpose` - Standard agent for multi-step tasks

```yaml
steps:
- id: research_step
agent: general-purpose # Delegates to the general-purpose agent
```

**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.

#### Doc Spec-Aware Output Format
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Agent delegation field for job.yml steps
- New `agent` field on steps allows specifying an agent type (e.g., `agent: general-purpose`)
- When `agent` is set, generated Claude Code skills automatically include `context: fork` and `agent:` in frontmatter
- Enables steps to delegate execution to specific agent types
- Updated `deepwork_jobs.define` step instructions with agent delegation guidance
- Updated `job_spec.md` doc spec with "Agent Delegation" section
- Explicit workflow definitions in job.yml for distinguishing multi-step workflows from standalone skills
- New `workflows` section in job.yml with `name`, `summary`, and ordered `steps` array
- Workflows are shown separately from standalone skills in generated meta-skills
Expand Down
1 change: 1 addition & 0 deletions src/deepwork/core/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ def _build_step_context(
"hooks": hooks, # New: all hooks by platform event name
"stop_hooks": stop_hooks, # Backward compat: after_agent hooks only
"quality_criteria": step.quality_criteria, # Declarative criteria with framing
"agent": step.agent, # Agent type (e.g., "general-purpose") - triggers context: fork
}

# Add workflow context if step is part of a workflow
Expand Down
4 changes: 4 additions & 0 deletions src/deepwork/core/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ class Step:
# Declarative quality criteria rendered with standard evaluation framing
quality_criteria: list[str] = field(default_factory=list)

# Agent type for this step (e.g., "general-purpose"). When set, skill uses context: fork
agent: str | None = None

@property
def stop_hooks(self) -> list[HookAction]:
"""
Expand Down Expand Up @@ -180,6 +183,7 @@ def from_dict(cls, data: dict[str, Any]) -> "Step":
hooks=hooks,
exposed=data.get("exposed", False),
quality_criteria=data.get("quality_criteria", []),
agent=data.get("agent"),
)


Expand Down
5 changes: 5 additions & 0 deletions src/deepwork/schemas/job_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@
"minLength": 1,
},
},
"agent": {
"type": "string",
"description": "Agent type for this step. When set, the skill uses context: fork and delegates to the specified agent (e.g., 'general-purpose').",
"minLength": 1,
},
},
"additionalProperties": False,
},
Expand Down
13 changes: 13 additions & 0 deletions src/deepwork/standard_jobs/deepwork_jobs/doc_specs/job_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ steps:
exposed: true # Makes step available without running dependencies
```

### Agent Delegation

When a step should be executed by a specific agent type, use the `agent` field. This automatically sets `context: fork` in the generated skill.

```yaml
steps:
- id: research_step
agent: general-purpose # Delegates to the general-purpose agent
```

Available agent types:
- `general-purpose` - Standard agent for multi-step tasks

### Quality Hooks

```yaml
Expand Down
13 changes: 13 additions & 0 deletions src/deepwork/standard_jobs/deepwork_jobs/steps/define.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,19 @@ For each major phase they mentioned, ask structured questions to gather details:
- Are there any quality checks or validation needed?
- What makes a good vs. bad output for this step?

6. **Agent Delegation** (optional)
- Should this step be executed by a specific agent type?
- Use the `agent` field when the step should run in a forked context with a specific agent
- When `agent` is set, the generated skill automatically includes `context: fork`
- Available agent types:
- `general-purpose` - Standard agent for multi-step tasks

```yaml
steps:
- id: research_step
agent: general-purpose # Delegates to the general-purpose agent
```

**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.

#### Doc Spec-Aware Output Format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ steps:
outputs:
- [output_filename_or_path] # e.g., "report.md" or "reports/analysis.md"
dependencies: [] # List of step IDs that must complete first
# Optional: Delegate to a specific agent type (uses context: fork)
# agent: general-purpose # or other agent type
# Optional: Quality validation hooks
hooks:
after_agent:
Expand Down
7 changes: 7 additions & 0 deletions src/deepwork/templates/claude/skill-job-step.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,20 @@ Template Variables:
- path: string (for script)
- content: string (for prompt)
- hooks: dict|null - All hooks by event name (Stop, PreToolUse, etc.)

Agent Delegation:
- agent: string|null - Agent type (e.g., "general-purpose"). When set, adds context: fork
#}
---
name: {{ job_name }}.{{ step_id }}
description: "{{ step_description }}"
{% if not exposed %}
user-invocable: false
{% endif %}{#- if not exposed #}
{% if agent %}
context: fork
agent: {{ agent }}
{% endif %}{#- if agent #}
{#
NOTE: Prompt-based stop hooks do not currently work in Claude Code.
See: https://github.com/anthropics/claude-code/issues/20221
Expand Down