Skill: welliu/checklist (version 1.2.1)

--- name: checklist version: 1.2.1 description: Collaborative task checklist manager for AI agents with sequential, parallel, and looping execution. Features agent coordination, dependencies, deadlock prevention, and loop safety. --- # Checklist 📋 **Collaborative task checklist manager for AI agents with advanced execution modes.** --- ## 🎯 When to Use Use this skill when: - **Multi-agent collaboration** - Multiple AI agents need to coordinate - **Sequential tasks** - Steps must execute in order - **Parallel tasks** - Steps can run simultaneously - **Looping workflows** - Repeat until condition is met - **Complex coordination** - Avoid deadlocks and infinite loops --- ## 🌐 Execution Modes ### 1. Sequential (串行) Steps execute one after another: ``` A → B → C → D ``` ### 2. Parallel (并行) Steps execute simultaneously: ``` A B ← Branch together C ``` ### 3. Loop (循环) Repeat until exit condition: ``` while condition: A → B if exit_condition: break ``` --- ## ⚡ Quick Commands ### Execution Control ```bash # Set execution mode checklist mode sequential # 串行 checklist mode parallel # 并行 checklist mode loop # 循环 # Configure loop checklist loop set 5 # Set max 5 iterations checklist loop condition "<expr>" # Set exit condition checklist loop count # Show current loop count # Run checklist checklist run # Execute with current mode checklist run --dry-run # Preview without executing # Safety checklist check # Check for deadlocks checklist validate # Validate entire workflow ``` ### Agent Commands ```bash checklist agent register <name> checklist agent use <name> checklist assign <item> <agent> checklist claim checklist status ``` ### Task Commands ```bash checklist create <template> checklist done <item> checklist depend <item> <dep> checklist tree ``` --- ## 🔄 Execution Modes Detail ### Sequential Mode ``` ✅ Sequential: Items execute in order 1 → 2 → 3 → 4 → 5 ✅ Item 3 can only start after Item 2 completes ``` ### Parallel Mode ``` ✅ Parallel: Items in same "group" run together Group 1: [1, 2] (parallel) ↓ Group 2: [3, 4] (parallel) ↓ Group 3: [5] (final) ``` ### Loop Mode ``` ✅ Loop: Repeat until exit condition Loop Config: - Max iterations: 5 (default, configurable) - Exit conditions: - All items done - Custom condition met - Manual break Loop Example: Iteration 1: [1, 2, 3] → Check exit → Continue Iteration 2: [1, 2, 3] → Check exit → Continue Iteration 3: [1, 2, 3] → Exit condition met → Stop ``` --- ## 🛡️ Safety Features ### 1. Loop Protection ```bash # Default: Max 5 iterations checklist loop set 5 # After 5 loops, automatically exits # Even if not all items complete ``` ### 2. Exit Conditions ```bash # Exit when specific item done checklist loop condition "item.5.done == true" # Exit when all required items done checklist loop condition "all_required_done" # Exit when iteration count reached checklist loop condition "count >= 5" ``` ### 3. Deadlock Prevention ```bash # Check for potential deadlocks checklist check 🔍 Deadlock Detection: - Circular dependencies: NONE - Unreachable items: NONE - Agent conflicts: NONE ✅ Workflow is safe to execute ``` ### 4. Validation ```bash # Validate entire workflow checklist validate 🔍 Validation: - All items have valid references: ✅ - No circular dependencies: ✅ - Agents assigned: 3/15 - Max loop iterations: 5 - Exit condition: defined ✅ Checklist is valid ``` --- ## 📋 Usage Examples ### Example 1: Sequential Deployment ``` User: Deploy app sequentially AI: [Execute: checklist create deploy] [Execute: checklist mode sequential] ✅ Mode: Sequential Execution Order: ⏳ 1. Run tests ⏳ 2. Build ⏳ 3. Deploy to staging ⏳ 4. Verify ⏳ 5. Deploy to prod ``` ### Example 2: Parallel Testing ``` User: Run tests in parallel AI: [Execute: checklist create test-suite] [Execute: checklist mode parallel] ✅ Mode: Parallel Parallel Groups: Group 1 (concurrent): 🔄 Unit tests 🔄 Integration tests 🔄 Lint checks ↓ All complete → Group 2: ✅ Generate report ``` ### Example 3: Loop with Exit ``` User: Poll API until successful, max 5 times AI: [Execute: checklist create api-poll] [Execute: checklist mode loop] [Execute: checklist loop set 5] [Execute: checklist loop condition "item.3.done == true"] Loop Config: - Max iterations: 5 - Exit: item #3 (API success) - Current: 0/5 Iteration 1: ⏳ 1. Send request ⏳ 2. Check response ⏳ 3. Verify success → Not done, continue... Iteration 3: ⏳ 1. Send request ⏳ 2. Check response ✅ 3. Verify success ← Exit condition met! 🔄 Loop exited at iteration 3 ✅ Exit condition satisfied ``` ### Example 4: Deadlock Prevention ``` User: Create conflicting dependencies AI: [Execute: checklist add "Task A"] [Execute: checklist add "Task B"] [Execute: checklist depend 1 2] [Execute: checklist depend 2 1] [Execute: checklist check] 🔍 Deadlock Detection: ⚠️ WARNING: Circular dependency detected! 1 → 2 → 1 Resolution suggestions: - Remove one dependency - Merge into single item ✅ Checklist NOT safe - fix before running ``` --- ## 🔧 Implementation ### Loop State ```json { "loop": { "enabled": true, "mode": "sequential|parallel|loop", "max_iterations": 5, "current_iteration": 0, "exit_condition": "item.3.done == true", "exit_reason": "condition_met|max_reached|manual" } } ``` ### Safety Checks ``` Before Execution: 1. Validate all references ✓ 2. Check circular dependencies ✓ 3. Verify agents available ✓ 4. Check loop config ✓ 5. Confirm exit condition ✓ During Execution: - Monitor for infinite loops - Track iteration count - Check exit conditions After Execution: - Final validation - Generate completion report ``` --- ## 🎯 Best Practices ### 1. Always Set Exit Conditions ```bash # Good checklist loop condition "item.success.done == true" # With timeout checklist loop set 10 ``` ### 2. Use Sequential for Dependent Tasks ```bash checklist mode sequential checklist depend 2 1 checklist depend 3 2 ``` ### 3. Use Parallel for Independent Tasks ```bash checklist mode parallel # Items in same group run together ``` ### 4. Check Before Running ```bash checklist check # Deadlock check checklist validate # Full validation ``` ### 5. Monitor Loop Count ```bash checklist loop count # Show current iteration ``` --- ## ⚠️ Important Notes ### Loop Safety | Scenario | Behavior | |----------|----------| | No exit condition | Uses max_iterations (default: 5) | | Exit condition never met | Stops at max_iterations | | Deadlock detected | Blocks execution, shows warning | | Circular dependency | Prevents running, suggests fix | ### Maximum Limits | Limit | Default | Max | |-------|---------|-----| | Loop iterations | 5 | 100 | | Parallel items | 10 | 50 | | Total items | 100 | 500 | --- ## 🦞 Summary **One line: Complex task → Choose mode (sequential/parallel/loop) → Set safety limits → Run with confidence → Automatic exit** ---

