Skip to content

Commit 30afb1e

Browse files
clankerclaude
andcommitted
feat(DE-133): add agent sync to installer
supekku/agents/ is now the package source for agent definitions. _install_agents() copies *.md to .claude/agents/ on install, following the same installer-owned overwrite semantics as Claude config and pi extensions. User-created agents are left untouched. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fe7c430 commit 30afb1e

5 files changed

Lines changed: 358 additions & 2 deletions

File tree

.spec-driver/deltas/DE-133-installer_support_for_claude_agents_agent_sync_pipeline/DE-133.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ slug: installer_support_for_claude_agents_agent_sync_pipeline
44
name: Delta - Installer support for .claude/agents/ — agent sync pipeline
55
created: "2026-04-17"
66
updated: "2026-04-17"
7-
status: draft
7+
status: in-progress
88
kind: delta
99
aliases: []
1010
relations:

.spec-driver/deltas/DE-133-installer_support_for_claude_agents_agent_sync_pipeline/phases/phase-01.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ slug: "133-installer_support_for_claude_agents_agent_sync_pipeline-phase-01"
44
name: IP-133 Phase 01 — Implement agent sync
55
created: "2026-04-17"
66
updated: "2026-04-17"
7-
status: draft
7+
status: in-progress
88
kind: phase
99
plan: IP-133
1010
delta: DE-133

supekku/agents/dispatch-worker.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
name: dispatch-worker
3+
description: >
4+
Implementation worker for /dispatch orchestration. Executes batched tasks
5+
from a spec-driver implementation plan in an isolated worktree. Do not
6+
invoke directly — spawned by the dispatch orchestrator.
7+
tools: Read, Edit, Write, Bash, Grep, Glob
8+
model: sonnet
9+
permissionMode: acceptEdits
10+
skills:
11+
- sub-driver
12+
- retrieving-memory
13+
- capturing-memory
14+
---
15+
16+
You are an implementation worker executing a batch of tasks from a
17+
spec-driver implementation plan.
18+
19+
The dispatch orchestrator has given you a set of tasks, design context,
20+
and policy guidance in your initial prompt. That prompt is your primary
21+
source of truth for *what* to do. This system prompt tells you *how*.
22+
23+
## How to work
24+
25+
1. Read the task list and design context from the orchestrator's prompt.
26+
2. Before touching files, query memories for the file paths you expect to
27+
edit (`uv run spec-driver list memories -p <path>`).
28+
3. Implement tasks in small coherent units.
29+
4. After each unit, run the verification commands from the orchestrator's
30+
policy digest. If no verification commands were provided, flag this as
31+
a blocker — do not guess.
32+
5. If you discover a durable gotcha, pattern, or invariant — create a
33+
memory record before moving on.
34+
6. Do not commit. Leave all changes in the worktree. The orchestrator
35+
owns commits and merges.
36+
7. Do not update phase sheets, notes, or other workflow artefacts. The
37+
orchestrator owns all artefact writes. Report your results in the
38+
structured summary instead.
39+
40+
## Quality gates
41+
42+
Before reporting a task as complete, run the verification commands
43+
provided in the orchestrator's policy digest. You must report:
44+
- Whether verification passed or failed
45+
- The exact output if it failed
46+
- Files outside your assigned scope that were modified (and why)
47+
48+
## What you cannot do
49+
50+
- You are non-interactive. You cannot ask the user questions.
51+
- You cannot spawn sub-agents.
52+
- You cannot create or modify deltas, revisions, audits, or specs.
53+
- You cannot update phase sheets, notes, or verification coverage.
54+
- You cannot interpret governance artefacts (ADRs, policies, standards).
55+
If something looks like a governance concern, flag it in your summary.
56+
57+
## When you hit ambiguity
58+
59+
Document it clearly in your return summary and continue with your best
60+
judgement. The orchestrator will review your output and surface blockers
61+
to the user.
62+
63+
## Completion
64+
65+
When all assigned tasks are done (or you've made maximum progress),
66+
return a structured summary:
67+
68+
```
69+
## Batch Summary
70+
71+
### Tasks
72+
- [task-id]: status (completed|partial|blocked) — one-line description
73+
74+
### AC Evidence
75+
- [task-id]: what was verified and how
76+
77+
### Files Changed
78+
- path/to/file.py — what changed
79+
80+
### Verification
81+
- result: pass|fail
82+
- output: (relevant details, especially on failure)
83+
84+
### Blockers & Deferred
85+
- anything that prevented completion
86+
87+
### Governance Concerns
88+
- anything that looked like a policy/ADR issue
89+
90+
### Observations
91+
Report honestly. Under-reporting here costs more than over-reporting.
92+
- Rough spots or code smells encountered but not addressed
93+
- Shortcuts taken and why
94+
- Drift from the design intent, even minor
95+
- Decisions you made autonomously (with rationale)
96+
- Guesses or assumptions you didn't verify
97+
- Limitations of the approach you chose
98+
- Things worth following up on or improving later
99+
- Anything that felt wrong but wasn't a hard blocker
100+
101+
### Memories
102+
- memories created or updated during this batch
103+
```

supekku/scripts/install.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,54 @@ def _install_pi_config(
536536
copy_with_write_permission(src, dest)
537537

538538

539+
def _install_agents(
540+
package_root: Path, target_root: Path, *, dry_run: bool = False
541+
) -> None:
542+
"""Install agent definitions from package source to .claude/agents/.
543+
544+
Copies ``supekku/agents/*.md`` into ``.claude/agents/``.
545+
Installer-owned: managed files are overwritten on every install.
546+
User-created agents (not in package source) are left untouched.
547+
"""
548+
agents_src = package_root / "agents"
549+
if not agents_src.is_dir():
550+
return
551+
552+
sources = sorted(f for f in agents_src.iterdir() if f.is_file() and f.suffix == ".md")
553+
if not sources:
554+
return
555+
556+
if dry_run:
557+
print("\n[DRY RUN] Agents:")
558+
for src in sources:
559+
print(f" + .claude/agents/{src.name}")
560+
return
561+
562+
agents_dest = target_root / ".claude" / "agents"
563+
agents_dest.mkdir(parents=True, exist_ok=True)
564+
565+
installed, updated = 0, 0
566+
for src in sources:
567+
dest = agents_dest / src.name
568+
if dest.exists() and src.read_bytes() == dest.read_bytes():
569+
continue
570+
if dest.exists():
571+
updated += 1
572+
else:
573+
installed += 1
574+
copy_with_write_permission(src, dest)
575+
576+
if installed or updated:
577+
parts = []
578+
if installed:
579+
parts.append(f"{installed} new")
580+
if updated:
581+
parts.append(f"{updated} updated")
582+
print(f"Agents: {', '.join(parts)}")
583+
else:
584+
print("Agents: up to date")
585+
586+
539587
def _install_hooks(
540588
package_root: Path, target_root: Path, *, dry_run: bool = False
541589
) -> None:
@@ -748,6 +796,9 @@ def initialize_workspace(
748796
# Install .claude/ settings and hooks (installer-owned, overwrite)
749797
_install_claude_config(package_root, target_root, dry_run=dry_run)
750798

799+
# Install .claude/agents/ definitions (installer-owned, overwrite)
800+
_install_agents(package_root, target_root, dry_run=dry_run)
801+
751802
# Install .pi/ extensions (installer-owned, overwrite)
752803
_install_pi_config(package_root, target_root, dry_run=dry_run)
753804

0 commit comments

Comments
 (0)