Case Plan Models

Case Plan Models

CaseMgr includes a library of reusable Case Plan Models based on the CMMN standard. Models are templates that define stages, tasks, milestones, sentries, and timers. Instantiate a model to create a new case, or add a model’s workflow to an existing case.

How to Use Models

Models can be used two ways:

  1. Instantiate — Creates a new case from the model. Use models.instantiate via MCP or click Models in the navigation.
  2. Add to Case — Adds the model’s workflow items to an existing case. Click the Workflow button in the case toolbar, or use cmmn.add_model_to_case via MCP.

CMMN Building Blocks

Each model is composed of these CMMN elements:

Element Symbol Purpose
Stage Rounded rectangle Container for tasks. Can auto-complete when all required children finish.
Task Rectangle Work to be done. Types: human, process (webhook/AI), decision, case (sub-case).
Milestone Diamond A checkpoint. Achieved when a sentry fires or manually.
Sentry Small circle A gate that watches for events (task complete, timer fire) and optionally evaluates a condition.
Timer Clock icon Fires on a schedule (cron) or after a duration. Triggers sentries.
Process Definition Gear Defines what a process task does (webhook URL, AI agent config).

Pattern Library

These models demonstrate reusable CMMN patterns. Use them as building blocks in your own workflows.

Approval Gate

A decision task produces an outcome, then conditional sentries route to approved or rejected branches. Use for document review, expense approval, hiring decisions, or any binary routing.

