Skip to content

nanocoai/nanoclaw / .claude/skills/add-cursor

add-cursor

Flagged

Use Cursor (local Agent SDK) as a full agent provider — planning, tool orchestration, MCP tools, session resume — alongside or instead of Claude. Cursor-account sign-in or API key, held by the credential gateway. Per-group via `ncl groups config update --provider cursor`. Distinct from using Cursor as a cloud agent (those run on Cursor VMs and are not this provider).

payload/container/agent-runner/src/provider-contracts/cursor.ts

View on GitHub
import {
  archiveCursorExchange,
  cursorExecutionPolicySection,
  cursorInferenceSection,
  cursorMcpServersSection,
  cursorMemorySection,
  cursorRuntimeOwnership,
  writeCursorMemoryHooks,
} from '../providers/cursor.js';
import { registerProviderContract } from '../providers/provider-registry.js';

import type { ProviderRuntimeContract, RuntimeAfterExchangeInput, RuntimeCallbackEffects } from './registry.js';

const provider = 'cursor';
// Pinned literal, not the core's constant: a core seam bump must fail this
// payload's version check until the payload is refreshed to match.
const RUNTIME_SEAM_VERSION = 1;

// This module loading means core runs the contract's
// memorySessionHookRegistration when it registers the memory hook, so the
// provider's own hooks.json write must stand down — otherwise both files
// would be written twice per session start.
cursorRuntimeOwnership.contractOwnsHookFiles = true;

const memory = cursorMemorySection();

export const cursorRuntimeContract: ProviderRuntimeContract = {
  seamVersion: RUNTIME_SEAM_VERSION,
  configuration: {
    // The stance is fixed — the container is the sandbox, Cursor's own is off,
    // and the tools that stall a headless session are always denied — so it is
    // declared as the constant it is.
    executionPolicy: { constant: cursorExecutionPolicySection() },
    // Only `model` reaches the SDK: Cursor's per-model `params` are catalogue
    // knowledge the container does not have, so `effort` and `speed` have no
    // honest mapping (see cursorInferenceSection). The default probes vary
    // `model`, which this function answers.
    inference: cursorInferenceSection,
    // The Cursor-native hooks run cursor-hook.ts, which reads the memory tree
    // itself rather than the hook command core registers, so the hooks
    // document is a constant, not a function of the hook.
    memory: { constant: memory },
    mcpServers: cursorMcpServersSection,
  },
  // Cursor discovers hooks from `.cursor/hooks.json` files, so the memory
  // registration writes them into the project and user layers.
  lifecycle: { memorySessionHookRegistration: () => writeCursorMemoryHooks(memory) },
  // The SDK's local agent store holds the history; there is no transcript to
  // read back, so each exchange is archived and there is no trace to upload.
  history: { afterExchange: archiveExchange },
  // Assistant text streams mid-turn from `run.stream()`, so complete message
  // blocks are delivered as they close, the way the Claude provider does.
  textDelivery: 'mid-turn-complete',
  commands: { formatting: 'xml' },
};

// Two-step registration: providers/cursor.ts registered the factory; this
// attaches the contract. Order-independent; providers/cursor.ts never imports this file.
registerProviderContract(provider, cursorRuntimeContract);

function archiveExchange({ exchange }: RuntimeAfterExchangeInput, fx: RuntimeCallbackEffects): string | null {
  return archiveCursorExchange(exchange, new Date(fx.now()));
}
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall