diff options
| author | soryu <soryu@soryu.co> | 2026-02-07 00:01:50 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-02-07 00:01:50 +0000 |
| commit | b8d563d45f14a2b1db1f684aa0a8dcd7e5b6ad56 (patch) | |
| tree | 95543fd150270018e384fbcf9d3df3dc45f052f6 /makima/src/daemon | |
| parent | cececbf326e258211ceae7afce716a5d1e46014f (diff) | |
| download | soryu-b8d563d45f14a2b1db1f684aa0a8dcd7e5b6ad56.tar.gz soryu-b8d563d45f14a2b1db1f684aa0a8dcd7e5b6ad56.zip | |
Remove directives for reimplementation
Diffstat (limited to 'makima/src/daemon')
| -rw-r--r-- | makima/src/daemon/api/directive.rs | 447 | ||||
| -rw-r--r-- | makima/src/daemon/api/mod.rs | 1 | ||||
| -rw-r--r-- | makima/src/daemon/cli/directive.rs | 186 | ||||
| -rw-r--r-- | makima/src/daemon/cli/mod.rs | 56 | ||||
| -rw-r--r-- | makima/src/daemon/skills/directive.md | 303 | ||||
| -rw-r--r-- | makima/src/daemon/skills/mod.rs | 4 |
6 files changed, 0 insertions, 997 deletions
diff --git a/makima/src/daemon/api/directive.rs b/makima/src/daemon/api/directive.rs deleted file mode 100644 index 48762d6..0000000 --- a/makima/src/daemon/api/directive.rs +++ /dev/null @@ -1,447 +0,0 @@ -//! Directive API methods. - -use uuid::Uuid; - -use super::client::{ApiClient, ApiError}; -use super::supervisor::JsonValue; - -impl ApiClient { - /// Create a new directive. - pub async fn create_directive( - &self, - goal: &str, - repository_url: Option<&str>, - autonomy_level: &str, - ) -> Result<JsonValue, ApiError> { - #[derive(serde::Serialize)] - #[serde(rename_all = "camelCase")] - struct CreateRequest<'a> { - goal: &'a str, - repository_url: Option<&'a str>, - autonomy_level: &'a str, - } - let req = CreateRequest { - goal, - repository_url, - autonomy_level, - }; - self.post("/api/v1/directives", &req).await - } - - /// List all directives for the authenticated user. - pub async fn list_directives( - &self, - status: Option<&str>, - limit: i32, - ) -> Result<JsonValue, ApiError> { - let mut params = Vec::new(); - if let Some(s) = status { - params.push(format!("status={}", s)); - } - params.push(format!("limit={}", limit)); - let query_string = format!("?{}", params.join("&")); - self.get(&format!("/api/v1/directives{}", query_string)) - .await - } - - /// Get a directive by ID (includes progress info). - pub async fn get_directive(&self, directive_id: Uuid) -> Result<JsonValue, ApiError> { - self.get(&format!("/api/v1/directives/{}", directive_id)) - .await - } - - /// Archive a directive. - pub async fn archive_directive(&self, directive_id: Uuid) -> Result<JsonValue, ApiError> { - self.delete_with_response(&format!("/api/v1/directives/{}", directive_id)) - .await - } - - /// Start a directive (plans and begins execution). - pub async fn start_directive(&self, directive_id: Uuid) -> Result<JsonValue, ApiError> { - self.post_empty(&format!("/api/v1/directives/{}/start", directive_id)) - .await - } - - /// Pause a directive. - pub async fn pause_directive(&self, directive_id: Uuid) -> Result<JsonValue, ApiError> { - self.post_empty(&format!("/api/v1/directives/{}/pause", directive_id)) - .await - } - - /// Resume a paused directive. - pub async fn resume_directive(&self, directive_id: Uuid) -> Result<JsonValue, ApiError> { - self.post_empty(&format!("/api/v1/directives/{}/resume", directive_id)) - .await - } - - /// Stop a directive. - pub async fn stop_directive(&self, directive_id: Uuid) -> Result<JsonValue, ApiError> { - self.post_empty(&format!("/api/v1/directives/{}/stop", directive_id)) - .await - } - - /// Get the current chain and steps for a directive. - pub async fn get_directive_chain(&self, directive_id: Uuid) -> Result<JsonValue, ApiError> { - self.get(&format!("/api/v1/directives/{}/chain", directive_id)) - .await - } - - /// Get directive DAG structure for visualization. - pub async fn get_directive_graph(&self, directive_id: Uuid) -> Result<JsonValue, ApiError> { - self.get(&format!("/api/v1/directives/{}/chain/graph", directive_id)) - .await - } - - /// List events for a directive. - pub async fn list_directive_events( - &self, - directive_id: Uuid, - limit: i32, - ) -> Result<JsonValue, ApiError> { - self.get(&format!( - "/api/v1/directives/{}/events?limit={}", - directive_id, limit - )) - .await - } - - /// List pending approvals for a directive. - pub async fn list_directive_approvals( - &self, - directive_id: Uuid, - ) -> Result<JsonValue, ApiError> { - self.get(&format!("/api/v1/directives/{}/approvals", directive_id)) - .await - } - - /// Approve an approval request. - pub async fn approve_directive_request( - &self, - directive_id: Uuid, - approval_id: Uuid, - response: Option<&str>, - ) -> Result<JsonValue, ApiError> { - #[derive(serde::Serialize)] - #[serde(rename_all = "camelCase")] - struct ApprovalRequest<'a> { - response: Option<&'a str>, - } - let req = ApprovalRequest { response }; - self.post( - &format!( - "/api/v1/directives/{}/approvals/{}/approve", - directive_id, approval_id - ), - &req, - ) - .await - } - - /// Deny an approval request. - pub async fn deny_directive_request( - &self, - directive_id: Uuid, - approval_id: Uuid, - response: Option<&str>, - ) -> Result<JsonValue, ApiError> { - #[derive(serde::Serialize)] - #[serde(rename_all = "camelCase")] - struct ApprovalRequest<'a> { - response: Option<&'a str>, - } - let req = ApprovalRequest { response }; - self.post( - &format!( - "/api/v1/directives/{}/approvals/{}/deny", - directive_id, approval_id - ), - &req, - ) - .await - } - - // ========================================================================= - // Chain operations - // ========================================================================= - - /// Force chain regeneration (replan). - pub async fn replan_directive_chain( - &self, - directive_id: Uuid, - ) -> Result<JsonValue, ApiError> { - self.post_empty(&format!( - "/api/v1/directives/{}/chain/replan", - directive_id - )) - .await - } - - // ========================================================================= - // Step management - // ========================================================================= - - /// Add a step to a directive's chain. - pub async fn add_directive_step( - &self, - directive_id: Uuid, - name: &str, - description: Option<&str>, - step_type: Option<&str>, - depends_on: Option<Vec<Uuid>>, - ) -> Result<JsonValue, ApiError> { - #[derive(serde::Serialize)] - #[serde(rename_all = "camelCase")] - struct AddStepReq<'a> { - name: &'a str, - #[serde(skip_serializing_if = "Option::is_none")] - description: Option<&'a str>, - #[serde(skip_serializing_if = "Option::is_none")] - step_type: Option<&'a str>, - #[serde(skip_serializing_if = "Option::is_none")] - depends_on: Option<Vec<Uuid>>, - } - let req = AddStepReq { - name, - description, - step_type, - depends_on, - }; - self.post( - &format!("/api/v1/directives/{}/chain/steps", directive_id), - &req, - ) - .await - } - - /// Get a step by ID. - pub async fn get_directive_step( - &self, - directive_id: Uuid, - step_id: Uuid, - ) -> Result<JsonValue, ApiError> { - self.get(&format!( - "/api/v1/directives/{}/chain/steps/{}", - directive_id, step_id - )) - .await - } - - /// Update a step. - pub async fn update_directive_step( - &self, - directive_id: Uuid, - step_id: Uuid, - update: serde_json::Value, - ) -> Result<JsonValue, ApiError> { - self.put( - &format!( - "/api/v1/directives/{}/chain/steps/{}", - directive_id, step_id - ), - &update, - ) - .await - } - - /// Delete a step. - pub async fn delete_directive_step( - &self, - directive_id: Uuid, - step_id: Uuid, - ) -> Result<(), ApiError> { - self.delete(&format!( - "/api/v1/directives/{}/chain/steps/{}", - directive_id, step_id - )) - .await - } - - /// Skip a step. - pub async fn skip_directive_step( - &self, - directive_id: Uuid, - step_id: Uuid, - ) -> Result<JsonValue, ApiError> { - self.post_empty(&format!( - "/api/v1/directives/{}/chain/steps/{}/skip", - directive_id, step_id - )) - .await - } - - /// Force re-evaluation of a step. - pub async fn evaluate_directive_step( - &self, - directive_id: Uuid, - step_id: Uuid, - ) -> Result<JsonValue, ApiError> { - self.post_empty(&format!( - "/api/v1/directives/{}/chain/steps/{}/evaluate", - directive_id, step_id - )) - .await - } - - /// Trigger manual rework for a step. - pub async fn rework_directive_step( - &self, - directive_id: Uuid, - step_id: Uuid, - instructions: Option<&str>, - ) -> Result<JsonValue, ApiError> { - #[derive(serde::Serialize)] - #[serde(rename_all = "camelCase")] - struct ReworkReq<'a> { - instructions: Option<&'a str>, - } - let req = ReworkReq { instructions }; - self.post( - &format!( - "/api/v1/directives/{}/chain/steps/{}/rework", - directive_id, step_id - ), - &req, - ) - .await - } - - // ========================================================================= - // Evaluations - // ========================================================================= - - /// List evaluations for a directive. - pub async fn list_directive_evaluations( - &self, - directive_id: Uuid, - ) -> Result<JsonValue, ApiError> { - self.get(&format!( - "/api/v1/directives/{}/evaluations", - directive_id - )) - .await - } - - // ========================================================================= - // Verifiers - // ========================================================================= - - /// List verifiers for a directive. - pub async fn list_directive_verifiers( - &self, - directive_id: Uuid, - ) -> Result<JsonValue, ApiError> { - self.get(&format!("/api/v1/directives/{}/verifiers", directive_id)) - .await - } - - /// Add a verifier to a directive. - pub async fn add_directive_verifier( - &self, - directive_id: Uuid, - name: &str, - verifier_type: &str, - command: Option<&str>, - ) -> Result<JsonValue, ApiError> { - #[derive(serde::Serialize)] - #[serde(rename_all = "camelCase")] - struct CreateVerifierReq<'a> { - name: &'a str, - verifier_type: &'a str, - #[serde(skip_serializing_if = "Option::is_none")] - command: Option<&'a str>, - } - let req = CreateVerifierReq { - name, - verifier_type, - command, - }; - self.post( - &format!("/api/v1/directives/{}/verifiers", directive_id), - &req, - ) - .await - } - - /// Update a verifier. - pub async fn update_directive_verifier( - &self, - directive_id: Uuid, - verifier_id: Uuid, - update: serde_json::Value, - ) -> Result<JsonValue, ApiError> { - self.put( - &format!( - "/api/v1/directives/{}/verifiers/{}", - directive_id, verifier_id - ), - &update, - ) - .await - } - - /// Auto-detect verifiers based on repository content. - pub async fn auto_detect_directive_verifiers( - &self, - directive_id: Uuid, - ) -> Result<JsonValue, ApiError> { - self.post_empty(&format!( - "/api/v1/directives/{}/verifiers/auto-detect", - directive_id - )) - .await - } - - // ========================================================================= - // Requirements & Spec - // ========================================================================= - - /// Update directive requirements. - pub async fn update_directive_requirements( - &self, - directive_id: Uuid, - requirements: serde_json::Value, - ) -> Result<JsonValue, ApiError> { - #[derive(serde::Serialize)] - #[serde(rename_all = "camelCase")] - struct UpdateReq { - requirements: serde_json::Value, - } - let req = UpdateReq { requirements }; - self.put( - &format!("/api/v1/directives/{}/requirements", directive_id), - &req, - ) - .await - } - - /// Update directive acceptance criteria. - pub async fn update_directive_criteria( - &self, - directive_id: Uuid, - acceptance_criteria: serde_json::Value, - ) -> Result<JsonValue, ApiError> { - #[derive(serde::Serialize)] - #[serde(rename_all = "camelCase")] - struct UpdateReq { - acceptance_criteria: serde_json::Value, - } - let req = UpdateReq { acceptance_criteria }; - self.put( - &format!("/api/v1/directives/{}/criteria", directive_id), - &req, - ) - .await - } - - /// Generate a specification from the directive's goal. - pub async fn generate_directive_spec( - &self, - directive_id: Uuid, - ) -> Result<JsonValue, ApiError> { - self.post_empty(&format!( - "/api/v1/directives/{}/generate-spec", - directive_id - )) - .await - } -} diff --git a/makima/src/daemon/api/mod.rs b/makima/src/daemon/api/mod.rs index 2d1efbf..49d80e0 100644 --- a/makima/src/daemon/api/mod.rs +++ b/makima/src/daemon/api/mod.rs @@ -2,7 +2,6 @@ pub mod client; pub mod contract; -pub mod directive; pub mod supervisor; pub use client::ApiClient; diff --git a/makima/src/daemon/cli/directive.rs b/makima/src/daemon/cli/directive.rs deleted file mode 100644 index a2bb34b..0000000 --- a/makima/src/daemon/cli/directive.rs +++ /dev/null @@ -1,186 +0,0 @@ -//! Directive CLI commands for autonomous goal-driven orchestration. -//! -//! Directives are top-level goals that the system works toward. Each directive -//! generates a chain of steps that are executed autonomously with configurable -//! guardrails. - -use clap::Args; -use uuid::Uuid; - -/// Common arguments for directive commands requiring API access. -#[derive(Args, Debug, Clone)] -pub struct DirectiveArgs { - /// API URL - #[arg(long, env = "MAKIMA_API_URL", default_value = "https://api.makima.jp", global = true)] - pub api_url: String, - - /// API key for authentication - #[arg(long, env = "MAKIMA_API_KEY", global = true)] - pub api_key: String, -} - -/// Arguments for the `create` command. -#[derive(Args, Debug)] -pub struct CreateArgs { - #[command(flatten)] - pub common: DirectiveArgs, - - /// The goal for the directive - #[arg(short, long)] - pub goal: String, - - /// Repository URL (optional) - #[arg(short, long)] - pub repository: Option<String>, - - /// Autonomy level: full_auto, guardrails, or manual - #[arg(short, long, default_value = "guardrails")] - pub autonomy: String, -} - -/// Arguments for the `status` command. -#[derive(Args, Debug)] -pub struct StatusArgs { - #[command(flatten)] - pub common: DirectiveArgs, - - /// Directive ID - pub directive_id: Uuid, -} - -/// Arguments for the `list` command. -#[derive(Args, Debug)] -pub struct ListArgs { - #[command(flatten)] - pub common: DirectiveArgs, - - /// Filter by status (draft, planning, active, paused, completed, archived, failed) - #[arg(long)] - pub status: Option<String>, - - /// Limit number of results - #[arg(long, default_value = "50")] - pub limit: i32, -} - -/// Arguments for the `steps` command. -#[derive(Args, Debug)] -pub struct StepsArgs { - #[command(flatten)] - pub common: DirectiveArgs, - - /// Directive ID - pub directive_id: Uuid, -} - -/// Arguments for the `events` command. -#[derive(Args, Debug)] -pub struct EventsArgs { - #[command(flatten)] - pub common: DirectiveArgs, - - /// Directive ID - pub directive_id: Uuid, - - /// Limit number of events - #[arg(long, default_value = "50")] - pub limit: i32, -} - -/// Arguments for the `approve` command. -#[derive(Args, Debug)] -pub struct ApproveArgs { - #[command(flatten)] - pub common: DirectiveArgs, - - /// Directive ID - pub directive_id: Uuid, - - /// Approval ID - pub approval_id: Uuid, - - /// Response message (optional) - #[arg(short, long)] - pub response: Option<String>, -} - -/// Arguments for the `deny` command. -#[derive(Args, Debug)] -pub struct DenyArgs { - #[command(flatten)] - pub common: DirectiveArgs, - - /// Directive ID - pub directive_id: Uuid, - - /// Approval ID - pub approval_id: Uuid, - - /// Reason for denial (optional) - #[arg(short, long)] - pub reason: Option<String>, -} - -/// Arguments for the `start` command. -#[derive(Args, Debug)] -pub struct StartArgs { - #[command(flatten)] - pub common: DirectiveArgs, - - /// Directive ID - pub directive_id: Uuid, -} - -/// Arguments for the `pause` command. -#[derive(Args, Debug)] -pub struct PauseArgs { - #[command(flatten)] - pub common: DirectiveArgs, - - /// Directive ID - pub directive_id: Uuid, -} - -/// Arguments for the `resume` command. -#[derive(Args, Debug)] -pub struct ResumeArgs { - #[command(flatten)] - pub common: DirectiveArgs, - - /// Directive ID - pub directive_id: Uuid, -} - -/// Arguments for the `stop` command. -#[derive(Args, Debug)] -pub struct StopArgs { - #[command(flatten)] - pub common: DirectiveArgs, - - /// Directive ID - pub directive_id: Uuid, -} - -/// Arguments for the `archive` command. -#[derive(Args, Debug)] -pub struct ArchiveArgs { - #[command(flatten)] - pub common: DirectiveArgs, - - /// Directive ID - pub directive_id: Uuid, -} - -/// Arguments for the `graph` command (ASCII DAG visualization). -#[derive(Args, Debug)] -pub struct GraphArgs { - #[command(flatten)] - pub common: DirectiveArgs, - - /// Directive ID - pub directive_id: Uuid, - - /// Show step status in nodes - #[arg(long)] - pub with_status: bool, -} diff --git a/makima/src/daemon/cli/mod.rs b/makima/src/daemon/cli/mod.rs index 77eee80..0805edd 100644 --- a/makima/src/daemon/cli/mod.rs +++ b/makima/src/daemon/cli/mod.rs @@ -3,7 +3,6 @@ pub mod config; pub mod contract; pub mod daemon; -pub mod directive; pub mod server; pub mod supervisor; pub mod view; @@ -13,7 +12,6 @@ use clap::{Parser, Subcommand}; pub use config::CliConfig; pub use contract::ContractArgs; pub use daemon::DaemonArgs; -pub use directive::DirectiveArgs; pub use server::ServerArgs; pub use supervisor::SupervisorArgs; pub use view::ViewArgs; @@ -60,14 +58,6 @@ pub enum Commands { /// Saves configuration to ~/.makima/config.toml for use by CLI commands. #[command(subcommand)] Config(ConfigCommand), - - /// Directive commands for autonomous goal-driven orchestration - /// - /// Directives are top-level goals that generate chains of steps executed - /// autonomously with configurable guardrails. Steps spawn contracts with - /// supervisors and are verified with programmatic and LLM evaluation. - #[command(subcommand)] - Directive(DirectiveCommand), } /// Config subcommands for CLI configuration. @@ -206,52 +196,6 @@ pub enum ContractCommand { CreateFile(contract::CreateFileArgs), } -/// Directive subcommands for autonomous goal-driven orchestration. -#[derive(Subcommand, Debug)] -pub enum DirectiveCommand { - /// Create a new directive from a goal - Create(directive::CreateArgs), - - /// Get directive status and progress - Status(directive::StatusArgs), - - /// List all directives - List(directive::ListArgs), - - /// List steps in the directive's chain - Steps(directive::StepsArgs), - - /// Display ASCII DAG visualization - /// - /// Shows the directive's chain structure as an ASCII graph with - /// steps as nodes and dependencies as edges. - Graph(directive::GraphArgs), - - /// Show recent events for a directive - Events(directive::EventsArgs), - - /// Approve a pending approval request - Approve(directive::ApproveArgs), - - /// Deny a pending approval request - Deny(directive::DenyArgs), - - /// Start a directive (generates chain and begins execution) - Start(directive::StartArgs), - - /// Pause a running directive - Pause(directive::PauseArgs), - - /// Resume a paused directive - Resume(directive::ResumeArgs), - - /// Stop a directive - Stop(directive::StopArgs), - - /// Archive a directive - Archive(directive::ArchiveArgs), -} - impl Cli { /// Parse command-line arguments pub fn parse_args() -> Self { diff --git a/makima/src/daemon/skills/directive.md b/makima/src/daemon/skills/directive.md deleted file mode 100644 index 97e8e20..0000000 --- a/makima/src/daemon/skills/directive.md +++ /dev/null @@ -1,303 +0,0 @@ ---- -name: makima-directive -description: Directive orchestration tools for autonomous goal-driven execution. Use when working with directives, chains, steps, verifiers, and approvals. ---- - -# Directive Orchestration Tools - -Directives are top-level goals that drive autonomous execution with configurable guardrails. Each directive generates a chain of steps that spawn contracts with supervisors, verified by programmatic checks and LLM evaluation. - -## Architecture - -``` -Directive (goal + requirements + acceptance criteria) - | - +-- Chain (generated DAG execution plan) - | +-- Step 1 (pending -> ready -> running -> evaluating -> passed) - | | +-- Contract (spawned when step reaches 'ready') - | | +-- Supervisor Task - | +-- Step 2 (depends_on: [Step 1]) - | +-- Step 3 (depends_on: [Step 1], parallel with Step 2) - | - +-- Verifiers (test runner, linter, build, type checker) - +-- Evaluations (programmatic + LLM composite scores) - +-- Events (audit stream) - +-- Approvals (human-in-the-loop gates) -``` - -## Status Flow - -### Directive Status -- `draft` - Created but not started -- `planning` - Generating chain from requirements -- `active` - Executing steps -- `paused` - Temporarily stopped -- `completed` - All steps passed -- `archived` - No longer active -- `failed` - Execution failed - -### Step Status -- `pending` - Waiting for dependencies -- `ready` - Dependencies met, ready to start -- `running` - Contract executing -- `evaluating` - Running verifiers -- `passed` - Evaluation succeeded -- `failed` - Evaluation failed, exceeded retries -- `rework` - Sent back for corrections -- `skipped` - Manually skipped -- `blocked` - Blocked by failed dependency - -## Autonomy Levels - -- `full_auto` - No approval gates, automatic progression -- `guardrails` - Request approval for yellow/red confidence scores -- `manual` - Request approval for all step completions - -## Confidence Scoring - -Each step evaluation produces a composite confidence score: - -1. **Programmatic verifiers** run first (tests, lint, build) - - Weight: 1.0 each - - If any required verifier fails: automatic RED - -2. **LLM evaluation** runs second - - Weight: 2.0 - - Evaluates against acceptance criteria - -3. **Composite score** computed from weighted average - - GREEN: >= configured threshold (default 0.8) - - YELLOW: >= yellow threshold (default 0.5) - - RED: below yellow threshold - -## CLI Commands - -```bash -# Create a new directive -makima directive create --goal "Add OAuth2 authentication" --repository https://github.com/org/repo - -# List directives -makima directive list [--status active] - -# Get directive status with progress -makima directive status <directive-id> - -# Start execution (generates chain and begins) -makima directive start <directive-id> - -# View chain steps -makima directive steps <directive-id> - -# View DAG visualization -makima directive graph <directive-id> --with-status - -# View recent events -makima directive events <directive-id> --limit 20 - -# Approve a pending request -makima directive approve <directive-id> <approval-id> [--response "Looks good"] - -# Deny a pending request -makima directive deny <directive-id> <approval-id> [--reason "Need more testing"] - -# Lifecycle commands -makima directive pause <directive-id> -makima directive resume <directive-id> -makima directive stop <directive-id> -makima directive archive <directive-id> -``` - -## API Endpoints - -### Directive CRUD -``` -POST /api/v1/directives # Create from goal -GET /api/v1/directives # List -GET /api/v1/directives/:id # Get with progress -PUT /api/v1/directives/:id # Update -DELETE /api/v1/directives/:id # Archive -``` - -### Lifecycle -``` -POST /api/v1/directives/:id/start # Plan + execute -POST /api/v1/directives/:id/pause # Pause -POST /api/v1/directives/:id/resume # Resume -POST /api/v1/directives/:id/stop # Stop -``` - -### Chain & Steps -``` -GET /api/v1/directives/:id/chain # Current chain + steps -GET /api/v1/directives/:id/chain/graph # DAG for visualization -POST /api/v1/directives/:id/chain/replan # Force regeneration -POST /api/v1/directives/:id/chain/steps # Add step -PUT /api/v1/directives/:id/chain/steps/:sid # Modify step -DELETE /api/v1/directives/:id/chain/steps/:sid # Remove step -``` - -### Step Operations -``` -GET /api/v1/directives/:id/steps/:sid # Step detail -POST /api/v1/directives/:id/steps/:sid/evaluate # Force re-evaluation -POST /api/v1/directives/:id/steps/:sid/skip # Skip step -POST /api/v1/directives/:id/steps/:sid/rework # Manual rework -``` - -### Monitoring -``` -GET /api/v1/directives/:id/evaluations # List evaluations -GET /api/v1/directives/:id/events # Event log (polling) -GET /api/v1/directives/:id/events/stream # Event stream (SSE) -``` - -### Verifiers -``` -GET /api/v1/directives/:id/verifiers # List verifiers -POST /api/v1/directives/:id/verifiers # Add verifier -PUT /api/v1/directives/:id/verifiers/:vid # Update verifier -POST /api/v1/directives/:id/verifiers/auto-detect # Auto-detect -``` - -### Approvals -``` -GET /api/v1/directives/:id/approvals # Pending approvals -POST /api/v1/directives/:id/approvals/:aid/approve # Approve -POST /api/v1/directives/:id/approvals/:aid/deny # Deny -``` - -## Creating a Directive - -### Request -```json -POST /api/v1/directives -{ - "goal": "Implement user authentication with OAuth2", - "repositoryUrl": "https://github.com/org/repo", - "autonomyLevel": "guardrails", - "confidenceThresholdGreen": 0.8, - "confidenceThresholdYellow": 0.5, - "maxReworkCycles": 3, - "maxTotalCostUsd": 100.0, - "maxWallTimeMinutes": 480 -} -``` - -### Response -```json -{ - "id": "uuid", - "title": "Implement user authentication with OAuth2", - "goal": "Implement user authentication with OAuth2", - "status": "draft", - "autonomyLevel": "guardrails", - "createdAt": "2026-02-05T12:00:00Z" -} -``` - -## Starting a Directive - -When you start a directive: -1. System generates requirements from the goal -2. Chain planner creates a DAG of steps -3. Root steps (no dependencies) transition to `ready` -4. Contracts spawn for ready steps with supervisors -5. Verifiers auto-detect from repository - -## Evaluation Flow - -When a contract completes: - -1. Step transitions to `evaluating` -2. **Programmatic verifiers** run (tests, lint, build) - - Each produces pass/fail + output -3. **LLM evaluation** runs - - Reviews code against acceptance criteria - - Provides feedback and score -4. **Composite score** computed -5. Based on confidence level and autonomy: - - GREEN: Step passes, downstream unblocks - - YELLOW (guardrails): Request approval - - RED: Initiate rework or request approval - -## Rework Flow - -When a step needs rework: - -1. Contract phase reset to editing -2. Supervisor receives rework instructions -3. Rework count incremented -4. If max reworks exceeded: escalate or fail - -## Event Types - -Events are logged for audit and monitoring: - -- `directive_created`, `directive_started`, `directive_paused`, `directive_completed` -- `chain_generated`, `chain_regenerated` -- `step_ready`, `step_started`, `step_evaluating`, `step_passed`, `step_failed` -- `rework_initiated`, `rework_completed` -- `approval_requested`, `approval_granted`, `approval_denied` -- `verifier_run`, `evaluation_completed` -- `circuit_breaker_triggered` - -## Verifier Configuration - -Verifiers can be auto-detected or manually configured: - -```json -POST /api/v1/directives/:id/verifiers -{ - "name": "Test Runner", - "verifierType": "test_runner", - "command": "npm test", - "workingDirectory": ".", - "timeoutSeconds": 300, - "weight": 1.0, - "required": true, - "enabled": true -} -``` - -### Auto-Detection - -The system detects verifiers from: -- `package.json` - npm test, npm run lint, npm run build -- `Cargo.toml` - cargo test, cargo clippy, cargo build -- `pyproject.toml` - pytest, ruff, mypy - -## Circuit Breakers - -Directives have built-in circuit breakers: - -- `maxTotalCostUsd` - Stop if cumulative cost exceeds limit -- `maxWallTimeMinutes` - Stop if elapsed time exceeds limit -- `maxReworkCycles` - Fail step after N rework attempts -- `maxChainRegenerations` - Fail if chain regenerated too many times - -## Example Workflow - -```bash -# 1. Create a directive -makima directive create \ - --goal "Add dark mode to the application" \ - --repository https://github.com/myorg/myapp \ - --autonomy guardrails - -# Returns directive ID: 123e4567-e89b-12d3-a456-426614174000 - -# 2. Start execution -makima directive start 123e4567-e89b-12d3-a456-426614174000 - -# 3. Monitor progress -makima directive status 123e4567-e89b-12d3-a456-426614174000 - -# 4. View the execution graph -makima directive graph 123e4567-e89b-12d3-a456-426614174000 --with-status - -# 5. Watch events -makima directive events 123e4567-e89b-12d3-a456-426614174000 - -# 6. If approval needed, approve or deny -makima directive approve 123e4567-e89b-12d3-a456-426614174000 <approval-id> -``` diff --git a/makima/src/daemon/skills/mod.rs b/makima/src/daemon/skills/mod.rs index c32f550..0b05f3a 100644 --- a/makima/src/daemon/skills/mod.rs +++ b/makima/src/daemon/skills/mod.rs @@ -9,12 +9,8 @@ pub const SUPERVISOR_SKILL: &str = include_str!("supervisor.md"); /// Contract skill content - task-contract interaction commands pub const CONTRACT_SKILL: &str = include_str!("contract.md"); -/// Directive skill content - autonomous goal-driven orchestration -pub const DIRECTIVE_SKILL: &str = include_str!("directive.md"); - /// All skills as (name, content) pairs for installation pub const ALL_SKILLS: &[(&str, &str)] = &[ ("makima-supervisor", SUPERVISOR_SKILL), ("makima-contract", CONTRACT_SKILL), - ("makima-directive", DIRECTIVE_SKILL), ]; |
