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
10 changes: 4 additions & 6 deletions .claude/commands/deepwork_jobs.implement.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,9 @@ This will:
- Generate slash-commands for each step
- Make the commands available in `.claude/commands/` (or appropriate platform directory)

### Step 6: Reload Commands
### Step 6: Relay Reload Instructions

Instruct the user to reload commands in their current session:
- Run `/reload` command (if available)
- Or restart the Claude session
After running `deepwork sync`, look at the "To use the new commands" section in the output. **Relay these exact reload instructions to the user** so they know how to pick up the new commands. Don't just reference the sync output - tell them directly what they need to do (e.g., "Type 'exit' then run 'claude --resume'" for Claude Code, or "Run '/memory refresh'" for Gemini CLI).

### Step 7: Consider Policies for the New Job

Expand Down Expand Up @@ -461,7 +459,7 @@ After running `deepwork sync`, the following slash-commands are now available:

## Next Steps

1. **Reload commands**: Run `/reload` or restart your Claude session
1. **Reload commands**: [Include the specific reload instructions from the `deepwork sync` output here]
2. **Start the workflow**: Run `/[job_name].[first_step_id]` to begin
3. **Test the job**: Try executing the first step to ensure everything works

Expand All @@ -488,7 +486,7 @@ Before marking this step complete, ensure:
- [ ] Each instruction file is complete and actionable
- [ ] `deepwork sync` executed successfully
- [ ] Commands generated in platform directory
- [ ] User informed of next steps (reload commands)
- [ ] User informed to follow reload instructions from `deepwork sync`
- [ ] implementation_summary.md created
- [ ] Considered whether policies would benefit this job (Step 7)
- [ ] If policies suggested, offered to run `/deepwork_policy.define`
Expand Down
4 changes: 2 additions & 2 deletions .claude/commands/deepwork_jobs.learn.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ If instruction files were modified:
- [Any additional suggestions]
```

3. **Instruct user to reload** if commands were regenerated
3. **If commands were regenerated**, look at the "To use the new commands" section in the `deepwork sync` output and **relay these exact reload instructions to the user** (e.g., "Type 'exit' then run 'claude --resume'" for Claude Code)

## File Reference Patterns

Expand Down Expand Up @@ -382,7 +382,7 @@ I found the following job executions:

**Summary**

Created `learning_summary.md` documenting all changes. Please run `/reload` to get the updated commands.
Created `learning_summary.md` documenting all changes. To get the updated commands, type 'exit' then run 'claude --resume'.
```

## Handling Edge Cases
Expand Down
10 changes: 4 additions & 6 deletions .deepwork/jobs/deepwork_jobs/steps/implement.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,9 @@ This will:
- Generate slash-commands for each step
- Make the commands available in `.claude/commands/` (or appropriate platform directory)

### Step 6: Reload Commands
### Step 6: Relay Reload Instructions

Instruct the user to reload commands in their current session:
- Run `/reload` command (if available)
- Or restart the Claude session
After running `deepwork sync`, look at the "To use the new commands" section in the output. **Relay these exact reload instructions to the user** so they know how to pick up the new commands. Don't just reference the sync output - tell them directly what they need to do (e.g., "Type 'exit' then run 'claude --resume'" for Claude Code, or "Run '/memory refresh'" for Gemini CLI).

### Step 7: Consider Policies for the New Job

Expand Down Expand Up @@ -391,7 +389,7 @@ After running `deepwork sync`, the following slash-commands are now available:

## Next Steps

1. **Reload commands**: Run `/reload` or restart your Claude session
1. **Reload commands**: [Include the specific reload instructions from the `deepwork sync` output here]
2. **Start the workflow**: Run `/[job_name].[first_step_id]` to begin
3. **Test the job**: Try executing the first step to ensure everything works

Expand All @@ -418,7 +416,7 @@ Before marking this step complete, ensure:
- [ ] Each instruction file is complete and actionable
- [ ] `deepwork sync` executed successfully
- [ ] Commands generated in platform directory
- [ ] User informed of next steps (reload commands)
- [ ] User informed to follow reload instructions from `deepwork sync`
- [ ] implementation_summary.md created
- [ ] Considered whether policies would benefit this job (Step 7)
- [ ] If policies suggested, offered to run `/deepwork_policy.define`
Expand Down
4 changes: 2 additions & 2 deletions .deepwork/jobs/deepwork_jobs/steps/learn.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ If instruction files were modified:
- [Any additional suggestions]
```

3. **Instruct user to reload** if commands were regenerated
3. **If commands were regenerated**, look at the "To use the new commands" section in the `deepwork sync` output and **relay these exact reload instructions to the user** (e.g., "Type 'exit' then run 'claude --resume'" for Claude Code)

## File Reference Patterns

Expand Down Expand Up @@ -319,7 +319,7 @@ I found the following job executions:

**Summary**

Created `learning_summary.md` documenting all changes. Please run `/reload` to get the updated commands.
Created `learning_summary.md` documenting all changes. To get the updated commands, type 'exit' then run 'claude --resume'.
```

## Handling Edge Cases
Expand Down
10 changes: 4 additions & 6 deletions .gemini/commands/deepwork_jobs/implement.toml
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,9 @@ This will:
- Generate slash-commands for each step
- Make the commands available in `.claude/commands/` (or appropriate platform directory)

### Step 6: Reload Commands
### Step 6: Relay Reload Instructions

Instruct the user to reload commands in their current session:
- Run `/reload` command (if available)
- Or restart the Claude session
After running `deepwork sync`, look at the "To use the new commands" section in the output. **Relay these exact reload instructions to the user** so they know how to pick up the new commands. Don't just reference the sync output - tell them directly what they need to do (e.g., "Type 'exit' then run 'claude --resume'" for Claude Code, or "Run '/memory refresh'" for Gemini CLI).

### Step 7: Consider Policies for the New Job

Expand Down Expand Up @@ -429,7 +427,7 @@ After running `deepwork sync`, the following slash-commands are now available:

## Next Steps

1. **Reload commands**: Run `/reload` or restart your Claude session
1. **Reload commands**: [Include the specific reload instructions from the `deepwork sync` output here]
2. **Start the workflow**: Run `/[job_name].[first_step_id]` to begin
3. **Test the job**: Try executing the first step to ensure everything works

Expand All @@ -456,7 +454,7 @@ Before marking this step complete, ensure:
- [ ] Each instruction file is complete and actionable
- [ ] `deepwork sync` executed successfully
- [ ] Commands generated in platform directory
- [ ] User informed of next steps (reload commands)
- [ ] User informed to follow reload instructions from `deepwork sync`
- [ ] implementation_summary.md created
- [ ] Considered whether policies would benefit this job (Step 7)
- [ ] If policies suggested, offered to run `/deepwork_policy.define`
Expand Down
4 changes: 2 additions & 2 deletions .gemini/commands/deepwork_jobs/learn.toml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ If instruction files were modified:
- [Any additional suggestions]
```

3. **Instruct user to reload** if commands were regenerated
3. **If commands were regenerated**, look at the "To use the new commands" section in the `deepwork sync` output and **relay these exact reload instructions to the user** (e.g., "Type 'exit' then run 'claude --resume'" for Claude Code)

## File Reference Patterns

Expand Down Expand Up @@ -351,7 +351,7 @@ I found the following job executions:

**Summary**

Created `learning_summary.md` documenting all changes. Please run `/reload` to get the updated commands.
Created `learning_summary.md` documenting all changes. To get the updated commands, run '/memory refresh' or restart your session.
```

## Handling Edge Cases
Expand Down
4 changes: 2 additions & 2 deletions .gemini/commands/deepwork_jobs/refine.toml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ After updating the changelog:
```

2. **Reload commands**
- Instruct user to run `/reload` or restart session
- Instruct user to follow the reload instructions shown by `deepwork sync`

3. **Provide summary**
- Show what changed
Expand Down Expand Up @@ -410,7 +410,7 @@ Now run:
deepwork sync
```

