// @bun
var F=Object.defineProperty;var G=(A)=>A;function H(A,B){this[A]=G.bind(null,B)}var J=(A,B)=>{for(var D in B)F(A,D,{get:B[D],enumerable:!0,configurable:!0,set:H.bind(B,D)})};var K=(A,B)=>()=>(A&&(B=A(A=0)),B);import E from"@contractspec/lib.ui-link";import{ChevronRight as I}from"lucide-react";import{jsx as q,jsxs as z}from"react/jsx-runtime";function P(){return z("div",{className:"space-y-8",children:[z("div",{className:"space-y-4",children:[q("h1",{className:"font-bold text-4xl",children:"Knowledge Categories"}),q("p",{className:"text-muted-foreground",children:"ContractSpec classifies knowledge into four categories based on trust level, source authority, and intended use. This classification determines how knowledge can be used in workflows, policy decisions, and agent responses."})]}),z("div",{className:"space-y-4",children:[q("h2",{className:"font-bold text-2xl",children:"The four categories"}),q("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:q("pre",{children:`type KnowledgeCategory =
  | "canonical"   // Internal ground truth
  | "operational" // Internal operational docs
  | "external"    // Third-party reference
  | "ephemeral";  // Temporary context`})})]}),z("div",{className:"space-y-6",children:[z("div",{className:"space-y-4",children:[q("h3",{className:"font-semibold text-xl",children:"1. Canonical"}),z("p",{className:"text-muted-foreground",children:[q("strong",{children:"Trust level:"})," Highest - Authoritative ground truth"]}),z("div",{className:"space-y-3",children:[z("div",{children:[q("h4",{className:"mb-2 font-semibold text-sm",children:"What it contains:"}),z("ul",{className:"ml-4 list-inside list-disc space-y-1 text-muted-foreground text-sm",children:[q("li",{children:"Official product specifications and schemas"}),q("li",{children:"Company policies and procedures"}),q("li",{children:"Legal terms and compliance requirements"}),q("li",{children:"Pricing rules and business logic"}),q("li",{children:"Data classification and security policies"})]})]}),z("div",{children:[q("h4",{className:"mb-2 font-semibold text-sm",children:"How it's used:"}),z("ul",{className:"ml-4 list-inside list-disc space-y-1 text-muted-foreground text-sm",children:[z("li",{children:[q("strong",{children:"Policy decisions"})," - Can drive PDP decisions"]}),z("li",{children:[q("strong",{children:"Validation"})," - Used to validate user inputs and operations"]}),z("li",{children:[q("strong",{children:"Code generation"})," - Source of truth for generated code"]}),z("li",{children:[q("strong",{children:"Compliance"})," - Reference for audit and regulatory checks"]})]})]}),z("div",{children:[q("h4",{className:"mb-2 font-semibold text-sm",children:"Examples:"}),q("div",{className:"overflow-x-auto rounded border border-border bg-background/50 p-3 font-mono text-muted-foreground text-xs",children:q("pre",{children:`// Product Canon space
{
  id: "product-canon",
  category: "canonical",
  sources: [
    "database-schema.sql",
    "product-catalog.yaml",
    "pricing-rules.json"
  ]
}

// Policy Canon space
{
  id: "policy-canon",
  category: "canonical",
  sources: [
    "data-classification.yaml",
    "access-policies.rego",
    "compliance-requirements.md"
  ]
}`})})]}),q("div",{className:"card-subtle border-violet-500/30 bg-violet-500/10 p-3",children:z("p",{className:"text-sm text-violet-300",children:[q("strong",{children:"\u26A0\uFE0F Important:"})," Canonical knowledge is immutable once indexed. Changes require re-sync and versioning."]})})]})]}),z("div",{className:"space-y-4",children:[q("h3",{className:"font-semibold text-xl",children:"2. Operational"}),z("p",{className:"text-muted-foreground",children:[q("strong",{children:"Trust level:"})," High - Internal but not authoritative"]}),z("div",{className:"space-y-3",children:[z("div",{children:[q("h4",{className:"mb-2 font-semibold text-sm",children:"What it contains:"}),z("ul",{className:"ml-4 list-inside list-disc space-y-1 text-muted-foreground text-sm",children:[q("li",{children:"Support ticket history and resolutions"}),q("li",{children:"Internal runbooks and playbooks"}),q("li",{children:"Sales materials and customer communications"}),q("li",{children:"Product management docs and roadmaps"}),q("li",{children:"Team wikis and knowledge bases"})]})]}),z("div",{children:[q("h4",{className:"mb-2 font-semibold text-sm",children:"How it's used:"}),z("ul",{className:"ml-4 list-inside list-disc space-y-1 text-muted-foreground text-sm",children:[z("li",{children:[q("strong",{children:"Context"})," - Provides helpful context for decisions"]}),z("li",{children:[q("strong",{children:"Suggestions"})," - Informs recommendations, not requirements"]}),z("li",{children:[q("strong",{children:"Learning"})," - Helps agents learn from past interactions"]}),z("li",{children:[q("strong",{children:"Troubleshooting"})," - Guides problem-solving workflows"]})]})]}),z("div",{children:[q("h4",{className:"mb-2 font-semibold text-sm",children:"Examples:"}),q("div",{className:"overflow-x-auto rounded border border-border bg-background/50 p-3 font-mono text-muted-foreground text-xs",children:q("pre",{children:`// Support History space
{
  id: "support-history",
  category: "operational",
  sources: [
    "gmail:support@company.com",
    "zendesk:tickets",
    "slack:support-channel"
  ]
}

// Internal Docs space
{
  id: "internal-docs",
  category: "operational",
  sources: [
    "notion:engineering-wiki",
    "confluence:product-docs",
    "google-drive:runbooks"
  ]
}`})})]})]})]}),z("div",{className:"space-y-4",children:[q("h3",{className:"font-semibold text-xl",children:"3. External"}),z("p",{className:"text-muted-foreground",children:[q("strong",{children:"Trust level:"})," Medium - Reference only"]}),z("div",{className:"space-y-3",children:[z("div",{children:[q("h4",{className:"mb-2 font-semibold text-sm",children:"What it contains:"}),z("ul",{className:"ml-4 list-inside list-disc space-y-1 text-muted-foreground text-sm",children:[q("li",{children:"Third-party integration documentation (Stripe, Twilio)"}),q("li",{children:"Regulatory and compliance documents"}),q("li",{children:"Industry standards and best practices"}),q("li",{children:"Public API documentation"}),q("li",{children:"External knowledge bases"})]})]}),z("div",{children:[q("h4",{className:"mb-2 font-semibold text-sm",children:"How it's used:"}),z("ul",{className:"ml-4 list-inside list-disc space-y-1 text-muted-foreground text-sm",children:[z("li",{children:[q("strong",{children:"Reference"})," - Consulted but not authoritative"]}),z("li",{children:[q("strong",{children:"Integration help"})," - Guides external API usage"]}),z("li",{children:[q("strong",{children:"Compliance context"})," - Provides regulatory background"]}),z("li",{children:[q("strong",{children:"Never for policy"})," - Cannot drive policy decisions"]})]})]}),z("div",{children:[q("h4",{className:"mb-2 font-semibold text-sm",children:"Examples:"}),q("div",{className:"overflow-x-auto rounded border border-border bg-background/50 p-3 font-mono text-muted-foreground text-xs",children:q("pre",{children:`// External Provider Docs space
{
  id: "provider-docs",
  category: "external",
  sources: [
    "url:https://stripe.com/docs",
    "url:https://twilio.com/docs",
    "url:https://openai.com/docs"
  ]
}

// Regulatory Docs space
{
  id: "regulatory-docs",
  category: "external",
  sources: [
    "url:https://gdpr.eu/",
    "url:https://www.hhs.gov/hipaa",
    "pdf:SOC2-requirements.pdf"
  ]
}`})})]}),q("div",{className:"card-subtle border-amber-500/30 bg-amber-500/10 p-3",children:z("p",{className:"text-amber-300 text-sm",children:[q("strong",{children:"\u26A0\uFE0F Note:"}),` External knowledge should be clearly marked in agent responses as "according to [source]" to indicate it's not internal authority.`]})})]})]}),z("div",{className:"space-y-4",children:[q("h3",{className:"font-semibold text-xl",children:"4. Ephemeral"}),z("p",{className:"text-muted-foreground",children:[q("strong",{children:"Trust level:"})," Low - Temporary context only"]}),z("div",{className:"space-y-3",children:[z("div",{children:[q("h4",{className:"mb-2 font-semibold text-sm",children:"What it contains:"}),z("ul",{className:"ml-4 list-inside list-disc space-y-1 text-muted-foreground text-sm",children:[q("li",{children:"Agent conversation history and scratchpads"}),q("li",{children:"Session-specific context and state"}),q("li",{children:"Draft documents and work-in-progress"}),q("li",{children:"Temporary calculations and intermediate results"}),q("li",{children:"User-provided context for current task"})]})]}),z("div",{children:[q("h4",{className:"mb-2 font-semibold text-sm",children:"How it's used:"}),z("ul",{className:"ml-4 list-inside list-disc space-y-1 text-muted-foreground text-sm",children:[z("li",{children:[q("strong",{children:"Session continuity"})," - Maintains conversation context"]}),z("li",{children:[q("strong",{children:"Working memory"})," - Stores intermediate results"]}),z("li",{children:[q("strong",{children:"Never persisted long-term"})," - Auto-purged after session"]}),z("li",{children:[q("strong",{children:"Never for decisions"})," - Cannot influence policy or validation"]})]})]}),z("div",{children:[q("h4",{className:"mb-2 font-semibold text-sm",children:"Examples:"}),q("div",{className:"overflow-x-auto rounded border border-border bg-background/50 p-3 font-mono text-muted-foreground text-xs",children:q("pre",{children:`// Agent Scratchpad space
{
  id: "agent-scratchpad",
  category: "ephemeral",
  retentionPolicy: { days: 1 },
  sources: [
    "session:current-conversation",
    "memory:agent-working-memory"
  ]
}

// User Session space
{
  id: "user-session",
  category: "ephemeral",
  retentionPolicy: { days: 7 },
  sources: [
    "session:user-uploads",
    "session:form-drafts"
  ]
}`})})]}),q("div",{className:"card-subtle border-red-500/30 bg-red-500/10 p-3",children:z("p",{className:"text-red-300 text-sm",children:[q("strong",{children:"\u26A0\uFE0F Critical:"})," Ephemeral knowledge is never used for policy decisions, compliance checks, or any authoritative purpose."]})})]})]})]}),z("div",{className:"space-y-4",children:[q("h2",{className:"font-bold text-2xl",children:"Category comparison"}),q("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:z("table",{className:"w-full text-left text-sm",children:[q("thead",{className:"bg-card/50",children:z("tr",{className:"border-border/50 border-b",children:[q("th",{className:"px-4 py-3 font-semibold",children:"Feature"}),q("th",{className:"px-4 py-3 font-semibold",children:"Canonical"}),q("th",{className:"px-4 py-3 font-semibold",children:"Operational"}),q("th",{className:"px-4 py-3 font-semibold",children:"External"}),q("th",{className:"px-4 py-3 font-semibold",children:"Ephemeral"})]})}),z("tbody",{className:"divide-y divide-border/50",children:[z("tr",{children:[q("td",{className:"px-4 py-3 font-semibold",children:"Trust Level"}),q("td",{className:"px-4 py-3",children:"Highest"}),q("td",{className:"px-4 py-3",children:"High"}),q("td",{className:"px-4 py-3",children:"Medium"}),q("td",{className:"px-4 py-3",children:"Low"})]}),z("tr",{children:[q("td",{className:"px-4 py-3 font-semibold",children:"Policy Impact"}),q("td",{className:"px-4 py-3",children:"\u2705 Can drive decisions"}),q("td",{className:"px-4 py-3",children:"\u26A0\uFE0F Can inform"}),q("td",{className:"px-4 py-3",children:"\u274C Reference only"}),q("td",{className:"px-4 py-3",children:"\u274C Never used"})]}),z("tr",{children:[q("td",{className:"px-4 py-3 font-semibold",children:"Mutability"}),q("td",{className:"px-4 py-3",children:"Immutable"}),q("td",{className:"px-4 py-3",children:"Mutable"}),q("td",{className:"px-4 py-3",children:"Mutable"}),q("td",{className:"px-4 py-3",children:"Temporary"})]}),z("tr",{children:[q("td",{className:"px-4 py-3 font-semibold",children:"Retention"}),q("td",{className:"px-4 py-3",children:"Permanent"}),q("td",{className:"px-4 py-3",children:"Long-term"}),q("td",{className:"px-4 py-3",children:"Long-term"}),q("td",{className:"px-4 py-3",children:"Short-term"})]}),z("tr",{children:[q("td",{className:"px-4 py-3 font-semibold",children:"Audit Level"}),q("td",{className:"px-4 py-3",children:"Full audit"}),q("td",{className:"px-4 py-3",children:"Full audit"}),q("td",{className:"px-4 py-3",children:"Basic audit"}),q("td",{className:"px-4 py-3",children:"Minimal audit"})]})]})]})})]}),z("div",{className:"space-y-4",children:[q("h2",{className:"font-bold text-2xl",children:"Best practices"}),z("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[q("li",{children:"Use canonical for anything that affects policy, pricing, or compliance"}),q("li",{children:"Use operational for context that helps but doesn't dictate decisions"}),q("li",{children:"Use external for reference material that's helpful but not authoritative"}),q("li",{children:"Use ephemeral for temporary working memory that shouldn't persist"}),q("li",{children:"Never mix categories in a single knowledge space - keep them separate"}),q("li",{children:"Document the category and purpose of each knowledge space clearly"})]})]}),z("div",{className:"flex items-center gap-4 pt-4",children:[q(E,{href:"/docs/knowledge",className:"btn-ghost",children:"Back to Knowledge"}),z(E,{href:"/docs/knowledge/spaces",className:"btn-primary",children:["Knowledge Spaces ",q(I,{size:16})]})]})]})}export{P as KnowledgeCategoriesPage};
