Home/Docs/Schemas
Canonical JSON schemas

Schemas. The shape of every object the hub publishes.

This page is schemas only. Architecture lives in /components. Sensitive-data handling lives in /privacy-boundary. The threat model lives in /harness. This page won’t duplicate them.

01 · Knowledge-pack schema

pack@1

Manifest, claims, citations, eval cases, signing block. Versioned with semver. Older versions remain pullable.

{
  "$schema": "https://duecare-ai.com/schema/pack/1.json",
  "id": "npl-qat-construction",
  "version": "1.4.0",
  "manifest": {
    "corridor": { "source": "NPL", "host": "QAT" },
    "sector": "construction",
    "languages": ["en", "ne"],
    "license": "CC-BY-4.0"
  },
  "claims": [
    {
      "id": "fee.cap",
      "text": "Recruitment-fee cap is X for this corridor.",
      "value_type": "amount",
      "citations": ["src.gov.qat.wpsupdate.2026-04"]
    }
  ],
  "citations": {
    "src.gov.qat.wpsupdate.2026-04": {
      "url": "https://www.adlsa.gov.qa/...",
      "hash": "sha256:6f1c…b042",
      "retrieved": "2026-04-12T08:21:00Z",
      "publisher": "Ministry of Labour, Qatar"
    }
  },
  "evals": [
    { "id": "fee.cap.basic", "input": "...", "expect": { "claim": "fee.cap" } }
  ],
  "signing": {
    "key_id": "k.maharjan",
    "alg": "ed25519",
    "signature": "base64:..."
  }
}
02 · Tools-registry schema

tool@1

Per-tool descriptor with JSON-schema args, output schema, test cases, version history.

{
  "$schema": "https://duecare-ai.com/schema/tool/1.json",
  "id": "employer.lookup_license",
  "version": "1.0.0",
  "description": "Look up a host-country employer license number against the public licensing register.",
  "args_schema": { "type": "object", "required": ["country","license_id"],
    "properties": { "country": {"type":"string"}, "license_id": {"type":"string"} } },
  "output_schema": { "type":"object",
    "properties": { "valid": {"type":"boolean"}, "expires": {"type":"string","format":"date"}, "source_url": {"type":"string"} } },
  "tests": [
    { "args": {"country":"QAT","license_id":"L-998822"}, "expect": { "valid": true } }
  ],
  "side_effects": "none",
  "rate_limit": "10/min/key",
  "signing": { "key_id": "k.maharjan", "alg": "ed25519", "signature": "base64:..." }
}
03 · Anonymized-signal schema

signal@1

The only category of opt-in data the hub receives. Schema enforces no PII columns.

{
  "$schema": "https://duecare-ai.com/schema/signal/1.json",
  "pattern_id": "fee_request",
  "corridor": { "source": "NPL", "host": "QAT" },
  "sector": "construction",
  "week": "2026-W16",
  "k_floor": 30,
  "deployment_id": "deploy:8c2",
  "opt_in": true
}

There is no worker_id, name, contact, employer, document, message, or free-text field in this schema, by design. The gateway rejects payloads that include unknown fields.

04 · Audit-feed event

audit@1

Append-only event format. Every write emits one row before the corresponding read becomes resolvable.

{
  "$schema": "https://duecare-ai.com/schema/audit/1.json",
  "ts": "2026-04-22T14:02:11.034Z",
  "verb": "PACK_PULL",
  "object": { "kind": "pack", "id": "npl-qat-construction", "version": "1.4.0" },
  "actor": { "kind": "api_anon" },
  "batch_id": "batch:2026-04-22-09",
  "batch_signature": "base64:..."
}
05 · Feedback receipt

feedback@1

Returned from the email gateway after the server-side PII detector clears an inbound message.

{
  "$schema": "https://duecare-ai.com/schema/feedback/1.json",
  "ticket_id": "tk-2026-04-22-0091",
  "type": "pack_feedback",
  "subtype": "citation",
  "affected": { "pack": "npl-qat-construction", "version": "1.3.0" },
  "reviewing_curator": "k.maharjan",
  "first_reply_due": "2026-04-25",
  "queue_url": "/api/hub/feedback/tk-2026-04-22-0091"
}
06 · KnowledgeObject base envelope

KnowledgeObject@1 — JSON-LD shape every pack and submission descends from

