{
  "version": "1.0",
  "activities": [
    {
      "name": "CloneRepoActivity",
      "description": "Clone a Git repository to the worker filesystem",
      "category": "repository",
      "inputs": {
        "repo": {
          "type": "string",
          "description": "Git repository URL",
          "required": true
        },
        "branch": {
          "type": "string",
          "description": "Git branch to clone (default: main)",
          "required": false,
          "default": "main"
        },
        "depth": {
          "type": "integer",
          "description": "Shallow clone depth (optional)",
          "required": false
        }
      },
      "outputs": {
        "path": {
          "type": "string",
          "description": "Local filesystem path where repo was cloned"
        },
        "commit": {
          "type": "string",
          "description": "Current commit hash"
        },
        "branch": {
          "type": "string",
          "description": "Current branch name"
        }
      },
      "constraints": {
        "defaultTimeout": "5m",
        "isFlaky": false,
        "recommendedRetries": 1,
        "retryBackoff": 1.5,
        "dependencies": [],
        "notes": "Network-dependent, may timeout on slow connections"
      }
    },
    {
      "name": "AnalyzeCodeActivity",
      "description": "Analyze code quality, structure, and metrics using ast-grep and pi CLI",
      "category": "analysis",
      "inputs": {
        "path": {
          "type": "string",
          "description": "Local filesystem path to analyze",
          "required": true
        },
        "language": {
          "type": "string",
          "description": "Programming language (go, python, javascript, etc)",
          "required": false
        },
        "depth": {
          "type": "integer",
          "description": "Analysis depth (1=shallow, 5=deep)",
          "required": false,
          "default": 3
        }
      },
      "outputs": {
        "quality": {
          "type": "number",
          "description": "Quality score 0-1.0"
        },
        "metrics": {
          "type": "object",
          "description": "Code metrics (LOC, complexity, etc)"
        },
        "issues": {
          "type": "array",
          "description": "List of identified issues"
        },
        "summary": {
          "type": "string",
          "description": "Human-readable analysis summary"
        }
      },
      "constraints": {
        "defaultTimeout": "10m",
        "isFlaky": true,
        "recommendedRetries": 3,
        "retryBackoff": 2.0,
        "dependencies": ["CloneRepoActivity"],
        "notes": "CPU-intensive, can timeout on large repos. Flaky on memory pressure."
      }
    },
    {
      "name": "SecurityScanActivity",
      "description": "Run security scanning (SAST) on codebase",
      "category": "security",
      "inputs": {
        "path": {
          "type": "string",
          "description": "Local filesystem path to scan",
          "required": true
        },
        "severity": {
          "type": "string",
          "description": "Minimum severity level (low, medium, high, critical)",
          "required": false,
          "default": "medium"
        }
      },
      "outputs": {
        "vulnerabilities": {
          "type": "array",
          "description": "List of vulnerabilities found"
        },
        "securityScore": {
          "type": "number",
          "description": "Security score 0-100"
        },
        "riskLevel": {
          "type": "string",
          "description": "Risk level (low, medium, high, critical)"
        }
      },
      "constraints": {
        "defaultTimeout": "8m",
        "isFlaky": false,
        "recommendedRetries": 2,
        "retryBackoff": 1.5,
        "dependencies": ["CloneRepoActivity"],
        "notes": "Network calls for vulnerability databases may timeout"
      }
    },
    {
      "name": "GenerateReportActivity",
      "description": "Generate comprehensive report from analysis and scan results",
      "category": "reporting",
      "inputs": {
        "analysisResult": {
          "type": "object",
          "description": "Output from AnalyzeCodeActivity",
          "required": true
        },
        "securityResult": {
          "type": "object",
          "description": "Output from SecurityScanActivity",
          "required": true
        },
        "format": {
          "type": "string",
          "description": "Report format (markdown, html, json)",
          "required": false,
          "default": "markdown"
        }
      },
      "outputs": {
        "report": {
          "type": "string",
          "description": "Generated report content"
        },
        "reportPath": {
          "type": "string",
          "description": "Path to saved report file"
        }
      },
      "constraints": {
        "defaultTimeout": "2m",
        "isFlaky": false,
        "recommendedRetries": 1,
        "retryBackoff": 1.0,
        "dependencies": ["AnalyzeCodeActivity", "SecurityScanActivity"],
        "notes": "CPU-light, reliable. Depends on upstream results."
      }
    },
    {
      "name": "DeploymentPreCheckActivity",
      "description": "Validate readiness for deployment (linting, tests, etc)",
      "category": "deployment",
      "inputs": {
        "path": {
          "type": "string",
          "description": "Local filesystem path to check",
          "required": true
        },
        "checkType": {
          "type": "string",
          "description": "Type of check (lint, test, build, all)",
          "required": false,
          "default": "all"
        }
      },
      "outputs": {
        "passed": {
          "type": "boolean",
          "description": "Whether all checks passed"
        },
        "failures": {
          "type": "array",
          "description": "List of failed checks"
        },
        "warnings": {
          "type": "array",
          "description": "List of warnings"
        }
      },
      "constraints": {
        "defaultTimeout": "15m",
        "isFlaky": true,
        "recommendedRetries": 2,
        "retryBackoff": 2.0,
        "dependencies": ["CloneRepoActivity"],
        "notes": "Very flaky - tests are non-deterministic, network issues, race conditions. Retry 2x."
      }
    },
    {
      "name": "NotifyStatusActivity",
      "description": "Send notifications to Slack, email, or webhook",
      "category": "notification",
      "inputs": {
        "channel": {
          "type": "string",
          "description": "Target channel or email",
          "required": true
        },
        "status": {
          "type": "string",
          "description": "Status to report (success, failure, warning)",
          "required": true
        },
        "message": {
          "type": "string",
          "description": "Message body",
          "required": true
        }
      },
      "outputs": {
        "notificationId": {
          "type": "string",
          "description": "ID of sent notification"
        },
        "timestamp": {
          "type": "string",
          "description": "When notification was sent"
        }
      },
      "constraints": {
        "defaultTimeout": "3m",
        "isFlaky": true,
        "recommendedRetries": 3,
        "retryBackoff": 1.5,
        "dependencies": [],
        "notes": "Network-dependent, may fail due to network or external service issues. Retry 3x."
      }
    },
    {
      "name": "ApproveWorkflowActivity",
      "description": "Human approval step or automated policy check",
      "category": "approval",
      "inputs": {
        "workflowId": {
          "type": "string",
          "description": "ID of workflow awaiting approval",
          "required": true
        },
        "requiredApprovals": {
          "type": "integer",
          "description": "Number of approvals needed (default 1)",
          "required": false,
          "default": 1
        },
        "timeoutMinutes": {
          "type": "integer",
          "description": "Minutes to wait for approval",
          "required": false,
          "default": 60
        }
      },
      "outputs": {
        "approved": {
          "type": "boolean",
          "description": "Whether approved"
        },
        "approver": {
          "type": "string",
          "description": "Who approved (if approved)"
        },
        "timestamp": {
          "type": "string",
          "description": "When approval was given"
        }
      },
      "constraints": {
        "defaultTimeout": "120m",
        "isFlaky": false,
        "recommendedRetries": 1,
        "retryBackoff": 1.0,
        "dependencies": [],
        "notes": "Waits for human input. Long timeout. Cannot retry (user input is irrevocable)."
      }
    },
    {
      "name": "ArchiveResultsActivity",
      "description": "Archive analysis results to cloud storage (S3, GCS)",
      "category": "storage",
      "inputs": {
        "reportPath": {
          "type": "string",
          "description": "Path to report to archive",
          "required": true
        },
        "destination": {
          "type": "string",
          "description": "Cloud destination (s3://bucket/path or gcs://bucket/path)",
          "required": true
        },
        "metadata": {
          "type": "object",
          "description": "Optional metadata tags",
          "required": false
        }
      },
      "outputs": {
        "archiveUrl": {
          "type": "string",
          "description": "URL of archived file"
        },
        "archiveSize": {
          "type": "integer",
          "description": "Size of archived file in bytes"
        }
      },
      "constraints": {
        "defaultTimeout": "5m",
        "isFlaky": true,
        "recommendedRetries": 2,
        "retryBackoff": 1.5,
        "dependencies": [],
        "notes": "Network-dependent. May fail on network issues or service throttling. Retry 2x."
      }
    },
    {
      "name": "RetrieveMemoryActivity",
      "description": "Retrieve relevant knowledge, skills, and lessons from poimen-memory semantic search",
      "category": "memory",
      "inputs": {
        "query": {
          "type": "string",
          "description": "Semantic search query",
          "required": true
        },
        "project": {
          "type": "string",
          "description": "Memory project (default: poimen)",
          "required": false,
          "default": "poimen"
        },
        "scope": {
          "type": "string",
          "description": "Retrieval scope: skills, lessons, references, all",
          "required": false,
          "default": "all"
        },
        "limit": {
          "type": "integer",
          "description": "Max results to return",
          "required": false,
          "default": 10
        },
        "tool": {
          "type": "string",
          "description": "Tool context for skill matching",
          "required": false
        },
        "task": {
          "type": "string",
          "description": "Task description for context retrieval",
          "required": false
        }
      },
      "outputs": {
        "skills": {
          "type": "array",
          "description": "Relevant skills found"
        },
        "lessons": {
          "type": "array",
          "description": "Relevant lessons/knowledge found"
        },
        "references": {
          "type": "array",
          "description": "Reference documents found"
        },
        "totalResults": {
          "type": "integer",
          "description": "Total results found"
        }
      },
      "constraints": {
        "defaultTimeout": "30s",
        "isFlaky": true,
        "recommendedRetries": 2,
        "retryBackoff": 1.5,
        "dependencies": [],
        "notes": "Network-dependent. First activity to run for context-aware routing. Fast timeout."
      }
    }
  ],
  "metadata": {
    "totalActivities": 9,
    "lastUpdated": "2025-08-31T00:00:00Z",
    "categories": {
      "repository": 1,
      "analysis": 1,
      "security": 1,
      "reporting": 1,
      "deployment": 1,
      "notification": 1,
      "approval": 1,
      "storage": 1,
      "memory": 1
    }
  }
}
