claude-flow-novice 2.14.13 → 2.14.15
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/.claude/commands/CFN_LOOP_TASK_MODE.md +7 -51
- package/.claude/commands/cfn-loop-cli.md +50 -125
- package/.claude/skills/cfn-agent-selector/SKILL.md +2 -2
- package/.claude/skills/cfn-agent-selector/select-agents.sh +0 -45
- package/.claude/skills/cfn-loop-orchestration/helpers/context-injection.sh +6 -69
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +0 -17
- package/README.md +2 -2
- package/claude-assets/agents/cfn-dev-team/CLAUDE.md +3 -3
- package/claude-assets/agents/cfn-dev-team/README.md +1 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +2 -2
- package/claude-assets/agents/cfn-dev-team/developers/README.md +3 -3
- package/claude-assets/agents/cfn-dev-team/documentation/agent-type-guidelines.md +1 -1
- package/claude-assets/agents/cfn-dev-team/test-agent.md +2 -2
- package/claude-assets/commands/CFN_LOOP_TASK_MODE.md +7 -51
- package/claude-assets/commands/cfn-loop-cli.md +50 -125
- package/claude-assets/skills/cfn-agent-selector/SKILL.md +2 -2
- package/claude-assets/skills/cfn-agent-selector/select-agents.sh +0 -45
- package/claude-assets/skills/cfn-loop-orchestration/helpers/context-injection.sh +6 -69
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +0 -17
- package/claude-assets/skills/cfn-multi-coordinator-planning/README.md +256 -0
- package/claude-assets/skills/cfn-multi-coordinator-planning/SKILL.md +62 -0
- package/claude-assets/skills/cfn-multi-coordinator-planning/map-dependencies-conflicts.sh +376 -0
- package/claude-assets/skills/cfn-multi-coordinator-planning/plan-coordinator-resources.sh +258 -0
- package/claude-assets/skills/cfn-multi-coordinator-planning/plan-multi-coordinator-work.sh +267 -0
- package/claude-assets/skills/cfn-multi-coordinator-planning/plan-risk-rollout.sh +350 -0
- package/claude-assets/skills/cfn-multi-coordinator-planning/test-multi-coordinator-planning.sh +338 -0
- package/claude-assets/skills/cfn-multi-coordinator-planning/validate-task-planning.sh +189 -0
- package/dist/agents/agent-loader.js +165 -146
- package/dist/agents/agent-loader.js.map +1 -1
- package/package.json +1 -1
- package/.claude/skills/cfn-agent-selector/SKILL.md.backup_before_replace +0 -91
- package/.claude/skills/cfn-loop-orchestration/helpers/validate-task-context.sh +0 -241
- package/.claude/skills/pre-edit-backup/backup.sh +0 -130
- package/.claude/skills/pre-edit-backup/cleanup.sh +0 -155
- package/.claude/skills/pre-edit-backup/restore.sh +0 -128
- package/.claude/skills/pre-edit-backup/revert-file.sh +0 -168
- package/claude-assets/agents/cfn-dev-team/CLAUDE.md.backup_before_replace +0 -1086
- package/claude-assets/agents/cfn-dev-team/README.md.backup_before_replace +0 -116
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md.backup_before_replace +0 -451
- package/claude-assets/agents/cfn-dev-team/developers/README.md.backup_before_replace +0 -69
- package/claude-assets/agents/cfn-dev-team/documentation/agent-type-guidelines.md.backup_before_replace +0 -465
- package/claude-assets/agents/cfn-dev-team/test-agent.md.backup_before_replace +0 -141
- package/claude-assets/skills/CFN-LOOP-VALIDATION.md +0 -202
- package/claude-assets/skills/REDIS-COORDINATION.md +0 -187
- package/claude-assets/skills/SKILL.md +0 -229
- package/claude-assets/skills/agent-discovery/agents-registry.json +0 -484
- package/claude-assets/skills/agent-name-validation/README.md +0 -28
- package/claude-assets/skills/agent-name-validation/SKILL.md +0 -168
- package/claude-assets/skills/agent-name-validation/validate-agent-names.sh +0 -47
- package/claude-assets/skills/cfn-agent-selector/SKILL.md.backup_before_replace +0 -91
- package/claude-assets/skills/cfn-loop-orchestration/helpers/validate-task-context.sh +0 -241
- package/claude-assets/skills/consensus-calculator.js +0 -45
- package/claude-assets/skills/evidence-chain.sql +0 -66
- package/claude-assets/skills/hook-pipeline/bash-dependency-checker.sh +0 -89
- package/claude-assets/skills/hook-pipeline/bash-pipe-safety.sh +0 -69
- package/claude-assets/skills/hook-pipeline/enforce-lf.sh +0 -36
- package/claude-assets/skills/hook-pipeline/js-promise-safety.sh +0 -110
- package/claude-assets/skills/hook-pipeline/python-async-safety.py +0 -124
- package/claude-assets/skills/hook-pipeline/python-import-checker.py +0 -114
- package/claude-assets/skills/hook-pipeline/python-subprocess-safety.py +0 -77
- package/claude-assets/skills/hook-pipeline/rust-command-safety.sh +0 -38
- package/claude-assets/skills/hook-pipeline/rust-dependency-checker.sh +0 -50
- package/claude-assets/skills/hook-pipeline/rust-future-safety.sh +0 -50
- package/claude-assets/skills/pre-edit-backup/backup.sh +0 -130
- package/claude-assets/skills/pre-edit-backup/cleanup.sh +0 -155
- package/claude-assets/skills/pre-edit-backup/restore.sh +0 -128
- package/claude-assets/skills/pre-edit-backup/revert-file.sh +0 -168
- package/claude-assets/skills/run-all-skill-tests.sh +0 -124
- package/claude-assets/skills/seo-orchestration/SKILL.md +0 -292
- package/claude-assets/skills/seo-orchestration/orchestrate-seo.sh +0 -566
- package/claude-assets/skills/seo-orchestration/orchestrate-seo.sh.backup +0 -755
- package/claude-assets/skills/seo-orchestration/validate-consensus.sh +0 -270
- package/claude-assets/skills/team-provider-routing/execute-agent.sh +0 -76
- package/claude-assets/skills/test-execution-coordinator-pattern.md +0 -228
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
# Agent Name Validation Skill
|
|
2
|
-
|
|
3
|
-
**Version:** 1.0.0
|
|
4
|
-
**Last Updated:** 2025-11-04
|
|
5
|
-
**Owner:** agent-builder
|
|
6
|
-
**Status:** Production
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
Validates that agent filenames match their frontmatter `name:` field to ensure consistency and prevent discovery issues.
|
|
11
|
-
|
|
12
|
-
## Purpose
|
|
13
|
-
|
|
14
|
-
- Ensures agent files can be discovered correctly by the agent spawning system
|
|
15
|
-
- Prevents mismatches between filename and agent identity
|
|
16
|
-
- Maintains naming consistency across the codebase
|
|
17
|
-
- Runs automatically after agent creation/updates
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
### Basic Validation
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
./.claude/skills/agent-name-validation/validate-agent-names.sh
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### Output Format
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
Validating agent filenames match frontmatter names...
|
|
31
|
-
==============================================
|
|
32
|
-
❌ MISMATCH: /path/to/backend-dev.md
|
|
33
|
-
Filename: backend-dev
|
|
34
|
-
Frontmatter: backend-developer
|
|
35
|
-
|
|
36
|
-
⚠️ WARNING: No frontmatter name found in /path/to/README.md
|
|
37
|
-
==============================================
|
|
38
|
-
✅ All agent files have matching names!
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Integration with Agent Builder
|
|
42
|
-
|
|
43
|
-
The agent-builder agent automatically runs this validation after:
|
|
44
|
-
|
|
45
|
-
1. Creating new agent files
|
|
46
|
-
2. Updating agent frontmatter
|
|
47
|
-
3. Renaming agent files
|
|
48
|
-
|
|
49
|
-
### Post-Creation Validation
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
# After creating/updating an agent
|
|
53
|
-
./.claude/skills/agent-name-validation/validate-agent-names.sh
|
|
54
|
-
|
|
55
|
-
# Check exit code
|
|
56
|
-
if [ $? -ne 0 ]; then
|
|
57
|
-
echo "⚠️ Agent name validation failed - please review mismatches"
|
|
58
|
-
fi
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Validation Rules
|
|
62
|
-
|
|
63
|
-
### ✅ Valid Patterns
|
|
64
|
-
|
|
65
|
-
- Filename: `backend-developer.md` → Frontmatter: `name: backend-developer`
|
|
66
|
-
- Filename: `api-tester.md` → Frontmatter: `name: api-tester`
|
|
67
|
-
|
|
68
|
-
### ❌ Invalid Patterns
|
|
69
|
-
|
|
70
|
-
- Filename: `backend-dev.md` → Frontmatter: `name: backend-developer` (mismatch)
|
|
71
|
-
- Filename: `APITester.md` → Frontmatter: `name: api-tester` (case mismatch)
|
|
72
|
-
|
|
73
|
-
### Ignored Files
|
|
74
|
-
|
|
75
|
-
- `CLAUDE.md` - Documentation file, not an agent
|
|
76
|
-
- Files without frontmatter (templates, READMEs)
|
|
77
|
-
|
|
78
|
-
## Exit Codes
|
|
79
|
-
|
|
80
|
-
- `0` - All agent files validated successfully
|
|
81
|
-
- `1` - One or more mismatches found
|
|
82
|
-
|
|
83
|
-
## Configuration
|
|
84
|
-
|
|
85
|
-
### Excluded Files
|
|
86
|
-
|
|
87
|
-
Edit the validation script to exclude additional files:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
# Skip specific files
|
|
91
|
-
if [ "$filename" = "CLAUDE" ] || [ "$filename" = "README" ]; then
|
|
92
|
-
continue
|
|
93
|
-
fi
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Examples
|
|
97
|
-
|
|
98
|
-
### Example 1: Successful Validation
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
$ ./.claude/skills/agent-name-validation/validate-agent-names.sh
|
|
102
|
-
Validating agent filenames match frontmatter names...
|
|
103
|
-
==============================================
|
|
104
|
-
✅ All agent files have matching names!
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Example 2: Mismatch Detected
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
$ ./.claude/skills/agent-name-validation/validate-agent-names.sh
|
|
111
|
-
Validating agent filenames match frontmatter names...
|
|
112
|
-
==============================================
|
|
113
|
-
❌ MISMATCH: .claude/agents/cfn-dev-team/developers/backend-dev.md
|
|
114
|
-
Filename: backend-dev
|
|
115
|
-
Frontmatter: backend-developer
|
|
116
|
-
==============================================
|
|
117
|
-
❌ Found 1 mismatch(es)
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
## Troubleshooting
|
|
121
|
-
|
|
122
|
-
### Issue: False Positives
|
|
123
|
-
|
|
124
|
-
**Symptom:** Valid agent files reported as mismatches
|
|
125
|
-
|
|
126
|
-
**Solution:** Verify frontmatter format:
|
|
127
|
-
```yaml
|
|
128
|
-
---
|
|
129
|
-
name: agent-name # Must be on line 2, no extra spaces
|
|
130
|
-
---
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### Issue: AWK Parsing Errors
|
|
134
|
-
|
|
135
|
-
**Symptom:** No frontmatter names detected
|
|
136
|
-
|
|
137
|
-
**Solution:** Check for:
|
|
138
|
-
- Windows line endings (run `dos2unix` on files)
|
|
139
|
-
- Missing `---` delimiters
|
|
140
|
-
- Malformed YAML
|
|
141
|
-
|
|
142
|
-
## Related Skills
|
|
143
|
-
|
|
144
|
-
- **Agent Creation** (`.claude/skills/agent-creation/`) - Creates new agents
|
|
145
|
-
- **Template Validation** (`.claude/skills/template-validation/`) - Validates agent structure
|
|
146
|
-
- **Pre-Edit Backup** (`.claude/skills/pre-edit-backup/`) - Backup system for file changes
|
|
147
|
-
|
|
148
|
-
## Maintenance
|
|
149
|
-
|
|
150
|
-
### Adding New Validations
|
|
151
|
-
|
|
152
|
-
To add additional validation rules, modify `validate-agent-names.sh`:
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
# Example: Validate agent type matches directory structure
|
|
156
|
-
if [[ "$agent_file" == *"/testers/"* ]]; then
|
|
157
|
-
expected_type="validator"
|
|
158
|
-
actual_type=$(awk 'BEGIN{in_fm=0} /^---$/{in_fm++; next} in_fm==1 && /^type:/{print $2; exit}' "$agent_file")
|
|
159
|
-
|
|
160
|
-
if [ "$actual_type" != "$expected_type" ]; then
|
|
161
|
-
echo "⚠️ Type mismatch in $agent_file"
|
|
162
|
-
fi
|
|
163
|
-
fi
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
## Version History
|
|
167
|
-
|
|
168
|
-
- **1.0.0** (2025-11-04) - Initial release with filename validation
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Script to validate agent filenames match frontmatter names
|
|
4
|
-
# Usage: ./scripts/validate-agent-names.sh
|
|
5
|
-
|
|
6
|
-
AGENTS_DIR="/mnt/c/Users/masha/Documents/claude-flow-novice/.claude/agents"
|
|
7
|
-
MISMATCHES=0
|
|
8
|
-
|
|
9
|
-
echo "Validating agent filenames match frontmatter names..."
|
|
10
|
-
echo "=============================================="
|
|
11
|
-
|
|
12
|
-
# Find all .md files in agents directory recursively
|
|
13
|
-
while IFS= read -r -d '' agent_file; do
|
|
14
|
-
# Get filename without extension
|
|
15
|
-
filename=$(basename "$agent_file" .md)
|
|
16
|
-
|
|
17
|
-
# Skip CLAUDE.md files
|
|
18
|
-
if [ "$filename" = "CLAUDE" ]; then
|
|
19
|
-
continue
|
|
20
|
-
fi
|
|
21
|
-
|
|
22
|
-
# Extract frontmatter name (between --- blocks, look for 'name:' field)
|
|
23
|
-
frontmatter_name=$(awk 'BEGIN{in_fm=0} /^---$/{in_fm++; next} in_fm==1 && /^name:/{print $2; exit}' "$agent_file")
|
|
24
|
-
|
|
25
|
-
# Skip if no frontmatter name found
|
|
26
|
-
if [ -z "$frontmatter_name" ]; then
|
|
27
|
-
echo "⚠️ WARNING: No frontmatter name found in $agent_file"
|
|
28
|
-
continue
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
# Compare filename with frontmatter name
|
|
32
|
-
if [ "$filename" != "$frontmatter_name" ]; then
|
|
33
|
-
echo "❌ MISMATCH: $agent_file"
|
|
34
|
-
echo " Filename: $filename"
|
|
35
|
-
echo " Frontmatter: $frontmatter_name"
|
|
36
|
-
echo ""
|
|
37
|
-
((MISMATCHES++))
|
|
38
|
-
fi
|
|
39
|
-
done < <(find "$AGENTS_DIR" -name "*.md" -type f -print0)
|
|
40
|
-
|
|
41
|
-
echo "=============================================="
|
|
42
|
-
if [ $MISMATCHES -eq 0 ]; then
|
|
43
|
-
echo "✅ All agent files have matching names!"
|
|
44
|
-
else
|
|
45
|
-
echo "❌ Found $MISMATCHES mismatch(es)"
|
|
46
|
-
exit 1
|
|
47
|
-
fi
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# Agent Selector Skill
|
|
2
|
-
|
|
3
|
-
**Version:** 1.0.0
|
|
4
|
-
**Purpose:** Select optimal agents for CFN Loop v3 based on task type and requirements
|
|
5
|
-
|
|
6
|
-
## Overview
|
|
7
|
-
|
|
8
|
-
Recommends Loop 3 (producers) and Loop 2 (evaluators) agents based on:
|
|
9
|
-
- Task type (from task-classifier)
|
|
10
|
-
- Task description keywords
|
|
11
|
-
- Complexity requirements
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
AGENTS=$(./.claude/skills/cfn-agent-selector/select-agents.sh \
|
|
17
|
-
--task-type "software-development" \
|
|
18
|
-
--description "Implement JWT authentication with refresh tokens")
|
|
19
|
-
|
|
20
|
-
echo "$AGENTS" | jq '.loop3[]' # ["backend-dev", "security-specialist"]
|
|
21
|
-
echo "$AGENTS" | jq '.loop2[]' # ["reviewer", "tester", "security-auditor"]
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Output Format
|
|
25
|
-
|
|
26
|
-
```json
|
|
27
|
-
{
|
|
28
|
-
"loop3": ["agent1", "agent2", "agent3"],
|
|
29
|
-
"loop2": ["validator1", "validator2", "validator3"],
|
|
30
|
-
"loop4": "product-owner",
|
|
31
|
-
"reasoning": "Explanation of agent selection"
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Agent Selection Rules
|
|
36
|
-
|
|
37
|
-
### Software Development
|
|
38
|
-
**Base Loop 3:** backend-dev, coder
|
|
39
|
-
**Add if keywords:**
|
|
40
|
-
- "security", "authentication", "JWT" → security-specialist
|
|
41
|
-
- "database", "SQL", "schema" → database-engineer (if exists)
|
|
42
|
-
- "deploy", "CI/CD", "infrastructure" → devops-engineer
|
|
43
|
-
- "frontend", "React", "UI" → react-frontend-engineer
|
|
44
|
-
|
|
45
|
-
**Loop 2:** reviewer, tester, security-auditor
|
|
46
|
-
|
|
47
|
-
### Content Creation
|
|
48
|
-
**Base Loop 3:** copywriter, content-strategist
|
|
49
|
-
**Add if keywords:**
|
|
50
|
-
- "SEO", "search", "keywords" → seo-specialist
|
|
51
|
-
- "technical", "documentation" → technical-writer (if exists)
|
|
52
|
-
|
|
53
|
-
**Loop 2:** editor, brand-reviewer, compliance-checker
|
|
54
|
-
|
|
55
|
-
### Research
|
|
56
|
-
**Base Loop 3:** researcher, data-analyst
|
|
57
|
-
**Add if keywords:**
|
|
58
|
-
- "statistics", "data analysis" → statistician (if exists)
|
|
59
|
-
- "domain-specific" → domain-expert
|
|
60
|
-
|
|
61
|
-
**Loop 2:** fact-checker, methodology-reviewer, statistician
|
|
62
|
-
|
|
63
|
-
### Design
|
|
64
|
-
**Base Loop 3:** ui-designer, ux-researcher
|
|
65
|
-
**Add if keywords:**
|
|
66
|
-
- "visual", "branding" → visual-designer
|
|
67
|
-
- "accessibility" → accessibility-advocate
|
|
68
|
-
|
|
69
|
-
**Loop 2:** accessibility-advocate, design-critic, user-tester
|
|
70
|
-
|
|
71
|
-
### Infrastructure
|
|
72
|
-
**Base Loop 3:** devops-engineer, terraform-engineer
|
|
73
|
-
**Add if keywords:**
|
|
74
|
-
- "Kubernetes", "k8s", "container" → kubernetes-architect
|
|
75
|
-
- "network", "security" → network-engineer (if exists)
|
|
76
|
-
|
|
77
|
-
**Loop 2:** security-auditor, cost-optimizer, compliance-checker
|
|
78
|
-
|
|
79
|
-
### Data Engineering
|
|
80
|
-
**Base Loop 3:** data-engineer, pipeline-builder
|
|
81
|
-
**Add if keywords:**
|
|
82
|
-
- "ETL", "transformation" → etl-specialist
|
|
83
|
-
- "streaming", "real-time" → streaming-specialist (if exists)
|
|
84
|
-
|
|
85
|
-
**Loop 2:** data-quality-validator, schema-reviewer, performance-tester
|
|
86
|
-
|
|
87
|
-
## Integration
|
|
88
|
-
|
|
89
|
-
Used by:
|
|
90
|
-
- `.claude/agents/cfn-v3-coordinator.md` - Agent selection
|
|
91
|
-
- `.claude/skills/cfn-agent-selector/select-agents.sh` - Primary selection script
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Task Context Validation Helper
|
|
3
|
-
# Validates that CLI mode has complete task context (prevents "consensus on vapor")
|
|
4
|
-
#
|
|
5
|
-
# Usage: validate-task-context.sh --task-id <id> [--task-description <desc>] [--expected-files <files>] [--success-criteria <criteria>]
|
|
6
|
-
|
|
7
|
-
set -euo pipefail
|
|
8
|
-
|
|
9
|
-
# Initialize variables
|
|
10
|
-
TASK_ID=""
|
|
11
|
-
TASK_DESCRIPTION=""
|
|
12
|
-
EXPECTED_FILES=""
|
|
13
|
-
SUCCESS_CRITERIA=""
|
|
14
|
-
NAMESPACE="swarm"
|
|
15
|
-
|
|
16
|
-
# Parse arguments
|
|
17
|
-
while [[ $# -gt 0 ]]; do
|
|
18
|
-
case "$1" in
|
|
19
|
-
--task-id)
|
|
20
|
-
TASK_ID="$2"
|
|
21
|
-
shift 2
|
|
22
|
-
;;
|
|
23
|
-
--task-description)
|
|
24
|
-
TASK_DESCRIPTION="$2"
|
|
25
|
-
shift 2
|
|
26
|
-
;;
|
|
27
|
-
--expected-files)
|
|
28
|
-
EXPECTED_FILES="$2"
|
|
29
|
-
shift 2
|
|
30
|
-
;;
|
|
31
|
-
--success-criteria)
|
|
32
|
-
SUCCESS_CRITERIA="$2"
|
|
33
|
-
shift 2
|
|
34
|
-
;;
|
|
35
|
-
--namespace)
|
|
36
|
-
NAMESPACE="$2"
|
|
37
|
-
shift 2
|
|
38
|
-
;;
|
|
39
|
-
*)
|
|
40
|
-
echo "Unknown parameter: $1" >&2
|
|
41
|
-
exit 1
|
|
42
|
-
;;
|
|
43
|
-
esac
|
|
44
|
-
done
|
|
45
|
-
|
|
46
|
-
# Validate required arguments
|
|
47
|
-
if [[ -z "$TASK_ID" ]]; then
|
|
48
|
-
echo "Error: --task-id is required" >&2
|
|
49
|
-
echo "Usage: $0 --task-id <id> [--task-description <desc>] [--expected-files <files>] [--success-criteria <criteria>]" >&2
|
|
50
|
-
exit 1
|
|
51
|
-
fi
|
|
52
|
-
|
|
53
|
-
# Validation functions
|
|
54
|
-
validate_task_description() {
|
|
55
|
-
local task_desc="$1"
|
|
56
|
-
|
|
57
|
-
if [[ -z "$task_desc" ]]; then
|
|
58
|
-
echo "❌ Task description is empty or missing"
|
|
59
|
-
return 1
|
|
60
|
-
fi
|
|
61
|
-
|
|
62
|
-
# Check minimum length (should be meaningful)
|
|
63
|
-
if [[ ${#task_desc} -lt 10 ]]; then
|
|
64
|
-
echo "❌ Task description too short (${#task_desc} chars, minimum 10)"
|
|
65
|
-
return 1
|
|
66
|
-
fi
|
|
67
|
-
|
|
68
|
-
# Check for actionable verbs
|
|
69
|
-
if [[ ! "$task_desc" =~ (create|build|implement|fix|migrate|update|add|remove|refactor|test|review|validate) ]]; then
|
|
70
|
-
echo "⚠️ Task description lacks clear action verb"
|
|
71
|
-
fi
|
|
72
|
-
|
|
73
|
-
# Check for specific deliverables (Zone A fix: prevent generic context)
|
|
74
|
-
if [[ "$task_desc" =~ (zone-d-round2|checkpoint|iteration [0-9]+) ]]; then
|
|
75
|
-
echo "❌ Task description contains generic identifier (Zone A issue)"
|
|
76
|
-
return 1
|
|
77
|
-
fi
|
|
78
|
-
|
|
79
|
-
echo "✅ Task description validation passed"
|
|
80
|
-
return 0
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
validate_expected_files() {
|
|
84
|
-
local files="$1"
|
|
85
|
-
local errors=0
|
|
86
|
-
|
|
87
|
-
if [[ -z "$files" ]]; then
|
|
88
|
-
echo "⚠️ No expected files specified (may be OK for analysis tasks)"
|
|
89
|
-
return 0
|
|
90
|
-
fi
|
|
91
|
-
|
|
92
|
-
# Split files by comma and validate each
|
|
93
|
-
IFS=',' read -ra file_array <<< "$files"
|
|
94
|
-
for file in "${file_array[@]}"; do
|
|
95
|
-
# Remove whitespace
|
|
96
|
-
file=$(echo "$file" | xargs)
|
|
97
|
-
|
|
98
|
-
if [[ -z "$file" ]]; then
|
|
99
|
-
continue
|
|
100
|
-
fi
|
|
101
|
-
|
|
102
|
-
# Check file path format
|
|
103
|
-
if [[ ! "$file" =~ ^[a-zA-Z0-9_/-]+\.[a-zA-Z]+$ && ! "$file" =~ ^[a-zA-Z0-9_/-]+/ ]]; then
|
|
104
|
-
echo "❌ Invalid file format: $file"
|
|
105
|
-
((errors++))
|
|
106
|
-
continue
|
|
107
|
-
fi
|
|
108
|
-
|
|
109
|
-
# Check for generic placeholders
|
|
110
|
-
if [[ "$file" =~ (placeholder|example|template) ]]; then
|
|
111
|
-
echo "❌ Generic file placeholder: $file"
|
|
112
|
-
((errors++))
|
|
113
|
-
continue
|
|
114
|
-
fi
|
|
115
|
-
|
|
116
|
-
done
|
|
117
|
-
|
|
118
|
-
if [[ $errors -eq 0 ]]; then
|
|
119
|
-
echo "✅ Expected files validation passed"
|
|
120
|
-
return 0
|
|
121
|
-
else
|
|
122
|
-
return 1
|
|
123
|
-
fi
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
validate_success_criteria() {
|
|
127
|
-
local criteria="$1"
|
|
128
|
-
local errors=0
|
|
129
|
-
|
|
130
|
-
if [[ -z "$criteria" ]]; then
|
|
131
|
-
echo "⚠️ No success criteria specified (may be OK for discovery tasks)"
|
|
132
|
-
return 0
|
|
133
|
-
fi
|
|
134
|
-
|
|
135
|
-
# Check criteria length
|
|
136
|
-
if [[ ${#criteria} -lt 5 ]]; then
|
|
137
|
-
echo "❌ Success criteria too short: $criteria"
|
|
138
|
-
((errors++))
|
|
139
|
-
fi
|
|
140
|
-
|
|
141
|
-
# Check for measurable outcomes
|
|
142
|
-
if [[ ! "$criteria" =~ (test|pass|fail|error|success|complete|0.*errors|100%) ]]; then
|
|
143
|
-
echo "⚠️ Success criteria lacks measurable outcomes"
|
|
144
|
-
fi
|
|
145
|
-
|
|
146
|
-
# Check for generic statements
|
|
147
|
-
if [[ "$criteria" =~ (done|finished|complete|good) && ${#criteria} -lt 20 ]]; then
|
|
148
|
-
echo "❌ Success criteria too generic: $criteria"
|
|
149
|
-
((errors++))
|
|
150
|
-
fi
|
|
151
|
-
|
|
152
|
-
if [[ $errors -eq 0 ]]; then
|
|
153
|
-
echo "✅ Success criteria validation passed"
|
|
154
|
-
return 0
|
|
155
|
-
else
|
|
156
|
-
return 1
|
|
157
|
-
fi
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
check_redis_context() {
|
|
161
|
-
local task_id="$1"
|
|
162
|
-
local redis_key="${NAMESPACE}:${task_id}:context"
|
|
163
|
-
|
|
164
|
-
# Check if context exists
|
|
165
|
-
if ! redis-cli EXISTS "$redis_key" >/dev/null 2>&1; then
|
|
166
|
-
echo "❌ No context found in Redis for task: $task_id"
|
|
167
|
-
return 1
|
|
168
|
-
fi
|
|
169
|
-
|
|
170
|
-
# Get all context fields
|
|
171
|
-
local context_fields
|
|
172
|
-
context_fields=$(redis-cli HGETALL "$redis_key" 2>/dev/null || echo "")
|
|
173
|
-
|
|
174
|
-
if [[ -z "$context_fields" ]]; then
|
|
175
|
-
echo "❌ Context exists but is empty for task: $task_id"
|
|
176
|
-
return 1
|
|
177
|
-
fi
|
|
178
|
-
|
|
179
|
-
# Count non-metadata fields
|
|
180
|
-
local field_count=0
|
|
181
|
-
while IFS= read -r field; do
|
|
182
|
-
# Skip metadata fields
|
|
183
|
-
if [[ ! "$field" =~ (updated_at|stored_at) ]]; then
|
|
184
|
-
((field_count++))
|
|
185
|
-
fi
|
|
186
|
-
done <<< "$context_fields"
|
|
187
|
-
|
|
188
|
-
if [[ $field_count -eq 0 ]]; then
|
|
189
|
-
echo "❌ Context contains only metadata fields"
|
|
190
|
-
return 1
|
|
191
|
-
fi
|
|
192
|
-
|
|
193
|
-
echo "✅ Redis context validation passed ($field_count data fields)"
|
|
194
|
-
return 0
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
# Main validation
|
|
198
|
-
validation_errors=0
|
|
199
|
-
echo "🔍 Validating task context for: $TASK_ID"
|
|
200
|
-
echo ""
|
|
201
|
-
|
|
202
|
-
# Validate task description
|
|
203
|
-
if [[ -n "$TASK_DESCRIPTION" ]]; then
|
|
204
|
-
if ! validate_task_description "$TASK_DESCRIPTION"; then
|
|
205
|
-
((validation_errors++))
|
|
206
|
-
fi
|
|
207
|
-
fi
|
|
208
|
-
|
|
209
|
-
# Validate expected files
|
|
210
|
-
if [[ -n "$EXPECTED_FILES" ]]; then
|
|
211
|
-
if ! validate_expected_files "$EXPECTED_FILES"; then
|
|
212
|
-
((validation_errors++))
|
|
213
|
-
fi
|
|
214
|
-
fi
|
|
215
|
-
|
|
216
|
-
# Validate success criteria
|
|
217
|
-
if [[ -n "$SUCCESS_CRITERIA" ]]; then
|
|
218
|
-
if ! validate_success_criteria "$SUCCESS_CRITERIA"; then
|
|
219
|
-
((validation_errors++))
|
|
220
|
-
fi
|
|
221
|
-
fi
|
|
222
|
-
|
|
223
|
-
# Check Redis context
|
|
224
|
-
if ! check_redis_context "$TASK_ID"; then
|
|
225
|
-
((validation_errors++))
|
|
226
|
-
fi
|
|
227
|
-
|
|
228
|
-
echo ""
|
|
229
|
-
|
|
230
|
-
# Final result
|
|
231
|
-
if [[ $validation_errors -eq 0 ]]; then
|
|
232
|
-
echo "🎉 All context validations passed!"
|
|
233
|
-
echo "✅ CLI Mode has complete, structured task context"
|
|
234
|
-
echo "✅ Zone A 'consensus on vapor' issue prevented"
|
|
235
|
-
exit 0
|
|
236
|
-
else
|
|
237
|
-
echo "❌ $validation_errors validation(s) failed"
|
|
238
|
-
echo "⚠️ Task context may be incomplete"
|
|
239
|
-
echo "⚠️ Risk of 'consensus on vapor' - please add missing context"
|
|
240
|
-
exit 1
|
|
241
|
-
fi
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const calculateConsensus = (taskMetrics) => {
|
|
2
|
-
const {
|
|
3
|
-
validatorScores,
|
|
4
|
-
confidenceScores,
|
|
5
|
-
gateways
|
|
6
|
-
} = taskMetrics;
|
|
7
|
-
|
|
8
|
-
const consensusScore = calculateWeightedConsensus(validatorScores);
|
|
9
|
-
const confidenceScore = calculateConfidenceMetric(confidenceScores);
|
|
10
|
-
const gateScore = calculateGatewayScore(gateways);
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
consensus: consensusScore,
|
|
14
|
-
confidence: confidenceScore,
|
|
15
|
-
gate_score: gateScore,
|
|
16
|
-
recommendation: decideNextAction(consensusScore, confidenceScore, gateScore)
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
function calculateWeightedConsensus(validatorScores) {
|
|
21
|
-
// Implement weighted consensus calculation
|
|
22
|
-
return validatorScores.reduce((a, b) => a + b, 0) / validatorScores.length;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function calculateConfidenceMetric(confidenceScores) {
|
|
26
|
-
// Implement confidence metric calculation
|
|
27
|
-
return Math.min(confidenceScores.reduce((a, b) => a * b, 1), 1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function calculateGatewayScore(gateways) {
|
|
31
|
-
// Implement gateway score calculation
|
|
32
|
-
return gateways.reduce((a, b) => a * b, 1);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function decideNextAction(consensusScore, confidenceScore, gateScore) {
|
|
36
|
-
if (consensusScore >= 0.90 && gateScore >= 0.75) {
|
|
37
|
-
return 'success';
|
|
38
|
-
} else if (consensusScore >= 0.75) {
|
|
39
|
-
return 'retry_with_specialists';
|
|
40
|
-
} else {
|
|
41
|
-
return 'manual_review';
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
module.exports = { calculateConsensus };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
-- Evidence Chain Schema for CFN Loop Validation
|
|
2
|
-
CREATE TABLE validation_evidence (
|
|
3
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
|
-
task_id TEXT NOT NULL,
|
|
5
|
-
validation_mode TEXT NOT NULL,
|
|
6
|
-
confidence REAL,
|
|
7
|
-
consensus_score REAL,
|
|
8
|
-
gate_score REAL,
|
|
9
|
-
iteration INTEGER,
|
|
10
|
-
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
11
|
-
status TEXT CHECK(status IN ('pending', 'success', 'retry', 'escalate', 'failure'))
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
CREATE INDEX idx_task_validation ON validation_evidence(task_id, validation_mode);
|
|
15
|
-
|
|
16
|
-
-- Stored Procedure for Inserting Validation Evidence
|
|
17
|
-
CREATE PROCEDURE insert_validation_evidence(
|
|
18
|
-
p_task_id TEXT,
|
|
19
|
-
p_validation_mode TEXT,
|
|
20
|
-
p_confidence REAL,
|
|
21
|
-
p_consensus_score REAL,
|
|
22
|
-
p_gate_score REAL,
|
|
23
|
-
p_iteration INTEGER,
|
|
24
|
-
p_status TEXT
|
|
25
|
-
)
|
|
26
|
-
BEGIN
|
|
27
|
-
INSERT INTO validation_evidence (
|
|
28
|
-
task_id,
|
|
29
|
-
validation_mode,
|
|
30
|
-
confidence,
|
|
31
|
-
consensus_score,
|
|
32
|
-
gate_score,
|
|
33
|
-
iteration,
|
|
34
|
-
status
|
|
35
|
-
) VALUES (
|
|
36
|
-
p_task_id,
|
|
37
|
-
p_validation_mode,
|
|
38
|
-
p_confidence,
|
|
39
|
-
p_consensus_score,
|
|
40
|
-
p_gate_score,
|
|
41
|
-
p_iteration,
|
|
42
|
-
p_status
|
|
43
|
-
);
|
|
44
|
-
END;
|
|
45
|
-
|
|
46
|
-
-- Function for Calculating Validation Success Rate
|
|
47
|
-
CREATE FUNCTION calculate_validation_success_rate(p_task_id TEXT)
|
|
48
|
-
RETURNS REAL
|
|
49
|
-
BEGIN
|
|
50
|
-
DECLARE total_attempts INTEGER;
|
|
51
|
-
DECLARE successful_attempts INTEGER;
|
|
52
|
-
|
|
53
|
-
SELECT COUNT(*) INTO total_attempts
|
|
54
|
-
FROM validation_evidence
|
|
55
|
-
WHERE task_id = p_task_id;
|
|
56
|
-
|
|
57
|
-
SELECT COUNT(*) INTO successful_attempts
|
|
58
|
-
FROM validation_evidence
|
|
59
|
-
WHERE task_id = p_task_id AND status = 'success';
|
|
60
|
-
|
|
61
|
-
RETURN CASE
|
|
62
|
-
WHEN total_attempts > 0
|
|
63
|
-
THEN (successful_attempts * 1.0) / total_attempts
|
|
64
|
-
ELSE 0.0
|
|
65
|
-
END;
|
|
66
|
-
END;
|