Defined in apps/duecare-ai.com/app/schema.py. The schema.org-style envelope carries identity + provenance + vetting + an open extensions dict; subtypes (ContextPack / GrepRulePack / ToolPack / ContactPack / RubricPack / EvalPromptPack / TrainingExamplePack) specialize the content payload.

{
  "@context": "https://duecare-ai.com/schema/v1",
  "@type": "ContextPack",
  "id": "phl-kwt-domestic",
  "version": "1.7.2",
  "schema_version": 1,
  "status": "vetted",
  "jurisdictions": ["PHL", "KWT"],
  "corridors": ["PHL-KWT"],
  "tags": ["domestic-work", "fees"],
  "source": {"kind": "public_url", "url": "https://gov.example/..."},
  "provenance": {
    "submitted_by": "automation:public_source_crawler",
    "vetted_by": "curator:k.maharjan",
    "vetted_at": "2026-04-12T09:14:00Z"
  },
  "content_hash": "sha256:9ab3...",
  "content": { /* shape varies by @type */ },
  "extensions": { "partner.policy_id": "..." }
}

Partners can add <vendor>.<key> fields to extensions without forking the schema. Validators enforce only the core envelope.

07 · v1.0 BundleEnvelope

bundle@1.0 — the Kaggle kernel emit contract

Every Kaggle kernel that writes JSON to /kaggle/working/ uses this envelope. Defined as a Pydantic v2 model in duecare.appendix_primitives.envelopes; full spec in docs/data_primitives.md. Helper write_v1_bundle() emits the 4-file artifact set (results.json + run.jsonl + metadata.json + bundle.zip with sha256 checksums) in one call.

{
  "schema_version": "1.0",
  "kernel_id": "a-19-multilingual-demo",
  "run_id": "a19_multilingual_2026-05-12T19-30-00Z",
  "config": {"n_languages": 5},
  "metadata": {
    "shared_citations": ["ILO C181", "POEA MC 14-2017 (PH)", "RA 8042 (PH)"]
  },
  "summary": {"n_languages": 5},
  "results": [
    {
      "row_id": "TL",
      "prompt_text": "Magkano ang placement fee para sa Hong Kong domestic worker?",
      "response": "Walang placement fee. Sec. 3 ng POEA MC 14-2017...",
      "elapsed_s": 0.0,
      "citations": ["ILO C181", "POEA MC 14-2017 (PH)", "RA 8042 (PH)"],
      "error": null
    }
  ]
}

Four reference kernels (A-19 multilingual, A-21 long-context, A-22 streaming, A-23 Coordinator) use the canonical write_v1_bundle() path. A static audit check (bundle_envelope_v1 in scripts/validate_public_surface.py) verifies every kernel.py conforms.

08 · Schema versioning

One schema per object kind. Semver-pinned. Old versions stay resolvable.

Schemas are published at /schema/<kind>/<major>.json. A new major ships only when a breaking change is unavoidable; old majors continue to validate historical artifacts.

Back to Docs →

KnowledgeObject taxonomy

One canonical envelope, 7 branches, 28 leaves. Every reusable artefact -- regex rule, retrieval doc, citation edge, persona prompt, tool definition, fact template, schema -- ships in the same shape so it round-trips across kernel, hub, and export ZIP.

matching_knowledge
pattern -> label / indicator
grep_rule · glob_rule · classifier_rule · heuristic_rule
grounding_knowledge
what's the law / norm / reference?
rag_doc · citation_edge · corridor_profile · ngo_directory
reasoning_knowledge
how should the model think?
persona_block · context_snippet · reasoning_step · rubric_dimension · modus_operandi
evaluation_knowledge
how do we test behavior?
evaluation_dimension · evaluation_prompt · evaluation_metric · evaluation_weighting
tool_knowledge
what can the model call?
tool_definition · tool_example · tool_chain
input_knowledge
what should be uploaded or extracted?
fact_template · extracted_fact · entity_signal · upload_schema · prompt_template
output_knowledge
what gets emitted?
envelope_schema · audit_template · submission_schema

Canonical spec: docs/knowledge_module_schema.md. Decision record: ADR-007. Runtime hierarchy: GET /api/knowledge/taxonomy on any running kernel. Type details: GET /api/knowledge/type-catalog.