Skip to content

Commit ab99063

Browse files
authored
Merge pull request kagenti#74 from kagenti/orchestrate/replicate
feat: bootstrap orchestrate skills for self-sufficient orchestration
2 parents c29e585 + 3c7cfdc commit ab99063

12 files changed

Lines changed: 2707 additions & 0 deletions

File tree

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
---
2+
name: orchestrate
3+
description: Enhance any repository with CI, tests, skills, and security through phased PRs - self-replicating
4+
---
5+
6+
```mermaid
7+
flowchart TD
8+
START(["/orchestrate"]) --> HAS_SCAN{Has scan report?}
9+
10+
HAS_SCAN -->|No| SCAN["orchestrate:scan"]:::orch
11+
SCAN --> PLAN["orchestrate:plan"]:::orch
12+
HAS_SCAN -->|Yes| HAS_PLAN{Has plan?}
13+
14+
HAS_PLAN -->|No| PLAN
15+
HAS_PLAN -->|Yes| NEXT_PHASE{Next phase?}
16+
17+
NEXT_PHASE -->|Phase 2| PRECOMMIT["orchestrate:precommit<br/>PR #1"]:::orch
18+
NEXT_PHASE -->|Phase 3| TESTS["orchestrate:tests<br/>PR #2"]:::orch
19+
NEXT_PHASE -->|Phase 4| CI["orchestrate:ci<br/>PR #3"]:::orch
20+
NEXT_PHASE -->|Phase 5| SECURITY["orchestrate:security<br/>PR #4"]:::orch
21+
NEXT_PHASE -->|Phase 6| REPLICATE["orchestrate:replicate<br/>PR #5"]:::orch
22+
NEXT_PHASE -->|Phase 7| REVIEW["orchestrate:review"]:::orch
23+
24+
PRECOMMIT --> TESTS
25+
TESTS --> CI
26+
CI --> SECURITY
27+
SECURITY --> REPLICATE
28+
REPLICATE --> REVIEW
29+
REVIEW -->|optional| ONBOARD_LINK["onboard:link"]:::onb
30+
ONBOARD_LINK --> ONBOARD_STD["onboard:standards"]:::onb
31+
REVIEW --> DONE([All phases complete])
32+
33+
classDef orch fill:#FF9800,stroke:#333,color:white
34+
classDef onb fill:#9C27B0,stroke:#333,color:white
35+
classDef check fill:#FFC107,stroke:#333,color:black
36+
class HAS_SCAN,HAS_PLAN,NEXT_PHASE check
37+
```
38+
39+
> Follow this diagram as the workflow.
40+
41+
# Orchestrate Skills
42+
43+
Enhance any repository with CI, tests, skills, and security through a series of phased PRs. Each phase produces a focused, reviewable PR of 600-700 lines.
44+
45+
## Entry Point Routing
46+
47+
When `/orchestrate` is invoked, determine the action:
48+
49+
```
50+
What was provided?
51+
|
52+
+-- /orchestrate <repo-path>
53+
| New target. Clone or locate the repo, then start from scan.
54+
| Example: /orchestrate .repos/my-service
55+
|
56+
+-- /orchestrate <phase>
57+
| Jump to a specific phase. Requires scan + plan to already exist.
58+
| Example: /orchestrate ci
59+
|
60+
+-- /orchestrate status
61+
Show current orchestration state for all tracked targets.
62+
```
63+
64+
### Route logic
65+
66+
1. **`/orchestrate <repo-path>`** -- If the path points to a git repository, derive the target name from the directory basename. Check `/tmp/kagenti/orchestrate/<target>/` for existing state. If no scan report exists, invoke `orchestrate:scan`. If scan exists but no plan, invoke `orchestrate:plan`. If both exist, determine the next incomplete phase and invoke it.
67+
68+
2. **`/orchestrate <phase>`** -- Validate that `scan-report.md` and `plan.md` exist for the current target. If missing, instruct the user to run `/orchestrate <repo-path>` first. Otherwise invoke the requested phase skill directly (e.g., `orchestrate:precommit`).
69+
70+
3. **`/orchestrate status`** -- List all directories under `/tmp/kagenti/orchestrate/`, read each target's `phase-status.md`, and display a summary table showing target name, current phase, and completion percentage.
71+
72+
## Phase Status Tracking
73+
74+
All orchestration state is persisted under `/tmp/kagenti/orchestrate/<target>/`:
75+
76+
| File | Purpose |
77+
|------|---------|
78+
| `scan-report.md` | Output of `orchestrate:scan` -- repo structure, tech stack, gaps |
79+
| `plan.md` | Output of `orchestrate:plan` -- enhancement plan with phases and PR scope |
80+
| `phase-status.md` | Tracks which phases are complete, in-progress, or pending |
81+
82+
The `phase-status.md` file uses this format:
83+
84+
```markdown
85+
# Orchestration Status: <target>
86+
87+
| Phase | Status | PR | Updated |
88+
|-------|--------|----|---------|
89+
| scan | complete | -- | 2025-01-15 |
90+
| plan | complete | -- | 2025-01-15 |
91+
| precommit | complete | #42 | 2025-01-16 |
92+
| tests | in-progress | #43 | 2025-01-17 |
93+
| ci | pending | -- | -- |
94+
| security | pending | -- | -- |
95+
| replicate | pending | -- | -- |
96+
| review | pending | -- | -- |
97+
```
98+
99+
Each phase skill is responsible for updating `phase-status.md` when it starts and completes.
100+
101+
## Phase Overview
102+
103+
| Phase | Skill | PR | Description |
104+
|-------|-------|-----|-------------|
105+
| 0 | orchestrate:scan | -- | Assess target repo structure, tech stack, and gaps |
106+
| 1 | orchestrate:plan | -- | Brainstorm enhancements and produce a phased plan |
107+
| 2 | orchestrate:precommit | PR #1 | Pre-commit hooks, linting, and code formatting |
108+
| 3 | orchestrate:tests | PR #2 | Test infrastructure and initial test coverage |
109+
| 4 | orchestrate:ci | PR #3 | Comprehensive CI: lint, test, build, security scanning, dependabot, scorecard |
110+
| 5 | orchestrate:security | PR #4 | Security governance: CODEOWNERS, SECURITY.md, CONTRIBUTING.md, LICENSE |
111+
| 6 | orchestrate:replicate | PR #5 | Bootstrap Claude Code skills into the target repo |
112+
| 7 | orchestrate:review | -- | Review all orchestration PRs before merge |
113+
114+
Phases are sequential. Each PR builds on the previous one. Tests come before CI (so CI can run them) and before security (so code refactoring for security fixes has test coverage as a safety net). The scan and plan phases do not produce PRs -- they produce artifacts that guide all subsequent phases.
115+
116+
## Self-Replication
117+
118+
Phase 6 (`orchestrate:replicate`) is what makes this system fractal. It copies a starter set of Claude Code skills into the target repository, including a tailored version of the orchestrate skill itself. Once replicated, the target repo can orchestrate other repos using the same phased approach.
119+
120+
This means every repository that goes through orchestration gains the ability to orchestrate others. The skills adapt to the target's tech stack (the scan report informs what language-specific linters, test frameworks, and CI patterns to use).
121+
122+
## Quick Start
123+
124+
```bash
125+
# Clone target repo into a working directory
126+
git clone git@github.com:org/repo.git .repos/repo-name
127+
128+
# Run the full orchestration pipeline
129+
# /orchestrate .repos/repo-name
130+
131+
# Or jump to a specific phase (if scan + plan already exist)
132+
# /orchestrate precommit
133+
134+
# Check status across all targets
135+
# /orchestrate status
136+
```
137+
138+
## Related Skills
139+
140+
### Orchestrate sub-skills
141+
142+
| Skill | Description |
143+
|-------|-------------|
144+
| `orchestrate:scan` | Assess target repo structure and identify gaps |
145+
| `orchestrate:plan` | Produce a phased enhancement plan |
146+
| `orchestrate:precommit` | Add pre-commit hooks, linters, formatters |
147+
| `orchestrate:ci` | Comprehensive CI: lint, test, build, security scanning, dependabot, scorecard |
148+
| `orchestrate:tests` | Add test infrastructure and initial test coverage |
149+
| `orchestrate:security` | Security governance: CODEOWNERS, SECURITY.md, CONTRIBUTING.md, LICENSE |
150+
| `orchestrate:replicate` | Bootstrap Claude Code skills into the target |
151+
| `orchestrate:review` | Review all orchestration PRs before merge |
152+
153+
### Onboard skills
154+
155+
| Skill | Description |
156+
|-------|-------------|
157+
| `onboard:link` | Link a newly-orchestrated repo to Kagenti |
158+
| `onboard:standards` | Apply organizational standards and conventions |

0 commit comments

Comments
 (0)