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
| Channel | Direction | Authentication |
|---|---|---|
| RSP Gateway | CleverCase → Platform | Service PAT |
| BuilderHub telemetry | CleverCase → Platform | Service PAT |
| Iorek ask | CleverCase → Platform | Service PAT |
| CleverCase REST | Platform → CleverCase | RAK_CLEVERCASE_SERVICE_KEY |
| MCP tools | Cursor → Platform | MCP env + PAT |
Forbidden patterns:
importfromrakontevr/src/**- Raw
localhost:1234LM Studio calls - Hardcoded platform URLs outside
.rakontevr/tenant.json
RSP Gateway
The Gateway is the single front door for AI inference. It handles:
| Responsibility | Detail |
|---|---|
| Authentication | Resolves org from PAT scopeType: org |
| Prompt shaping | System prompts, team context, policies |
| Metering | Inserts usage_records with traceId |
| Provider routing | ProviderRegistry → Iorek tier policy |
| Response headers | Echoes X-Trace-Id, X-Rak-Provider |
Gateway URLs by environment
| Environment | URL |
|---|---|
| Production hosted | https://gateway.rakontevr.ai/v1 |
| Tailscale | Team internal host |
| Local daemon | http://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:
- Unified agent — orchestrates persona + domain + surface context for Gladys
- Telemetry ingestion —
POST /api/builderhub/apps/{appId}/telemetry - AppKit hosting — Business Studio and Agent Studio embed points
Required scopes from provisioning:
clevercase:read
clevercase:write
inferenceIorek 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.
| Concept | CleverCase value |
|---|---|
personaId | gladys |
domain | legal |
surface | clevercase-experience |
| Default tier | goliath |
| Default virtual model | iorek |
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)
| Tool | Purpose |
|---|---|
rsp_stories | Backlog from PostgreSQL |
rsp_execute_tenant | Tenant-scoped pipeline run |
rsp_check | Phase gate verification |
rsp_audit | False-positive detection |
ai_query | Routed inference |
rsp_ask_iorek | Legal domain Q&A |
business_rules_search | Domain rule lookup |
cursor_doctor | Setup health check |
gateway_status | Gateway reachability |
Blocked tools (platform operator)
rsp_execute, dgx_fleet_status, fleet_*, deploy tools, rsp_security_scan
Setup writes .cursor/mcp.json:
clevercase setupMCP 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:
| Surface | Enforcement |
|---|---|
| worker | Sealed env at boot |
| gateway | Sanitized inference responses |
| mcp | Tenant tool allowlist |
| sdk | PAT-scoped telemetry |
CleverCase compliance mode adds:
dataClassification: legal-privilegedrequireNimPiiScan: truecloudOffloadRequiresMasking: true- Standards: SOC 2, HIPAA, ABA 1.6
Provisioning lifecycle
Verify: rak client verify-access --email you@clevercase.com --tenant clevercase
Packages and plugins
| Artifact | Location | Role |
|---|---|---|
@clevercase/rak-plugin | packages/rak-plugin-clevercase/ | Schema, migrations, Shield |
| Cursor plugin | packages/cursor-plugin-clevercase/ | Rules, skills, commands |
| Vendored SDK | vendor/rakontevr/sdk/ | Telemetry client |
| Tenant manifest | .rakontevr/tenant.json | Id, gateway, key ref |
Previous: Domain Model · Next: Chapter 5 — Data Flows