{
  "title": "StackBuilder — public composition schema",
  "version": "1.0",
  "site": "https://stackbuilder.layer2c.com",
  "about": "StackBuilder is the deterministic composition layer of the Layer2C research system. It reads the graded Layer2C assessments (4+1 vendor authority, scored with DAPM) and Fourth Cloud readiness, composes vendors layer-by-layer, and computes two whole-design signals the per-layer grades cannot show: Design Risk and the Reasoning Dependency Index (RDI). This file documents the inputs it accepts, the deterministic composition rules, and the exact output shape. Capability and authority are QUOTED from the canon and never generated; the model narrates the result, it never determines it. StackBuilder NEVER re-grades an assessment.",
  "relatedSurfaces": {
    "componentsList": "https://stackbuilder.layer2c.com/components.json",
    "exampleReports": "https://stackbuilder.layer2c.com/example-composition.json",
    "reproducibilitySpec": "https://stackbuilder.layer2c.com/stackbuilder-reproducibility.json",
    "humanReadable": "https://stackbuilder.layer2c.com/llms.txt",
    "canon4plus1": "https://layer2c.com/llms.txt",
    "fourthCloud": "https://cloud.layer2c.com/llms.txt",
    "systemMap": "https://layer2c.com/system"
  },
  "reproducibility": "The exact composition and scoring logic — the pick algorithm per objective, anchor/tie handling, affinity-lock, and the precise Design Risk and RDI formulas — is published at /stackbuilder-reproducibility.json so another agent can reconstruct a stack and verify every derived signal.",
  "savedRoadmaps": {
    "stored": "The KNOBS (inputs: vendors/deployment, objective, pinned, excluded, assign, and the resolved anchor) plus a name; not the composed output and not a grade version. Requires a signed-in account.",
    "onReopen": "Re-derived from current grades via the same deterministic algorithm, using the saved anchor to keep tie-breaks stable.",
    "assessmentUpdate": "Grades are read live, so a re-graded assessment flows into a saved roadmap on reopen. Roadmaps are reproducible by input, not frozen by version.",
    "recompute": "Any change to the selections recomposes the whole stack deterministically."
  },
  "endpoints": {
    "compose": {
      "method": "POST",
      "path": "/api/v1/stackbuilder/compose",
      "public": true,
      "summary": "Deterministic layer-by-layer composition. Supply either an explicit vendor list or a deployment preference.",
      "input": {
        "oneOfRequired": ["vendors", "deployment"],
        "properties": {
          "vendors": { "type": "array", "items": "vendorId", "description": "Explicit (curated) vendor set to compose from. A curated pick lets a specialist that is STRICTLY stronger than the base win its layer (best-of-breed)." },
          "deployment": { "enum": ["public", "private", "hybrid"], "description": "Auto-compose within a deployment world. 'hybrid' applies the data-home / cloud-above per-layer split (foundation + data plane private; operational + reasoning + apps public) so it genuinely spans both worlds." },
          "objective": { "enum": ["capability", "authority", "balanced"], "default": "capability", "description": "capability = maximize capability; authority = keep the most retained authority among adequate vendors; balanced = capability weighted, rewarding retained authority." },
          "pinned": { "type": "array", "items": "vendorId", "description": "Existing/preferred vendors; anchored at any layer where they are adequate (moderate+)." },
          "excluded": { "type": "array", "items": "vendorId", "description": "Vendors the buyer rules out. An explicit veto wins even over a pin." },
          "assign": { "type": "object", "description": "{layerId: vendorId} — PLACE a specific vendor at a specific layer, overriding the grade pick. Refused (never faked) if that vendor is a gap there." },
          "anchor": { "type": "vendorId", "description": "Pins the coherence tie-break so a composition reproduces exactly. When omitted, one anchor is chosen at random among the equally-graded leaders (tie-breaks only; never overrides a real grade difference)." }
        }
      },
      "returns": "CompositionResult"
    },
    "wizard": {
      "method": "POST",
      "path": "/api/v1/stackbuilder/wizard",
      "public": true,
      "summary": "Outcome-driven entry: maps buyer outcomes/pains to priority 4+1 layers and an authority lean, then composes. It makes the buyer PLACE their authority; it does not loan composition judgment.",
      "input": {
        "properties": {
          "deployment": { "enum": ["public", "private", "hybrid", null] },
          "outcomes": { "type": "array", "items": { "enum": ["compliance_governance", "security_access", "autonomous_operations", "cost_optimization", "performance_sla", "developer_velocity"] } },
          "painPoints": { "type": "array", "items": { "enum": ["compliance_violations", "agent_data_access", "cross_region_latency", "manual_scaling", "high_egress_costs", "no_cost_visibility", "poor_gpu_util", "dev_blocked_on_infra"] } },
          "pinned": { "type": "array", "items": "vendorId" }
        }
      },
      "returns": "{ roadmap: CompositionResult, requirements: { priorityLayers, objective, needs2c } }"
    },
    "vendors": {
      "method": "GET",
      "path": "/api/v1/stackbuilder/vendors",
      "public": true,
      "summary": "The available stack components: every vendor with kind, deployment, Fourth-Cloud flag, and its 4+1 layer-status row. Frozen snapshot at /components.json.",
      "returns": "{ vendors: VendorProfile[] }"
    }
  },
  "enums": {
    "layer": ["layer0", "layer1a", "layer1b", "layer1c", "layer2a", "layer2b", "layer2c", "layer3"],
    "status": { "strong": "strong native capability", "moderate": "adequate capability", "partner": "via partner ecosystem", "gap": "no graded capability — buyer owns the layer" },
    "authority": { "Retained": "buyer owns and controls it", "Delegated": "substitutable partner; buyer keeps swap authority", "Ceded": "vendor controls it; buyer consumes without governance authority" },
    "vendorKind": { "platform": "adopt one whole ecosystem; at most one base platform per world (affinity-lock)", "specialist": "supplements a base at its strongest layers; never a base" },
    "objective": ["capability", "authority", "balanced"],
    "deployment": ["public", "private", "hybrid"],
    "designRiskLevel": ["low", "moderate", "high"],
    "rdiLevel": ["low", "moderate", "high"]
  },
  "output": {
    "$id": "CompositionResult",
    "type": "object",
    "description": "The deterministic composition. Every capability/authority value is quoted from the canon.",
    "properties": {
      "vendors": { "type": "array", "description": "The eligible vendor ids the composition drew from." },
      "objective": { "enum": ["capability", "authority", "balanced"] },
      "pinned": { "type": "array" },
      "excluded": { "type": "array" },
      "assign": { "type": "object", "description": "Honored {layerId: vendorId} placements." },
      "assignmentsRefused": { "type": "array", "items": { "layerId": "string", "vendorId": "string", "reason": "excluded | gap" }, "description": "Placements the engine refused because the vendor is excluded or is a gap at that layer. Missing evidence stays visible; capability is never manufactured." },
      "anchor": { "type": "vendorId | null", "description": "The coherence vendor the stack converged on." },
      "layers": {
        "type": "array",
        "description": "One entry per 4+1 layer, in order.",
        "items": {
          "layerId": "one of enums.layer",
          "label": "e.g. 'Layer 2C'",
          "shortName": "e.g. 'Reasoning'",
          "contributor": "vendorId that holds this layer, or null for a gap",
          "status": "one of enums.status",
          "authority": "one of enums.authority — INHERITED from the contributing vendor's cell",
          "citationUrl": "link to the source assessment cell on layer2c.com",
          "fromExisting": "true if the contributor was a pinned/existing vendor",
          "assigned": "true if placed by an explicit assign",
          "kind": "contributor's vendorKind",
          "note": "present only on a gap: 'no eligible vendor — the buyer owns this layer'"
        }
      },
      "coverage": { "type": "string", "description": "'N/8' layers with a graded contributor." },
      "gaps": { "type": "array", "description": "layerIds with no eligible vendor — the buyer owns them." },
      "fromExistingCount": { "type": "integer" },
      "supplementCount": { "type": "integer" },
      "stitching": { "type": "object | null", "description": "Present when more than one vendor contributes: { authority: 'Retained', note }. The integration seam across vendors is the one thing the buyer always Retains, because you own the glue." },
      "fourthCloud": { "type": "array", "items": { "vendor": "vendorId", "entityId": "string", "fcReasoningScore": "number (FC-2C 0–4)", "citationUrl": "string" }, "description": "Fourth Cloud sustainability read for contributors whose entity has an FC record. Never merged into the 4+1 view; the two models are not isomorphic." },
      "designRisk": {
        "type": "object",
        "description": "Whole-design integration risk the per-layer grades cannot show.",
        "properties": {
          "level": "low | moderate | high",
          "vendors": "count of distinct contributors",
          "seams": "integration seams = max(0, vendors - 1)",
          "competingPlatforms": "names of 2+ base platforms each holding 2+ layers — two ecosystems stitched together, the 'wouldn't work as laid out' signal",
          "crossVendorDependencies": { "items": { "dependency": "string", "fromVendor": "string", "toVendor": "string" }, "description": "Critical 4+1 feeds into the Reasoning Plane (1A→2C governance, 2A→2C telemetry, 2B→2C SLA) that cross a vendor seam the buyer must build." },
          "control": { "kept": "layers not Ceded", "ceded": "layers Ceded" },
          "weakLayers": "count of moderate/partner layers"
        },
        "levelRule": "high if competing platforms exist OR 2+ cross-vendor 2C dependencies; moderate if any cross-vendor 2C dependency OR 3+ seams; else low."
      },
      "reasoningDependency": {
        "type": "object",
        "description": "RDI — the '2C signal'. How much autonomous runtime judgment the stack is built to exercise (capacity), independent of who owns it. Ownership is reported beside the level (DAPM's question), never folded into it; ceding is a placement, not an absence.",
        "properties": {
          "level": "low | moderate | high",
          "reasoningPlane": "layer2c status, or 'gap'",
          "reasoningAuthority": "layer2c authority (DAPM)",
          "reasoningVendor": "name of the 2C contributor",
          "acts": "true if an application/agent layer (L3) executes",
          "ungoverned": "true if the stack acts (L3) with no reasoning plane governing it",
          "autonomousLayers": { "owned": "Retained", "shared": "Delegated", "ceded": "Ceded", "total": "graded autonomous layers (2A/2B/2C/3)" }
        },
        "levelRule": "high if a reasoning plane exists and the stack acts, or it acts ungoverned; moderate if it reasons but does not act, or acts on a weak plane; else low."
      }
    }
  },
  "determinism": "Given identical inputs, StackBuilder produces identical architectures. Tie-breaks are pinned by the coherence `anchor`, which is reproducible when supplied and chosen at random among equally-graded leaders otherwise (never overriding a real grade difference).",
  "howItReasons": {
    "onePerLayer": "Exactly one vendor contributes each layer — the best graded pick under the objective. Multiple vendors do not co-satisfy a single layer; a specialist supplements the base only at the layers where it is the pick.",
    "tieHandling": "Ties break toward the chosen anchor (coherence), then whole-stack coverage (prefer the more complete vendor), then retained authority. For the authority objective, retained authority leads among adequate-capability vendors.",
    "overrides": "The buyer can steer: `pinned` prefers a vendor (anchored where adequate), `excluded` vetoes one (a veto beats a pin), and `assign` places a specific vendor at a layer. An assign is refused if that vendor is a gap there — the engine will not manufacture capability.",
    "provenance": "Every composed layer carries a citationUrl to its source assessment cell; grades are never altered. The reference reports at /example-composition.json extend each layer's evidence chain to the hands-on Lab (labs.layer2c.com) that validated that vendor at that layer, where one exists.",
    "whatItNeverDoes": "It never re-grades an assessment, never infers unsupported capability, and never hides a gap — a layer with no eligible vendor is reported as the buyer's to own."
  },
  "compositionRules": [
    "Deterministic: capability and authority come from the graded assessments, quoted, never generated. The LLM narrates the result; it does not determine it.",
    "Authority is INHERITED from the contributing vendor's cell. The only thing the buyer RETAINS by composing is the stitching (the integration seam), which exists whenever more than one vendor contributes.",
    "Affinity-lock: a composition adopts at most ONE base platform per deployment world; specialists supplement it. Two competing platforms are never stitched together — a composition that ends up with two is flagged in designRisk.competingPlatforms.",
    "The critical cross-layer feeds into the Reasoning Plane (1A→2C, 2A→2C, 2B→2C) are where strong-on-paper capability is only realized by building integration. When those layers are different vendors, the feed crosses a seam the buyer must build and own.",
    "An explicit assign is refused (never faked) if the vendor is a gap at that layer: the engine cannot manufacture capability that is not graded.",
    "A gap layer becomes the buyer's: authority Retained, note that the buyer owns it. Missing evidence stays visible rather than filled in by model confidence."
  ],
  "provenance": [
    "StackBuilder composes from assessed evidence; it never re-grades a vendor assessment. Grades travel here unchanged from layer2c.com and cloud.layer2c.com.",
    "Every composed layer carries a citationUrl back to the source assessment cell.",
    "Recommendations are bounded by available assessments and methodology. StackBuilder is an educational instrument that names the trade (the control you cede, the gaps you own, the integration effort you carry) to sharpen a conversation with an architect, not to replace one.",
    "Layer2C is an independent research system. Assessments are opinionated analyses, not certifications, paid rankings, procurement recommendations, or permanent conclusions."
  ],
  "publisher": "The CTO Advisor LLC · https://thectoadvisor.com"
}
