Getting Started Copy

Developer Quickstart

Get up and running with BetterContext in under 5 minutes. Ingest your repository, index workspace knowledge, and run your first context query.

Prerequisites: A BetterContext account with an active API Key (get one here) and Python 3.9+ or Node.js 18+.

Step 1: Install the SDK / CLI

Choose your preferred language or install the standalone developer CLI:

Python:

pip install bettercontext

Node.js / TypeScript:

npm install @bettercontext/sdk

macOS Homebrew CLI:

brew install bettercontext/tap/bettercontext

Step 2: Set your API Key

Export your secret key as an environment variable in your terminal or .env file:

export BETTERCONTEXT_API_KEY="bc_live_your_api_key_here"

Step 3: Index your Codebase

Use the CLI to automatically scan your repository, create the knowledge graph, and establish file dependencies:

# Initialize BetterContext in the current directory
bettercontext init

# Ingest and parse repository files into your memory graph
bettercontext ingest . --branch main

BetterContext automatically respects your .gitignore, skips binary files, and extracts AST definitions, commit history, and inline documentation.

Step 4: Query the Context Engine

Query your newly created memory graph using Python or TypeScript:

Python:

from bettercontext import BetterContextClient

client = BetterContextClient()

# Ask questions grounded in your repository's real architecture
response = client.context.query(
    prompt="Where is user authentication handled, and how are tokens refreshed?",
    max_tokens=1024
)

print(response.context_string)
for citation in response.citations:
    print(f"- {citation.path} (Relevance: {citation.score})")

TypeScript:

import { BetterContext } from '@bettercontext/sdk';

const bc = new BetterContext();

async function main() {
  const result = await bc.context.query({
    prompt: "Where is user authentication handled, and how are tokens refreshed?",
    maxTokens: 1024,
  });

  console.log(result.contextString);
}

main();

Step 5: Connect AI Agents (Claude, Cursor, Antigravity)

Connect your favorite AI agent harness using BetterContext's universal Model Context Protocol (MCP) server:

# Install MCP connector into Claude Desktop or Cursor in one command:
bettercontext mcp install --target claude
bettercontext mcp install --target cursor

Your agents will now automatically call bettercontext_query and bettercontext_upsert during interactive coding sessions.

Next Steps

Was this page helpful?

Powered By BetterContext