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/providers/cursor-hook.test.ts

View on GitHub
import { describe, expect, it } from 'bun:test';
import fs from 'fs';
import os from 'os';
import path from 'path';

import { hookPayload, resolveSource } from './cursor-hook.js';

describe('cursor-hook adapter', () => {
  it('maps --compact onto the compact memory source', () => {
    expect(resolveSource(['--compact'], '')).toBe('compact');
  });

  it('reads Cursor stdin source when present', () => {
    expect(resolveSource([], JSON.stringify({ source: 'clear' }))).toBe('clear');
    expect(resolveSource([], JSON.stringify({ source: 'resume' }))).toBe('resume');
  });

  it('treats sessionStart (no source field) as startup', () => {
    expect(resolveSource([], '{}')).toBe('startup');
    expect(resolveSource([], 'not-json')).toBe('startup');
  });

  it('omits additional_context on resume so Cursor does not re-inject memory', () => {
    expect(hookPayload('resume')).toEqual({});
  });

  it('renders the shared NanoClaw memory context on startup and clear', () => {
    const base = fs.mkdtempSync(path.join(os.tmpdir(), 'cursor-memory-hook-'));
    try {
      fs.mkdirSync(path.join(base, 'memory', 'system'), { recursive: true });
      fs.writeFileSync(path.join(base, 'memory', 'index.md'), '# Cursor memory sentinel\n');
      fs.writeFileSync(path.join(base, 'memory', 'system', 'definition.md'), '# Memory definition\n');

      for (const source of ['startup', 'clear'] as const) {
        const payload = hookPayload(source, base);
        expect(payload.additional_context).toContain('Cursor memory sentinel');
        expect(payload.user_message).toBeUndefined();
      }
    } finally {
      fs.rmSync(base, { recursive: true, force: true });
    }
  });

  it('returns user_message on compact, the field Cursor forwards into preCompact', () => {
    const base = fs.mkdtempSync(path.join(os.tmpdir(), 'cursor-memory-hook-'));
    try {
      fs.mkdirSync(path.join(base, 'memory', 'system'), { recursive: true });
      fs.writeFileSync(path.join(base, 'memory', 'index.md'), '# Cursor memory sentinel\n');
      fs.writeFileSync(path.join(base, 'memory', 'system', 'definition.md'), '# Memory definition\n');

      const payload = hookPayload('compact', base);
      expect(payload.user_message).toContain('Cursor memory sentinel');
      expect(payload.additional_context).toBeUndefined();
    } finally {
      fs.rmSync(base, { recursive: true, force: true });
    }
  });
});
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