CONCEPTPlatformCode Ledger (CDA)

Shift left. Shift right.

7-phase session protocol8 MCP toolsClosed loop — pre and post
Definition

CDA catches violations at the PR. MCP prevents them before the first line is written. Same governance record. Both ends.

Where each one acts

Session start
Context assembly
Code generation
PR opened
PASS or BLOCKED
Shift Left — MCPbefore the first line
Shift Right — CDAat PR time
Shift RightShift Right — CDA

Catches violations after code is written, at PR time.

WhenPR opened → diff fetched → entity mapped → Lens evaluation → PASS or BLOCKED
EnforcesCHI scope, Lens criteria, architectural boundaries
OutputGitHub check result (binding, non-optional), session result in Agent Shepherd
Shift LeftShift Left — MCP

Loads design context before the agent writes a line of code.

WhenSession start → context assembly → code generation with validate_diff feedback
ProvidesArchitecture Ledger state, applicable Lenses, Steering context, CHI scope
OutputAgent generates code that already satisfies Lens criteria; BLOCKER findings halt generation immediately

An agent with only CDA is governed after the fact. An agent with MCP is governed from the start. rkito is the only platform that operationalises both.

Every governed agent session. Every time.

The session protocol runs identically whether the agent is a developer in an IDE or an autonomous pipeline in CI. Same record. Same gates. Same provenance.

The 7-Phase Protocol
01
AuthenticationSession token issued and agent registered in Agent Shepherd. OAuth PKCE for human developers. Service account API key for autonomous agents. No session token — no protocol.register_session
Gate
02
Skill DiscoveryThe agent calls get_skills(entityIds[]) and receives a conformance bundle: entity binding, applicable Lenses, Steering refs, CHI requirements. The agent's instruction space is bounded before any code is considered.get_skills
03
Precondition ResolutionConditional gate. If the target entity is not present in the Architecture Ledger, the agent must draft a CHI for entity introduction and wait for architect approval before proceeding.draft_chi
Gate
04
CHI GateNo code before an approved Change Intention exists for the structural change scope. Agent calls get_approved_chi and waits in "CHI pending" state if needed. This is the IFR-driving phase — intent before implementation.get_approved_chi, check_chi_scope
Gate
05
Context AssemblyThree parallel MCP calls load the full governed context: Architecture Ledger state for target entities, all applicable Lenses, Steering context (Manifesto, Pillars, Policies, ADRs). The agent's working context is now bounded by the same record the CDA will evaluate against.get_ledger_state, get_applicable_lenses, get_steering_context
06
Governed Code GenerationAgent generates code within the approved CHI scope. validate_diff is called at each write step. BLOCKER findings halt generation immediately — agent must self-correct before continuing. ADVISORY findings are logged to the session record.validate_diff
07
CDA Evaluation and Session ClosePR opened triggers CDA automatically. Lens evaluation runs. GitHub check is produced. Session result — PASS or BLOCKED — is recorded immutably in Agent Shepherd. Full governance provenance chain is complete.automatic on PR open
No code before approved CHIBLOCKER must resolve before PRCDA is binding — not advisory

Two agent contexts. One governance record.

Bootstrap paths depend on context. IDE agents can use MCP prompts, instruction files, or session hooks. Autonomous agents receive context via orchestrator injection or SDK. Every path leads to the same governed protocol.

IDE Agents

Interactive · Claude Code, Cursor, Copilot Chat, Cline

A1PreferredMCP Prompts

rkito publishes rkito_session_protocol as a named MCP prompt. When the IDE initialises a session with rkito registered as an MCP server, the protocol is injected into agent context automatically — before the agent takes its first action. Zero developer friction.

Zero friction — when IDE host supports MCP prompts

A2Universal fallbackCLAUDE.md / AGENTS.md snippet

rkito’s onboarding UI generates a one-time snippet for CLAUDE.md, AGENTS.md, .cursor/rules, or .github/copilot-instructions.md. The developer adds it once; all team members who clone the repo get governed sessions automatically.

At the start of every session, before reading any files,
call get_rkito_protocol() to load the governed interaction
protocol. Then call register_session with your workContextId,
agentInstanceId, and branchRef before proceeding.

Works today with all MCP-compatible agents

A4Session Hooks — Claude Code PreToolUse

Claude Code supports hooks that fire before any tool use. rkito provides rkito-mcp-check: a CLI check that verifies session registration before the first tool call fires.

{
  "hooks": {
    "PreToolUse": [{
      "matcher": "*",
      "hooks": [{ "type": "command", "command": "rkito-mcp-check --session-registered" }]
    }]
  }
}

Claude Code only — hardest enforcement

Autonomous Agents

Machine · CI pipelines, Devin, orchestrated agents, GitHub Actions

B1PrimaryOrchestrator env vars + system prompt

The orchestrator owns bootstrap. It injects RKITO_API_KEY, RKITO_MCP_URL, and a system prompt instruction before the agent starts. Any LLM-based agent that accepts a system prompt. No agent-side feature required.

env:
  RKITO_API_KEY: ${{ secrets.RKITO_API_KEY }}
  RKITO_MCP_URL: https://mcp.rkito.io/v1

Works with any agent that accepts a system prompt

B3Planned — Enterpriserkito SDK

For organisations building custom orchestration pipelines, the rkito Agent SDK wraps session startup, authentication, protocol loading, and context assembly into a single call.

const session = await RkitoSession.start({
  apiKey: process.env.RKITO_API_KEY,
  workContextId: 'payment-service-update',
  branchRef: 'feature/payment-refactor'
})

Planned — Enterprise tier

Not documentation. Governed instruction payloads.

A Skill is a versioned, CHI-gated instruction set bound to an Architecture Ledger entity. When an agent retrieves a skill, it receives a conformance bundle — the skill instructions plus the complete set of Lenses applicable to the bound entities. The agent's instruction space is bounded by the same binary criteria that CDA evaluates at PR time.

skill::auth-service::oauth-flow · v2Conformance Bundle
Instructions
How to interact with Auth Service — permitted patterns, interface contracts, boundary rules
Lens bundle
Lens[A12] Service Authentication Posture · Lens[A15] External Service Data Access
Steering refs
Pillar: Security · Policy: API Gateway Routing · ADR-0041: Auth Service Isolation
Bound entity
Auth Service @ Ledger state v7 · approved via CHI-0089
Org-privateOrg-private

Authored and consumed within one org. The default. Governance record stays internal.

PublishedPublished

Discoverable by other orgs in the rkito network. Version-controlled. Forking tracked.

ForkedForked

Locally owned derivative. CHI-governed. Provenance link to origin skill preserved.

An agent operating under a skill cannot be instructed to violate a Lens — because the Lens criteria are co-delivered with the instructions.

Govern your agents.

Register rkito as an MCP server. Configure your bootstrap method. Every agent session governed from the first call. Every PR evaluated at merge. One governance record. Both ends.