graph TD
    subgraph Stage["Approval Stage (auto-complete)"]
        T1["Review Task
(decision)"] S1(("Sentry
decision==approved")) S2(("Sentry
decision==rejected")) M1{"Approved
Milestone"} M2{"Rejected
Milestone"} end T1 -->|complete| S1 T1 -->|complete| S2 S1 -->|fires| M1 S2 -->|fires| M2

Components: 1 stage, 1 decision task, 2 conditional sentries, 2 milestones
Key concept: The decision task’s result.decision field determines which sentry fires. Only one branch activates.

Decision Tree

Extends the approval gate pattern to three or more branches. A decision task evaluates input, and multiple sentries with different conditions route to different handler tasks. Use for triage, classification, priority routing.

graph TD
    subgraph Stage["Triage Stage (auto-complete)"]
        T1["Evaluate Input
(decision)"] S1(("Sentry
priority==high")) S2(("Sentry
priority==medium")) S3(("Sentry
priority==low")) T2["High Priority
Path"] T3["Medium Priority
Path"] T4["Low Priority
Path"] end T1 -->|complete| S1 T1 -->|complete| S2 T1 -->|complete| S3 S1 -->|enables| T2 S2 -->|enables| T3 S3 -->|enables| T4

Components: 1 stage, 1 decision task, 3 handler tasks, 3 conditional sentries
Key concept: Each sentry has a different condition_expression. Only the matching condition’s branch activates.

Escalation Timer

A human task has a deadline enforced by a timer. If the task isn’t completed before the timer fires, an escalation path activates. Use for SLA enforcement, approval deadlines, time-sensitive reviews.

graph TD
    subgraph Stage["Work Stage (auto-complete)"]
        T1["Primary Task
(human)"] TM["Deadline Timer
24 hours"] S1(("Escalation
Sentry")) T2["Escalation Task
(human)"] M1{"Completed
Milestone"} end TM -->|fires| S1 S1 -->|enables| T2 T1 -.->|if completed first| M1

Components: 1 stage, 2 tasks, 1 timer (PT24H duration), 1 sentry, 1 milestone
Key concept: The timer and task race. If the timer fires first, the sentry enables the escalation task. If the task completes first, the milestone is achieved and the stage auto-completes.

Multi-Stage Pipeline

Sequential stages gated by sentries. Each stage must complete before the next activates. Use for onboarding flows, project phases, manufacturing steps, or any sequential workflow.

graph LR
    subgraph P1["Phase 1"]
        T1["Task"]
    end
    subgraph P2["Phase 2"]
        T2["Task"]
    end
    subgraph P3["Phase 3"]
        T3["Task"]
    end
    P1 -->|"Sentry:
complete"| P2 P2 -->|"Sentry:
complete"| P3 P3 --> M1{"Pipeline
Complete"}

Components: 3 stages (each auto-complete with 1 task), 2 cross-stage sentries, 1 milestone
Key concept: Sentries at the root level watch one stage’s completion and gate the next stage’s activation. This enforces sequential ordering.

Parallel Work with Join

Multiple tasks execute concurrently within a stage. A sentry watches for the final task’s completion to achieve a milestone. The stage auto-completes when the milestone is achieved.

graph TD
    subgraph Stage["Work Stage (auto-complete)"]
        T1["Task A
(parallel)"] T2["Task B
(parallel)"] T3["Task C
(parallel)"] S1(("Join
Sentry")) M1{"All Work
Complete"} end T1 & T2 & T3 -->|complete| S1 S1 -->|fires| M1

Components: 1 stage, 3 parallel tasks, 1 sentry, 1 milestone
Key concept: All tasks are available immediately. The join sentry fires when the watched task completes, achieving the milestone and auto-completing the stage.

Monitoring Loop

A cron timer periodically executes a webhook, checks a condition on the response, and auto-resolves when the condition is met. Based on a real-world Twilio A2P campaign monitoring use case.

graph TD
    subgraph Stage["Monitoring Stage (auto-complete)"]
        TM["Cron Timer
every 6 hours"] T1["Poll Status
(webhook)"] S1(("Sentry
status==VERIFIED")) M1{"Condition
Met"} end TM -->|fires| T1 T1 -->|complete| S1 S1 -->|achieves| M1 M1 -.->|auto-complete| Stage

Components: 1 stage, 1 process task (webhook), 1 process definition, 1 cron timer, 1 conditional sentry, 1 milestone
Key concept: The timer repeats indefinitely until the sentry’s condition is met. When the milestone is achieved, the stage auto-completes and cascading termination stops the timer.


Automation Patterns

These models demonstrate automated processing with AI agents and external APIs.

AI Work Item Pipeline

A process task creates an AI work item, an AI agent polls and processes it, then completes the source task. The sentry watches task completion to achieve a milestone and auto-complete the stage.

graph TD
    subgraph Stage["AI Processing (auto-complete)"]
        PD["Process Definition
(ai_agent)"] T1["Execute AI Work
(process task)"] S1(("Sentry
task complete")) M1{"AI Processing
Complete"} end PD -.->|configures| T1 T1 -->|complete| S1 S1 -->|achieves| M1

Components: 1 stage, 1 process task, 1 process definition (ai_agent), 1 sentry, 1 milestone
Key concept: The process definition’s agent_config tells CaseMgr to create an AI work item. An external AI agent (or cron-polled agent) picks up the work item, does the work, and marks it complete.

Recurring API Poll

Timer-driven API polling with conditional resolution. A cron timer fires on schedule, triggers a webhook process task, and outcome sentries watch for success or failure conditions. Includes an LLM context task with instructions for configuring the poll.

graph TD
    subgraph Stage["Polling Stage (auto-complete)"]
        CTX["Stage Context
(instructions for LLM)"] TM["Poll Timer
hourly cron"] S_EN(("Enable
Sentry")) T1["Poll API
(webhook)"] S_OK(("Sentry
SUCCESS")) S_FAIL(("Sentry
FAILED")) M1{"Resolved"} end TM -->|fires| S_EN S_EN -->|enables| T1 T1 -->|complete| S_OK T1 -->|complete| S_FAIL S_OK -->|achieves| M1 S_FAIL -->|achieves| M1

Components: 1 stage, 2 tasks (1 context, 1 process), 1 process definition (webhook), 1 cron timer, 3 sentries, 1 milestone
Key concept: The timer fires repeatedly. Each cycle enables the webhook task via a sentry. Two outcome sentries watch the task result with different conditions. Either resolution path achieves the milestone, auto-completes the stage, and terminates the timer. The context task contains LLM agent instructions.


Workflow Templates

Complete end-to-end workflows for real-world use cases.

Bug Triage & Fix

Software bug lifecycle from report through fix to verification. Demonstrates decision tasks for AI-powered severity assessment, discretionary tasks (optional test writing), and multi-stage progression.

graph LR
    subgraph Triage["Triage"]
        T1["Report Bug"]
        T2["Assess Severity
(AI decision)"] M1{"Bug
Triaged"} end subgraph Fix["Fix"] T3["Investigate
Root Cause"] T4["Implement
Fix"] T5["Write Tests
(optional)"] M2{"Fix
Ready"} end subgraph Verify["Verification"] T6["Code
Review"] T7["QA
Verification"] M3{"Fix
Verified"} end Triage --> Fix --> Verify

Components: 3 stages, 7 tasks (1 AI decision, 1 discretionary, 5 human), 3 milestones
Key concepts: AI decision task for automated severity assessment. Discretionary “Write Tests” task can be added during execution if needed. Sequential stages ensure fix verification.

Project Kickoff

A project management template covering the full lifecycle from discovery to closeout. Mixes human and AI/process tasks across four phases.

graph LR
    subgraph Discovery
        T1["Define Scope"]
        T2["Identify
Stakeholders"] M1{"Scope
Approved"} end subgraph Planning T3["Create
Project Plan"] T4["Set Up
Infrastructure
(process)"] end subgraph Execution T5["Execute
Deliverables"] T6["Status Update
(optional)"] M2{"Deliverables
Complete"} end subgraph Closeout T7["Retrospective"] T8["Archive
Project
(process)"] end Discovery --> Planning --> Execution --> Closeout

Components: 4 stages, 8 tasks (6 human, 2 process, 1 discretionary), 2 milestones
Key concepts: Sequential phases without sentries (stages flow by sequence). Process tasks for infrastructure setup and archival can be automated via webhooks.

Research & Report

AI-human collaboration workflow. AI gathers and summarizes sources, humans define questions and review results. Demonstrates the handoff pattern between process tasks and human tasks.

graph LR
    subgraph Setup["Research Setup"]
        T1["Define Research
Questions (human)"] T2["Gather Sources
(AI process)"] end subgraph Analysis T3["Review
Sources (human)"] T4["Summarize
Findings (AI)"] M1{"Research
Complete"} end subgraph Report T5["Draft Report
(AI process)"] T6["Review &
Edit (human)"] M2{"Report
Approved"} end Setup --> Analysis --> Report

Components: 3 stages, 6 tasks (3 human, 3 process/AI), 2 milestones
Key concepts: Human-AI handoff pattern. Humans set direction and review, AI executes research and drafting. Each stage produces artifacts consumed by the next.

Invoice Generation Workflow

The most complex model in the library. A complete invoicing workflow with four stages linked by cross-stage sentries. Covers client selection, billable items, LaTeX/PDF generation, and delivery.

graph TD
    subgraph S1["Invoice Preparation"]
        T1["Select
Client"] T2["Select or Create
Invoice"] M1{"Invoice
Ready"} T1 -->|sentry| T2 -->|sentry| M1 end subgraph S2["Add Billable Items"] T3["Add
Durations"] T4["Add
Expenses"] T5["Mark Items
Complete"] T6["Review
Invoice"] M2{"Items
Finalized"} T5 -->|sentry| M2 -->|sentry| T6 end subgraph S3["Generate Documents"] T7["Generate
LaTeX (process)"] T8["Compile PDF
(process)"] M3{"PDF
Ready"} T7 -->|sentry| T8 -->|sentry| M3 end subgraph S4["Delivery"] T9["Review &
Download PDF"] T10["Send to
Client"] M4{"Invoice
Delivered"} T9 -->|sentry| T10 -->|sentry| M4 end M1 -->|"cross-stage sentry"| S2 T6 -->|"cross-stage sentry"| S3 M3 -->|"cross-stage sentry"| S4

Components: 4 stages, 10 tasks (8 human, 2 process), 4 milestones, 11 sentries
Key concepts: Cross-stage sentries enforce stage sequencing. Within each stage, sentries chain tasks and milestones. Process tasks for LaTeX generation and PDF compilation run automatically. The most comprehensive example of sentry-gated workflows.


Starter Templates

Simple templates for getting started quickly.

Software Development Lifecycle

A minimal SDLC template with one stage, one task, and one milestone. Good starting point for customization.

Components: 1 stage (Analysis), 1 task (Code Review), 1 milestone (Release Complete)

Software Development Project

A more complete SDLC with three phases, estimated hours, and discretionary tasks for code review and performance testing.

Components: 3 stages (Planning, Development, Testing), 6 tasks with hour estimates (2 discretionary), 2 milestones

Sprint Template

A single sprint cycle with a development stage, completion sentry, and a 24-hour deadline timer for time pressure.

Components: 1 stage, 1 task, 1 milestone, 1 sentry, 1 timer (24h)

Sub-Project Template

The simplest model — a single human task. Use as a building block within larger cases.

Components: 1 task

Project Template with Discretionary Items

Demonstrates CMMN discretionary items. A required core task lives inside a stage, while optional Code Review and Performance Testing tasks sit in the planning table. They can be added during case execution if needed.

Components: 1 stage, 1 required task, 2 discretionary tasks


Using Models via MCP

# List all available models (including public ones)
wa mcp models.list include_public=true

# Get model details
wa mcp models.get id="#61:37"

# See what's in a model
wa mcp models.list_definitions model_id="#61:37"

# Create a new case from a model
wa mcp models.instantiate model_id="#61:37" name="Q1 Budget Approval"

# Add a model's workflow to an existing case
wa mcp cmmn.add_model_to_case case_id="#1:123" model_id="#61:40"

Creating Your Own Models

You can create custom models from scratch or save existing case workflows as models:

# Create a new model
wa mcp models.create name="My Workflow" description="Custom workflow"

# Add definitions to the model
wa mcp models.add_definition model_id="..." type="stage" name="Phase 1" auto_complete=true
wa mcp models.add_definition model_id="..." type="task" name="Do Work" parent_definition_id="..."

# Publish when ready
wa mcp models.publish id="..."

# Or save an existing stage as a model
wa mcp models.create_from_stage stage_id="#4:12345" name="My Stage Model"