legion-cc 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +269 -0
- package/VERSION +1 -0
- package/agents/legion-orchestrator.md +95 -0
- package/bin/install.js +898 -0
- package/bin/legion-tools.cjs +421 -0
- package/bin/lib/config.cjs +141 -0
- package/bin/lib/core.cjs +216 -0
- package/bin/lib/domain.cjs +107 -0
- package/bin/lib/init.cjs +184 -0
- package/bin/lib/session.cjs +140 -0
- package/bin/lib/state.cjs +280 -0
- package/commands/legion/devops/architect.md +44 -0
- package/commands/legion/devops/build.md +52 -0
- package/commands/legion/devops/cycle.md +52 -0
- package/commands/legion/devops/execute.md +52 -0
- package/commands/legion/devops/plan.md +51 -0
- package/commands/legion/devops/quick.md +45 -0
- package/commands/legion/devops/review.md +52 -0
- package/commands/legion/resume.md +52 -0
- package/commands/legion/status.md +53 -0
- package/hooks/legion-context-monitor.js +180 -0
- package/hooks/legion-statusline.js +191 -0
- package/package.json +48 -0
- package/references/agent-routing.md +64 -0
- package/references/devops/agent-map.md +61 -0
- package/references/devops/pipeline-patterns.md +87 -0
- package/references/domain-registry.md +63 -0
- package/references/ui-brand.md +102 -0
- package/templates/config.json +25 -0
- package/templates/devops/architect-output.md +28 -0
- package/templates/devops/execution-report.md +23 -0
- package/templates/devops/plan-output.md +33 -0
- package/templates/devops/review-checklist.md +35 -0
- package/templates/session.md +17 -0
- package/templates/state.md +17 -0
- package/templates/task-record.md +19 -0
- package/workflows/core/completion.md +70 -0
- package/workflows/core/context-load.md +57 -0
- package/workflows/core/init.md +52 -0
- package/workflows/devops/architect.md +91 -0
- package/workflows/devops/build.md +92 -0
- package/workflows/devops/cycle.md +237 -0
- package/workflows/devops/execute.md +118 -0
- package/workflows/devops/plan.md +108 -0
- package/workflows/devops/quick.md +107 -0
- package/workflows/devops/review.md +112 -0
- package/workflows/resume.md +88 -0
- package/workflows/status.md +72 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Legion — Domain Registry
|
|
2
|
+
|
|
3
|
+
## Installed Domains
|
|
4
|
+
|
|
5
|
+
### devops (v0.1.0)
|
|
6
|
+
|
|
7
|
+
**Description**: Infrastructure design, planning, execution, and review.
|
|
8
|
+
|
|
9
|
+
**Pipeline**: architect → plan → execute → review
|
|
10
|
+
|
|
11
|
+
**Agents**:
|
|
12
|
+
| Role | Agent | Model |
|
|
13
|
+
|------|-------|-------|
|
|
14
|
+
| architect | devops-architect | opus |
|
|
15
|
+
| planner | delivery-planner | sonnet |
|
|
16
|
+
| executor | infra-executor | opus |
|
|
17
|
+
| builder | codebase-builder | opus |
|
|
18
|
+
| reviewer | devops-architect | sonnet |
|
|
19
|
+
|
|
20
|
+
**Commands**:
|
|
21
|
+
- `/legion:devops:quick` — Fast context-aware execution
|
|
22
|
+
- `/legion:devops:architect` — Architecture design
|
|
23
|
+
- `/legion:devops:plan` — Delivery planning
|
|
24
|
+
- `/legion:devops:execute` — Infrastructure execution
|
|
25
|
+
- `/legion:devops:build` — Codebase scaffolding
|
|
26
|
+
- `/legion:devops:review` — Architecture review
|
|
27
|
+
- `/legion:devops:cycle` — Full pipeline
|
|
28
|
+
|
|
29
|
+
## Adding a New Domain
|
|
30
|
+
|
|
31
|
+
To register a new domain (e.g., `backend`):
|
|
32
|
+
|
|
33
|
+
1. Create commands at `commands/legion/{domain}/`
|
|
34
|
+
2. Create workflows at `workflows/{domain}/`
|
|
35
|
+
3. Create templates at `templates/{domain}/`
|
|
36
|
+
4. Create references at `references/{domain}/`
|
|
37
|
+
5. Map agents in `references/{domain}/agent-map.md`
|
|
38
|
+
6. Add domain entry to this registry
|
|
39
|
+
7. Run `install.sh` to deploy
|
|
40
|
+
|
|
41
|
+
### Domain Structure Template
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
commands/legion/{domain}/
|
|
45
|
+
├── quick.md
|
|
46
|
+
├── {stage1}.md
|
|
47
|
+
├── {stage2}.md
|
|
48
|
+
├── ...
|
|
49
|
+
└── cycle.md
|
|
50
|
+
|
|
51
|
+
workflows/{domain}/
|
|
52
|
+
├── quick.md
|
|
53
|
+
├── {stage1}.md
|
|
54
|
+
├── {stage2}.md
|
|
55
|
+
├── ...
|
|
56
|
+
└── cycle.md
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Each domain must define:
|
|
60
|
+
- **Pipeline stages** (ordered sequence)
|
|
61
|
+
- **Agent mapping** (which agent handles which stage)
|
|
62
|
+
- **Model assignment** (which Claude model for each agent)
|
|
63
|
+
- **Classification rules** (for `/quick` auto-routing)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Legion — UI & Branding Guide
|
|
2
|
+
|
|
3
|
+
## Banner Format
|
|
4
|
+
|
|
5
|
+
All workflows display a banner at start:
|
|
6
|
+
```
|
|
7
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
8
|
+
LEGION ► {DOMAIN} ► {ACTION}
|
|
9
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
For cross-domain commands:
|
|
13
|
+
```
|
|
14
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
15
|
+
LEGION ► {ACTION}
|
|
16
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Status Symbols
|
|
20
|
+
|
|
21
|
+
| Symbol | Meaning |
|
|
22
|
+
|--------|---------|
|
|
23
|
+
| ✓ | Complete / Passed / Loaded |
|
|
24
|
+
| ✗ | Failed / Not found / Error |
|
|
25
|
+
| ◆ | In Progress / Active |
|
|
26
|
+
| ○ | Pending / Not started |
|
|
27
|
+
| ⚠ | Warning / Attention needed |
|
|
28
|
+
| ► | Next action / Suggestion |
|
|
29
|
+
|
|
30
|
+
## Context Report Format
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
◆ Loading context...
|
|
34
|
+
|
|
35
|
+
✓ .codebase/architecture.md (loaded)
|
|
36
|
+
✓ .codebase/project-structure.md (loaded)
|
|
37
|
+
✗ .codebase/stack.md (not found)
|
|
38
|
+
✓ STATE.md (loaded — stage: plan)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Completion Block
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
45
|
+
✓ COMPLETE — {TYPE}: {description}
|
|
46
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
47
|
+
|
|
48
|
+
Artifact: .planning/legion/{domain}/{artifact}
|
|
49
|
+
Status: {status}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Next Action Block
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
───────────────────────────────────────────────
|
|
56
|
+
► Next: /legion:{domain}:{action}
|
|
57
|
+
{description}
|
|
58
|
+
|
|
59
|
+
Also available:
|
|
60
|
+
- /legion:{domain}:{alt1} — {description}
|
|
61
|
+
- /legion:{domain}:{alt2} — {description}
|
|
62
|
+
───────────────────────────────────────────────
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Warning Block
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
⚠ {Warning title}
|
|
69
|
+
|
|
70
|
+
{Warning description}
|
|
71
|
+
|
|
72
|
+
To resolve:
|
|
73
|
+
/legion:{command} {args}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Pipeline Visualization
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
architect → [plan] → execute → review
|
|
80
|
+
^^^^
|
|
81
|
+
current stage
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Or with status:
|
|
85
|
+
```
|
|
86
|
+
✓ architect → ◆ plan → ○ execute → ○ review
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Color Scheme (for statusline)
|
|
90
|
+
|
|
91
|
+
| Context Remaining | Color | Symbol |
|
|
92
|
+
|-------------------|-------|--------|
|
|
93
|
+
| > 50% | Green | ████████░░ |
|
|
94
|
+
| 35-50% | Yellow | █████░░░░░ |
|
|
95
|
+
| 25-35% | Orange | ███░░░░░░░ |
|
|
96
|
+
| < 25% | Red | ██░░░░░░░░ |
|
|
97
|
+
|
|
98
|
+
## Naming Convention
|
|
99
|
+
|
|
100
|
+
- Commands: `/legion:{domain}:{action}` (lowercase, hyphens for multi-word)
|
|
101
|
+
- Artifacts: `{NNN}-{type}-{slug}.md` (zero-padded number, lowercase, hyphens)
|
|
102
|
+
- Directories: lowercase, hyphens
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.1.0",
|
|
3
|
+
"domain": "devops",
|
|
4
|
+
"agents": {
|
|
5
|
+
"architect": "devops-architect",
|
|
6
|
+
"planner": "delivery-planner",
|
|
7
|
+
"executor": "infra-executor",
|
|
8
|
+
"builder": "codebase-builder",
|
|
9
|
+
"reviewer": "devops-architect"
|
|
10
|
+
},
|
|
11
|
+
"models": {
|
|
12
|
+
"architect": "opus",
|
|
13
|
+
"planner": "sonnet",
|
|
14
|
+
"executor": "opus",
|
|
15
|
+
"builder": "opus",
|
|
16
|
+
"reviewer": "sonnet"
|
|
17
|
+
},
|
|
18
|
+
"pipeline": ["architect", "plan", "execute", "review"],
|
|
19
|
+
"checkpoints": {
|
|
20
|
+
"after_architect": true,
|
|
21
|
+
"after_plan": true,
|
|
22
|
+
"after_execute": false,
|
|
23
|
+
"after_review": false
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Architecture — {{title}}
|
|
2
|
+
|
|
3
|
+
## 1. Task Understanding
|
|
4
|
+
{{understanding of what was requested}}
|
|
5
|
+
|
|
6
|
+
## 2. Architecture-Aware Implementation Plan
|
|
7
|
+
{{how this fits into existing architecture}}
|
|
8
|
+
|
|
9
|
+
## 3. Proposed Architecture/Solution
|
|
10
|
+
{{detailed architecture proposal}}
|
|
11
|
+
|
|
12
|
+
## 4. Trade-offs/Alternatives
|
|
13
|
+
{{options considered and why this was chosen}}
|
|
14
|
+
|
|
15
|
+
## 5. Implementation Steps (Phased)
|
|
16
|
+
{{phased implementation approach}}
|
|
17
|
+
|
|
18
|
+
## 6. Example Implementations
|
|
19
|
+
{{concrete code/config examples}}
|
|
20
|
+
|
|
21
|
+
## 7. Validation and Operations
|
|
22
|
+
{{how to validate and operate}}
|
|
23
|
+
|
|
24
|
+
## 8. Common Mistakes/Anti-Patterns
|
|
25
|
+
{{what to avoid}}
|
|
26
|
+
|
|
27
|
+
## 9. Next Action
|
|
28
|
+
{{recommended next step}}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Execution Report — {{title}}
|
|
2
|
+
|
|
3
|
+
## 1. Execution Context
|
|
4
|
+
{{what was executed and why}}
|
|
5
|
+
|
|
6
|
+
## 2. Pre-Execution Verification
|
|
7
|
+
{{state before changes}}
|
|
8
|
+
|
|
9
|
+
## 3. Execution Actions Performed
|
|
10
|
+
{{what was done, step by step}}
|
|
11
|
+
|
|
12
|
+
## 4. Validation Results
|
|
13
|
+
{{terraform fmt/validate/plan results, tests, etc.}}
|
|
14
|
+
|
|
15
|
+
## 5. Task Status
|
|
16
|
+
Status: {{DONE|PARTIAL|BLOCKED}}
|
|
17
|
+
Tasks completed: {{N/M}}
|
|
18
|
+
|
|
19
|
+
## 6. Risks/Notes
|
|
20
|
+
{{anything to be aware of}}
|
|
21
|
+
|
|
22
|
+
## 7. Next Execution Step
|
|
23
|
+
{{what comes next}}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Implementation Plan — {{title}}
|
|
2
|
+
|
|
3
|
+
## 1. Planning Input Summary
|
|
4
|
+
{{what was received from architect}}
|
|
5
|
+
|
|
6
|
+
## 2. Decomposition Strategy
|
|
7
|
+
{{approach to breaking down the work}}
|
|
8
|
+
|
|
9
|
+
## 3. Full Phase-by-Phase Implementation Plan
|
|
10
|
+
|
|
11
|
+
### Phase 0: Discovery/Validation
|
|
12
|
+
{{tasks}}
|
|
13
|
+
|
|
14
|
+
### Phase 1: Foundation
|
|
15
|
+
{{tasks}}
|
|
16
|
+
|
|
17
|
+
### Phase N: ...
|
|
18
|
+
{{tasks}}
|
|
19
|
+
|
|
20
|
+
## 4. Dependency Map
|
|
21
|
+
{{task dependencies}}
|
|
22
|
+
|
|
23
|
+
## 5. Execution Handoffs
|
|
24
|
+
{{who does what}}
|
|
25
|
+
|
|
26
|
+
## 6. Critical Path
|
|
27
|
+
{{sequence that determines timeline}}
|
|
28
|
+
|
|
29
|
+
## 7. Final Readiness Checklist
|
|
30
|
+
{{pre-execution checks}}
|
|
31
|
+
|
|
32
|
+
## 8. Next Action
|
|
33
|
+
{{recommended next step}}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Review Checklist — {{title}}
|
|
2
|
+
|
|
3
|
+
## Architecture Alignment
|
|
4
|
+
- [ ] Changes match original architecture intent
|
|
5
|
+
- [ ] No unauthorized scope expansion
|
|
6
|
+
- [ ] Design patterns followed correctly
|
|
7
|
+
|
|
8
|
+
## Security
|
|
9
|
+
- [ ] No secrets in code/config
|
|
10
|
+
- [ ] Least privilege IAM policies
|
|
11
|
+
- [ ] Security groups properly scoped
|
|
12
|
+
- [ ] SOPS encryption for sensitive values
|
|
13
|
+
- [ ] No public exposure of internal services
|
|
14
|
+
|
|
15
|
+
## Terraform Best Practices
|
|
16
|
+
- [ ] terraform fmt passes
|
|
17
|
+
- [ ] terraform validate passes
|
|
18
|
+
- [ ] terraform plan shows expected changes only
|
|
19
|
+
- [ ] No hardcoded values — uses variables
|
|
20
|
+
- [ ] Proper resource naming (snake_case)
|
|
21
|
+
- [ ] Tags include local.tags.general
|
|
22
|
+
- [ ] State management correct
|
|
23
|
+
- [ ] Remote state references valid
|
|
24
|
+
|
|
25
|
+
## Operational Readiness
|
|
26
|
+
- [ ] Monitoring/alerting configured
|
|
27
|
+
- [ ] Logging enabled
|
|
28
|
+
- [ ] Backup strategy defined
|
|
29
|
+
- [ ] Rollback plan documented
|
|
30
|
+
- [ ] Runbook updated
|
|
31
|
+
|
|
32
|
+
## Findings
|
|
33
|
+
|
|
34
|
+
| # | Severity | Finding | Location | Recommendation |
|
|
35
|
+
|---|----------|---------|----------|----------------|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Legion Session — {{date}}
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
Domain: {{domain}}
|
|
5
|
+
Stage: {{stage}}
|
|
6
|
+
Started: {{timestamp}}
|
|
7
|
+
|
|
8
|
+
## Work Performed
|
|
9
|
+
{{summary}}
|
|
10
|
+
|
|
11
|
+
## Artifacts Created
|
|
12
|
+
{{artifacts}}
|
|
13
|
+
|
|
14
|
+
## State at End
|
|
15
|
+
Stage: {{end_stage}}
|
|
16
|
+
Last completed: {{last_completed}}
|
|
17
|
+
Next: {{next_action}}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Legion State
|
|
2
|
+
|
|
3
|
+
## Project
|
|
4
|
+
Domain: {{domain}}
|
|
5
|
+
Last activity: {{date}} — Initialized
|
|
6
|
+
|
|
7
|
+
## Current Work
|
|
8
|
+
Pipeline: architect -> plan -> execute -> review
|
|
9
|
+
Stage: idle
|
|
10
|
+
Input: —
|
|
11
|
+
Last completed: —
|
|
12
|
+
Next: /legion:{{domain}}:quick or /legion:{{domain}}:architect
|
|
13
|
+
|
|
14
|
+
## Task History
|
|
15
|
+
|
|
16
|
+
| # | Type | Description | Date | Status | Artifact |
|
|
17
|
+
|---|------|-------------|------|--------|----------|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Task Record — {{NNN}}-{{type}}-{{slug}}
|
|
2
|
+
|
|
3
|
+
## Metadata
|
|
4
|
+
- Number: {{NNN}}
|
|
5
|
+
- Type: {{type}}
|
|
6
|
+
- Description: {{description}}
|
|
7
|
+
- Date: {{date}}
|
|
8
|
+
- Status: {{status}}
|
|
9
|
+
- Agent: {{agent}}
|
|
10
|
+
- Model: {{model}}
|
|
11
|
+
|
|
12
|
+
## Input
|
|
13
|
+
{{input_summary}}
|
|
14
|
+
|
|
15
|
+
## Output
|
|
16
|
+
{{output_summary}}
|
|
17
|
+
|
|
18
|
+
## Artifact
|
|
19
|
+
Path: .planning/legion/{{domain}}/{{NNN}}-{{type}}-{{slug}}.md
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Legion Core — Workflow Completion
|
|
2
|
+
|
|
3
|
+
Every workflow ends with this completion sequence.
|
|
4
|
+
|
|
5
|
+
## Step 1: Save Artifact
|
|
6
|
+
|
|
7
|
+
Save the agent's output to:
|
|
8
|
+
```
|
|
9
|
+
.planning/legion/{domain}/{NNN}-{type}-{slug}.md
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Where:
|
|
13
|
+
- `{NNN}` — next task number from init context
|
|
14
|
+
- `{type}` — architect, plan, execution, review, build, quick
|
|
15
|
+
- `{slug}` — generated from task description
|
|
16
|
+
|
|
17
|
+
Use `node ~/.claude/legion/bin/legion-tools.cjs generate-slug "<description>"` for the slug.
|
|
18
|
+
|
|
19
|
+
## Step 2: Update STATE.md
|
|
20
|
+
|
|
21
|
+
Run:
|
|
22
|
+
```bash
|
|
23
|
+
node ~/.claude/legion/bin/legion-tools.cjs task-record <type> "<description>" <status>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Where status is: `done`, `partial`, `blocked`, `failed`.
|
|
27
|
+
|
|
28
|
+
Update current work stage:
|
|
29
|
+
```bash
|
|
30
|
+
node ~/.claude/legion/bin/legion-tools.cjs state update currentWork.stage <next-stage>
|
|
31
|
+
node ~/.claude/legion/bin/legion-tools.cjs state update currentWork.lastCompleted "<type> ({NNN})"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Step 3: Create Session Record
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
node ~/.claude/legion/bin/legion-tools.cjs session-record "<summary>"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Step 4: Display Completion
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
44
|
+
✓ COMPLETE — {TYPE}: {description}
|
|
45
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
46
|
+
|
|
47
|
+
Artifact: .planning/legion/{domain}/{artifact}
|
|
48
|
+
Status: {status}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Step 5: Route to Next Action
|
|
52
|
+
|
|
53
|
+
Based on the pipeline position, suggest the next command:
|
|
54
|
+
|
|
55
|
+
| Completed | Next Command | Description |
|
|
56
|
+
|-----------|-------------|-------------|
|
|
57
|
+
| architect | `/legion:devops:plan` | Decompose into executable tasks |
|
|
58
|
+
| plan | `/legion:devops:execute` | Implement the plan |
|
|
59
|
+
| execute | `/legion:devops:review` | Review what was built |
|
|
60
|
+
| review | — | Pipeline complete |
|
|
61
|
+
| quick | — | Standalone task complete |
|
|
62
|
+
| build | `/legion:devops:architect` | Design architecture |
|
|
63
|
+
|
|
64
|
+
Display:
|
|
65
|
+
```
|
|
66
|
+
───────────────────────────────────────────────
|
|
67
|
+
► Next: /legion:devops:{next}
|
|
68
|
+
{next description}
|
|
69
|
+
───────────────────────────────────────────────
|
|
70
|
+
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Legion Core — Context Loading
|
|
2
|
+
|
|
3
|
+
This workflow loads all available project context before spawning agents.
|
|
4
|
+
|
|
5
|
+
## Priority 1: .codebase/ (Project Documentation)
|
|
6
|
+
|
|
7
|
+
If `.codebase/` exists, read these files in order:
|
|
8
|
+
1. `.codebase/architecture.md` — High-level architecture
|
|
9
|
+
2. `.codebase/project-structure.md` — Directory tree
|
|
10
|
+
3. `.codebase/code-style.md` — Coding conventions
|
|
11
|
+
4. `.codebase/stack.md` — Technology stack
|
|
12
|
+
5. `.codebase/dependencies.md` — Dependencies
|
|
13
|
+
6. `.codebase/configuration.md` — Config and env vars
|
|
14
|
+
7. `.codebase/run-and-dev.md` — How to run/build/test
|
|
15
|
+
8. `.codebase/decisions.md` — Key decisions
|
|
16
|
+
|
|
17
|
+
Read files in parallel using Read tool. Skip files that don't exist.
|
|
18
|
+
|
|
19
|
+
## Priority 2: .planning/codebase/ (Codebase Analysis)
|
|
20
|
+
|
|
21
|
+
If `.planning/codebase/` exists, also read:
|
|
22
|
+
1. `.planning/codebase/ARCHITECTURE.md`
|
|
23
|
+
2. `.planning/codebase/STRUCTURE.md`
|
|
24
|
+
3. `.planning/codebase/CONVENTIONS.md`
|
|
25
|
+
4. `.planning/codebase/STACK.md`
|
|
26
|
+
5. `.planning/codebase/INTEGRATIONS.md`
|
|
27
|
+
6. `.planning/codebase/CONCERNS.md`
|
|
28
|
+
|
|
29
|
+
## Priority 3: Legion State
|
|
30
|
+
|
|
31
|
+
Read `.planning/legion/STATE.md` if it exists.
|
|
32
|
+
|
|
33
|
+
## Priority 4: Latest Artifacts
|
|
34
|
+
|
|
35
|
+
If STATE.md references a current pipeline, read the latest artifact from `.planning/legion/devops/`.
|
|
36
|
+
|
|
37
|
+
## Context Summary
|
|
38
|
+
|
|
39
|
+
After loading, compile a brief context summary (max 500 words) that includes:
|
|
40
|
+
- Project type and stack
|
|
41
|
+
- Architecture overview
|
|
42
|
+
- Current conventions
|
|
43
|
+
- Any active work from STATE.md
|
|
44
|
+
|
|
45
|
+
This summary will be passed to agents alongside the full task description.
|
|
46
|
+
|
|
47
|
+
## If Nothing Found
|
|
48
|
+
|
|
49
|
+
If no .codebase/ or .planning/ exists:
|
|
50
|
+
```
|
|
51
|
+
⚠ No project context found.
|
|
52
|
+
|
|
53
|
+
To create project documentation, run:
|
|
54
|
+
/legion:devops:build
|
|
55
|
+
|
|
56
|
+
To proceed without context, describe your task and the agent will inspect the codebase directly.
|
|
57
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Legion Core — Workflow Initialization
|
|
2
|
+
|
|
3
|
+
Every Legion workflow begins with this initialization sequence.
|
|
4
|
+
|
|
5
|
+
## Step 1: Run legion-tools init
|
|
6
|
+
|
|
7
|
+
Execute:
|
|
8
|
+
```bash
|
|
9
|
+
node ~/.claude/legion/bin/legion-tools.cjs init <workflow-type> $ARGUMENTS
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Where `<workflow-type>` is one of: `devops-quick`, `devops-architect`, `devops-plan`, `devops-execute`, `devops-build`, `devops-review`, `devops-cycle`, `status`, `resume`.
|
|
13
|
+
|
|
14
|
+
Parse the JSON output. It contains:
|
|
15
|
+
- `domain` — active domain (e.g., "devops")
|
|
16
|
+
- `stateExists` — whether STATE.md was found
|
|
17
|
+
- `codebaseExists` — whether .codebase/ was found
|
|
18
|
+
- `planningCodebaseExists` — whether .planning/codebase/ was found
|
|
19
|
+
- `config` — Legion config for this project
|
|
20
|
+
- `state` — current state object
|
|
21
|
+
- `nextTaskNum` — next artifact number (e.g., "002")
|
|
22
|
+
- `timestamp` — current date
|
|
23
|
+
- `latestArtifact` — path to most recent artifact
|
|
24
|
+
|
|
25
|
+
## Step 2: Print Banner
|
|
26
|
+
|
|
27
|
+
Display the Legion banner:
|
|
28
|
+
```
|
|
29
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
30
|
+
LEGION ► {DOMAIN} ► {ACTION}
|
|
31
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Step 3: Report Context Status
|
|
35
|
+
|
|
36
|
+
Display what was found:
|
|
37
|
+
```
|
|
38
|
+
◆ Initializing...
|
|
39
|
+
|
|
40
|
+
{✓|✗} .codebase/ — {found N docs | not found}
|
|
41
|
+
{✓|✗} .planning/codebase/ — {found N docs | not found}
|
|
42
|
+
{✓|✗} STATE.md — {loaded, stage: {stage} | created new}
|
|
43
|
+
{✓|✗} config.json — {loaded | created default}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Step 4: Load Context
|
|
47
|
+
|
|
48
|
+
Follow the context-load workflow from @~/.claude/legion/workflows/core/context-load.md
|
|
49
|
+
|
|
50
|
+
## Step 5: Return Context
|
|
51
|
+
|
|
52
|
+
Make the loaded context available to the calling workflow for agent spawning.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Legion DevOps — Architect Workflow
|
|
2
|
+
|
|
3
|
+
Invoke the devops-architect agent to design infrastructure architecture.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
- Task description provided via $ARGUMENTS
|
|
7
|
+
|
|
8
|
+
## Workflow
|
|
9
|
+
|
|
10
|
+
### Step 1: Initialize
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
node ~/.claude/legion/bin/legion-tools.cjs init devops-architect $ARGUMENTS
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Parse JSON output. Display banner:
|
|
17
|
+
```
|
|
18
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
19
|
+
LEGION ► DEVOPS ► ARCHITECT
|
|
20
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Step 2: Load Context
|
|
24
|
+
|
|
25
|
+
Follow @~/.claude/legion/workflows/core/context-load.md
|
|
26
|
+
|
|
27
|
+
### Step 3: Check Existing Architecture
|
|
28
|
+
|
|
29
|
+
If STATE.md shows previous architect outputs:
|
|
30
|
+
- Read the latest architect artifact
|
|
31
|
+
- Note what was already designed to avoid duplication
|
|
32
|
+
- Pass existing architecture as reference to the agent
|
|
33
|
+
|
|
34
|
+
### Step 4: Spawn Architect Agent
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
Task(
|
|
38
|
+
prompt="<legion_context>
|
|
39
|
+
You are being invoked by Legion DevOps Architect workflow.
|
|
40
|
+
|
|
41
|
+
## Project Context
|
|
42
|
+
{compiled context summary from .codebase/ and .planning/}
|
|
43
|
+
|
|
44
|
+
## Existing Architecture
|
|
45
|
+
{content of latest architect artifact, if any — or 'None — this is the first architecture task'}
|
|
46
|
+
|
|
47
|
+
## Current State
|
|
48
|
+
{STATE.md summary}
|
|
49
|
+
|
|
50
|
+
## Architecture Task
|
|
51
|
+
{$ARGUMENTS — the user's architecture task description}
|
|
52
|
+
|
|
53
|
+
## Instructions
|
|
54
|
+
- Read and follow your full agent instructions from ~/.claude/agents/devops-architect.md
|
|
55
|
+
- Use MCP tools for ALL operations (mandatory)
|
|
56
|
+
- Inspect the actual codebase BEFORE making any design decisions
|
|
57
|
+
- Read .planning/codebase/ documentation if available
|
|
58
|
+
- If unsure about anything, say 'я не знаю'
|
|
59
|
+
- Report results using your standard 9-section output format
|
|
60
|
+
- Focus on actionable architecture, not theory
|
|
61
|
+
</legion_context>",
|
|
62
|
+
subagent_type="devops-architect",
|
|
63
|
+
model="opus",
|
|
64
|
+
description="Architect: {short task description}"
|
|
65
|
+
)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Step 5: Process Results
|
|
69
|
+
|
|
70
|
+
Capture the architect's output.
|
|
71
|
+
|
|
72
|
+
### Step 6: Complete
|
|
73
|
+
|
|
74
|
+
Follow @~/.claude/legion/workflows/core/completion.md
|
|
75
|
+
|
|
76
|
+
- Save artifact as `{NNN}-architect-{slug}.md`
|
|
77
|
+
- Update STATE.md: stage → "plan", next → "/legion:devops:plan"
|
|
78
|
+
- Display completion:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
82
|
+
✓ COMPLETE — ARCHITECT: {description}
|
|
83
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
84
|
+
|
|
85
|
+
Artifact: .planning/legion/devops/{NNN}-architect-{slug}.md
|
|
86
|
+
|
|
87
|
+
───────────────────────────────────────────────
|
|
88
|
+
► Next: /legion:devops:plan
|
|
89
|
+
Decompose this architecture into executable tasks
|
|
90
|
+
───────────────────────────────────────────────
|
|
91
|
+
```
|