path: _meta.json
content: {
  "name": "checklist",
  "version": "1.2.1",
  "description": "Collaborative task checklist manager for AI agents with sequential, parallel, and looping execution. Features agent coordination, dependencies, deadlock prevention, and loop safety.",
  "author": "wenew",
  "tags": ["checklist", "task", "management", "tracking", "collaboration", "multi-agent", "workflow", "sequential", "parallel", "loop", "safety"],
  "homepage": "https://github.com/wenew/checklist",
  "license": "MIT"
}


path: templates/onboarding.json
content: {
  "name": "Employee Onboarding",
  "description": "New employee setup and integration checklist",
  "category": "hr",
  "items": [
    {"id": 1, "text": "Send welcome email with first day instructions", "required": true},
    {"id": 2, "text": "Create company accounts (email, Slack, etc.)", "required": true},
    {"id": 3, "text": "Set up workstation/laptop", "required": true},
    {"id": 4, "text": "Grant access to required systems", "required": true},
    {"id": 5, "text": "Assign buddy/mentor", "required": true},
    {"id": 6, "text": "Schedule orientation meeting", "required": true},
    {"id": 7, "text": "Review company policies and handbook", "required": false},
    {"id": 8, "text": "Complete HR paperwork", "required": true},
    {"id": 9, "text": "Team introduction meeting", "required": true},
    {"id": 10, "text": "Assign first project/task", "required": false},
    {"id": 11, "text": "Schedule check-in after 1 week", "required": true},
    {"id": 12, "text": "Schedule check-in after 1 month", "required": true}
  ]
}


path: templates/incident-response.json
content: {
  "name": "Incident Response",
  "description": "IT incident response and troubleshooting workflow",
  "category": "operations",
  "items": [
    {"id": 1, "text": "Identify and categorize the incident (P1/P2/P3)", "required": true},
    {"id": 2, "text": "Notify stakeholders and create incident ticket", "required": true},
    {"id": 3, "text": "Gather initial information (logs, screenshots, error messages)", "required": true},
    {"id": 4, "text": "Check monitoring/alerting systems for anomalies", "required": true},
    {"id": 5, "text": "Review recent changes that might have caused the issue", "required": true},
    {"id": 6, "text": "Isolate affected systems if needed", "required": true},
    {"id": 7, "text": "Implement fix or workaround", "required": true},
    {"id": 8, "text": "Verify fix is working", "required": true},
    {"id": 9, "text": "Update incident ticket with resolution details", "required": true},
    {"id": 10, "text": "Send resolution notification to stakeholders", "required": true},
    {"id": 11, "text": "Schedule post-incident review meeting", "required": false},
    {"id": 12, "text": "Document lessons learned", "required": false}
  ]
}


