CleverCase

Platform Deep Dive

Gateway, MCP, RSP, BuilderHub, Shield, and the tenant client contract — a narrative walkthrough of the Rakontevr platform boundary.

Platform Deep Dive

CleverCase as a platform client

CleverCase V2 does not embed the Rakontevr platform. It calls the platform — the same way a mobile app calls a backend API. This separation is enforced at the git boundary: the CleverCase repo is standalone; the Rakontevr monorepo is a separate repository operated by Rakontevr engineering.

Understanding the platform contract is essential for Gravis Law developers because every AI query, every MCP tool invocation, and every RSP pipeline run crosses this boundary.


The integration contract

ChannelDirectionAuthentication
RSP GatewayCleverCase → PlatformService PAT
BuilderHub telemetryCleverCase → PlatformService PAT
Iorek askCleverCase → PlatformService PAT
CleverCase RESTPlatform → CleverCaseRAK_CLEVERCASE_SERVICE_KEY
MCP toolsCursor → PlatformMCP env + PAT

Forbidden patterns:

  • import from rakontevr/src/**
  • Raw localhost:1234 LM Studio calls
  • Hardcoded platform URLs outside .rakontevr/tenant.json

RSP Gateway

The Gateway is the single front door for AI inference. It handles:

ResponsibilityDetail
AuthenticationResolves org from PAT scopeType: org
Prompt shapingSystem prompts, team context, policies
MeteringInserts usage_records with traceId
Provider routingProviderRegistry → Iorek tier policy
Response headersEchoes X-Trace-Id, X-Rak-Provider

Gateway URLs by environment

EnvironmentURL
Production hostedhttps://gateway.rakontevr.ai/v1
TailscaleTeam internal host
Local daemonhttp://localhost:4242/v1

Cursor BYOK chat completions appear in usage_records as task_type = 'cursor-gateway'.


BuilderHub

BuilderHub registers CleverCase as application app_clevercase. Route surface prefix: /builderhub/experiences/clevercase.

BuilderHub provides:

  1. Unified agent — orchestrates persona + domain + surface context for Gladys
  2. Telemetry ingestion — POST /api/builderhub/apps/{appId}/telemetry
  3. AppKit hosting — Business Studio and Agent Studio embed points

Required scopes from provisioning:

clevercase:read
clevercase:write
inference

Iorek engine

Iorek is the inference engine — tier routing, virtual models, composer loops, and latency traces. Gladys is a persona on Iorek, not a separate model.

ConceptCleverCase value
personaIdgladys
domainlegal
surfaceclevercase-experience
Default tiergoliath
Default virtual modeliorek

MCP equivalent:

rsp_ask_iorek({
  question: "...",
  personaId: "gladys",
  tenantId: "00000000-0000-4000-a000-000000000003",
  domain: "legal"
})

MCP — Cursor as thin client

The MCP server exposes a tenant-scoped tool catalog to Cursor agents. CleverCase orgs get the client preset — a reduced catalog without fleet/dispatch operator tools.

Allowed tools (representative)

ToolPurpose
rsp_storiesBacklog from PostgreSQL
rsp_execute_tenantTenant-scoped pipeline run
rsp_checkPhase gate verification
rsp_auditFalse-positive detection
ai_queryRouted inference
rsp_ask_iorekLegal domain Q&A
business_rules_searchDomain rule lookup
cursor_doctorSetup health check
gateway_statusGateway reachability

Blocked tools (platform operator)

rsp_execute, dgx_fleet_status, fleet_*, deploy tools, rsp_security_scan

Setup writes .cursor/mcp.json:

clevercase setup

MCP audit log: .rakontevr/logs/mcp-tool-audit.jsonl


RSP — Story-First Pipeline

The Rakontevr Story-First Pipeline (RSP) is how CleverCase proves feature delivery:

CleverCase uses rsp_execute_tenant — not platform rsp_execute. Runs record tenantId = 00000000-0000-4000-a000-000000000003.

A run is only complete when phases 0–9 are all completed or skipped. Status alone is not proof — verify with rsp_audit.


Shield V2 on the platform boundary

Shield V2 spans four surfaces declared in rak-plugin.json:

SurfaceEnforcement
workerSealed env at boot
gatewaySanitized inference responses
mcpTenant tool allowlist
sdkPAT-scoped telemetry

CleverCase compliance mode adds:

  • dataClassification: legal-privileged
  • requireNimPiiScan: true
  • cloudOffloadRequiresMasking: true
  • Standards: SOC 2, HIPAA, ABA 1.6

Provisioning lifecycle

Verify: rak client verify-access --email you@clevercase.com --tenant clevercase


Packages and plugins

ArtifactLocationRole
@clevercase/rak-pluginpackages/rak-plugin-clevercase/Schema, migrations, Shield
Cursor pluginpackages/cursor-plugin-clevercase/Rules, skills, commands
Vendored SDKvendor/rakontevr/sdk/Telemetry client
Tenant manifest.rakontevr/tenant.jsonId, gateway, key ref

Previous: Domain Model · Next: Chapter 5 — Data Flows

On this page