Swirls

SWIRLS_

  • How it works
  • Pricing

56 matches

OverviewDeliver client operations10Win and grow accounts8Resolve customer issues6Create and distribute content9Run people and operations5Review money and agreements3Monitor systems and data9Compose dependable work6

56 matches

OverviewDeliver client operations10Win and grow accounts8Resolve customer issues6Create and distribute content9Run people and operations5Review money and agreements3Monitor systems and data9Compose dependable work6
← Finance & LegalFormView on GitHub

Contract Reviewer

Reviews contracts for risks and key terms, flags critical clauses for human legal review.

aiswitch

Source

/**
 * Reviews legal contracts for risks and key terms.
 * Flags critical clauses for human legal review.
 */

form contract_review {
  label: "Contract Review"
  schema: @json {
    {
      "type": "object",
      "required": ["contract_text", "contract_type"],
      "properties": {
        "contract_text": { "type": "string", "title": "Contract Text" },
        "contract_type": {
          "type": "string",
          "title": "Contract Type",
          "enum": ["nda", "saas_agreement", "employment", "vendor", "partnership"]
        },
        "our_role": {
          "type": "string",
          "title": "Our Role",
          "enum": ["buyer", "seller", "partner"]
        }
      }
    }
  }
}

workflow review_contract {
  label: "Review Contract"

  root {
    type: code
    label: "Extract contract"
    code: @ts { return context.nodes.root.input }
    outputSchema: @json {
      {
        "type": "object",
        "properties": {
          "contract_text": { "type": "string" },
          "contract_type": {
            "type": "string",
            "enum": ["nda", "saas_agreement", "employment", "vendor", "partnership"]
          },
          "our_role": {
            "type": "string",
            "enum": ["buyer", "seller", "partner"]
          }
        }
      }
    }
  }

  node analyze {
    type: ai
    label: "Analyze contract"
    kind: object
    model: "google/gemini-2.5-flash"
    prompt: @ts {
      const req = context.nodes.root.output
      return "Review this " + req.contract_type + " contract from the perspective of the " + (req.our_role || "buyer") + ". Identify risks, unusual clauses, and key terms.\n\n" + req.contract_text
    }
    schema: @json {
      {
        "type": "object",
        "required": ["risk_level", "key_terms", "risks", "recommendations"],
        "properties": {
          "risk_level": { "type": "string", "enum": ["low", "medium", "high", "critical"] },
          "key_terms": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "clause": { "type": "string" },
                "summary": { "type": "string" },
                "concern_level": { "type": "string" }
              }
            }
          },
          "risks": { "type": "array", "items": { "type": "string" } },
          "missing_clauses": { "type": "array", "items": { "type": "string" } },
          "recommendations": { "type": "array", "items": { "type": "string" } }
        }
      }
    }
  }

  node route_risk {
    type: switch
    label: "Route by risk"
    cases: ["needs_legal", "low_risk"]
    router: @ts {
      const level = context.nodes.analyze.output.risk_level
      if (level === "high" || level === "critical") return "needs_legal"
      return "low_risk"
    }
  }

  node legal_review {
    type: code
    label: "Queue for legal"
    code: @ts { return {} }
    review: {
      enabled: true
      title: "Legal Review Required"
      description: "This contract has been flagged as high risk. See the analyze node output for the flagged risks and key terms."
      schema: @json {
        {
          "type": "object",
          "properties": {
            "notes": { "type": "string", "title": "Notes" }
          },
          "additionalProperties": false
        }
      }
      actions: [
        { id: "approve", label: "Approve with Notes", outcome: "approve" },
        { id: "reject", label: "Do Not Sign", outcome: "reject" }
      ]
    }
  }

  node record_approval {
    type: code
    label: "Record legal approval"
    code: @ts {
      const analysis = context.nodes.analyze.output
      const review = context.reviews.legal_review || {}
      return {
        status: "approved_by_legal",
        risk_level: analysis.risk_level,
        risks: analysis.risks,
        key_terms: analysis.key_terms,
        contract_type: context.nodes.root.output.contract_type,
        legal_notes: review.notes || ""
      }
    }
  }

  node summary {
    type: code
    label: "Generate summary"
    code: @ts {
      const analysis = context.nodes.analyze.output
      return {
        status: "reviewed",
        risk_level: analysis.risk_level,
        term_count: analysis.key_terms.length,
        risk_count: analysis.risks.length,
        recommendations: analysis.recommendations
      }
    }
  }

  flow {
    root -> analyze
    analyze -> route_risk
    route_risk -["needs_legal"]-> legal_review
    route_risk -["low_risk"]-> summary
    legal_review -> record_approval
  }
}

trigger on_contract {
  form:contract_review -> review_contract
  enabled: true
}

Flow

Trigger to workflow

contract_reviewform
review_contract
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

Workflow nodes

CODE
Code Node
Extract contract
AI
AI Node
Analyze contract
SWITCH
Switch Node
Route by risk
CODE
Code Node
Queue for legal
CODE
Code Node
Record legal approval
CODE
Code Node
Generate summary
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.