path: templates/deploy.json
content: {
  "name": "Deploy Checklist",
  "description": "Pre-deployment verification steps",
  "category": "devops",
  "items": [
    {"id": 1, "text": "Run all tests locally and verify passing", "required": true},
    {"id": 2, "text": "Review code changes in git diff", "required": true},
    {"id": 3, "text": "Check environment variables are properly set", "required": true},
    {"id": 4, "text": "Verify database migrations are backward compatible", "required": true},
    {"id": 5, "text": "Enable maintenance mode (if needed)", "required": false},
    {"id": 6, "text": "Deploy to staging/QA environment first", "required": true},
    {"id": 7, "text": "Run smoke tests on staging", "required": true},
    {"id": 8, "text": "Create database backup", "required": true},
    {"id": 9, "text": "Deploy to production", "required": true},
    {"id": 10, "text": "Verify health endpoints respond correctly", "required": true},
    {"id": 11, "text": "Check application logs for errors", "required": true},
    {"id": 12, "text": "Verify database connections working", "required": true},
    {"id": 13, "text": "Notify stakeholders of deployment", "required": false},
    {"id": 14, "text": "Disable maintenance mode", "required": false},
    {"id": 15, "text": "Monitor error rates for 30 minutes", "required": true}
  ]
}


path: templates/database-migration.json
content: {
  "name": "Database Migration",
  "description": "Safe database migration workflow",
  "category": "devops",
  "items": [
    {"id": 1, "text": "Create migration script", "required": true},
    {"id": 2, "text": "Add rollback script", "required": true},
    {"id": 3, "text": "Test migration on local/staging DB", "required": true},
    {"id": 4, "text": "Verify rollback on staging", "required": true},
    {"id": 5, "text": "Create database backup", "required": true},
    {"id": 6, "text": "Schedule maintenance window", "required": true},
    {"id": 7, "text": "Notify users of downtime", "required": true},
    {"id": 8, "text": "Enable maintenance mode", "required": true},
    {"id": 9, "text": "Run migration during maintenance window", "required": true},
    {"id": 10, "text": "Verify data integrity after migration", "required": true},
    {"id": 11, "text": "Test application functionality", "required": true},
    {"id": 12, "text": "Disable maintenance mode", "required": true},
    {"id": 13, "text": "Monitor for 30 minutes post-migration", "required": true},
    {"id": 14, "text": "Confirm backup is restorable", "required": false}
  ]
}


path: templates/container-security.json
content: {
  "name": "Container Security",
  "description": "Docker/container security scanning checklist",
  "category": "security",
  "items": [
    {"id": 1, "text": "Use official base images", "required": true},
    {"id": 2, "text": "Verify base image is up to date", "required": true},
    {"id": 3, "text": "Run container security scan", "required": true},
    {"id": 4, "text": "Fix critical vulnerabilities found", "required": true},
    {"id": 5, "text": "Don't run as root user", "required": true},
    {"id": 6, "text": "Use minimal base image (Alpine/distroless)", "required": false},
    {"id": 7, "text": "Remove unnecessary packages", "required": true},
    {"id": 8, "text": "Scan for secrets in image", "required": true},
    {"id": 9, "text": "Verify file permissions", "required": true},
    {"id": 10, "text": "Check for exposed secrets in environment", "required": true},
    {"id": 11, "text": "Verify HEALTHCHECK is defined", "required": true},
    {"id": 12, "text": "Test container runs correctly", "required": true},
    {"id": 13, "text": "Scan application dependencies", "required": true}
  ]
}


path: templates/performance-testing.json
content: {
  "name": "Performance Testing",
  "description": "Application performance testing checklist",
  "category": "testing",
  "items": [
    {"id": 1, "text": "Define performance benchmarks", "required": true},
    {"id": 2, "text": "Prepare test data", "required": true},
    {"id": 3, "text": "Run load tests (normal load)", "required": true},
    {"id": 4, "text": "Run load tests (peak load)", "required": true},
    {"id": 5, "text": "Run stress tests", "required": true},
    {"id": 6, "text": "Test API response times", "required": true},
    {"id": 7, "text": "Check database query performance", "required": true},
    {"id": 8, "text": "Verify caching effectiveness", "required": true},
    {"id": 9, "text": "Check memory usage", "required": true},
    {"id": 10, "text": "Verify CPU utilization", "required": true},
    {"id": 11, "text": "Test concurrent user limits", "required": true},
    {"id": 12, "text": "Check network latency", "required": true},
    {"id": 13, "text": "Document performance bottlenecks", "required": true},
    {"id": 14, "text": "Create performance report", "required": true}
  ]
}


path: templates/release.json
content: {
  "name": "Release Checklist",
  "description": "Software release preparation and deployment workflow",
  "category": "devops",
  "items": [
    {"id": 1, "text": "Update version number in configuration", "required": true},
    {"id": 2, "text": "Update changelog with all changes", "required": true},
    {"id": 3, "text": "Run full test suite locally", "required": true},
    {"id": 4, "text": "Ensure all tests pass on CI/CD", "required": true},
    {"id": 5, "text": "Run security scans", "required": true},
    {"id": 6, "text": "Update API documentation if needed", "required": false},
    {"id": 7, "text": "Create release branch", "required": true},
    {"id": 8, "text": "Run integration tests on staging", "required": true},
    {"id": 9, "text": "Perform smoke tests", "required": true},
    {"id": 10, "text": "Create release tag", "required": true},
    {"id": 11, "text": "Deploy to production", "required": true},
    {"id": 12, "text": "Verify production deployment", "required": true},
    {"id": 13, "text": "Send release announcement", "required": true},
    {"id": 14, "text": "Monitor error rates for 30 minutes", "required": true}
  ]
}


