ricursor

Ricursor documentation v1

Long-term project memory, self-correction and MCP/API integration for AI coding agents.

Cursor MCP: setup, context checks and troubleshooting →Claude Code: project memory and verified corrections →

Long-term, rotatable project memory

Ricursor stores architectural rules and evidence-linked corrections for vibecoders and developers using AI coding agents. Relevant memory is retrieved for each task; version deltas refresh changes and remove deleted rules across sessions and model switches. Project learning means accumulating and reusing saved memory, not retraining model weights. It targets model drift, repeated hallucinated assumptions and unnecessary context/token burn; results depend on the integration and are not guaranteed. Repository structure is extracted locally, not uploaded as source. Hosted AI prompts and replies pass to Cloudflare in transit only and are not stored, logged or used for policy checks. MCP and the HTTP context API are documented below; this guide does not claim a separate published SDK or universal native-edit enforcement.

MCP: ricursor_context({project:"APP",task:"implement auth"})
HTTP: GET /v1/agent/context?project=APP&task=implement%20auth

Export rules for Lovable / AGENTS.md

Install or update Ricursor from your project folder with its workspace key and exact project name. Run ricursor rules export: it reads the saved machine key and .ricursor.json project, prints every applicable project and workspace-wide rule, and never uploads repository files. Pass a project name to override the configured project. Save to a separate Markdown file, then paste the Ricursor section into existing AGENTS.md or Lovable Project settings → Knowledge; preserve existing instructions. This is a point-in-time snapshot, not automatic synchronization, model retraining or mandatory enforcement of Lovable edits. Re-export when rules change. Missing projects, revoked keys and unavailable APIs exit with an error; never paste an unsuccessful export.

curl -fsSL https://ricursor.com/install.sh | sh -s -- rcsk_YOUR_KEY "YOUR_PROJECT_NAME"
ricursor rules export
ricursor rules export "YOUR_PROJECT_NAME" > ricursor-rules.md
# If ricursor is not on PATH:
~/.ricursor/bin/ricursor rules export

Cursor setup: MCP tools, not model routing

Run the installer in your project folder with your Ricursor workspace key and project name, then restart Cursor. It writes .cursor/mcp.json with the local ricursor_broker server; the key stays in your machine configuration, outside the repository. The broker exposes project context and checked JS/TS changes. Confirm that Cursor discovers ricursor_broker and can call ricursor_context for your project. This does not replace Cursor’s model or prove that Cursor’s native edits cannot bypass the broker.

curl -fsSL https://ricursor.com/install.sh | sh -s -- rcsk_YOUR_KEY YOUR_PROJECT_NAME
Cursor MCP server: ricursor_broker
Context tool: ricursor_context({project:"YOUR_PROJECT_NAME",task:"your coding task"})

Cursor authentication & automatic-routing status

Automatic Cursor → Ricursor → Cloudflare Qwen routing remains required, but is not delivered or verified. A Ricursor workspace key authenticates Ricursor tools and its hosted AI relay; it is not a Cursor login or Cursor API key. Cursor CLI coding requests require Cursor authentication. The tested CLI stopped at Authentication required before running tools; signing in alone does not establish Qwen routing. Its endpoint override targets Cursor’s service protocol, not an OpenAI-compatible model URL. Cursor documents that IDE custom-key requests pass through Cursor servers, which cannot reach your local gateway. No supported automatic installer configuration for that routing was established. Claude Code’s verified Qwen adapter is separate and is not evidence of Cursor support.

Verified: installer writes Cursor broker MCP configuration
Not verified: Cursor coding through Ricursor Qwen
Not guaranteed: mandatory checks for Cursor native edits
Requirement remains open: automatic routing with a successful real Cursor coding session

Semantic retrieval & version deltas

Pass task to rank saved constraints using Cloudflare Workers AI and Vectorize. Keep the returned cursor and pass since on the next request with the same key, project and task: constraints contains changed rules and delta.removed contains IDs to remove. Expired or mismatched cursors return 409; fetch without since to reset. Tokens measure rule payloads with cl100k_base, not model billing. Indexing is eventually consistent; retrieval labels recent fallback explicitly. This indexes saved rules, not your repository.

GET https://api.ricursor.com/v1/agent/context?project=APP&task=implement%20auth
GET https://api.ricursor.com/v1/agent/context?project=APP&task=implement%20auth&since=RETURNED_CURSOR
MCP: ricursor_context({project:"APP",task:"implement auth",since:cursor})

Connect over MCP

