Schema Documentation

The canonical implementation lives in src/lib/ncp/schema.ts. Use https://ncplabs-web--ncplabs.us-central1.hosted.app/api/ncp/validate to validate and persist NCP triggers. Use https://ncplabs-web--ncplabs.us-central1.hosted.app/api/ncp/schema for machine-readable schema metadata and allowed values.

{
  "metadata_endpoint": "https://ncplabs-web--ncplabs.us-central1.hosted.app/api/ncp/schema",
  "validator_endpoint": "https://ncplabs-web--ncplabs.us-central1.hosted.app/api/ncp/validate",
  "ncp_version": "0.1",
  "allowed_values": {
    "severity": [
      "critical",
      "high",
      "medium",
      "low",
      "info",
      "opportunity"
    ],
    "sensitivity": [
      "public",
      "internal",
      "private",
      "financial",
      "legal",
      "security",
      "secret",
      "family",
      "health"
    ],
    "urgency": [
      "interrupt_now",
      "same_hour",
      "daily_digest",
      "weekly_digest",
      "log_only"
    ],
    "channels": [
      "app",
      "email",
      "sms",
      "push",
      "webhook",
      "local"
    ],
    "context_ref_types": [
      "url",
      "mcp",
      "file",
      "database",
      "api",
      "local"
    ]
  }
}
{
  "ncp_version": "0.1",
  "type": "trigger",
  "id": "trg_openai_cost_spike_2026_05_23",
  "source": {
    "system": "openai",
    "event_type": "api.usage.spike"
  },
  "timestamp": "2026-05-23T18:42:00Z",
  "domain": "cost_management",
  "subject": "OpenAI API usage spike",
  "summary": "OpenAI API usage increased unusually and may create unexpected project costs.",
  "severity": "high",
  "confidence": 0.96,
  "sensitivity": "financial",
  "personal_relevance": 0.94,
  "evidence": [
    {
      "label": "daily_cost",
      "value": 49,
      "unit": "USD",
      "detail": "Daily usage exceeded normal baseline."
    },
    {
      "label": "projected_monthly_cost",
      "value": 1470,
      "unit": "USD",
      "detail": "Projected if usage continues at same rate."
    }
  ],
  "context_refs": [
    {
      "type": "mcp",
      "ref": "mcp://openai/usage/2026-05-23",
      "description": "OpenAI usage details",
      "sensitivity": "financial"
    }
  ],
  "recommended_route": {
    "agent": "cost_guardian",
    "project": "poclab",
    "domain": "finance.ops"
  },
  "action_contract": {
    "allowed_without_approval": [
      "summarize_usage",
      "identify_likely_source",
      "draft_fix"
    ],
    "requires_approval": [
      "disable_function",
      "rotate_api_key",
      "change_billing_limit"
    ],
    "forbidden": [
      "delete_project"
    ]
  },
  "delivery_policy": {
    "urgency": "same_hour",
    "channels": [
      "app",
      "push"
    ],
    "quiet_hours_respected": false
  },
  "tags": [
    "api",
    "cost",
    "billing",
    "anomaly"
  ]
}