path: templates/daily-standup.json
content: {
  "name": "Daily Standup",
  "description": "Daily team standup meeting preparation",
  "category": "meeting",
  "items": [
    {"id": 1, "text": "Review yesterday's accomplishments", "required": true},
    {"id": 2, "text": "Identify today's planned tasks", "required": true},
    {"id": 3, "text": "Note any blockers or impediments", "required": true},
    {"id": 4, "text": "Update task management system", "required": true},
    {"id": 5, "text": "Check for dependent tasks from teammates", "required": false},
    {"id": 6, "text": "Review PRs needing attention", "required": false},
    {"id": 7, "text": "Check calendar for meetings today", "required": false}
  ]
}


path: templates/code-merge.json
content: {
  "name": "Code Merge",
  "description": "Pull request/merge request review checklist",
  "category": "development",
  "items": [
    {"id": 1, "text": "All tests passing", "required": true},
    {"id": 2, "text": "Code follows style guidelines", "required": true},
    {"id": 3, "text": "No hardcoded credentials", "required": true},
    {"id": 4, "text": "Input validation implemented", "required": true},
    {"id": 5, "text": "Error handling in place", "required": true},
    {"id": 6, "text": "No security vulnerabilities", "required": true},
    {"id": 7, "text": "Unit tests included", "required": true},
    {"id": 8, "text": "Documentation updated", "required": false},
    {"id": 9, "text": "No debug code left behind", "required": true},
    {"id": 10, "text": "Reviewed git diff", "required": true},
    {"id": 11, "text": "Reviewed by at least 1 peer", "required": true},
    {"id": 12, "text": "No merge conflicts", "required": true},
    {"id": 13, "text": "Branch up to date with target", "required": true}
  ]
}


path: templates/security-review.json
content: {
  "name": "Security Review Checklist",
  "description": "Pre-release security verification",
  "category": "security",
  "items": [
    {"id": 1, "text": "All user inputs are validated and sanitized", "required": true},
    {"id": 2, "text": "Authentication mechanisms are secure (not using weak methods)", "required": true},
    {"id": 3, "text": "Authorization checks on all protected resources", "required": true},
    {"id": 4, "text": "Passwords are hashed with strong algorithms (bcrypt, argon2)", "required": true},
    {"id": 5, "text": "Session management is secure", "required": true},
    {"id": 6, "text": "CSRF protection is implemented", "required": true},
    {"id": 7, "text": "XSS protection is in place", "required": true},
    {"id": 8, "text": "No sensitive data in URLs or logs", "required": true},
    {"id": 9, "text": "API rate limiting is configured", "required": true},
    {"id": 10, "text": "Security headers are set (CSP, HSTS, etc.)", "required": true},
    {"id": 11, "text": "Database uses parameterized queries", "required": true},
    {"id": 12, "text": "File uploads are properly validated", "required": true},
    {"id": 13, "text": "Dependencies scanned for vulnerabilities", "required": true},
    {"id": 14, "text": "No exposed debug endpoints in production", "required": true},
    {"id": 15, "text": "Error messages don't leak sensitive info", "required": true}
  ]
}


path: templates/api-review.json
content: {
  "name": "API Design Review",
  "description": "REST API design review checklist",
  "category": "development",
  "items": [
    {"id": 1, "text": "Verify RESTful URL structure", "required": true},
    {"id": 2, "text": "Check HTTP methods usage (GET/POST/PUT/DELETE)", "required": true},
    {"id": 3, "text": "Verify proper HTTP status codes", "required": true},
    {"id": 4, "text": "Review authentication/authorization design", "required": true},
    {"id": 5, "text": "Check rate limiting strategy", "required": true},
    {"id": 6, "text": "Verify error response format consistency", "required": true},
    {"id": 7, "text": "Review versioning strategy", "required": true},
    {"id": 8, "text": "Check pagination for list endpoints", "required": true},
    {"id": 9, "text": "Verify request/response schemas", "required": true},
    {"id": 10, "text": "Review API documentation completeness", "required": true},
    {"id": 11, "text": "Check for sensitive data exposure", "required": true},
    {"id": 12, "text": "Verify idempotency for mutations", "required": true}
  ]
}


path: templates/code-review.json
content: {
  "name": "Code Review Checklist",
  "description": "Pre-commit code review verification",
  "category": "development",
  "items": [
    {"id": 1, "text": "Code follows project style guidelines", "required": true},
    {"id": 2, "text": "No hardcoded credentials or secrets", "required": true},
    {"id": 3, "text": "Input validation is implemented", "required": true},
    {"id": 4, "text": "Error handling is properly implemented", "required": true},
    {"id": 5, "text": "No SQL injection vulnerabilities", "required": true},
    {"id": 6, "text": "Authentication is required for protected endpoints", "required": true},
    {"id": 7, "text": "Authorization checks are in place", "required": true},
    {"id": 8, "text": "Sensitive data is encrypted at rest", "required": true},
    {"id": 9, "text": "HTTPS is enforced for all traffic", "required": true},
    {"id": 10, "text": "No console.log or debug statements left", "required": false},
    {"id": 11, "text": "Unit tests are included", "required": true},
    {"id": 12, "text": "Code is documented where complex", "required": false},
    {"id": 13, "text": "No performance issues identified", "required": true},
    {"id": 14, "text": "Dependencies are up to date", "required": false},
    {"id": 15, "text": "Changelog updated", "required": false}
  ]
}


path: scripts/checklist.sh
content: #!/bin/bash

# Checklist - Multi-Agent Collaborative Task Checklist Manager

set -e

CHECKLIST_DIR="${HOME}/.checklist"
ACTIVE_DIR="${CHECKLIST_DIR}/active"
TEMPLATES_DIR="${CHECKLIST_DIR}/templates"
SKILL_TEMPLATES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../templates" && pwd)"
AGENTS_FILE="${CHECKLIST_DIR}/agents.json"

mkdir -p "${CHECKLIST_DIR}" "${ACTIVE_DIR}" "${TEMPLATES_DIR}"

# Copy skill templates if not exist
if [[ -d "$SKILL_TEMPLATES_DIR" ]] && [[ ! "$(ls -A "$TEMPLATES_DIR" 2>/dev/null)" ]]; then
    cp "${SKILL_TEMPLATES_DIR}"/*.json "${TEMPLATES_DIR}/" 2>/dev/null || true
fi

# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
MAGENTA='\033[0;35m'
NC='\033[0m'

print_status() { echo -e "${BLUE}[checklist]${NC} $1"; }
print_success() { echo -e "${GREEN}[✓]${NC} $1"; }
print_warning() { echo -e "${YELLOW}[!]${NC} $1"; }
print_error() { echo -e "${RED}[✗]${NC} $1"; }
print_agent() { echo -e "${MAGENTA}[👤 $1]${NC} $2"; }

# ============== AGENT COMMANDS ==============

cmd_agent_register() {
    local name="$1"
    local role="${2:-general}"
    
    if [[ -z "$name" ]]; then
        print_error "Agent name required"
        return 1
    fi
    
    # Create agents file if not exists
    if [[ ! -f "$AGENTS_FILE" ]]; then
        echo '{"agents": [], "current": null}' > "$AGENTS_FILE"
    fi
    
    # Check if agent already exists
    if jq -e --arg name "$name" '.agents[] | select(.name == $name)' "$AGENTS_FILE" >/dev/null 2>&1; then
        print_warning "Agent '$name' already registered"
        return
    fi
    
    # Add agent
    local temp=$(mktemp)
    jq --arg name "$name" --arg role "$role" \
        '.agents += [{"name": $name, "role": $role, "active": true}] | .current = $name' \
        "$AGENTS_FILE" > "$temp" && mv "$temp" "$AGENTS_FILE"
    
    print_success "Registered agent: $name (role: $role)"
}

cmd_agent_use() {
    local name="$1"
    
    if [[ ! -f "$AGENTS_FILE" ]]; then
        print_error "No agents registered"
        return 1
    fi
    
    if ! jq -e --arg name "$name" '.agents[] | select(.name == $name)' "$AGENTS_FILE" >/dev/null 2>&1; then
        print_error "Agent '$name' not found"
        return 1
    fi
    
    local temp=$(mktemp)
    jq --arg name "$name" '.current = $name' "$AGENTS_FILE" > "$temp" && mv "$temp" "$AGENTS_FILE"
    
    print_success "Switched to agent: $name"
}

cmd_agent_list() {
    if [[ ! -f "$AGENTS_FILE" ]]; then
        print_warning "No agents registered"
        return
    fi
    
    local current=$(jq -r '.current // "none"' "$AGENTS_FILE")
    
    echo ""
    echo "📋 Registered Agents:"
    echo ""
    
    jq -r '.agents[] | "\(.name) (\(.role))"' "$AGENTS_FILE" | while read -r agent; do
        if [[ "$agent" == "$current"* ]]; then
            echo "  👤 $agent *"
        else
            echo "  ○ $agent"
        fi
    done
    echo ""
    echo "Current: $current"
}

cmd_agent_status() {
    local name="${1:-$(jq -r '.current' "$AGENTS_FILE")}"
    local active_file="${ACTIVE_DIR}/current.json"
    
    if [[ ! -f "$active_file" ]]; then
        print_error "No active checklist"
        return
    fi
    
    local total=$(jq -r '.items | length' "$active_file")
    local claimed=$(jq -r --arg name "$name" '[.items[] | select(.assigned_to == $name)] | length' "$active_file")
    local done_count=$(jq -r --arg name "$name" '[.items[] | select(.completed_by == $name)] | length' "$active_file")
    
    echo ""
    echo "👤 Agent: $name"
    echo "   Claimed: $claimed items"
    echo "   Completed: $done_count items"
    echo ""
    
    # Show this agent's items
    jq -r --arg name "$name" '.items[] | select(.assigned_to == $name) | "  [\(.status)] \(.id). \(.text)"' "$active_file"
}

# ============== TASK COMMANDS ==============

cmd_claim() {
    local active_file="${ACTIVE_DIR}/current.json"
    
    if [[ ! -f "$active_file" ]]; then
        print_error "No active checklist"
        return 1
    fi
    
    local current=$(jq -r '.current' "$AGENTS_FILE")
    if [[ "$current" == "null" ]]; then
        print_error "No current agent. Run: checklist agent register <name>"
        return 1
    fi
    
    # Find first available item (not done, no assignee, dependencies met)
    local available=$(jq -r --arg agent "$current" \
        '.items[] | select(.status == "pending" and (.assigned_to == null or .assigned_to == $agent)) | .id' "$active_file" | head -1)
    
    if [[ -z "$available" ]]; then
        print_warning "No available items to claim"
        return
    fi
    
    local temp=$(mktemp)
    jq --argjson item_id "$available" --arg agent "$current" \
        '(.items[] | select(.id == $item_id)).assigned_to = $agent | (.items[] | select(.id == $item_id)).status = "claimed"' \
        "$active_file" > "$temp" && mv "$temp" "$active_file"
    
    local text=$(jq -r --argjson item_id "$available" '.items[] | select(.id == $item_id) | .text' "$active_file")
    print_success "Claimed item #$available: $text"
}

cmd_assign() {
    local item_num="$1"
    local agent="$2"
    local active_file="${ACTIVE_DIR}/current.json"
    
    if [[ ! -f "$active_file" ]]; then
        print_error "No active checklist"
        return 1
    fi
    
    if [[ -z "$agent" ]]; then
        agent=$(jq -r '.current' "$AGENTS_FILE")
    fi
    
    local temp=$(mktemp)
    jq --argjson num "$item_num" --arg agent "$agent" \
        '(.items[] | select(.id == num)).assigned_to = $agent | (.items[] | select(.id == num)).status = "claimed"' \
        "$active_file" > "$temp" && mv "$temp" "$active_file"
    
    print_success "Assigned item #$item_num to $agent"
}

cmd_release() {
    local item_num="$1"
    local active_file="${ACTIVE_DIR}/current.json"
    
    if [[ ! -f "$active_file" ]]; then
        print_error "No active checklist"
        return 1
    fi
    
    local temp=$(mktemp)
    jq --argjson num "$item_num" \
        '(.items[] | select(.id == num)).assigned_to = null | (.items[] | select(.id == num)).status = "pending"' \
        "$active_file" > "$temp" && mv "$temp" "$active_file"
    
    print_success "Released item #$item_num"
}

# ============== DEPENDENCY COMMANDS ==============

cmd_depend() {
    local item_num="$1"
    local depends_on="$2"
    local active_file="${ACTIVE_DIR}/current.json"
    
    if [[ ! -f "$active_file" ]]; then
        print_error "No active checklist"
        return 1
    fi
    
    local temp=$(mktemp)
    jq --argjson num "$item_num" --argjson dep "$depends_on" \
        '(.items[] | select(.id == num)).depends_on = ($dep | if type == "array" then . else [.] end)' \
        "$active_file" > "$temp" && mv "$temp" "$active_file"
    
    print_success "Item #$item_num now depends on #$depends_on"
}

cmd_tree() {
    local active_file="${ACTIVE_DIR}/current.json"
    
    if [[ ! -f "$active_file" ]]; then
        print_error "No active checklist"
        return 1
    fi
    
    local name=$(jq -r '.name' "$active_file")
    echo ""
    echo "📋 Dependency Tree: $name"
    echo ""
    
    # Show items sorted by dependencies
    jq -r '.items[] | "\(.id)|\(.text)|\(.status)|\(.depends_on | join(","))"' "$active_file" | while IFS='|' read -r id text status deps; do
        local indent=""
        if [[ "$deps" != "" ]]; then
            indent="  └─ "
        fi
        
        case "$status" in
            done) echo "✅ $id. $text" ;;
            claimed) echo "🔄 $id. $text (assigned)" ;;
            skipped) echo "⏭️  $id. $text" ;;
            *) echo "⬜ $id. $text" ;;
        esac
    done
}

# ============== BASIC COMMANDS ==============

cmd_show() {
    local active_file="${ACTIVE_DIR}/current.json"
    
    if [[ ! -f "$active_file" ]]; then
        print_warning "No active checklist. Use 'checklist create <template>'"
        return
    fi
    
    local name=$(jq -r '.name' "$active_file")
    local total=$(jq -r '.items | length' "$active_file")
    local done_count=$(jq -r '[.items[] | select(.status == "done")] | length' "$active_file")
    local claimed=$(jq -r '[.items[] | select(.status == "claimed")] | length' "$active_file")
    
    echo ""
    echo "📋 Checklist: $name"
    echo ""
    echo "Progress: ${done_count}/${total} completed"
    
    if [[ $total -gt 0 ]]; then
        local progress=$((done_count * 100 / total))
        local bars=$((progress / 5))
        printf "["
        printf "%${bars}s" | tr ' ' '█'
        printf "%$((20 - bars))s" | tr ' ' '─'
        printf "] %d%%\n" "$progress"
    fi
    echo ""
    
    # Group by agent
    if [[ -f "$AGENTS_FILE" ]]; then
        local current=$(jq -r '.current // "none"' "$AGENTS_FILE")
        echo "Current agent: $current"
        echo ""
    fi
    
    local idx=1
    while IFS= read -r id; do
        local item=$(jq -r --argjson item_id "$id" '.items[] | select(.id == $item_id)' "$active_file")
        local text=$(echo "$item" | jq -r '.text')
        local status=$(echo "$item" | jq -r '.status')
        local assigned=$(echo "$item" | jq -r '.assigned_to // "null"')
        local deps=$(echo "$item" | jq -r '.depends_on | join(",")')
        
        if [[ "$deps" == "" ]]; then
            deps=""
        else
            deps=" (deps: $deps)"
        fi
        
        case "$status" in
            done) 
                local by=$(echo "$item" | jq -r '.completed_by // ""')
                echo "✅ $idx. $text$deps" ;;
            claimed) 
                echo "🔄 $idx. $assigned: $text$deps" ;;
            skip) 
                local reason=$(echo "$item" | jq -r '.reason // ""')
                echo "⏭️  $idx. $text (reason: $reason)$deps" ;;
            *) 
                echo "⬜ $idx. $text$deps" ;;
        esac
        ((idx++))
    done < <(jq -r '.items[] | .id' "$active_file")
}

cmd_status() {
    local active_file="${ACTIVE_DIR}/current.json"
    
    if [[ ! -f "$active_file" ]]; then
        print_error "No active checklist"
        return
    fi
    
    local name=$(jq -r '.name' "$active_file")
    local total=$(jq -r '.items | length' "$active_file")
    local done_count=$(jq -r '[.items[] | select(.status == "done")] | length' "$active_file")
    
    echo ""
    echo "📊 Overall Progress: $name"
    echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
    echo "Total: $total | Done: $done_count | Remaining: $((total - done_count))"
    
    if [[ -f "$AGENTS_FILE" ]]; then
        echo ""
        echo "👥 Agent Progress:"
        jq -r '.agents[] | .name' "$AGENTS_FILE" | while read -r agent; do
            local claimed=$(jq -r --arg name "$agent" '[.items[] | select(.assigned_to == name)] | length' "$active_file")
            local done_by=$(jq -r --arg name "$agent" '[.items[] | select(.completed_by == name)] | length' "$active_file")
            echo "  👤 $agent: $done_by/$claimed completed"
        done
    fi
}

cmd_done() {
    local item_num="$1"
    local active_file="${ACTIVE_DIR}/current.json"
    local current=$(jq -r '.current' "$AGENTS_FILE")
    
    if [[ ! -f "$active_file" ]]; then
        print_error "No active checklist"
        return 1
    fi
    
    # Update status
    local temp=$(mktemp)
    jq --argjson num "$item_num" --arg agent "$current" --arg now "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
        '(.items[] | select(.id == num)).status = "done" | (.items[] | select(.id == num)).completed_by = $agent | (.items[] | select(.id == num)).completed_at = $now' \
        "$active_file" > "$temp" && mv "$temp" "$active_file"
    
    print_success "Marked item $item_num as done"
    cmd_show
}

cmd_skip() {
    local item_num="$1"
    local reason="${2:-Skipped}"
    local active_file="${ACTIVE_DIR}/current.json"
    
    if [[ ! -f "$active_file" ]]; then
        print_error "No active checklist"
        return 1
    fi
    
    local temp=$(mktemp)
    jq --argjson num "$item_num" --arg reason "$reason" \
        '(.items[] | select(.id == num)).status = "skip" | (.items[] | select(.id == num)).reason = $reason' \
        "$active_file" > "$temp" && mv "$temp" "$active_file"
    
    print_success "Skipped item $item_num: $reason"
    cmd_show
}

cmd_add() {
    local text="$1"
    local active_file="${ACTIVE_DIR}/current.json"
    
    if [[ ! -f "$active_file" ]]; then
        print_error "No active checklist. Create one first."
        return 1
    fi
    
    local next_id=$(jq '[.items[].id] | max + 1' "$active_file")
    
    local temp=$(mktemp)
    jq --argjson item_id "$next_id" --arg text "$text" \
        '.items += [{"id": id, "text": text, "status": "pending", "required": true, "depends_on": []}]' \
        "$active_file" > "$temp" && mv "$temp" "$active_file"
    
    print_success "Added: $text"
    cmd_show
}

cmd_create() {
    local name="$1"
    
    if [[ -z "$name" ]]; then
        print_error "Template name required"
        cmd_templates
        return 1
    fi
    
    local template_file="${TEMPLATES_DIR}/${name}.json"
    
    if [[ -f "$template_file" ]]; then
        cp "$template_file" "${ACTIVE_DIR}/current.json"
        # Reset all statuses
        local temp=$(mktemp)
        jq '.items[] |= {"id": .id, "text": .text, "status": "pending", "required": .required, "assigned_to": null, "completed_by": null, "depends_on": (.depends_on // [])}' \
            "${ACTIVE_DIR}/current.json" > "$temp" && mv "$temp" "${ACTIVE_DIR}/current.json"
        print_success "Created checklist: $name"
    else
        # Create custom
        cat > "${ACTIVE_DIR}/current.json" << EOF
{
  "name": "$name",
  "description": "Custom checklist",
  "items": []
}
EOF
        print_success "Created new checklist: $name"
    fi
    
    cmd_show
}

cmd_templates() {
    print_status "Available templates:"
    echo ""
    
    local count=1
    for template in "${TEMPLATES_DIR}"/*.json; do
        if [[ -f "$template" ]]; then
            local name=$(basename "$template" .json)
            local desc=$(jq -r '.description // "No description"' "$template" 2>/dev/null || echo "Template")
            echo "  $count. $name - $desc"
            ((count++))
        fi
    done
    
    if [[ $count -eq 1 ]]; then
        echo "  No templates. Use 'checklist create <name>' for custom."
    fi
}

# ============== MAIN ==============

usage() {
    cat << EOF
Checklist - Multi-Agent Collaborative Checklist Manager (v1.1.0)

Usage: checklist <command> [options]

Commands:
    Agent Management:
        agent register <name> [role]    Register this agent
        agent use <name>                Switch to agent
        agent list                       List agents
        agent status [name]             Show agent's tasks
    
    Task Management:
        create <template>              Create checklist from template
        show                           Show current checklist
        status                         Show all agents' progress
        claim                          Claim available task
        assign <item> [agent]          Assign task to agent
        release <item>                 Release claimed task
        done <item-num>                Mark item done
        skip <item-num> [reason]       Skip item
        add "<text>"                    Add custom item
    
    Dependencies:
        depend <item> <dep-item>       Add dependency
        tree                           Show dependency tree
    
    Templates:
        templates                      List templates

Examples:
    checklist agent register backend-dev
    checklist agent register frontend-dev
    checklist create deploy
    checklist assign 4 backend-dev
    checklist claim
    checklist done 3
    checklist status

EOF
    exit 1
}

# Parse main command
case "$1" in
    agent)
        case "$2" in
            register) cmd_agent_register "$3" "$4" ;;
            use) cmd_agent_use "$3" ;;
            list) cmd_agent_list ;;
            status) cmd_agent_status "$3" ;;
            *) usage ;;
        esac
        ;;
    create) cmd_create "$2" ;;
    show) cmd_show ;;
    status) cmd_status ;;
    claim) cmd_claim ;;
    assign) cmd_assign "$2" "$3" ;;
    release) cmd_release "$2" ;;
    done) cmd_done "$2" ;;
    skip) cmd_skip "$2" "$3" ;;
    add) cmd_add "$2" ;;
    depend) cmd_depend "$2" "$3" ;;
    tree) cmd_tree ;;
    templates) cmd_templates ;;
    help|--help|-h|"") usage ;;
    *) print_error "Unknown command: $1" ; usage ;;
esac


path: evals/evals.json
content: {
  "tests": [
    {
      "id": 1,
      "prompt": "Create a deployment checklist",
      "expected": "Should create deploy checklist with 15 items"
    },
    {
      "id": 2,
      "prompt": "Register an agent named 'backend'",
      "expected": "Should register agent successfully"
    },
    {
      "id": 3,
      "prompt": "Register another agent named 'frontend'",
      "expected": "Should register agent successfully"
    },
    {
      "id": 4,
      "prompt": "List all registered agents",
      "expected": "Should show both backend and frontend agents"
    },
    {
      "id": 5,
      "prompt": "Switch to backend agent",
      "expected": "Should switch current agent to backend"
    },
    {
      "id": 6,
      "prompt": "Assign item 4 to backend agent",
      "expected": "Should assign item to backend"
    },
    {
      "id": 7,
      "prompt": "Claim an available task for current agent",
      "expected": "Should claim next available item"
    },
    {
      "id": 8,
      "prompt": "Mark item 1 as done",
      "expected": "Should update item status to done"
    },
    {
      "id": 9,
      "prompt": "Show current checklist progress",
      "expected": "Should display progress with completion percentage"
    },
    {
      "id": 10,
      "prompt": "Set execution mode to sequential",
      "expected": "Should set mode to sequential"
    },
    {
      "id": 11,
      "prompt": "Set execution mode to parallel",
      "expected": "Should set mode to parallel"
    },
    {
      "id": 12,
      "prompt": "Set execution mode to loop",
      "expected": "Should set mode to loop"
    },
    {
      "id": 13,
      "prompt": "Set max loop iterations to 5",
      "expected": "Should set max_iterations to 5"
    },
    {
      "id": 14,
      "prompt": "Set exit condition as item 3 done",
      "expected": "Should configure exit condition"
    },
    {
      "id": 15,
      "prompt": "Add a dependency: item 5 depends on item 3",
      "expected": "Should add dependency"
    },
    {
      "id": 16,
      "prompt": "Show dependency tree",
      "expected": "Should display dependency tree"
    },
    {
      "id": 17,
      "prompt": "Check for deadlocks in the workflow",
      "expected": "Should report deadlock check results"
    },
    {
      "id": 18,
      "prompt": "Validate the entire checklist workflow",
      "expected": "Should show validation results"
    },
    {
      "id": 19,
      "prompt": "Skip item 2 with reason 'not required'",
      "expected": "Should skip item with reason"
    },
    {
      "id": 20,
      "prompt": "Show overall status of all agents",
      "expected": "Should display multi-agent progress"
    }
  ]
}


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)