Create a workspace and project in Console, then open Connections for your host-specific MCP configuration. The MCP server authenticates with a workspace key (rcsk_…) sent as a Bearer token. Pass your workspace ID and project name when calling its tools; it does not automatically index a repository.

claude mcp add --transport http ricursor https://api.ricursor.com/v1/mcp --header "Authorization: Bearer rcsk_YOUR_KEY"

Context API

Create an API key in Connections. GET /v1/agent/context serves stored constraints and recent state for the key’s workspace. The optional project query is a project name. This is a context API, not an OpenAI-compatible model proxy.

GET https://api.ricursor.com/v1/agent/context?project=YOUR_PROJECT_NAME
Authorization: Bearer YOUR_API_KEY

Memory and reported activity

Add constraints in Console → Elastic memory. Connected agents can report usage and file-change, delta or alert events using ricursor_report or POST /v1/agent/ingest. The Playground is illustrative. Connected agents can save corrections with ricursor_correct or POST /v1/agent/corrections, linked to a recent blocked or review action from the same key and project. The local broker checks supported writes and the Claude Code adapter routes model calls through Ricursor. This evidence link does not prove arbitrary code correctness, and native edits in other clients may bypass checks.

POST https://api.ricursor.com/v1/agent/ingest
Idempotency-Key: UNIQUE_REPORT_ID
[{"type":"state","project":"YOUR_PROJECT_NAME","kind":"file_change","path":"src/auth.ts","detail":"file_updated"}]

Guardrails & retry safety

Reports are atomic and tenant-scoped. Reuse the same Idempotency-Key (API) or request_id (MCP) with unchanged data when retrying; changed data with the same ID is rejected. Use a new ID for each new logical report. Batches accept at most 200 events and 256 KiB, real calendar dates, integer tokens up to one billion, and safe relative paths. Named projects must exist; nothing silently falls back to another project. Each workspace accepts 60 new reports per minute; retries of already recorded IDs do not consume this allowance. Receipts persist until the workspace is deleted. These are ingestion safeguards, not an autonomous model safety guarantee.

Success: {"ok":true,"inserted":1,"replayed":false}
Retry:   {"ok":true,"inserted":1,"replayed":true}
Conflict: HTTP 409
MCP: ricursor_report({workspace, project, request_id, usage, state})

API reference

Base address https://api.ricursor.com/v1. Requests and replies are JSON. Errors return {"error": { "code", "message", "requestId" }}. Members of other workspaces get 404; weaker roles get 403.

Agent API

Authorization: Bearer rcsk_… (workspace key)

GET/agent/context?project=NAMEkeySaved constraints and recent state for the key's workspace
GET/agent/rules/export?project=NAMEkeyFull project and workspace-wide saved rules for AGENTS.md export; no top-K limit
GET/agent/context?project=NAME&task=TASK&since=CURSORkeySemantic memory retrieval and version deltas; cursor bound to key/project/task
POST/agent/ingestkeyReport usage and state events; requires Idempotency-Key
POST/agent/snapshotwriter keyVersioned JS/TS metadata snapshots; automatically queue proactive checks
GET/agent/snapshot?project=NAMEkeyTracked metadata, hashes and versions for the selected project
POST/agent/checkkeyPre-write guard: blocks stale versions, missing exports and accepted import-boundary violations
GET/agent/ledger?project=NAMEkeyShared structure, rule versions and task handoffs; stale decisions tell the agent to refresh
POST/agent/handoffwriter keyVersioned structured task IDs and constraint decisions; no prompts or code
POST/agent/actions/checkwriter keyMetadata-only write/delete proposal; returns allow or block with reasons and a one-use receipt
POST/agent/actions/consumewriter keyAtomically consumes a receipt right before the local broker executes
POST/agent/actions/check-groupwriter keyUp to 20 related changes judged on their combined end state; 3rd identical block is final
POST/agent/actions/consume-groupwriter keyAll-or-nothing, one-use consumption of a group receipt
POST/agent/gateway/reservewriter keyIdempotent token reservation for a local gateway call against the daily budget
POST/agent/gateway/reconcilewriter keyRecords locally reported token usage for a reserved call
POST/mcpkeyMCP JSON-RPC endpoint (ricursor_context, ricursor_report)

Sign-in

Public, then Authorization: Bearer SESSION

