claude-symphony 0.0.1 → 0.0.3
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/README.md +16 -12
- package/assets/claude_symphony.webp +0 -0
- package/assets/claude_symphony_ascii.txt +8 -0
- package/bin/create.js +80 -69
- package/package.json +3 -2
- package/template/.claude/commands/benchmark.md +32 -32
- package/template/.claude/commands/brainstorm.md +33 -33
- package/template/.claude/commands/checkpoint.md +42 -42
- package/template/.claude/commands/codex.md +52 -52
- package/template/.claude/commands/collaborate.md +47 -47
- package/template/.claude/commands/context.md +77 -77
- package/template/.claude/commands/deploy.md +50 -50
- package/template/.claude/commands/fork.md +46 -46
- package/template/.claude/commands/gemini.md +43 -43
- package/template/.claude/commands/handoff.md +42 -42
- package/template/.claude/commands/implement.md +42 -42
- package/template/.claude/commands/init-project.md +25 -25
- package/template/.claude/commands/next.md +67 -67
- package/template/.claude/commands/planning.md +38 -38
- package/template/.claude/commands/qa.md +47 -47
- package/template/.claude/commands/refactor.md +50 -50
- package/template/.claude/commands/research.md +31 -31
- package/template/.claude/commands/restore.md +53 -53
- package/template/.claude/commands/run-stage.md +45 -45
- package/template/.claude/commands/stages.md +49 -49
- package/template/.claude/commands/status.md +41 -41
- package/template/.claude/commands/tasks.md +33 -33
- package/template/.claude/commands/test.md +45 -45
- package/template/.claude/commands/ui-ux.md +31 -31
- package/template/.claude/commands/validate.md +81 -81
- package/template/.claude/hooks/ai-selector.sh +39 -39
- package/template/.claude/hooks/auto-checkpoint.sh +30 -30
- package/template/.claude/hooks/output-validator.sh +45 -45
- package/template/.claude/hooks/post-stage.sh +28 -28
- package/template/.claude/hooks/pre-stage.sh +47 -47
- package/template/.claude/hooks/session-start.sh +27 -27
- package/template/.claude/hooks/statusline.sh +24 -24
- package/template/.claude/hooks/stop.sh +26 -26
- package/template/.claude/settings.json +32 -32
- package/template/.claude/skills/ai-collaboration/README.md +31 -31
- package/template/.claude/skills/ai-collaboration/debate.md +66 -66
- package/template/.claude/skills/ai-collaboration/parallel.md +34 -34
- package/template/.claude/skills/ai-collaboration/prompts/CLAUDE.md +59 -63
- package/template/.claude/skills/auto-checkpoint/README.md +46 -46
- package/template/.claude/skills/auto-checkpoint/prompts/CLAUDE.md +68 -72
- package/template/.claude/skills/auto-checkpoint/rollback.md +95 -95
- package/template/.claude/skills/auto-checkpoint/trigger.md +37 -37
- package/template/.claude/skills/context-compression/README.md +69 -69
- package/template/.claude/skills/context-compression/analyze.md +74 -74
- package/template/.claude/skills/context-compression/compress.md +103 -103
- package/template/.claude/skills/context-compression/prompts/compression.md +78 -78
- package/template/.claude/skills/output-validator/README.md +33 -33
- package/template/.claude/skills/output-validator/prompts/CLAUDE.md +74 -78
- package/template/.claude/skills/output-validator/validate.md +76 -76
- package/template/.claude/skills/smart-handoff/README.md +35 -35
- package/template/.claude/skills/smart-handoff/extract.md +42 -42
- package/template/.claude/skills/smart-handoff/prompts/CLAUDE.md +52 -54
- package/template/.claude/skills/smart-handoff/summarize.md +55 -55
- package/template/.claude/skills/stage-transition/README.md +50 -50
- package/template/.claude/skills/stage-transition/handoff-gen.md +89 -89
- package/template/.claude/skills/stage-transition/prompts/transition.md +74 -74
- package/template/.claude/skills/stage-transition/validate.md +41 -41
- package/template/CLAUDE.md +334 -335
- package/template/config/ai_benchmarking.yaml +22 -22
- package/template/config/ai_collaboration.yaml +18 -18
- package/template/config/ai_logging.yaml +50 -50
- package/template/config/auto_checkpoint.yaml +32 -32
- package/template/config/context.yaml +20 -20
- package/template/config/git.yaml +51 -51
- package/template/config/handoff_intelligence.yaml +23 -23
- package/template/config/mcp_fallbacks.yaml +71 -71
- package/template/config/memory_integration.yaml +23 -23
- package/template/config/model_enforcement.yaml +53 -53
- package/template/config/models.yaml +24 -24
- package/template/config/output_validation.yaml +44 -44
- package/template/config/pipeline.yaml +25 -25
- package/template/config/pipeline_forking.yaml +40 -40
- package/template/config/qa_logging.yaml +67 -67
- package/template/config/smart_rollback.yaml +48 -48
- package/template/config/stage_personas.yaml +154 -154
- package/template/config/workflow.yaml +16 -16
- package/template/scripts/ai-benchmark.sh +41 -41
- package/template/scripts/codex-wrapper.sh +32 -32
- package/template/scripts/context-manager.sh +136 -136
- package/template/scripts/create-checkpoint.sh +34 -34
- package/template/scripts/gemini-wrapper.sh +31 -31
- package/template/scripts/init-project.sh +40 -40
- package/template/scripts/list-stages.sh +30 -30
- package/template/scripts/next-stage.sh +67 -67
- package/template/scripts/output-validate.sh +2 -2
- package/template/scripts/pipeline-fork.sh +68 -68
- package/template/scripts/pre-run-check.sh +84 -84
- package/template/scripts/restore-checkpoint.sh +50 -50
- package/template/scripts/run-stage.sh +44 -44
- package/template/scripts/show-status.sh +30 -30
- package/template/scripts/smart-handoff.sh +70 -70
- package/template/stages/01-brainstorm/CLAUDE.md +70 -74
- package/template/stages/01-brainstorm/README.md +54 -54
- package/template/stages/01-brainstorm/config.yaml +18 -18
- package/template/stages/01-brainstorm/prompts/collaboration.md +24 -24
- package/template/stages/01-brainstorm/prompts/ideation.md +41 -41
- package/template/stages/01-brainstorm/prompts/persona.md +50 -50
- package/template/stages/01-brainstorm/prompts/requirements.md +55 -55
- package/template/stages/01-brainstorm/prompts/validation.md +28 -28
- package/template/stages/01-brainstorm/templates/ideas.md +47 -47
- package/template/stages/01-brainstorm/templates/requirements_analysis.md +61 -61
- package/template/stages/02-research/CLAUDE.md +72 -76
- package/template/stages/02-research/config.yaml +12 -12
- package/template/stages/02-research/prompts/collaboration.md +29 -29
- package/template/stages/02-research/prompts/feasibility.md +38 -38
- package/template/stages/02-research/prompts/market_analysis.md +29 -29
- package/template/stages/02-research/prompts/tech_stack.md +34 -34
- package/template/stages/02-research/prompts/validation.md +29 -29
- package/template/stages/03-planning/CLAUDE.md +88 -92
- package/template/stages/03-planning/config.yaml +10 -10
- package/template/stages/03-planning/prompts/architecture.md +43 -43
- package/template/stages/03-planning/prompts/collaboration.md +34 -34
- package/template/stages/03-planning/prompts/validation.md +34 -34
- package/template/stages/04-ui-ux/CLAUDE.md +68 -72
- package/template/stages/04-ui-ux/config.yaml +5 -5
- package/template/stages/04-ui-ux/prompts/collaboration.md +35 -35
- package/template/stages/04-ui-ux/prompts/validation.md +30 -30
- package/template/stages/05-task-management/CLAUDE.md +81 -85
- package/template/stages/05-task-management/config.yaml +17 -17
- package/template/stages/05-task-management/prompts/collaboration.md +30 -30
- package/template/stages/05-task-management/prompts/validation.md +33 -33
- package/template/stages/05-task-management/templates/notion_integration.md +70 -70
- package/template/stages/05-task-management/templates/parallel_groups.yaml +64 -64
- package/template/stages/05-task-management/templates/task_schema.yaml +33 -33
- package/template/stages/06-implementation/CLAUDE.md +117 -121
- package/template/stages/06-implementation/config.yaml +10 -10
- package/template/stages/06-implementation/prompts/collaboration.md +29 -29
- package/template/stages/06-implementation/prompts/validation.md +36 -36
- package/template/stages/07-refactoring/CLAUDE.md +120 -124
- package/template/stages/07-refactoring/config.yaml +11 -11
- package/template/stages/07-refactoring/prompts/collaboration.md +36 -36
- package/template/stages/07-refactoring/prompts/validation.md +40 -40
- package/template/stages/08-qa/CLAUDE.md +80 -84
- package/template/stages/08-qa/config.yaml +7 -7
- package/template/stages/08-qa/prompts/collaboration.md +34 -34
- package/template/stages/08-qa/prompts/validation.md +41 -41
- package/template/stages/09-testing/CLAUDE.md +86 -90
- package/template/stages/09-testing/config.yaml +10 -10
- package/template/stages/09-testing/prompts/collaboration.md +38 -38
- package/template/stages/09-testing/prompts/validation.md +41 -41
- package/template/stages/10-deployment/CLAUDE.md +86 -90
- package/template/stages/10-deployment/config.yaml +11 -11
- package/template/stages/10-deployment/prompts/collaboration.md +37 -37
- package/template/stages/10-deployment/prompts/validation.md +54 -54
- package/template/stages/10-deployment/templates/github-actions-cd.yaml +1 -1
|
@@ -1,174 +1,174 @@
|
|
|
1
1
|
# /validate - Output Validation Command
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Validate the outputs of the current stage.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Usage
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
/validate [options]
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Options
|
|
12
12
|
|
|
13
|
-
|
|
|
14
|
-
|
|
15
|
-
| `--stage` |
|
|
16
|
-
| `--verbose` |
|
|
17
|
-
| `--fix` |
|
|
18
|
-
| `--skip-commands` |
|
|
19
|
-
| `--force` |
|
|
13
|
+
| Option | Description | Default |
|
|
14
|
+
|--------|-------------|---------|
|
|
15
|
+
| `--stage` | Stage ID to validate | Current stage |
|
|
16
|
+
| `--verbose` | Detailed output | false |
|
|
17
|
+
| `--fix` | Auto-fix suggestions | false |
|
|
18
|
+
| `--skip-commands` | Skip command validation | false |
|
|
19
|
+
| `--force` | Pass even on failure | false |
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Validation Items
|
|
22
22
|
|
|
23
|
-
### 1.
|
|
23
|
+
### 1. Required File Existence
|
|
24
24
|
```bash
|
|
25
25
|
/validate
|
|
26
|
-
# → ideas.md ✅, requirements_analysis.md ❌ (
|
|
26
|
+
# → ideas.md ✅, requirements_analysis.md ❌ (missing)
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
### 2.
|
|
29
|
+
### 2. File Content Validation
|
|
30
30
|
```bash
|
|
31
31
|
/validate --verbose
|
|
32
|
-
# → ideas.md: 8
|
|
33
|
-
# →
|
|
32
|
+
# → ideas.md: 8 ideas (minimum 5) ✅
|
|
33
|
+
# → Required sections: Functional Requirements ✅, Non-Functional Requirements ❌
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
### 3.
|
|
36
|
+
### 3. Command Validation
|
|
37
37
|
```bash
|
|
38
38
|
/validate
|
|
39
39
|
# → npm run lint ✅
|
|
40
40
|
# → npm run typecheck ✅
|
|
41
|
-
# → npm run test ❌ (3
|
|
41
|
+
# → npm run test ❌ (3 failures)
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
### 4.
|
|
44
|
+
### 4. Quality Score
|
|
45
45
|
```bash
|
|
46
46
|
/validate
|
|
47
|
-
# →
|
|
47
|
+
# → Overall score: 0.85/1.0
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
##
|
|
50
|
+
## Output Format
|
|
51
51
|
|
|
52
|
-
###
|
|
52
|
+
### Simple Output
|
|
53
53
|
```
|
|
54
|
-
✅
|
|
54
|
+
✅ Validation passed: 06-implementation (score: 0.95)
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
###
|
|
57
|
+
### On Failure
|
|
58
58
|
```
|
|
59
|
-
❌
|
|
59
|
+
❌ Validation failed: 06-implementation
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
1.
|
|
63
|
-
2.
|
|
61
|
+
Failed items:
|
|
62
|
+
1. Test failures (3)
|
|
63
|
+
2. Coverage below target (75% < 80%)
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
- [ ] tests/auth.test.ts:45
|
|
67
|
-
- [ ]
|
|
65
|
+
Fixes needed:
|
|
66
|
+
- [ ] Fix tests/auth.test.ts:45
|
|
67
|
+
- [ ] Improve test coverage by 5%
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
###
|
|
70
|
+
### Verbose Output (--verbose)
|
|
71
71
|
```markdown
|
|
72
|
-
#
|
|
72
|
+
# Output Validation Report
|
|
73
73
|
|
|
74
|
-
##
|
|
75
|
-
##
|
|
76
|
-
##
|
|
74
|
+
## Stage: 06-implementation
|
|
75
|
+
## Status: ⚠️ Partial Pass
|
|
76
|
+
## Score: 0.85
|
|
77
77
|
|
|
78
|
-
###
|
|
79
|
-
|
|
|
80
|
-
|
|
81
|
-
| source_code/ | ✅ |
|
|
82
|
-
| implementation_log.md | ✅ |
|
|
78
|
+
### File Validation
|
|
79
|
+
| File | Status | Details |
|
|
80
|
+
|------|--------|---------|
|
|
81
|
+
| source_code/ | ✅ | Directory exists |
|
|
82
|
+
| implementation_log.md | ✅ | Required format met |
|
|
83
83
|
|
|
84
|
-
###
|
|
85
|
-
|
|
|
86
|
-
|
|
84
|
+
### Command Validation
|
|
85
|
+
| Command | Result | Time |
|
|
86
|
+
|---------|--------|------|
|
|
87
87
|
| lint | ✅ | 2.3s |
|
|
88
88
|
| typecheck | ✅ | 4.1s |
|
|
89
89
|
| test | ❌ | 15.2s |
|
|
90
90
|
|
|
91
|
-
###
|
|
92
|
-
|
|
|
93
|
-
|
|
91
|
+
### Quality Metrics
|
|
92
|
+
| Metric | Current | Target | Status |
|
|
93
|
+
|--------|---------|--------|--------|
|
|
94
94
|
| Lint | 0.95 | 0.90 | ✅ |
|
|
95
95
|
| Coverage | 0.75 | 0.80 | ❌ |
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
##
|
|
98
|
+
## Auto-Fix Suggestions
|
|
99
99
|
|
|
100
100
|
```bash
|
|
101
101
|
/validate --fix
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
```markdown
|
|
105
|
-
##
|
|
105
|
+
## Auto-Fix Suggestions
|
|
106
106
|
|
|
107
|
-
### 1.
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
### 1. Add Missing Section
|
|
108
|
+
**File**: requirements_analysis.md
|
|
109
|
+
**Suggestion**: Add "Non-Functional Requirements" section
|
|
110
110
|
|
|
111
|
-
### 2.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
### 2. Fix Test
|
|
112
|
+
**File**: tests/auth.test.ts:45
|
|
113
|
+
**Cause**: Return type mismatch
|
|
114
|
+
**Fix**:
|
|
115
115
|
```typescript
|
|
116
116
|
expect(result).toHaveProperty('token');
|
|
117
|
-
//
|
|
117
|
+
// Change to →
|
|
118
118
|
expect(result.data).toHaveProperty('token');
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
Apply auto-fixes? (y/n)
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
##
|
|
124
|
+
## Force Pass
|
|
125
125
|
|
|
126
126
|
```bash
|
|
127
127
|
/validate --force
|
|
128
128
|
```
|
|
129
129
|
|
|
130
130
|
```
|
|
131
|
-
⚠️
|
|
132
|
-
|
|
131
|
+
⚠️ There are failed validation items.
|
|
132
|
+
Force pass anyway?
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
>
|
|
134
|
+
Enter reason:
|
|
135
|
+
> Temporary failure due to test environment issue, verified locally
|
|
136
136
|
|
|
137
|
-
✅
|
|
137
|
+
✅ Force passed (reason recorded)
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
-
##
|
|
140
|
+
## Examples
|
|
141
141
|
|
|
142
142
|
```bash
|
|
143
|
-
#
|
|
143
|
+
# Validate current stage
|
|
144
144
|
/validate
|
|
145
145
|
|
|
146
|
-
#
|
|
146
|
+
# Validate specific stage with details
|
|
147
147
|
/validate --stage 06 --verbose
|
|
148
148
|
|
|
149
|
-
#
|
|
149
|
+
# Include auto-fix suggestions
|
|
150
150
|
/validate --fix
|
|
151
151
|
|
|
152
|
-
#
|
|
152
|
+
# Quick validation (skip commands)
|
|
153
153
|
/validate --skip-commands
|
|
154
154
|
```
|
|
155
155
|
|
|
156
|
-
##
|
|
156
|
+
## Validation Results Storage
|
|
157
157
|
|
|
158
|
-
-
|
|
159
|
-
-
|
|
158
|
+
- Results: `state/validations/{stage}_{timestamp}.json`
|
|
159
|
+
- Report: `state/validations/{stage}_{timestamp}.md`
|
|
160
160
|
|
|
161
|
-
##
|
|
161
|
+
## Configuration
|
|
162
162
|
|
|
163
|
-
`config/output_validation.yaml`
|
|
163
|
+
See `config/output_validation.yaml`
|
|
164
164
|
|
|
165
|
-
##
|
|
165
|
+
## Auto-Run on Stage Transition
|
|
166
166
|
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
Validation runs automatically when executing `/next` command.
|
|
168
|
+
Stage transition is blocked if validation fails.
|
|
169
169
|
|
|
170
|
-
##
|
|
170
|
+
## Related Commands
|
|
171
171
|
|
|
172
|
-
- `/next` -
|
|
173
|
-
- `/status` -
|
|
174
|
-
- `/stages` -
|
|
172
|
+
- `/next` - Next stage transition
|
|
173
|
+
- `/status` - Pipeline status
|
|
174
|
+
- `/stages` - Stage list
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# claude-symphony AI Selector Hook
|
|
3
|
-
#
|
|
3
|
+
# Dynamic AI model selection
|
|
4
4
|
|
|
5
5
|
set -e
|
|
6
6
|
|
|
@@ -10,18 +10,18 @@ CONFIG_FILE="$PROJECT_ROOT/config/models.yaml"
|
|
|
10
10
|
BENCHMARKS_DIR="$PROJECT_ROOT/state/ai_benchmarks"
|
|
11
11
|
PROGRESS_FILE="$PROJECT_ROOT/state/progress.json"
|
|
12
12
|
|
|
13
|
-
#
|
|
13
|
+
# Color definitions
|
|
14
14
|
BLUE='\033[0;34m'
|
|
15
15
|
GREEN='\033[0;32m'
|
|
16
16
|
YELLOW='\033[1;33m'
|
|
17
17
|
NC='\033[0m'
|
|
18
18
|
|
|
19
|
-
#
|
|
19
|
+
# Log functions
|
|
20
20
|
log_info() { echo -e "${BLUE}[AI-SELECT]${NC} $1"; }
|
|
21
21
|
log_success() { echo -e "${GREEN}[AI-SELECT]${NC} $1"; }
|
|
22
22
|
log_suggest() { echo -e "${YELLOW}[AI-SELECT]${NC} $1"; }
|
|
23
23
|
|
|
24
|
-
#
|
|
24
|
+
# Get current stage
|
|
25
25
|
get_current_stage() {
|
|
26
26
|
if [ -f "$PROGRESS_FILE" ]; then
|
|
27
27
|
cat "$PROGRESS_FILE" 2>/dev/null | grep -o '"current_stage"[[:space:]]*:[[:space:]]*"[^"]*"' | cut -d'"' -f4
|
|
@@ -30,7 +30,7 @@ get_current_stage() {
|
|
|
30
30
|
fi
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
#
|
|
33
|
+
# Stage-based model selection
|
|
34
34
|
get_stage_model() {
|
|
35
35
|
local stage="$1"
|
|
36
36
|
|
|
@@ -56,7 +56,7 @@ get_stage_model() {
|
|
|
56
56
|
esac
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
#
|
|
59
|
+
# Task type-based model selection
|
|
60
60
|
get_task_model() {
|
|
61
61
|
local task_type="$1"
|
|
62
62
|
|
|
@@ -79,13 +79,13 @@ get_task_model() {
|
|
|
79
79
|
esac
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
#
|
|
82
|
+
# Performance-based model selection
|
|
83
83
|
get_performance_model() {
|
|
84
84
|
local task_type="$1"
|
|
85
85
|
local benchmark_file="$BENCHMARKS_DIR/latest.json"
|
|
86
86
|
|
|
87
87
|
if [ -f "$benchmark_file" ]; then
|
|
88
|
-
#
|
|
88
|
+
# Extract best performing model from recent benchmark results
|
|
89
89
|
local best_model=$(cat "$benchmark_file" 2>/dev/null | grep -o '"best_model"[[:space:]]*:[[:space:]]*"[^"]*"' | cut -d'"' -f4)
|
|
90
90
|
|
|
91
91
|
if [ -n "$best_model" ]; then
|
|
@@ -94,23 +94,23 @@ get_performance_model() {
|
|
|
94
94
|
fi
|
|
95
95
|
fi
|
|
96
96
|
|
|
97
|
-
#
|
|
97
|
+
# Default if no benchmark available
|
|
98
98
|
echo "claudecode"
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
#
|
|
101
|
+
# Complexity-based model selection
|
|
102
102
|
get_complexity_model() {
|
|
103
103
|
local complexity="$1"
|
|
104
104
|
|
|
105
105
|
case "$complexity" in
|
|
106
106
|
"simple"|"low")
|
|
107
|
-
echo "claudecode" #
|
|
107
|
+
echo "claudecode" # Fast response
|
|
108
108
|
;;
|
|
109
109
|
"moderate"|"medium")
|
|
110
110
|
echo "claudecode"
|
|
111
111
|
;;
|
|
112
112
|
"complex"|"high")
|
|
113
|
-
echo "claudecode" #
|
|
113
|
+
echo "claudecode" # Complex logic handling
|
|
114
114
|
;;
|
|
115
115
|
*)
|
|
116
116
|
echo "claudecode"
|
|
@@ -118,59 +118,59 @@ get_complexity_model() {
|
|
|
118
118
|
esac
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
#
|
|
121
|
+
# Select best model (comprehensive)
|
|
122
122
|
select_best_model() {
|
|
123
123
|
local stage="$1"
|
|
124
124
|
local task_type="$2"
|
|
125
125
|
local complexity="$3"
|
|
126
126
|
|
|
127
|
-
#
|
|
127
|
+
# Weights
|
|
128
128
|
local stage_weight=0.4
|
|
129
129
|
local task_weight=0.3
|
|
130
130
|
local perf_weight=0.2
|
|
131
131
|
local complexity_weight=0.1
|
|
132
132
|
|
|
133
|
-
#
|
|
133
|
+
# Models per criterion
|
|
134
134
|
local stage_model=$(get_stage_model "$stage")
|
|
135
135
|
local task_model=$(get_task_model "$task_type")
|
|
136
136
|
local perf_model=$(get_performance_model "$task_type")
|
|
137
137
|
local comp_model=$(get_complexity_model "$complexity")
|
|
138
138
|
|
|
139
|
-
log_info "
|
|
140
|
-
log_info "
|
|
141
|
-
log_info "
|
|
142
|
-
log_info "
|
|
143
|
-
log_info "
|
|
139
|
+
log_info "Model selection analysis:"
|
|
140
|
+
log_info " Stage-based: $stage_model (weight: $stage_weight)"
|
|
141
|
+
log_info " Task-based: $task_model (weight: $task_weight)"
|
|
142
|
+
log_info " Performance-based: $perf_model (weight: $perf_weight)"
|
|
143
|
+
log_info " Complexity-based: $comp_model (weight: $complexity_weight)"
|
|
144
144
|
|
|
145
|
-
#
|
|
146
|
-
#
|
|
145
|
+
# Stage-based has highest weight, so prioritize it
|
|
146
|
+
# In actual implementation, score calculation needed
|
|
147
147
|
local selected_model="$stage_model"
|
|
148
148
|
|
|
149
|
-
log_success "
|
|
149
|
+
log_success "Selected model: $selected_model"
|
|
150
150
|
echo "$selected_model"
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
#
|
|
153
|
+
# Print model info
|
|
154
154
|
print_model_info() {
|
|
155
155
|
local model="$1"
|
|
156
156
|
|
|
157
157
|
case "$model" in
|
|
158
158
|
"claudecode")
|
|
159
|
-
echo "Claude Code -
|
|
159
|
+
echo "Claude Code - Accurate code generation, complex logic analysis"
|
|
160
160
|
;;
|
|
161
161
|
"claude")
|
|
162
|
-
echo "Claude -
|
|
162
|
+
echo "Claude - Deep research, document analysis and summarization"
|
|
163
163
|
;;
|
|
164
164
|
"gemini")
|
|
165
|
-
echo "Gemini -
|
|
165
|
+
echo "Gemini - Creative ideas, diverse perspective exploration"
|
|
166
166
|
;;
|
|
167
167
|
"codex")
|
|
168
|
-
echo "Codex -
|
|
168
|
+
echo "Codex - Code analysis, refactoring, test generation"
|
|
169
169
|
;;
|
|
170
170
|
esac
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
#
|
|
173
|
+
# Main execution
|
|
174
174
|
main() {
|
|
175
175
|
local action="$1"
|
|
176
176
|
shift
|
|
@@ -199,25 +199,25 @@ main() {
|
|
|
199
199
|
"current")
|
|
200
200
|
local stage=$(get_current_stage)
|
|
201
201
|
local model=$(get_stage_model "$stage")
|
|
202
|
-
log_info "
|
|
203
|
-
log_info "
|
|
202
|
+
log_info "Current stage: $stage"
|
|
203
|
+
log_info "Recommended model: $model"
|
|
204
204
|
print_model_info "$model"
|
|
205
205
|
;;
|
|
206
206
|
*)
|
|
207
|
-
echo "
|
|
207
|
+
echo "Usage: $0 {stage|task|select|info|current} [args]"
|
|
208
208
|
echo ""
|
|
209
|
-
echo "
|
|
210
|
-
echo " stage [stage_id] -
|
|
211
|
-
echo " task [task_type] -
|
|
212
|
-
echo " select [stage] [task] [complexity] -
|
|
213
|
-
echo " info [model] -
|
|
214
|
-
echo " current -
|
|
209
|
+
echo "Commands:"
|
|
210
|
+
echo " stage [stage_id] - Stage-based model selection"
|
|
211
|
+
echo " task [task_type] - Task type-based model selection"
|
|
212
|
+
echo " select [stage] [task] [complexity] - Comprehensive model selection"
|
|
213
|
+
echo " info [model] - Print model info"
|
|
214
|
+
echo " current - Recommended model for current stage"
|
|
215
215
|
exit 1
|
|
216
216
|
;;
|
|
217
217
|
esac
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
#
|
|
220
|
+
# Call main only when executed directly
|
|
221
221
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
|
222
222
|
main "$@"
|
|
223
223
|
fi
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# claude-symphony Auto-Checkpoint Hook
|
|
3
|
-
#
|
|
3
|
+
# Auto-checkpoint trigger detection and creation
|
|
4
4
|
|
|
5
5
|
set -e
|
|
6
6
|
|
|
@@ -10,25 +10,25 @@ CONFIG_FILE="$PROJECT_ROOT/config/auto_checkpoint.yaml"
|
|
|
10
10
|
CHECKPOINTS_DIR="$PROJECT_ROOT/state/checkpoints"
|
|
11
11
|
PROGRESS_FILE="$PROJECT_ROOT/state/progress.json"
|
|
12
12
|
|
|
13
|
-
#
|
|
13
|
+
# Color definitions
|
|
14
14
|
RED='\033[0;31m'
|
|
15
15
|
GREEN='\033[0;32m'
|
|
16
16
|
YELLOW='\033[1;33m'
|
|
17
17
|
BLUE='\033[0;34m'
|
|
18
18
|
NC='\033[0m'
|
|
19
19
|
|
|
20
|
-
#
|
|
20
|
+
# Log functions
|
|
21
21
|
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
|
22
22
|
log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
|
|
23
23
|
log_warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; }
|
|
24
24
|
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
|
25
25
|
|
|
26
|
-
#
|
|
26
|
+
# Ensure checkpoint directory
|
|
27
27
|
ensure_checkpoint_dir() {
|
|
28
28
|
mkdir -p "$CHECKPOINTS_DIR"
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
#
|
|
31
|
+
# Get current stage
|
|
32
32
|
get_current_stage() {
|
|
33
33
|
if [ -f "$PROGRESS_FILE" ]; then
|
|
34
34
|
cat "$PROGRESS_FILE" 2>/dev/null | grep -o '"current_stage"[[:space:]]*:[[:space:]]*"[^"]*"' | cut -d'"' -f4
|
|
@@ -37,7 +37,7 @@ get_current_stage() {
|
|
|
37
37
|
fi
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
#
|
|
40
|
+
# Calculate changed lines
|
|
41
41
|
get_changed_lines() {
|
|
42
42
|
if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
|
|
43
43
|
git diff --stat 2>/dev/null | tail -1 | grep -oE '[0-9]+ insertion|[0-9]+ deletion' | grep -oE '[0-9]+' | paste -sd+ | bc 2>/dev/null || echo "0"
|
|
@@ -46,7 +46,7 @@ get_changed_lines() {
|
|
|
46
46
|
fi
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
#
|
|
49
|
+
# Create checkpoint
|
|
50
50
|
create_checkpoint() {
|
|
51
51
|
local trigger_reason="$1"
|
|
52
52
|
local checkpoint_name="$2"
|
|
@@ -62,38 +62,38 @@ create_checkpoint() {
|
|
|
62
62
|
|
|
63
63
|
local checkpoint_path="$CHECKPOINTS_DIR/$checkpoint_name"
|
|
64
64
|
|
|
65
|
-
log_info "
|
|
65
|
+
log_info "Creating checkpoint: $checkpoint_name"
|
|
66
66
|
|
|
67
|
-
#
|
|
67
|
+
# Create checkpoint directory
|
|
68
68
|
mkdir -p "$checkpoint_path"
|
|
69
69
|
|
|
70
|
-
#
|
|
70
|
+
# Copy source code (exclude node_modules)
|
|
71
71
|
if [ -d "$PROJECT_ROOT/src" ]; then
|
|
72
72
|
rsync -a --exclude='node_modules' --exclude='.git' --exclude='state/checkpoints' \
|
|
73
73
|
"$PROJECT_ROOT/src" "$checkpoint_path/" 2>/dev/null || true
|
|
74
74
|
fi
|
|
75
75
|
|
|
76
|
-
#
|
|
76
|
+
# Copy config files
|
|
77
77
|
if [ -d "$PROJECT_ROOT/config" ]; then
|
|
78
78
|
cp -r "$PROJECT_ROOT/config" "$checkpoint_path/" 2>/dev/null || true
|
|
79
79
|
fi
|
|
80
80
|
|
|
81
|
-
#
|
|
81
|
+
# Copy state files
|
|
82
82
|
if [ -d "$PROJECT_ROOT/state" ]; then
|
|
83
83
|
mkdir -p "$checkpoint_path/state"
|
|
84
84
|
cp "$PROJECT_ROOT/state/progress.json" "$checkpoint_path/state/" 2>/dev/null || true
|
|
85
85
|
fi
|
|
86
86
|
|
|
87
|
-
#
|
|
87
|
+
# Copy stage outputs
|
|
88
88
|
if [ -d "$PROJECT_ROOT/stages" ]; then
|
|
89
89
|
mkdir -p "$checkpoint_path/stages"
|
|
90
90
|
find "$PROJECT_ROOT/stages" -name "outputs" -type d -exec cp -r {} "$checkpoint_path/stages/" \; 2>/dev/null || true
|
|
91
91
|
fi
|
|
92
92
|
|
|
93
|
-
# HANDOFF
|
|
93
|
+
# Copy HANDOFF
|
|
94
94
|
find "$PROJECT_ROOT/stages" -name "HANDOFF.md" -exec cp {} "$checkpoint_path/" \; 2>/dev/null || true
|
|
95
95
|
|
|
96
|
-
#
|
|
96
|
+
# Create metadata
|
|
97
97
|
cat > "$checkpoint_path/metadata.json" << EOF
|
|
98
98
|
{
|
|
99
99
|
"name": "$checkpoint_name",
|
|
@@ -105,49 +105,49 @@ create_checkpoint() {
|
|
|
105
105
|
}
|
|
106
106
|
EOF
|
|
107
107
|
|
|
108
|
-
log_success "
|
|
108
|
+
log_success "Checkpoint created: $checkpoint_name"
|
|
109
109
|
|
|
110
|
-
# Git
|
|
110
|
+
# Create Git tag (optional)
|
|
111
111
|
if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
|
|
112
112
|
git tag -a "checkpoint/$checkpoint_name" -m "Auto-checkpoint: $trigger_reason" 2>/dev/null || true
|
|
113
113
|
fi
|
|
114
114
|
|
|
115
|
-
#
|
|
115
|
+
# Cleanup old checkpoints
|
|
116
116
|
cleanup_old_checkpoints
|
|
117
117
|
|
|
118
118
|
echo "$checkpoint_name"
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
#
|
|
121
|
+
# Cleanup old checkpoints
|
|
122
122
|
cleanup_old_checkpoints() {
|
|
123
123
|
local max_checkpoints=20
|
|
124
124
|
local checkpoint_count=$(ls -1 "$CHECKPOINTS_DIR" 2>/dev/null | wc -l)
|
|
125
125
|
|
|
126
126
|
if [ "$checkpoint_count" -gt "$max_checkpoints" ]; then
|
|
127
127
|
local to_delete=$((checkpoint_count - max_checkpoints))
|
|
128
|
-
log_info "
|
|
128
|
+
log_info "Cleaning up old checkpoints: ${to_delete}"
|
|
129
129
|
|
|
130
|
-
#
|
|
130
|
+
# Delete oldest first (exclude milestones)
|
|
131
131
|
ls -1t "$CHECKPOINTS_DIR" | tail -n "$to_delete" | while read -r checkpoint; do
|
|
132
|
-
# milestone
|
|
132
|
+
# Preserve milestone checkpoints
|
|
133
133
|
if [[ ! "$checkpoint" =~ (stage_complete|pre_destructive|manual) ]]; then
|
|
134
134
|
rm -rf "$CHECKPOINTS_DIR/$checkpoint"
|
|
135
|
-
log_info "
|
|
135
|
+
log_info "Deleted: $checkpoint"
|
|
136
136
|
fi
|
|
137
137
|
done
|
|
138
138
|
fi
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
#
|
|
141
|
+
# Detect destructive action
|
|
142
142
|
check_destructive_action() {
|
|
143
143
|
local command="$1"
|
|
144
144
|
|
|
145
|
-
#
|
|
145
|
+
# Destructive patterns
|
|
146
146
|
local patterns=("rm -rf" "git reset --hard" "drop table" "DELETE FROM" "truncate")
|
|
147
147
|
|
|
148
148
|
for pattern in "${patterns[@]}"; do
|
|
149
149
|
if [[ "$command" == *"$pattern"* ]]; then
|
|
150
|
-
log_warning "
|
|
150
|
+
log_warning "Destructive action detected: $pattern"
|
|
151
151
|
create_checkpoint "pre_destructive" ""
|
|
152
152
|
return 0
|
|
153
153
|
fi
|
|
@@ -156,7 +156,7 @@ check_destructive_action() {
|
|
|
156
156
|
return 1
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
#
|
|
159
|
+
# Main execution
|
|
160
160
|
main() {
|
|
161
161
|
local action="$1"
|
|
162
162
|
shift
|
|
@@ -172,16 +172,16 @@ main() {
|
|
|
172
172
|
cleanup_old_checkpoints
|
|
173
173
|
;;
|
|
174
174
|
"list")
|
|
175
|
-
ls -1t "$CHECKPOINTS_DIR" 2>/dev/null || echo "
|
|
175
|
+
ls -1t "$CHECKPOINTS_DIR" 2>/dev/null || echo "No checkpoints"
|
|
176
176
|
;;
|
|
177
177
|
*)
|
|
178
|
-
echo "
|
|
178
|
+
echo "Usage: $0 {create|check-destructive|cleanup|list} [args]"
|
|
179
179
|
exit 1
|
|
180
180
|
;;
|
|
181
181
|
esac
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
#
|
|
184
|
+
# Call main only when executed directly
|
|
185
185
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
|
186
186
|
main "$@"
|
|
187
187
|
fi
|