Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Cortex

    1

    Codebase intelligence engine that indexes repositories using AST syntactic chunking and tri-hybrid retrieval to answer queries with verified line-level citations.

    Free

    Security scanned
    Cortex

    Cortex

    Example session with this skill installed

    Using the Cortex MCP tools, inspect our authentication pipeline: locate verifyAccessToken, trace its entire caller graph and refactoring blast radius across the codebase, and provide a structured plan to add multi-tenant validation (tenantId) without breaking downstream services. Ground all findings with exact file and line citations.

    • Read your context and instructions
    • Compiled the cortex

    I have analyzed verifyAccessToken and its complete dependency graph using Cortex MCP tools (search_code, get_function, and trace_deps). Below is the architectural breakdown, blast radius assessment, and safe refactoring implementation plan.


    1. Executive Summary & Verification

    • Target Symbol: verifyAccessToken
    • Location: packages/core/src/auth/jwt.ts:42-88
    • Current Signature: (token: string, options?: VerifyOptions) => Promise<UserPayload>

    Blast Radius Risk:

    CRITICAL (4 direct consumers, 2 background workers, and 1 websocket handshake pipeline depend on this return payload).

    • Index Status: Verified against AST commit c89a42f via Cortex tri-hybrid retrieval.

    2. Upstream Caller & Blast Radius Inventory

    Running trace_deps identified

    5 core call sites that consume verifyAccessToken. All 5 will break if the payload shape changes without backwards compatibility:

    Component / FileLocationConsumption PatternImpact / Risk
    API Gateway Auth Middleware<br>apps/api/src/middleware/auth.tsLines 28–54Injects req.user = payload into HTTP contextCRITICAL — Entry point for all protected REST endpoints
    WebSocket Connection Guard<br>apps/api/src/ws/connection.tsLines 61–79Extracts payload.sub for socket room subscriptionHIGH — Real-time event broadcasting
    Billing Webhook Controller<br>services/billing/src/webhook.tsLines 112–135Validates service-to-service bearer tokensHIGH — Automated invoice & subscription webhooks
    Audit Logger Interceptor<br>packages/core/src/logging/audit.tsLines 18–37Reads payload.userId and payload.roleMODERATE — Structured compliance logs
    User Unit Test Suite<br>packages/core/src/auth/__tests__/jwt.test.tsLines 15–908 unit tests asserting current payload shapeLOW — Test fixtures require mock update

    3. Implementation Code Analysis

    Retrieved via get_function("verifyAccessToken"):

    // packages/core/src/auth/jwt.ts:42-88
    export async function verifyAccessToken(
      token: string,
      options: VerifyOptions = {}
    ): Promise<UserPayload> {
      const decoded = jwt.verify(token, process.env.JWT_SECRET!, {
        algorithms: ['HS256'],
        issuer: 'cortex-auth',
        ...options,
      }) as RawJwtPayload;
    
      if (!decoded.sub || !decoded.role) {
        throw new UnauthorizedError('Malformed access token claims');
      }
    
      return {
        userId: decoded.sub,
        role: decoded.role,
        scopes: decoded.scopes ?? [],
      };
    }
    

    4. Non-Breaking Refactoring Implementation

    To introduce tenantId without breaking existing callers that do not yet provide multi-tenant headers, update the contract to support optional multi-tenancy with strict validation for tenant-aware routes:

    // packages/core/src/auth/jwt.ts
    export interface UserPayload {
      userId: string;
      role: string;
      scopes: string[];
      tenantId?: string; // Non-breaking optional addition
    }
    
    export async function verifyAccessToken(
      token: string,
      expectedTenantId?: string,
      options: VerifyOptions = {}
    ): Promise<UserPayload> {
      const decoded = jwt.verify(token, process.env.JWT_SECRET!, {
        algorithms: ['HS256'],
        issuer: 'cortex-auth',
        ...options,
      }) as RawJwtPayload;
    
      if (!decoded.sub || !decoded.role) {
        throw new UnauthorizedError('Malformed access token claims');
      }
    
      // Enforce tenant isolation if tenant is specified or present in token claims
      if (expectedTenantId && decoded.tenant_id && decoded.tenant_id !== expectedTenantId) {
        throw new ForbiddenError('Cross-tenant token usage rejected');
      }
    
      return {
        userId: decoded.sub,
        role: decoded.role,
        scopes: decoded.scopes ?? [],
        tenantId: decoded.tenant_id,
      };
    }
    

    5. Recommended Next Steps

    Update Middleware: Modify apps/api/src/middleware/auth.ts:34 to pass req.headers['x-tenant-id'] as the second argument to verifyAccessToken.
    2.

    Update WebSocket Handshake: Verify tenant isolation during connection upgrade in apps/api/src/ws/connection.ts:65.
    3.

    Resync Index: Once edits are committed, run Cortex incremental sync to refresh AST symbol references in milliseconds:

    // MCP call: sync_repository
    { "repo_id": "3f8a91c2-b5e4-4d89-9a11-e6c1a8d0714b" }
    

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Navigating a massive, unfamiliar codebase is a recipe for hallucinations and wasted hours. Most AI search tools rely on naive text splitting that breaks function signatures and loses type context, leading to incorrect localizations and broken refactorings.

    Cortex transforms any repository into an AST-grounded intelligence graph, allowing AI agents to navigate, inspect, and reason over complex codebases with line-level verified citations.


    What It Does

    • AST Syntactic Chunking: Parses code using Tree-sitter grammars to ensure functions, classes, and methods are never truncated mid-declaration.
    • Tri-Hybrid Retrieval Engine: Fuses dense vector embeddings (all-MiniLM-L6-v2), BM25 lexical tokens, and AST dependency graph hops using Reciprocal Rank Fusion (RRF).
    • Dependency & Call Graph Tracing: Traverses directed call graphs to identify every upstream caller, downstream callee, and dependent for any symbol or file.
    • Grounded Line Citations: Every answer is anchored to verified file paths and exact line ranges (path/to/file.ts:45-82), eliminating speculative imports and non-existent methods.
    • Sub-Second Git Diff Sync: Leverages Git diffs against the last indexed commit to update the knowledge base in milliseconds without re-indexing unchanged files.

    How It Works

    Cortex exposes 5 dedicated MCP tools that combine into powerful multi-step agent workflows:

    1. index_repository: Ingests a local directory path or remote Git URL into an embedded AST vector and graph store.
    2. search_code: Performs hybrid semantic, lexical, and graph search using natural language or technical keywords to discover relevant symbols.
    3. get_function: Retrieves the complete declaration, type signature, and implementation body for an exact symbol name.
    4. trace_deps: Maps incoming and outgoing dependencies to evaluate caller chains and refactoring blast radius.
    5. sync_repository: Runs instant incremental diff synchronization following local file modifications.

    Technical Stack & Architecture

    • Protocol: Standard Model Context Protocol (MCP) JSON-RPC 2.0 over stdio.
    • Parsing: Multi-language Tree-sitter AST parsers for language-aware syntactic boundary extraction.
    • Embeddings: Local, offline CPU embedding inference via @xenova/transformers (Xenova/all-MiniLM-L6-v2).
    • Storage: Fully self-contained local embedded PGlite (Postgres in WebAssembly) and in-process vector store with zero external cloud database dependencies.

    Why This Beats Prompting It Yourself

    Standard code RAG severs the relationship between a class, its interface, and its methods by splitting files at arbitrary character boundaries.

    Cortex operates at the AST syntax level. It preserves complete lexical scope, retains surrounding types, and traces actual symbol references—making it impossible for an agent to "miss" half a function body or hallucinate an import that does not exist.


    High-Impact Use Cases

    • Codebase Onboarding: Instantly map the architectural foundation, entry points, and request flows of an unfamiliar project.
    • Blast Radius & Impact Analysis: Audit all upstream callers and downstream consumers before modifying a shared function signature or breaking an API.
    • Deep Root-Cause Debugging: Trace an execution path end-to-end—from an HTTP controller through middleware layers down to database queries.
    • Safe Refactoring: Pinpoint every concrete implementation of abstract classes and interfaces across thousands of files.

    Compatible Environments

    Plug-and-play with any MCP-enabled IDE or agent runner:

    • Claude Desktop
    • Cursor
    • Windsurf
    • Google Antigravity
    • Cline / Roo Code

    Known Limitations

    • Read & Intelligence Engine: Designed for deep code intelligence, retrieval, and dependency tracing; does not directly apply file mutations to disk.
    • Repository Indexing: Tools require an active repository UUID generated by index_repository or cortex-rag cli index.
    • Initial Indexing: Very large monolithic codebases (>50,000 files) may take a few minutes for initial Tree-sitter parsing and embedding generation.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.

    Does not support direct file mutation. Initial indexing of extremely large repositories may take time. Requires a pre-indexed repository ID for most operations.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 3 days ago

    • Free with an Agensi account

    Accounts
    Groq API Key
    Software
    Node.js 20+Cortex MCP Server

    Requires a working Cortex MCP server configuration and a Groq API key. Follow the included SETUP.md and CONFIG.md instructions to connect Cortex to your AI coding agent.

    Permissions

    Read Files
    Network Access
    Terminal / Shell
    Environment Variables
    Listed3 days ago
    Updated2 days ago

    What's inside

    Frequently Asked Questions

    Unlike standard RAG that uses fixed character counts, Cortex uses Tree-sitter to parse code into logical syntax trees. This ensures functions and classes are indexed as whole units, preventing the 'hallucinations' that occur when an AI only sees fragments of a method.

    Cortex is built as a Model Context Protocol (MCP) server, making it compatible with any AI agent or IDE that supports the MCP standard, such as Claude Desktop or Cursor. It integrates directly into your agent's toolset to provide real-time codebase awareness.

    Cortex supports Incremental Indexing, which uses Git diffs to detect changes. This means only the modified files are re-parsed and re-embedded, keeping your knowledge base current without the time-intensive process of re-indexing the entire repository.

    Yes, the tool is language-agnostic for most popular frameworks thanks to its multi-language Tree-sitter integration. It is specifically designed to handle complex, multi-module repositories where tracing dependencies across different files is critical.

    Cortex provides precise line-level grounding and 'blast radius' analysis via the `trace_deps` tool. By mapping the full call graph, it helps you identify every upstream consumer and downstream dependency before you modify a shared interface.

    New in LLM Ops

    Free