GET/healthpublicBackend status
POST/auth/sign-uppublicCreate an account and personal workspace; returns a session
POST/auth/sign-inpublicEmail + password; returns a session
POST/auth/password-resetpublicRequest a password reset email (one-time link, 1 hour, 3/hour)
POST/auth/password-reset/confirmpublicSet a new password with the emailed token; ends all sessions
GET/auth/mesigned inCurrent account
POST/auth/sign-outsigned inEnd this session
POST/auth/sign-out-otherssigned inEnd every other session
POST/auth/passwordsigned inChange password (needs current password)
POST/auth/emailsigned inRequest an email change; applies after the new address is verified
POST/auth/email/verifypublicConfirm an email with the one-use link token
POST/auth/email/verify/resendsigned inResend verification for the current address

Workspaces, team & invites

Authorization: Bearer SESSION

GET/workspacessigned inWorkspaces you belong to
POST/workspacessigned inCreate a workspace (you become owner)
PATCH/workspaces/:wsadminRename
GET/workspaces/:ws/membersmemberList members
POST/workspaces/:ws/membersadminAdd a member
PATCH/workspaces/:ws/members/:useradminChange role (never owner)
DELETE/workspaces/:ws/members/:useradminRemove a member
GET/workspaces/:ws/invitesadminPending invites
POST/workspaces/:ws/invitesadminCreate invite link
DELETE/invites/:idadminRevoke invite
GET/invites/:tokenpublicPreview invite
POST/invites/:token/acceptsigned inAccept once

Projects, memory & keys

Authorization: Bearer SESSION

GET/workspaces/:ws/projectsmemberList projects
POST/workspaces/:ws/projectswriterCreate project
PATCH/projects/:idwriterRename project
DELETE/projects/:idadminDelete project
GET/workspaces/:ws/constraints?project=IDmemberSaved constraints
POST/workspaces/:ws/constraintswriterAdd constraint
DELETE/constraints/:idwriterDelete constraint
PATCH/constraints/:idwriterUpdate rule with optimistic version; stale edits return 409
POST/workspaces/:ws/memory-indexwriterProcess pending Cloudflare memory indexing (up to 20 rules)
GET/workspaces/:ws/projects/:p/constraintswriterConstraints applying to a project
GET/workspaces/:ws/keysadminList workspace keys
POST/workspaces/:ws/keysadminCreate key (secret shown once)
DELETE/keys/:idadminRevoke key

State, activity, usage, AI & CI

Authorization: Bearer SESSION

GET/workspaces/:ws/state?project=IDmemberLive state events
GET/workspaces/:ws/intent?project=IDmemberTracked modules, pending checks, architecture suggestions and drift alerts
POST/workspaces/:ws/intentwriterAccept architecture suggestion into memory or dismiss finding
GET/PUT/workspaces/:ws/middlewaremember / adminOptional override: Enforce (default) or Observe and daily gateway token budget; changes are audited and invalidate receipts
GET/workspaces/:ws/actionsmemberRecent broker decisions and mode-change audit
POST/workspaces/:ws/statewriterRecord state events
GET/workspaces/:ws/activitymemberActivity history
POST/workspaces/:ws/activitymemberRecord a switch/recovery entry
GET/workspaces/:ws/usage?project=IDmemberToken usage rows
POST/workspaces/:ws/projects/:p/reviewwriterDisabled (410): remote source uploads violate the code-free boundary
POST/workspaces/:ws/projects/:p/analyzewriterDisabled (410): raw log uploads violate the code-free boundary
POST/workspaces/:ws/projects/:p/analyseswriterDisabled (410): legacy finding evidence may contain source
GET/workspaces/:ws/cimemberCI analyses and applied fixes
POST/workspaces/:ws/ci/fixeswriterMark a finding as fixed (once)

Profile & account

Authorization: Bearer SESSION

GET/profilesigned inYour profile
PATCH/profilesigned inUpdate name
GET/preferencessigned inYour preferences
PUT/preferencessigned inSave preferences
PUT/avatarsigned inUpload photo (PNG/JPEG/WebP)
DELETE/avatarsigned inRemove photo
GET/avatars/:usersigned inPhoto of someone you share a workspace with
GET/account/exportsigned inDownload your data
DELETE/accountsigned inDelete account (password + "DELETE")

Staff (administration)

Session + staff role + authenticator code

GET/admin/accessstaffYour staff role and 2FA state
POST/admin/mfa/enrollstaffStart authenticator setup
POST/admin/mfa/verifystaffVerify a 6-digit code
GET/admin/sections/:namestaffRead-only staff section (audited)
GET/admin/accountsstaffAccount directory
POST/admin/accountsowner + recent 2FAChange an account's name or plan
GET/admin/cistaffCI trends across workspaces