Skip to main content

Cursor

Use Cursor's AI-first IDE to build Trix memory integrations with inline assistance.

Overview

Cursor is an AI-first code editor built as a fork of VS Code. It provides inline AI assistance, CMD+K for targeted edits, and Composer for multi-file changes. Cursor's @Docs feature allows you to add Trix platform documentation directly to your context, and it supports MCP servers for direct memory access.

Cursor excels at inline code editing, documentation-aware suggestions, and MCP server integration for direct Trix memory access. It feels natural for VS Code users.

Installation & Setup

Download Cursor from cursor.com. It's available for macOS, Windows, and Linux.

Import from VS Code

Cursor can import your VS Code extensions, settings, and keybindings automatically. On first launch, you'll be prompted to import your configuration. Cursor also supports MCP servers, allowing direct integration with Trix memory tools.

Configure AI Model

Cursor supports multiple AI models. For Trix memory integration, Claude Sonnet or GPT-4 work best:

  1. Open Settings (Cmd+, on Mac, Ctrl+, on Windows/Linux)
  2. Navigate to Cursor Settings → Models
  3. Select your preferred model (Claude Sonnet 4 or GPT-4o recommended)
  4. Add your API key if using your own

Cursor offers both free and paid plans. The free plan includes limited AI requests, while Pro plans provide unlimited access with premium models.

Adding Trix Documentation

Cursor's @Docs feature allows you to add Trix documentation to your context, making AI suggestions more accurate.

Add Official Trix Docs

  1. Open Cursor Settings (Cmd+, or Ctrl+,)
  2. Navigate to Features → Docs
  3. Click "Add new doc"
  4. Add the Trix GitHub documentation URL:
Trix Documentation URL
https://trixdb.com/docs

You can also add your own Trix integration documentation:

terminal
# Create a docs file in your project
touch docs/trix-integration.md

# Add your Trix setup, patterns, and conventions
# Then reference it in Cursor Settings → Features → Docs

Using @Docs in Chat

Once added, reference Trix docs in your prompts:

Cursor Chat
@Docs Create a React component that integrates Trix memory search with proper TypeScript types

Cursor will use the official Trix documentation to provide accurate API references and patterns.

Core Features for Trix Development

Inline Editing (CMD+K)

CMD+K (Ctrl+K on Windows/Linux) allows you to edit code inline with AI assistance:

  1. Select the code you want to modify
  2. Press CMD+K
  3. Describe what you want to change
  4. Review and accept/reject the changes

Example: Select your memory service code and press CMD+K, then type:

CMD+K prompt
Add error handling for API calls and implement retry with exponential backoff

Tab Completion

Cursor provides intelligent code completion as you type. Start typing and press Tab to accept suggestions:

Auto-completion example
// Start typing:
const results = await client.memories.

// Press Tab to complete:
const results = await client.memories.list({
  q: searchQuery,
  space_id: spaceId,
  limit: 10
});

Composer (Multi-File Editing)

Composer allows you to make coordinated changes across multiple files:

  1. Open Composer (Cmd+Shift+I or Ctrl+Shift+I)
  2. Describe changes affecting multiple files
  3. Cursor will plan and execute changes across your codebase
  4. Review and apply the changes

Example Composer prompt:

Composer prompt
Add a memory-powered context system to this project:
1. Create memory service with Trix SDK
2. Add search function with metadata filters
3. Build context injection middleware for LLM calls
4. Handle error cases and empty results
5. Add TypeScript types for all memory operations

Chat Interface

Use Cursor's chat interface for questions and exploration:

Chat examples
How do I configure Trix memory search for my use case?

@Docs What endpoints does the Trix API provide for memory management?

Show me how to integrate Trix memory with my chatbot

Common Workflows

Initial Trix Setup

  1. Open Composer (Cmd+Shift+I)
  2. Paste this prompt:
Composer
Set up Trix memory SDK in this project:
- Install @trixdb/client package
- Create a memory service with TypeScript
- Configure API key from environment
- Add store, search, and delete methods
- Export the service from index.ts
  1. Review the planned changes
  2. Apply the changes
  3. Test the implementation

Adding Memory Features

  1. Open your memory service file
  2. Select the section you want to enhance or place cursor where you want new code
  3. Press CMD+K and type:
CMD+K
Add metadata filtering, space-based isolation, and batch memory creation to this service

Debugging Issues

Use the chat to debug configuration issues:

Chat
@Codebase My Trix memory search is returning irrelevant results.
Here's my search configuration. What can I improve?

The @Codebase reference tells Cursor to analyze your entire codebase, helping it understand context and dependencies.

Refactoring Workflow

  1. Select the code you want to refactor
  2. Press CMD+K
  3. Describe the refactoring:
CMD+K
Extract this memory retrieval logic into a reusable hook

Advanced Tips

Custom Rules

Create a .cursorrules file in your project root to teach Cursor about your preferences:

.cursorrules
# .cursorrules

## Trix Memory Platform Patterns

When working with Trix:
- Always use TypeScript
- Use the @trixdb/client SDK for API interactions
- Handle API errors with proper retry logic
- Use spaces for data isolation between users
- Follow async/await patterns for all API calls

## Code Style
- Use arrow functions
- Prefer const over let
- Add JSDoc comments for complex functions
- Export types separately from services

## Memory Operations
Always use proper types:
```typescript
const memory = await client.memories.create({
  content: "User preference",
  space_id: spaceId,
  metadata: { source: "chat" }
});
```

## Search Pattern
Use this pattern for memory retrieval:
1. Build search query from user context
2. Apply metadata filters for relevance
3. Set appropriate limit and threshold
4. Inject results into LLM prompt
5. Handle empty results gracefully

Linter Integration

Cursor integrates with ESLint. Use the "Iterate on Lints" feature to auto-fix issues:

  1. Open the Problems panel
  2. Click "Iterate on Lints"
  3. Cursor will fix linting issues automatically

Terminal Integration

Cursor has an integrated terminal. Use it to run Trix-related commands:

Integrated terminal
npm install @trixdb/client
npm run dev
npm test

Best Practices

  • Use @Docs for accuracy - Reference Trix documentation for correct API usage
  • Leverage @Codebase - Let Cursor analyze your full codebase for better suggestions
  • Iterate with CMD+K - Make small, targeted changes instead of rewriting entire files
  • Create .cursorrules - Teach Cursor your Trix patterns and preferences
  • Use Composer for structure - Let Composer handle multi-file architectural changes
  • Review AI suggestions - Always test and understand generated code before accepting

Cursor's suggestions are based on patterns in its training data. For Trix-specific patterns, always verify against the official Trix platform documentation at trixdb.com/docs.

Example Prompts

Setup Prompts

Chat prompts
@Docs Set up Trix memory SDK in this project with TypeScript

Create a memory service with search and store methods

@Codebase Add Trix memory context to my existing chat handler

Memory & Search Prompts

Chat prompts
Add metadata filtering to my Trix memory search

Implement batch memory creation for document ingestion

@Docs Configure space-based isolation for multi-tenant memory

Debugging Prompts

Chat prompts
@Codebase Why are my Trix memory searches returning low-relevance results?

Debug this Trix API authentication error [paste error message]

@Docs How do I set up webhooks for memory change events?

For more prompts, see the Prompt Library.

Useful Keyboard Shortcuts

ActionmacOSWindows/Linux
Inline EditCmd+KCtrl+K
Open ComposerCmd+Shift+ICtrl+Shift+I
Open ChatCmd+LCtrl+L
Accept SuggestionTabTab
Reject SuggestionEscEsc
Next SuggestionCmd+→Ctrl+→

Next Steps