c

cortex-plugin-approval-workflow

ESM
v1.0.0MIT

Official CortexPrism plugin

0.00CortexPrism
agent-strategycortex-plugindevelopmentesmorchestrationworkflow

Install Command

$ cortex plugin install marketplace:cortexprism.io/plugins/cortex-plugin-approval-workflow
Website RepositoryLicense: MITEntry: mod.ts

Configuration

Plugin Type
ESM
Entry Point
mod.ts
License
MIT

Capabilities

toolsmiddleware:preevents:listener

Tags

agent-strategycortex-plugindevelopmentesmorchestrationworkflow

Statistics

Downloads
0
Rating
0.0
/ 5.0
Version
v1.0.0
Published
June 15, 2026

Reviews (0)

No reviews yet. Be the first to rate this plugin!

README

Cortex Plugin — Approval Workflow

Human-in-the-Loop Approval plugin for CortexPrism. Pauses agent execution at critical decision points (file writes, shell commands, PR merges) and routes to a human reviewer via Slack, Discord, or Web UI with diff previews and one-click approve/deny.

Installation

cortex plugin install marketplace:cortex-plugin-approval-workflow

cortex plugin install github:CortexPrism/cortex-plugin-approval-workflow

cortex plugin install ./manifest.json

Quick Start

After installation, the plugin registers six tools and a pre-middleware hook:

cortex tools list

Use in an agent session:

cortex chat --plugin cortex-plugin-approval-workflow

Configuration

Configure via the plugin UI or in ~/.cortex/config.json:

{
  "plugins": {
    "cortex-plugin-approval-workflow": {
      "enabled": true,
      "config": {
        "defaultTimeoutMinutes": 30,
        "autoDenyOnTimeout": true,
        "requireApprovalFor": "high_and_critical"
      }
    }
  }
}

Settings

SettingTypeDefaultDescription
defaultTimeoutMinutesnumber30Minutes before a pending request times out
autoDenyOnTimeoutbooleantrueAuto-deny when timeout expires
requireApprovalForselecthigh_and_criticalMinimum risk level requiring approval
notifySlacktextSlack webhook URL for notifications
notifyDiscordtextDiscord webhook URL for notifications

Risk Thresholds

ValueBehavior
critical_onlyOnly critical-risk actions require approval
high_and_criticalHigh and critical-risk actions require approval
medium_and_aboveMedium, high, and critical-risk actions require approval
allAll actions regardless of risk require approval

Tools

approval_request

Create an approval request for a pending action. Pauses agent execution and routes to human reviewers.

Parameters:

  • action (string, required) — Description of what needs approval
  • details (string, required) — Diff, command, or change details to review
  • risk_level (string) — low, medium, high, or critical (default medium)
  • timeout_minutes (number) — Override default timeout (default 30)
  • auto_deny_on_timeout (boolean) — Override auto-deny behavior (default true)

Example:

cortex tool call approval_request \
  --action "Delete production database records" \
  --details "$(cat delete_migration.sql)" \
  --risk_level critical \
  --timeout_minutes 15

approval_check

Check the status of an approval request by its ID.

Parameters:

  • request_id (string, required) — The approval request ID

Example:

cortex tool call approval_check \
  --request_id "a1b2c3d4-e5f6-7890-abcd-ef1234567890"

approval_list

List approval requests filtered by status.

Parameters:

  • status (string) — pending, approved, denied, or all (default all)
  • limit (number) — Maximum results (default 20)

Example:

cortex tool call approval_list --status pending --limit 10

approval_cancel

Cancel a pending approval request.

Parameters:

  • request_id (string, required) — The approval request ID
  • reason (string) — Reason for cancellation

Example:

cortex tool call approval_cancel \
  --request_id "a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
  --reason "No longer needed"

approval_policy

View or update the approval policy rules.

Parameters:

  • action (string) — view or update (default view)
  • rules (string) — JSON array of rule objects (required for update)

Example — View:

cortex tool call approval_policy --action view

Example — Update:

cortex tool call approval_policy \
  --action update \
  --rules '[{"tool_name":"shell:run","min_risk":"high","enabled":true}]'

approval_stats

Get statistics about approval requests.

Parameters:

  • since (string) — ISO date filter (e.g. 2026-06-01T00:00:00Z)

Example:

cortex tool call approval_stats --since "2026-06-01T00:00:00Z"

Pre-Middleware

The plugin registers a preMiddleware hook that fires before every tool execution. It checks the active policy rules and blocks tools that require human approval.

Integration example:

// In a Cortex agent config:
{
  "plugins": {
    "cortex-plugin-approval-workflow": {
      "policyRules": [
        { "tool_name": "shell:run", "min_risk": "medium", "enabled": true },
        { "tool_name": "fs:write", "min_risk": "high", "enabled": true },
        { "tool_name": "git:merge", "min_risk": "critical", "enabled": true }
      ]
    }
  }
}

When a tool requiring approval is invoked, the middleware blocks execution and instructs the agent to call approval_request first. The agent pauses until the request is approved or denied.

Capabilities

CapabilityDescription
toolsRegisters six approval workflow tools
middleware:prePre-middleware hook intercepts tool execution
events:listenerListens for approval events (approve/deny/cancel)

Policy Rules

Default policy rules (editable via approval_policy tool):

ToolMin Risk
shell:runmedium
shell:execmedium
fs:writehigh
fs:deletecritical
git:pushhigh
git:mergecritical
pr:mergecritical
network:fetchmedium

Auto-Deny Timeout

Each approval request has a configurable timeout. When the timeout expires and auto_deny_on_timeout is enabled, the request is automatically denied. The default timeout is 30 minutes.

Notifications

Configure Slack or Discord webhook URLs in the plugin settings to receive real-time notifications when approval requests are created.

Development

Setup

deno cache mod.ts
deno task test

Validate

deno task validate

Local Testing

cortex plugin install ./manifest.json
cortex tool call approval_list --status all
cortex chat --plugin cortex-plugin-approval-workflow

Best Practices

  • Set requireApprovalFor to match your team's risk tolerance
  • Configure webhooks for instant reviewer notifications
  • Use descriptive action and details fields so reviewers have full context
  • Review policy rules regularly and tune min_risk thresholds
  • Keep default timeout short enough to not block CI but long enough for manual review

License

MIT — See LICENSE

Support

Published June 15, 2026 · Updated June 15, 2026