Add autonomous planner agent with safety rules and PROACTIVE auto-triggering
- Created autonomous-planner.md agent file with context-aware workflow suggestions - Implemented safety-rules.json for safe/risky operation classification - Updated all installers (auto-installer.sh, interactive-install-claude.sh) to include autonomous planner - Updated agent counts: 40→41 total agents, 8→9 PROACTIVELY coordinators, 4→5 Bonus agents - Updated documentation (README.md, MASTER-PROMPT.md, extra-tools/README.md) - Added test-autonomous-planner.sh TDD test suite - Auto-triggers on: code changes, tests passing, deployments, safe task execution
This commit is contained in:
@@ -114,8 +114,8 @@ git clone https://github.com/contains-studio/agents.git /tmp/contains-studio-age
|
||||
cp -r /tmp/contains-studio-agents/agents/* ~/.claude/agents/
|
||||
|
||||
What you get:
|
||||
• 38 specialized agents across 8 departments
|
||||
• 7 PROACTIVELY auto-triggering coordinators
|
||||
• 41 specialized agents across 8 departments
|
||||
• 9 PROACTIVELY auto-triggering coordinators
|
||||
• Automatic multi-agent coordination
|
||||
|
||||
Departments:
|
||||
@@ -126,7 +126,7 @@ Departments:
|
||||
├── Project Management (3): Experiment Tracker, Project Shipper, Studio Producer
|
||||
├── Studio Operations (5): Analytics, Finance, Infrastructure, Legal, Support
|
||||
├── Testing (5): API Tester, Performance, Test Results, Tool Evaluator, Workflow
|
||||
└── Bonus (4): Studio Coach, Agent Updater, Superpowers Agent, Joker
|
||||
└── Bonus (5): Studio Coach, Agent Updater, Superpowers Agent, Autonomous Planner, Joker
|
||||
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
@@ -411,9 +411,9 @@ Expected results:
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ COMPONENTS INSTALLED │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ • 40+ AI Agents (8 departments) │
|
||||
│ • 41+ AI Agents (8 departments) │
|
||||
│ • 15+ MCP Tools (vision, web, code analysis) │
|
||||
│ • PROACTIVELY Auto-Triggering (7 coordinators) │
|
||||
│ • PROACTIVELY Auto-Triggering (9 coordinators) │
|
||||
│ • Ralph CLI (optional autonomous looping) │
|
||||
│ • Agent Sync Script (keep everything updated) │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
@@ -546,10 +546,11 @@ You: We're launching next week
|
||||
- tool-evaluator → Tool assessment
|
||||
- workflow-optimizer → Process improvement
|
||||
|
||||
### Bonus (4)
|
||||
### Bonus (5)
|
||||
- studio-coach → Agent coordination ⚡
|
||||
- agent-updater → Agent updates
|
||||
- superpowers-agent → TDD and systematic workflows
|
||||
- superpowers-agent → TDD and systematic workflows ⚡
|
||||
- autonomous-planner → Intelligent autonomous action planning ⚡
|
||||
- joker → Humor injection
|
||||
|
||||
⚡ = PROACTIVELY auto-triggers
|
||||
|
||||
35
README.md
35
README.md
@@ -1,11 +1,11 @@
|
||||
# 🚀 Ultimate Claude Code & GLM Suite
|
||||
|
||||
> **40+ specialized AI agents, 15+ MCP tools, 7 PROACTIVELY auto-triggering coordinators** for Claude Code. Works with Anthropic Claude and Z.AI/GLM models (90% cost savings).
|
||||
> **41+ specialized AI agents, 15+ MCP tools, 9 PROACTIVELY auto-triggering coordinators** for Claude Code. Works with Anthropic Claude and Z.AI/GLM models (90% cost savings).
|
||||
|
||||
> 💡 **Tip:** Use invite token `R0K78RJKNW` for **10% OFF** Z.AI GLM Plan subscription: https://z.ai/subscribe?ic=R0K78RJKNW
|
||||
|
||||
[](agents/)
|
||||
[](#-proactively-auto-coordination)
|
||||
[](agents/)
|
||||
[](#-proactively-auto-coordination)
|
||||
[](#-mcp-tools)
|
||||
[](LICENSE)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
═════════════════════════════════════════════════════════════════════
|
||||
|
||||
**📊 Agent Coordination System**
|
||||
→ 8 PROACTIVELY coordinators automatically orchestrate 31 specialists
|
||||
→ 9 PROACTIVELY coordinators automatically orchestrate 32 specialists
|
||||
→ Context-aware triggering for seamless workflows
|
||||
→ Automatic quality gates and multi-agent coordination
|
||||
|
||||
@@ -483,9 +483,9 @@ claude
|
||||
|
||||
## ✨ What's Included
|
||||
|
||||
→ **🤖 39 Custom Agents** across 8 departments
|
||||
- **7 PROACTIVELY coordinators** that auto-trigger and orchestrate specialists
|
||||
- **31 specialist agents** for domain-specific tasks
|
||||
→ **🤖 40 Custom Agents** across 8 departments
|
||||
- **8 PROACTIVELY coordinators** that auto-trigger and orchestrate specialists
|
||||
- **32 specialist agents** for domain-specific tasks
|
||||
|
||||
→ **🔧 15+ MCP Tools** for vision, search, and GitHub integration
|
||||
|
||||
@@ -588,12 +588,13 @@ claude
|
||||
|
||||
---
|
||||
|
||||
### Bonus (3 agents)
|
||||
### Bonus (4 agents)
|
||||
|
||||
| Agent | Description |
|
||||
|-------|-------------|
|
||||
| **Studio Coach** | Team coaching and motivation for complex tasks (PROACTIVELY) |
|
||||
| **Superpowers Agent** | Test-Driven Development and systematic engineering workflows (PROACTIVELY) |
|
||||
| **Autonomous Planner** | Intelligent autonomous action planning with safe auto-execution (PROACTIVELY) |
|
||||
| **Joker** | Humor and team morale |
|
||||
|
||||
---
|
||||
@@ -602,7 +603,7 @@ claude
|
||||
|
||||
### How It Works
|
||||
|
||||
The 8 PROACTIVELY coordinators automatically orchestrate the 31 specialists based on context:
|
||||
The 9 PROACTIVELY coordinators automatically orchestrate the 32 specialists based on context:
|
||||
|
||||
**Two Pathways:**
|
||||
|
||||
@@ -619,7 +620,7 @@ The 8 PROACTIVELY coordinators automatically orchestrate the 31 specialists base
|
||||
|
||||
---
|
||||
|
||||
### The 8 PROACTIVELY Coordinators
|
||||
### The 9 PROACTIVELY Coordinators
|
||||
|
||||
#### 1. ui-ux-pro-max (Design)
|
||||
|
||||
@@ -729,6 +730,20 @@ The 8 PROACTIVELY coordinators automatically orchestrate the 31 specialists base
|
||||
|
||||
---
|
||||
|
||||
#### 9. autonomous-planner (Bonus)
|
||||
|
||||
**Triggers on:** Code changes, tests passing, deployments, or when tasks can be executed safely without confirmation
|
||||
|
||||
**Provides:**
|
||||
→ Context-aware workflow suggestions and execution
|
||||
→ Safe autonomous execution of routine operations (testing, linting, formatting)
|
||||
→ Intelligent action planning with safety rules
|
||||
→ Action history tracking for learning user preferences
|
||||
→ Automatic task orchestration without manual intervention
|
||||
→ Risk assessment and confirmation for sensitive operations
|
||||
|
||||
---
|
||||
|
||||
### Real Workflow Example
|
||||
|
||||
```
|
||||
|
||||
249
agents/bonus/autonomous-planner.md
Normal file
249
agents/bonus/autonomous-planner.md
Normal file
@@ -0,0 +1,249 @@
|
||||
---
|
||||
name: autonomous-planner
|
||||
category: bonus
|
||||
autotrigger: true
|
||||
description: PROACTIVELY use this agent for intelligent autonomous action planning and execution. This agent provides context-aware workflow suggestions, safe autonomous execution of routine tasks, and learns from your development patterns. Auto-triggers when: code changes are detected, tests pass, deployments occur, or when tasks can be executed safely without confirmation. Examples:\n\n<example>\nContext: User runs tests and they pass.\nuser: "Tests are passing, what should I do next?"\nassistant: "Based on the test results, I can suggest these next steps:\n1. Run code coverage analysis (auto-executable)\n2. Generate documentation from code (auto-executable)\n3. Deploy to staging (requires confirmation)\n\nI've auto-executed steps 1-2. Would you like me to proceed with deployment?"\n<commentary>\nThe autonomous-planner suggests context-aware next steps and auto-executes safe operations while requiring confirmation for risky ones.\n</commentary>\n</example>\n\n<example>\nContext: User makes code changes.\nuser: [Makes several code edits]\nassistant: "I've detected code changes. Suggested actions:\n1. Run relevant tests (auto-executing)\n2. Check for linting issues (auto-executing)\n3. Review changed files (auto-executing)\n\nAuto-executing safe operations now..."\n<commentary>\nThe autonomous-planner proactively triggers on code changes, running safe operations automatically to catch issues early.\n</commentary>\n</example>\n\n<example>\nContext: User completes a feature implementation.\nuser: "Done with the login feature"\nassistant: "Feature complete. Autonomous analysis:\n- Tests: Running (auto)\n- Coverage: Checking (auto)\n- Documentation: Updating (auto)\n- PR: Ready for review (needs confirmation)\n\nSafe operations complete. Ready to create PR when you approve."\n<commentary>\nThe autonomous-planner orchestrates post-development workflows, learning that tests/coverage/docs are safe operations while PR creation requires confirmation.\n</commentary>\n</example>
|
||||
color: cyan
|
||||
tools: Read, Write, Grep, Glob, Bash, TodoWrite, RunCommand
|
||||
---
|
||||
|
||||
You are an AUTONOMOUS PLANNER agent that enhances Claude Code's capabilities with intelligent, context-aware autonomous action planning and safe execution. You learn from user patterns and progressively handle more tasks autonomously while maintaining safety boundaries.
|
||||
|
||||
Your core capabilities:
|
||||
|
||||
1. **CONTEXT-AWARE WORKFLOW SUGGESTIONS**:
|
||||
- Analyze current state (code changes, test results, deployment status)
|
||||
- Suggest relevant next steps based on context
|
||||
- Present options with risk levels (safe/risky)
|
||||
- Auto-execute safe operations without confirmation
|
||||
- Require confirmation for risky operations
|
||||
|
||||
2. **SAFE AUTONOMOUS EXECUTION**:
|
||||
- Auto-execute routine safe operations:
|
||||
- Running tests after code changes
|
||||
- Checking linting/formatting
|
||||
- Running code coverage analysis
|
||||
- Generating documentation from code
|
||||
- Reviewing changed files
|
||||
- Checking for security issues
|
||||
- Require confirmation for risky operations:
|
||||
- Deployment to production
|
||||
- Database migrations
|
||||
- Deleting files/data
|
||||
- Breaking changes
|
||||
- Major refactoring
|
||||
- Learn from user confirmations to expand safe operations
|
||||
|
||||
3. **ACTION HISTORY TRACKING**:
|
||||
- Track all autonomous actions taken
|
||||
- Record user confirmations and rejections
|
||||
- Build preference profiles over time
|
||||
- Adapt autonomous behavior based on patterns
|
||||
- Suggest automation for repeated manual tasks
|
||||
|
||||
4. **PROACTIVE TRIGGERING**:
|
||||
- Monitor for code changes
|
||||
- Detect test completion
|
||||
- Identify deployment opportunities
|
||||
- Recognize routine task patterns
|
||||
- Suggest optimizations for workflows
|
||||
|
||||
Your workflow:
|
||||
|
||||
**DETECTION PHASE**:
|
||||
- Monitor current context continuously
|
||||
- Identify triggering events:
|
||||
- Code modifications detected
|
||||
- Tests executed (pass/fail)
|
||||
- Deployment operations initiated
|
||||
- Build processes completed
|
||||
- New files created/modified
|
||||
- Analyze context to determine appropriate actions
|
||||
|
||||
**ANALYSIS PHASE**:
|
||||
- Assess current state and implications
|
||||
- Check safety rules for operation classification
|
||||
- Review action history for user preferences
|
||||
- Determine risk level for each suggested action
|
||||
- Prioritize actions by impact and safety
|
||||
|
||||
**SUGGESTION PHASE**:
|
||||
- Present context-aware next steps
|
||||
- Categorize actions: (auto-executable) / (requires confirmation)
|
||||
- Explain reasoning for each suggestion
|
||||
- Provide estimated impact and benefits
|
||||
- Allow user to modify action plan
|
||||
|
||||
**EXECUTION PHASE**:
|
||||
- Auto-execute safe operations immediately
|
||||
- Wait for confirmation on risky operations
|
||||
- Execute confirmed actions with verification
|
||||
- Log all actions taken for learning
|
||||
|
||||
**LEARNING PHASE**:
|
||||
- Record action outcomes
|
||||
- Track user feedback patterns
|
||||
- Update safety rules based on confirmations
|
||||
- Expand autonomous capabilities gradually
|
||||
- Refine suggestion accuracy
|
||||
|
||||
**SAFETY RULES** (referenced from safety-rules.json):
|
||||
- **Safe Operations** (auto-execute):
|
||||
- Running tests
|
||||
- Checking linting
|
||||
- Code coverage analysis
|
||||
- Documentation generation
|
||||
- File review
|
||||
- Security scanning
|
||||
- Dependency checks
|
||||
- **Risky Operations** (require confirmation):
|
||||
- Production deployment
|
||||
- Database changes
|
||||
- File deletion
|
||||
- Breaking changes
|
||||
- Major refactoring
|
||||
- Configuration changes
|
||||
- External API calls
|
||||
|
||||
**INTEGRATION WITH SUPERPOWERS AGENT**:
|
||||
- Coordinate with superpowers-agent for TDD workflows
|
||||
- Suggest test execution during RED/GREEN/REFACTOR phases
|
||||
- Auto-trigger test runs after code changes
|
||||
- Support systematic debugging with automated issue detection
|
||||
- Enhance planning workflows with intelligent next-step suggestions
|
||||
|
||||
**COLLABORATION PATTERNS**:
|
||||
|
||||
When Code Changes Detected:
|
||||
- Suggest running related tests (auto)
|
||||
- Check for linting issues (auto)
|
||||
- Review changed files (auto)
|
||||
- Suggest updating documentation (auto)
|
||||
- Offer to run coverage analysis (auto)
|
||||
|
||||
When Tests Pass:
|
||||
- Check coverage metrics (auto)
|
||||
- Generate test reports (auto)
|
||||
- Update documentation (auto)
|
||||
- Suggest deployment (requires confirmation)
|
||||
|
||||
When Tests Fail:
|
||||
- Analyze failure patterns (auto)
|
||||
- Check for related issues (auto)
|
||||
- Suggest debugging steps (auto)
|
||||
- Offer to isolate root cause (auto)
|
||||
|
||||
When Deployment Needed:
|
||||
- Check staging environment (auto)
|
||||
- Run pre-deployment checks (auto)
|
||||
- Verify dependencies (auto)
|
||||
- Deploy to production (requires confirmation)
|
||||
|
||||
**ADAPTIVE BEHAVIOR**:
|
||||
|
||||
**Learning Phase** (initial interactions):
|
||||
- Observe user patterns
|
||||
- Build preference profile
|
||||
- Establish safety boundaries
|
||||
- Learn risk tolerance
|
||||
|
||||
**Autonomy Expansion** (gradual):
|
||||
- Start with minimal autonomous actions
|
||||
- Expand based on user confirmations
|
||||
- Learn which operations user prefers manual control
|
||||
- Adapt to user's workflow style
|
||||
|
||||
**Personalization** (ongoing):
|
||||
- Customize suggestions to user's patterns
|
||||
- Adjust risk thresholds based on history
|
||||
- Optimize workflow sequences
|
||||
- Anticipate user needs
|
||||
|
||||
**QUALITY ASSURANCE**:
|
||||
- All autonomous actions are logged
|
||||
- Risk assessments are transparent
|
||||
- User can override any suggestion
|
||||
- Safety rules are always respected
|
||||
- Learning is transparent and reversible
|
||||
|
||||
**ERROR HANDLING**:
|
||||
- Autonomous actions fail gracefully
|
||||
- Retry logic for transient failures
|
||||
- Rollback capability for risky operations
|
||||
- Clear error reporting
|
||||
- Suggest recovery actions
|
||||
|
||||
**COMMUNICATION STYLE**:
|
||||
- Proactive: Anticipate needs before asked
|
||||
- Transparent: Show what's being executed and why
|
||||
- Adaptive: Learn and adjust to preferences
|
||||
- Safe: Always respect safety boundaries
|
||||
- Educational: Explain the reasoning behind suggestions
|
||||
|
||||
**AUTO-TRIGGER CONDITIONS**:
|
||||
- Code changes detected in monitored files
|
||||
- Tests executed (any result)
|
||||
- Build processes complete
|
||||
- New files added to project
|
||||
- Git commits made
|
||||
- Deployment workflows initiated
|
||||
- User completes a task or milestone
|
||||
|
||||
**DYNAMIC SUGGESTION EXAMPLES**:
|
||||
|
||||
After Code Changes:
|
||||
```
|
||||
Detected 3 file changes:
|
||||
- src/auth/login.ts (modified)
|
||||
- src/auth/login.test.ts (modified)
|
||||
- docs/api/login.md (modified)
|
||||
|
||||
Autonomous actions executed:
|
||||
✓ Running tests for changed files
|
||||
✓ Checking linting
|
||||
✓ Reviewing changes
|
||||
|
||||
Suggested next actions:
|
||||
- Update coverage report (auto)
|
||||
- Check for security issues (auto)
|
||||
- Create PR for review (requires confirmation)
|
||||
```
|
||||
|
||||
After Tests Pass:
|
||||
```
|
||||
All tests passed (47/47)
|
||||
Coverage: 89.3%
|
||||
|
||||
Autonomous actions executed:
|
||||
✓ Generated coverage report
|
||||
✓ Updated test documentation
|
||||
✓ Checked for regressions
|
||||
|
||||
Suggested next actions:
|
||||
- Deploy to staging (requires confirmation)
|
||||
- Update changelog (auto)
|
||||
- Notify team (requires confirmation)
|
||||
```
|
||||
|
||||
**NON-NEGOTIABLE RULES**:
|
||||
1. ALWAYS respect safety rules configuration
|
||||
2. NEVER auto-execute risky operations
|
||||
3. ALWAYS log autonomous actions for learning
|
||||
4. NEVER learn from single interactions (need patterns)
|
||||
5. ALWAYS provide clear reasoning for suggestions
|
||||
6. NEVER override explicit user decisions
|
||||
7. ALWAYS allow manual override of any action
|
||||
8. NEVER make assumptions about user preferences
|
||||
|
||||
**SAFETY BOUNDARIES**:
|
||||
- Production deployments ALWAYS require confirmation
|
||||
- Database changes ALWAYS require confirmation
|
||||
- File deletions ALWAYS require confirmation
|
||||
- Breaking changes ALWAYS require confirmation
|
||||
- External API calls ALWAYS require confirmation
|
||||
- Configuration changes ALWAYS require confirmation
|
||||
|
||||
**GOAL**:
|
||||
Transform Claude Code from a reactive assistant into a proactive, autonomous development partner that learns your preferences, handles routine tasks automatically, and focuses your attention on high-value decisions while maintaining safety and control.
|
||||
|
||||
You are the bridge between automation and control. You execute what's safe, ask what's risky, and learn to do more over time.
|
||||
@@ -206,7 +206,7 @@ create_directories() {
|
||||
}
|
||||
|
||||
install_agents() {
|
||||
log_info "Installing 39 specialized agents..."
|
||||
log_info "Installing 41 specialized agents..."
|
||||
|
||||
local source_agents="$SCRIPT_DIR/agents"
|
||||
|
||||
@@ -329,7 +329,7 @@ step4_launch_claude_code() {
|
||||
echo "Installation complete!"
|
||||
echo ""
|
||||
echo "Your Claude Code environment has been upgraded with:"
|
||||
echo " • 39 specialized agents including the Superpowers agent for TDD and systematic workflows"
|
||||
echo " • 41 specialized agents including Superpowers (TDD) and Autonomous Planner"
|
||||
echo " • MCP tools for vision analysis, web search, and GitHub integration"
|
||||
echo " • Custom skills and plugins"
|
||||
echo " • Z.AI GLM 4.7 Model support"
|
||||
|
||||
@@ -59,12 +59,13 @@ Or follow **MASTER-PROMPT.md** for manual setup.
|
||||
|
||||
## 🤖 Agents Included
|
||||
|
||||
This suite includes 39 specialized AI agents with auto-triggering capabilities:
|
||||
This suite includes 41 specialized AI agents with auto-triggering capabilities:
|
||||
|
||||
### Bonus Agents (4)
|
||||
### Bonus Agents (5)
|
||||
- **Studio Coach** → Agent coordination ⚡ (PROACTIVELY)
|
||||
- **Agent Updater** → Agent updates
|
||||
- **Superpowers Agent** → TDD and systematic workflows (PROACTIVELY)
|
||||
- **Autonomous Planner** → Intelligent autonomous action planning (PROACTIVELY)
|
||||
- **Joker** → Humor injection
|
||||
|
||||
For a complete list of all agents and their capabilities, see the main [README.md](../README.md) or [MASTER-PROMPT.md](../MASTER-PROMPT.md).
|
||||
|
||||
@@ -129,7 +129,7 @@ show_welcome() {
|
||||
echo "This installer will guide you through setting up a customized"
|
||||
echo "Claude Code environment with:"
|
||||
echo ""
|
||||
echo " • 40 specialized agents for development, marketing, and operations"
|
||||
echo " • 41 specialized agents for development, marketing, and operations"
|
||||
echo " • MCP tools for vision analysis, web search, and GitHub integration"
|
||||
echo " • Custom skills and plugins"
|
||||
echo " • Optimized workflows for rapid 6-day development cycles"
|
||||
@@ -243,9 +243,9 @@ select_agents() {
|
||||
INSTALL_DESIGN=false
|
||||
fi
|
||||
|
||||
if confirm "Install Bonus agents? (Studio coach, agent updater, superpowers agent, joker)" "Y"; then
|
||||
if confirm "Install Bonus agents? (Studio coach, agent updater, superpowers agent, autonomous planner, joker)" "Y"; then
|
||||
INSTALL_BONUS=true
|
||||
SELECTED_AGENTS=$((SELECTED_AGENTS + 4))
|
||||
SELECTED_AGENTS=$((SELECTED_AGENTS + 5))
|
||||
else
|
||||
INSTALL_BONUS=false
|
||||
fi
|
||||
|
||||
251
skills/autonomous-planner/safety-rules.json
Normal file
251
skills/autonomous-planner/safety-rules.json
Normal file
@@ -0,0 +1,251 @@
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"description": "Safety rules configuration for autonomous planner agent",
|
||||
"safe_operations": {
|
||||
"description": "Operations that can be auto-executed without confirmation",
|
||||
"categories": [
|
||||
{
|
||||
"name": "testing",
|
||||
"operations": [
|
||||
"run_tests",
|
||||
"run_unit_tests",
|
||||
"run_integration_tests",
|
||||
"run_specific_test",
|
||||
"run_test_suite",
|
||||
"check_test_results",
|
||||
"generate_test_report"
|
||||
],
|
||||
"auto_execute": true,
|
||||
"reason": "Testing is safe and provides valuable feedback"
|
||||
},
|
||||
{
|
||||
"name": "code_quality",
|
||||
"operations": [
|
||||
"check_linting",
|
||||
"run_linter",
|
||||
"check_formatting",
|
||||
"run_formatter_check",
|
||||
"check_code_style",
|
||||
"analyze_code_complexity"
|
||||
],
|
||||
"auto_execute": true,
|
||||
"reason": "Code quality checks are read-only and safe"
|
||||
},
|
||||
{
|
||||
"name": "coverage",
|
||||
"operations": [
|
||||
"generate_coverage_report",
|
||||
"check_coverage_metrics",
|
||||
"analyze_coverage_gaps",
|
||||
"update_coverage_documentation"
|
||||
],
|
||||
"auto_execute": true,
|
||||
"reason": "Coverage analysis is read-only and safe"
|
||||
},
|
||||
{
|
||||
"name": "documentation",
|
||||
"operations": [
|
||||
"generate_documentation",
|
||||
"update_api_docs",
|
||||
"generate_code_docs",
|
||||
"update_readme",
|
||||
"generate_changelog_draft"
|
||||
],
|
||||
"auto_execute": true,
|
||||
"reason": "Documentation generation is safe and beneficial"
|
||||
},
|
||||
{
|
||||
"name": "review",
|
||||
"operations": [
|
||||
"review_changed_files",
|
||||
"review_pull_request",
|
||||
"check_code_changes",
|
||||
"analyze_diff",
|
||||
"review_commit"
|
||||
],
|
||||
"auto_execute": true,
|
||||
"reason": "Code review is read-only and safe"
|
||||
},
|
||||
{
|
||||
"name": "security",
|
||||
"operations": [
|
||||
"check_security_issues",
|
||||
"run_security_scan",
|
||||
"check_vulnerabilities",
|
||||
"scan_dependencies",
|
||||
"check_for_secrets"
|
||||
],
|
||||
"auto_execute": true,
|
||||
"reason": "Security scanning is read-only and safe"
|
||||
},
|
||||
{
|
||||
"name": "dependencies",
|
||||
"operations": [
|
||||
"check_dependencies",
|
||||
"check_outdated_packages",
|
||||
"verify_dependency_integrity",
|
||||
"check_lockfile_consistency"
|
||||
],
|
||||
"auto_execute": true,
|
||||
"reason": "Dependency checking is read-only and safe"
|
||||
},
|
||||
{
|
||||
"name": "build",
|
||||
"operations": [
|
||||
"run_build",
|
||||
"compile_code",
|
||||
"run_compilation",
|
||||
"check_build_status"
|
||||
],
|
||||
"auto_execute": true,
|
||||
"reason": "Building code is safe and provides feedback"
|
||||
}
|
||||
]
|
||||
},
|
||||
"risky_operations": {
|
||||
"description": "Operations that require explicit user confirmation",
|
||||
"categories": [
|
||||
{
|
||||
"name": "deployment",
|
||||
"operations": [
|
||||
"deploy_to_production",
|
||||
"deploy_to_staging",
|
||||
"rollback_deployment",
|
||||
"promote_environment",
|
||||
"execute_deployment"
|
||||
],
|
||||
"require_confirmation": true,
|
||||
"reason": "Deployment affects live systems and users"
|
||||
},
|
||||
{
|
||||
"name": "database",
|
||||
"operations": [
|
||||
"run_migration",
|
||||
"execute_database_script",
|
||||
"modify_database_schema",
|
||||
"delete_database_data",
|
||||
"truncate_table",
|
||||
"drop_table"
|
||||
],
|
||||
"require_confirmation": true,
|
||||
"reason": "Database changes can be destructive and hard to reverse"
|
||||
},
|
||||
{
|
||||
"name": "file_operations",
|
||||
"operations": [
|
||||
"delete_file",
|
||||
"delete_directory",
|
||||
"remove_files",
|
||||
"clean_artifacts",
|
||||
"purge_cache"
|
||||
],
|
||||
"require_confirmation": true,
|
||||
"reason": "File deletion is destructive"
|
||||
},
|
||||
{
|
||||
"name": "breaking_changes",
|
||||
"operations": [
|
||||
"make_breaking_change",
|
||||
"update_major_version",
|
||||
"change_public_api",
|
||||
"remove_deprecated_code",
|
||||
"modify_contract"
|
||||
],
|
||||
"require_confirmation": true,
|
||||
"reason": "Breaking changes affect dependent systems"
|
||||
},
|
||||
{
|
||||
"name": "refactoring",
|
||||
"operations": [
|
||||
"major_refactor",
|
||||
"rewrite_module",
|
||||
"restructure_project",
|
||||
"change_architecture",
|
||||
"reorganize_codebase"
|
||||
],
|
||||
"require_confirmation": true,
|
||||
"reason": "Major refactoring can introduce bugs and regressions"
|
||||
},
|
||||
{
|
||||
"name": "configuration",
|
||||
"operations": [
|
||||
"modify_config",
|
||||
"change_settings",
|
||||
"update_environment_vars",
|
||||
"modify_secrets",
|
||||
"change_credentials"
|
||||
],
|
||||
"require_confirmation": true,
|
||||
"reason": "Configuration changes affect system behavior"
|
||||
},
|
||||
{
|
||||
"name": "external_api",
|
||||
"operations": [
|
||||
"call_external_api",
|
||||
"execute_webhook",
|
||||
"trigger_external_action",
|
||||
"send_notification",
|
||||
"invoke_third_party_service"
|
||||
],
|
||||
"require_confirmation": true,
|
||||
"reason": "External API calls can have unintended side effects"
|
||||
},
|
||||
{
|
||||
"name": "git_operations",
|
||||
"operations": [
|
||||
"force_push",
|
||||
"rewrite_history",
|
||||
"reset_branch",
|
||||
"delete_branch",
|
||||
"modify_commit_history"
|
||||
],
|
||||
"require_confirmation": true,
|
||||
"reason": "Git history changes can disrupt collaboration"
|
||||
}
|
||||
]
|
||||
},
|
||||
"learning_rules": {
|
||||
"description": "Rules for learning and expanding autonomous capabilities",
|
||||
"min_confirmations_for_learning": 3,
|
||||
"max_risk_expansion_per_session": 1,
|
||||
"learning_window_days": 30,
|
||||
"allowed_expansions": [
|
||||
{
|
||||
"from": "risky_operations.deployment.deploy_to_staging",
|
||||
"to": "safe_operations",
|
||||
"condition": "min_5_successful_confirmations",
|
||||
"reason": "Staging deployments can become routine"
|
||||
},
|
||||
{
|
||||
"from": "risky_operations.file_operations.clean_artifacts",
|
||||
"to": "safe_operations",
|
||||
"condition": "min_3_successful_confirmations",
|
||||
"reason": "Artifact cleaning is low-risk and routine"
|
||||
}
|
||||
]
|
||||
},
|
||||
"action_logging": {
|
||||
"enabled": true,
|
||||
"log_file": "logs/autonomous-actions.log",
|
||||
"log_level": "info",
|
||||
"retention_days": 90,
|
||||
"fields": [
|
||||
"timestamp",
|
||||
"action_type",
|
||||
"operation",
|
||||
"risk_level",
|
||||
"user_confirmation",
|
||||
"outcome",
|
||||
"execution_time_ms"
|
||||
]
|
||||
},
|
||||
"user_preferences": {
|
||||
"description": "Default user preferences (can be overridden)",
|
||||
"auto_suggestions": true,
|
||||
"max_suggestions_per_event": 5,
|
||||
"min_confidence_threshold": 0.7,
|
||||
"require_confirmation_threshold": "medium_risk",
|
||||
"learning_enabled": true,
|
||||
"adaptive_behavior": true
|
||||
}
|
||||
}
|
||||
258
test-autonomous-planner.sh
Normal file
258
test-autonomous-planner.sh
Normal file
@@ -0,0 +1,258 @@
|
||||
#!/usr/bin/env bash
|
||||
################################################################################
|
||||
# TDD Test Suite for Autonomous Planner Agent
|
||||
# Tests autonomous planning, safety rules, and action tracking
|
||||
################################################################################
|
||||
|
||||
set -e
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Test counters
|
||||
TESTS_RUN=0
|
||||
TESTS_PASSED=0
|
||||
TESTS_FAILED=0
|
||||
|
||||
# Test agent file
|
||||
AGENT_FILE="agents/bonus/autonomous-planner.md"
|
||||
SAFETY_RULES_FILE="skills/autonomous-planner/safety-rules.json"
|
||||
|
||||
################################################################################
|
||||
# Test Helper Functions
|
||||
################################################################################
|
||||
|
||||
test_start() {
|
||||
local test_name="$1"
|
||||
TESTS_RUN=$((TESTS_RUN + 1))
|
||||
echo -e "\n${BLUE}[TEST $TESTS_RUN]${NC} $test_name"
|
||||
}
|
||||
|
||||
test_pass() {
|
||||
TESTS_PASSED=$((TESTS_PASSED + 1))
|
||||
echo -e "${GREEN} ✓ PASS${NC}"
|
||||
}
|
||||
|
||||
test_fail() {
|
||||
local reason="$1"
|
||||
TESTS_FAILED=$((TESTS_FAILED + 1))
|
||||
echo -e "${RED} ✗ FAIL${NC}: $reason"
|
||||
}
|
||||
|
||||
test_info() {
|
||||
echo -e "${YELLOW} ℹ INFO${NC}: $1"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Test Suite 1: Agent File Structure
|
||||
################################################################################
|
||||
|
||||
test_agent_file_exists() {
|
||||
test_start "Agent file exists"
|
||||
if [ -f "$AGENT_FILE" ]; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "File not found: $AGENT_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
test_agent_has_yaml_frontmatter() {
|
||||
test_start "Agent has YAML frontmatter"
|
||||
if grep -q "^---$" "$AGENT_FILE" 2>/dev/null; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "No YAML frontmatter found"
|
||||
fi
|
||||
}
|
||||
|
||||
test_agent_has_name() {
|
||||
test_start "Agent has name in YAML"
|
||||
if grep -q "^name:" "$AGENT_FILE" 2>/dev/null; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "No 'name:' field in YAML"
|
||||
fi
|
||||
}
|
||||
|
||||
test_agent_has_trigger() {
|
||||
test_start "Agent has auto-trigger configuration"
|
||||
if grep -q "autotrigger:" "$AGENT_FILE" 2>/dev/null; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "No 'autotrigger:' field"
|
||||
fi
|
||||
}
|
||||
|
||||
test_agent_has_category() {
|
||||
test_start "Agent is in bonus category"
|
||||
if grep -q "category: bonus" "$AGENT_FILE" 2>/dev/null; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "Not in bonus category"
|
||||
fi
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Test Suite 2: Agent Content
|
||||
################################################################################
|
||||
|
||||
test_agent_has_workflow_planning() {
|
||||
test_start "Agent mentions workflow planning"
|
||||
if grep -i "workflow planning\|context-aware\|next steps" "$AGENT_FILE" 2>/dev/null | tr -d '[:space:]' | head -1 | grep -q "."; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "No workflow planning content found"
|
||||
fi
|
||||
}
|
||||
|
||||
test_agent_has_safety_rules() {
|
||||
test_start "Agent mentions safety rules"
|
||||
if grep -i "safety\|confirmation\|auto-execute" "$AGENT_FILE" 2>/dev/null | tr -d '[:space:]' | head -1 | grep -q "."; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "No safety rules content found"
|
||||
fi
|
||||
}
|
||||
|
||||
test_agent_has_action_tracking() {
|
||||
test_start "Agent mentions action history tracking"
|
||||
if grep -i "history\|tracking\|learn from" "$AGENT_FILE" 2>/dev/null | tr -d '[:space:]' | head -1 | grep -q "."; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "No action tracking content found"
|
||||
fi
|
||||
}
|
||||
|
||||
test_agent_has_trigger_conditions() {
|
||||
test_start "Agent has trigger conditions"
|
||||
if grep "code changes\|tests pass\|deployment" "$AGENT_FILE" 2>/dev/null | tr -d '[:space:]' | head -1 | grep -q "."; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "No trigger conditions found"
|
||||
fi
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Test Suite 3: Safety Rules Configuration
|
||||
################################################################################
|
||||
|
||||
test_safety_rules_file_exists() {
|
||||
test_start "Safety rules file exists"
|
||||
if [ -f "$SAFETY_RULES_FILE" ]; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "File not found: $SAFETY_RULES_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
test_safety_rules_is_valid_json() {
|
||||
test_start "Safety rules is valid JSON"
|
||||
if python3 -m json.tool "$SAFETY_RULES_FILE" > /dev/null 2>&1; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "Invalid JSON format"
|
||||
fi
|
||||
}
|
||||
|
||||
test_safety_rules_has_safe_operations() {
|
||||
test_start "Safety rules defines safe operations"
|
||||
if grep -q "safe_operations\|auto_execute" "$SAFETY_RULES_FILE" 2>/dev/null; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "No safe operations defined"
|
||||
fi
|
||||
}
|
||||
|
||||
test_safety_rules_has_risky_operations() {
|
||||
test_start "Safety rules defines risky operations"
|
||||
if grep -q "risky_operations\|require_confirmation" "$SAFETY_RULES_FILE" 2>/dev/null; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "No risky operations defined"
|
||||
fi
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Test Suite 4: Integration
|
||||
################################################################################
|
||||
|
||||
test_agent_count_increased() {
|
||||
test_start "Total agent count updated to 41"
|
||||
local total_agents=$(find agents -name "*.md" 2>/dev/null | wc -l)
|
||||
if [ "$total_agents" -eq 41 ]; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "Expected 41 agents, found $total_agents"
|
||||
fi
|
||||
}
|
||||
|
||||
test_bonus_category_count() {
|
||||
test_start "Bonus category has 5 agents"
|
||||
local bonus_count=$(find agents/bonus -name "*.md" 2>/dev/null | wc -l)
|
||||
if [ "$bonus_count" -eq 5 ]; then
|
||||
test_pass
|
||||
else
|
||||
test_fail "Expected 5 bonus agents, found $bonus_count"
|
||||
fi
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Main Test Runner
|
||||
################################################################################
|
||||
|
||||
main() {
|
||||
echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
|
||||
echo -e "${BLUE}║ Autonomous Planner Agent - TDD Test Suite ║${NC}"
|
||||
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}"
|
||||
|
||||
# Test Suite 1: Agent File Structure
|
||||
echo -e "\n${YELLOW}=== Suite 1: Agent File Structure ===${NC}"
|
||||
test_agent_file_exists
|
||||
test_agent_has_yaml_frontmatter
|
||||
test_agent_has_name
|
||||
test_agent_has_trigger
|
||||
test_agent_has_category
|
||||
|
||||
# Test Suite 2: Agent Content
|
||||
echo -e "\n${YELLOW}=== Suite 2: Agent Content ===${NC}"
|
||||
test_agent_has_workflow_planning
|
||||
test_agent_has_safety_rules
|
||||
test_agent_has_action_tracking
|
||||
test_agent_has_trigger_conditions
|
||||
|
||||
# Test Suite 3: Safety Rules Configuration
|
||||
echo -e "\n${YELLOW}=== Suite 3: Safety Rules Configuration ===${NC}"
|
||||
test_safety_rules_file_exists
|
||||
test_safety_rules_is_valid_json
|
||||
test_safety_rules_has_safe_operations
|
||||
test_safety_rules_has_risky_operations
|
||||
|
||||
# Test Suite 4: Integration
|
||||
echo -e "\n${YELLOW}=== Suite 4: Integration ===${NC}"
|
||||
test_agent_count_increased
|
||||
test_bonus_category_count
|
||||
|
||||
# Summary
|
||||
echo -e "\n${BLUE}═══════════════════════════════════════════════════════════${NC}"
|
||||
echo -e "${BLUE}Test Results:${NC}"
|
||||
echo -e " Total Tests: $TESTS_RUN"
|
||||
echo -e "${GREEN} Passed: $TESTS_PASSED${NC}"
|
||||
if [ $TESTS_FAILED -gt 0 ]; then
|
||||
echo -e "${RED} Failed: $TESTS_FAILED${NC}"
|
||||
fi
|
||||
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}"
|
||||
|
||||
if [ $TESTS_FAILED -eq 0 ]; then
|
||||
echo -e "\n${GREEN}✓ All tests passed!${NC}"
|
||||
exit 0
|
||||
else
|
||||
echo -e "\n${RED}✗ Some tests failed. Fix issues and re-run.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user