Then reload your session and you'll have:
Then follow the reload instructions shown by `deepwork sync` and you'll have:
- /competitive_research.validate_positioning (new!)
- All other commands updated
```
Expand Down
9 changes: 9 additions & 0 deletions src/deepwork/cli/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def sync_commands(project_path: Path) -> None:
# Sync each platform
generator = CommandGenerator()
stats = {"platforms": 0, "commands": 0, "hooks": 0}
synced_adapters: list[AgentAdapter] = []

for platform_name in platforms:
try:
Expand Down Expand Up @@ -157,6 +158,7 @@ def sync_commands(project_path: Path) -> None:
console.print(f" [red]✗[/red] Failed to sync hooks: {e}")

stats["platforms"] += 1
synced_adapters.append(adapter)

# Summary
console.print()
Expand All @@ -174,3 +176,10 @@ def sync_commands(project_path: Path) -> None:

console.print(table)
console.print()

# Show reload instructions for each synced platform
if synced_adapters and stats["commands"] > 0:
console.print("[bold]To use the new commands:[/bold]")
for adapter in synced_adapters:
console.print(f" [cyan]{adapter.display_name}:[/cyan] {adapter.reload_instructions}")
console.print()
17 changes: 17 additions & 0 deletions src/deepwork/core/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ class AgentAdapter(ABC):
commands_dir: ClassVar[str] = "commands"
command_template: ClassVar[str] = "command-job-step.md.jinja"

# Instructions for reloading commands after sync (shown to users)
# Subclasses should override with platform-specific instructions.
reload_instructions: ClassVar[str] = (
"Restart your AI assistant session to use the new commands."
)

# Mapping from generic CommandLifecycleHook to platform-specific event names.
# Subclasses should override this to provide platform-specific mappings.
hook_name_mapping: ClassVar[dict[CommandLifecycleHook, str]] = {}
Expand Down Expand Up @@ -253,6 +259,12 @@ class ClaudeAdapter(AgentAdapter):
display_name = "Claude Code"
config_dir = ".claude"

# Claude Code doesn't have a reload command - must restart session
reload_instructions: ClassVar[str] = (
"Type 'exit' to leave your current session, then run "
"'claude --resume' (your history will be maintained)."
)

# Claude Code uses PascalCase event names
hook_name_mapping: ClassVar[dict[CommandLifecycleHook, str]] = {
CommandLifecycleHook.AFTER_AGENT: "Stop",
Expand Down Expand Up @@ -333,6 +345,11 @@ class GeminiAdapter(AgentAdapter):
config_dir = ".gemini"
command_template = "command-job-step.toml.jinja"

# Gemini CLI can reload with /memory refresh
reload_instructions: ClassVar[str] = (
"Run '/memory refresh' to reload commands, or restart your Gemini CLI session."
)

# Gemini CLI does NOT support command-level hooks
# Hooks are global/project-level in settings.json, not per-command
hook_name_mapping: ClassVar[dict[CommandLifecycleHook, str]] = {}
Expand Down
10 changes: 4 additions & 6 deletions src/deepwork/standard_jobs/deepwork_jobs/steps/implement.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,9 @@ This will:
- Generate slash-commands for each step
- Make the commands available in `.claude/commands/` (or appropriate platform directory)

### Step 6: Reload Commands
### Step 6: Relay Reload Instructions

Instruct the user to reload commands in their current session:
- Run `/reload` command (if available)
- Or restart the Claude session
After running `deepwork sync`, look at the "To use the new commands" section in the output. **Relay these exact reload instructions to the user** so they know how to pick up the new commands. Don't just reference the sync output - tell them directly what they need to do (e.g., "Type 'exit' then run 'claude --resume'" for Claude Code, or "Run '/memory refresh'" for Gemini CLI).

### Step 7: Consider Policies for the New Job

Expand Down Expand Up @@ -397,7 +395,7 @@ After running `deepwork sync`, the following slash-commands are now available:

## Next Steps

1. **Reload commands**: Run `/reload` or restart your Claude session
1. **Reload commands**: [Include the specific reload instructions from the `deepwork sync` output here]
2. **Start the workflow**: Run `/[job_name].[first_step_id]` to begin
3. **Test the job**: Try executing the first step to ensure everything works

Expand All @@ -424,7 +422,7 @@ Before marking this step complete, ensure:
- [ ] Each instruction file is complete and actionable
- [ ] `deepwork sync` executed successfully
- [ ] Commands generated in platform directory
- [ ] User informed of next steps (reload commands)
- [ ] User informed to follow reload instructions from `deepwork sync`
- [ ] implementation_summary.md created
- [ ] Considered whether policies would benefit this job (Step 7)
- [ ] If policies suggested, offered to run `/deepwork_policy.define`
Expand Down
4 changes: 2 additions & 2 deletions src/deepwork/standard_jobs/deepwork_jobs/steps/learn.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ If instruction files were modified:
- [Any additional suggestions]
```

3. **Instruct user to reload** if commands were regenerated
3. **If commands were regenerated**, look at the "To use the new commands" section in the `deepwork sync` output and **relay these exact reload instructions to the user** (e.g., "Type 'exit' then run 'claude --resume'" for Claude Code)

## File Reference Patterns

Expand Down Expand Up @@ -319,7 +319,7 @@ I found the following job executions:

**Summary**

Created `learning_summary.md` documenting all changes. Please run `/reload` to get the updated commands.
Created `learning_summary.md` documenting all changes. To get the updated commands, type 'exit' then run 'claude --resume'.
```

## Handling Edge Cases
Expand Down