CleverCase

Rakontevr Integration

Full integration map — SDK, Shield, MCP, Gateway, BuilderHub, and Iorek

Rakontevr Integration

CleverCase V2 is a standalone tenant client of the Rakontevr platform. The two codebases communicate only through authenticated HTTP channels — no workspace imports, no shared monorepo paths.

This page maps every integration surface: SDK, Shield, MCP, Gateway, BuilderHub, and Iorek.


Integration map


Approved integration channels

ChannelDirectionAuthPurpose
RSP GatewayCleverCase → RakontevrRAKONTEVR_SERVICE_KEYInference, chat completions
@rakontevr/sdk (vendored)CleverCase → RakontevrSame service PATTelemetry
BuilderHub telemetryCleverCase → RakontevrSame service PATApp usage metering
Iorek /v1/iorek/askCleverCase → RakontevrSame service PATGladys legal Q&A
CleverCase REST APIRakontevr → CleverCaseRAK_CLEVERCASE_SERVICE_KEYPlatform callbacks
MCP toolsCursor → RakontevrMCP env + PATStories, AI, docs, health

Forbidden: importing Rakontevr platform source, calling localhost:1234 LM Studio directly, hardcoding internal URLs outside .rakontevr/tenant.json.


Environment variables

Provisioned by rak client provision-full --client clevercase:

VariablePurpose
RAKONTEVR_SERVICE_KEYPAT for Gateway / BuilderHub / Iorek
RAKONTEVR_GATEWAY_URLGateway base (default: https://gateway.rakontevr.ai/v1)
RAKONTEVR_TENANT_ID00000000-0000-4000-a000-000000000003
RAK_TENANT_IDSame UUID — MCP and RSP attribution
RAK_TENANT_SLUGclevercase
NEXT_PUBLIC_RAKONTEVR_APP_IDBuilderHub app registration

Setup in this repo:

clevercase setup       # writes .cursor/mcp.json + session
clevercase whoami      # verify service key + tenant
rak client verify-access --email you@clevercase.com --tenant clevercase

SDK layer

Vendored at vendor/rakontevr/sdk/. Used for telemetry only — not platform business logic.

Key files:

FileRole
src/lib/clevercase/platform/with-cc-api.tsJSON route wrapper + telemetry
src/lib/clevercase/platform/with-cc-api-stream.tsSSE wrapper (Gladys)
src/lib/clevercase/rakontevr-config.tsServer-side gateway config
src/lib/clevercase/rakontevr-client.tsHTTP client helpers
src/middleware.tsx-cc-trace-id ↔ X-Trace-Id bridge

Gateway

All AI inference routes through the RSP Gateway — including Cursor BYOK chat (taskType: cursor-gateway).

Gateway URLs:

EnvironmentURL
Hosted (default)https://gateway.rakontevr.ai/v1
Tailscale internalTeam-specific (e.g. http://rsp-gateway:4242/v1)
Local daemonhttp://localhost:4242/v1

BuilderHub

BuilderHub registers CleverCase as app app_clevercase with route surface prefix /builderhub/experiences/clevercase.

IntegrationPath / API
Unified agentGladys → personaId gladys, domain legal
TelemetryPer-route withCcApi reports
AppKit surfacesBusiness Studio, Agent Studio via src/lib/clevercase/appkit/

Required API scopes (from provision-full):

  • clevercase:read, clevercase:write
  • inference

Iorek engine

Gladys is a persona on Iorek — not a separate model path.

Call siteEntry
Browser Gladys/api/gladys/stream → streamGladysAsk
MCP legal Q&Arsp_ask_iorek({ personaId: gladys, domain: legal })
Cursor agentsSame MCP tool with tenant UUID

Virtual model defaults: iorek (use iorek-v4 for NIM-preferred).


MCP (Cursor thin client)

Client orgs receive a reduced MCP catalog (CLIENT_ORG_MCP_TOOLS):

AllowedBlocked (platform-only)
ai_query, ai_statusdgx_fleet_status, fleet_*
rsp_stories, rsp_tasks, rsp_run_statusrsp_execute, rsp_plan_and_dispatch
rsp_check, rsp_audit, rsp_execute_tenantDeploy / rollback tools
docs_*, cursor_doctor, gateway_statusrsp_security_scan
rsp_ask_iorek, business_rules_search
workflow_search, secrets_list

MCP env in .cursor/mcp.json:

{
  "RAK_TENANT_ID": "00000000-0000-4000-a000-000000000003",
  "RAK_TENANT_SLUG": "clevercase",
  "RAK_MCP_PRESET": "client"
}

Audit correlation: .rakontevr/logs/mcp-tool-audit.jsonl includes sessionId, tenantId, rspRunId, storyId.


Shield V2

Declared in rak-plugin.json and enforced across all four surfaces:

SurfaceCleverCase touchpoint
workerDocker worker boot, sealed env
gatewayInference response sanitization
mcpTenant-scoped tool allowlist
sdkPAT-scoped telemetry

Verify: clevercase shield status / clevercase shield audit


RSP pipeline (tenant-scoped)

CleverCase feature delivery flows through the Rakontevr Story-First Pipeline:

StepTool / command
BacklogMCP rsp_stories
Create storyMCP rsp_story_create
Execute (tenant)MCP rsp_execute_tenant — not platform rsp_execute
Phase gateMCP rsp_check
VerifyMCP rsp_audit + phase evidence

Packages in this repo

PackageDescription
packages/rak-plugin-clevercaseDomain plugin — schema, migrations, Shield, MSO RBAC
packages/cursor-plugin-clevercaseCursor rules, skills, slash commands (/cc-rsp, /cc-verify)
vendor/rakontevr/sdkVendored telemetry SDK
vendor/rakontevr/appkit-*BuilderHub UI kit vendored copies

Build plugin: npm run build:rak-plugin


Troubleshooting

SymptomFix
MCP tools missingRe-run clevercase setup; check RAK_TENANT_ID
403 on inferenceService key missing inference scope — re-run provision-full
Gladys 503Set RAKONTEVR_SERVICE_KEY in .env.local
Gateway unreachableUse hosted URL + Tailscale, or rak gateway status
Cross-repo importsRemove — use HTTP integration only

On this page