Skip to content

feat(forge): Enhanced agent orchestration validation system with /forge command#565

Open
echobt wants to merge 5 commits intomasterfrom
feature/forge-orchestration-system
Open

feat(forge): Enhanced agent orchestration validation system with /forge command#565
echobt wants to merge 5 commits intomasterfrom
feature/forge-orchestration-system

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Feb 2, 2026

Summary

This PR introduces the Forge Orchestration System, a comprehensive modular framework for code validation through specialized agents. Each agent validates specific aspects of the codebase and returns structured JSON responses indicating rule compliance.

Features

🔧 Core Orchestration System

  • DAG-based Agent Execution: Agents can have dependencies, allowing conditional execution flows
  • Parallel Execution: Configurable concurrent agent execution with max_parallel setting
  • Fail-fast Mode: Option to stop on first failure or continue all validations

🤖 Validation Agents

Three built-in agents with extensible architecture:

Agent Purpose
SecurityAgent Detects secrets, audits dependencies, checks unsafe code
QualityAgent Validates TODOs, unwrap usage, documentation coverage
AggregatorAgent Combines results, generates recommendations, triggers actions if all pass

📋 Modular Configuration (TOML)

All agent behavior is controlled via modifiable TOML configuration files:

.cortex/forge/
├── forge.toml                 # Global orchestration settings
└── agents/
    ├── security/rules.toml    # Security rules & patterns
    ├── quality/rules.toml     # Quality checks configuration
    └── aggregator/rules.toml  # Aggregation thresholds

📊 JSON Protocol

Agents respond with structured JSON for machine-readable validation:

{
  "status": "pass|warning|fail",
  "agent_id": "security",
  "rules_applied": [...],
  "findings": [{
    "severity": "error|warning|info",
    "message": "Description",
    "location": { "file": "...", "line": 42 },
    "suggestion": "How to fix"
  }]
}

🖥️ TUI Dashboard

Interactive dashboard via /forge command showing:

  • Real-time agent execution status
  • Findings list with severity highlighting
  • Progress bar for overall validation
  • Detailed finding inspection

🔗 Slash Command Integration

New /forge command for validation orchestration

Files Changed

New Modules

  • src/cortex-agents/src/forge/ - Core orchestration
    • protocol.rs - Validation protocol (JSON serialization)
    • orchestrator.rs - DAG-based execution engine
    • config.rs - TOML configuration loader
    • agents/ - Built-in validation agents
  • src/cortex-engine/src/commands/forge.rs - Slash command
  • src/cortex-tui/src/views/forge.rs - Dashboard view

Configuration Files

  • .cortex/forge/forge.toml - Global settings
  • .cortex/forge/agents/*/rules.toml - Per-agent rules

Testing

  • cargo check passes
  • cargo fmt applied
  • ✅ Unit tests for protocol serialization
  • ✅ Unit tests for validation status logic

- Add ValidationAgent trait with async validate method
- Add SecurityAgent for security-focused code analysis:
  - secrets_exposed: detect hardcoded secrets/API keys
  - dependencies_audit: check for vulnerable dependencies
  - unsafe_code: find undocumented unsafe blocks
  - input_validation: basic injection pattern detection
- Add QualityAgent for code quality checks:
  - todo_comments: find TODO/FIXME/HACK comments
  - unimplemented_code: detect todo!() and unimplemented!()
  - error_handling: check for unwrap() without context
  - dead_code: find #[allow(dead_code)] markers
  - documentation: check missing public item docs
- Add AggregatorAgent to combine results from all agents:
  - Determines overall status (Pass only if ALL agents passed)
  - Groups findings by severity
  - Produces ForgeResponse with recommendation (proceed/block)
- Add comprehensive unit tests for all agents
- Fix GlobalConfig to use manual Default impl instead of derive
- Ensures max_parallel defaults to 4, timeout_seconds to 600
- Add module exports for config, orchestrator, protocol in mod.rs
- Add documentation for orchestration usage example
Implement the /forge command with subcommands:
- /forge (or /forge run) - Run all validation agents
- /forge status - Show current validation status
- /forge config - Show configuration
- /forge agents - List available agents
- /forge check <agent> - Run specific agent only

Includes alias 'validate', category 'Development', comprehensive help text,
and 9 unit tests covering all subcommands.
@echobt echobt force-pushed the feature/forge-orchestration-system branch from 012daaf to 7c1190d Compare February 2, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant