Skip to main content

Lightning Code Index - Sub-millisecond semantic code search and analysis

Project description

LCI - Lightning Code Index

Lightning-fast code indexing and search for AI assistants.

CI Go Report Card License: MIT

Features

  • Sub-millisecond search: Trigram-based indexing with <5ms search guarantee
  • Multi-language support: Go, TypeScript, JavaScript, Python, Rust, C#, PHP, and more
  • MCP integration: Model Context Protocol server for AI assistant integration
  • Semantic search: Natural language queries with intelligent matching
  • Call graph analysis: Track function calls, references, and dependencies
  • Semantic annotations: @lci: vocabulary for marking up code with metadata

Installation

npm (recommended)

npm install -g @standardbeagle/lci

pip

pip install lightning-code-index

Homebrew (coming soon)

brew install standardbeagle/tap/lci

From Source

go install github.com/standardbeagle/lci/cmd/lci@latest

From Releases

Download pre-built binaries from GitHub Releases.

Quick Start

CLI Usage

# Index and search in current directory
lci search "handleRequest"

# Find symbol definitions
lci def UserService

# Find all references to a symbol
lci refs CreateUser

# Display function call hierarchy
lci tree main

# Fast grep-style search
lci grep "TODO|FIXME"

# List files that would be indexed
lci list

MCP Server

Start the MCP server for AI assistant integration:

lci mcp

Claude Code Integration

Add to your .mcp.json:

{
  "lci": {
    "command": "lci",
    "args": ["mcp"],
    "env": {}
  }
}

Configuration

Create .lci.kdl in your project root:

project {
    name "my-project"
    root "."
}

index {
    include "**/*.go" "**/*.ts" "**/*.py"
    exclude "**/node_modules/**" "**/vendor/**"
}

search {
    max-results 100
    context-lines 3
}

MCP Tools

When running as an MCP server, LCI exposes these tools:

Tool Description
search Semantic code search with fuzzy matching
get_context Get detailed context for a code symbol
find_files Fast file path search with glob patterns
code_insight Codebase intelligence and analysis
context Save/load code context manifests
semantic_annotations Query @lci: semantic labels
side_effects Analyze function purity and side effects

Semantic Annotations

Mark up your code with @lci: annotations for enhanced AI understanding:

// @lci:risk[high] @lci:public-api
// @lci:requires[env:DATABASE_URL]
func HandleUserLogin(w http.ResponseWriter, r *http.Request) {
    // ...
}

// @lci:purpose[Validate user credentials against database]
// @lci:must[Return error for invalid credentials]
func ValidateCredentials(username, password string) error {
    // ...
}

Annotation Categories

  • Risk & Safety: @lci:risk[low|medium|high|critical], @lci:safe-zone, @lci:stability
  • Dependencies: @lci:requires[env:VAR], @lci:requires[db:table], @lci:requires[service:name]
  • Conventions: @lci:convention[pattern], @lci:idiom[name], @lci:template[name]
  • Contracts: @lci:must[behavior], @lci:must-not[behavior], @lci:invariant[condition]
  • Purpose: @lci:purpose[description], @lci:domain[area], @lci:owner[team]

Architecture

lci/
├── cmd/lci/          # CLI entry point
├── internal/
│   ├── core/         # Trigram index, symbol store, reference tracker
│   ├── parser/       # Tree-sitter based multi-language parsing
│   ├── search/       # Search engine and scoring
│   ├── indexing/     # Master index and pipeline
│   ├── mcp/          # MCP server and tools
│   └── analysis/     # Code analysis and metrics
└── pkg/              # Public API

Performance

LCI is designed for speed:

  • Indexing: <5s for typical projects (<10k files)
  • Search: <5ms for most queries
  • Memory: <100MB for typical web projects
  • Startup: Near-instant with persistent index

Development

# Run tests
go test ./...

# Build
go build ./cmd/lci

# Run with race detector
go test -race ./...

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please read the contributing guidelines before submitting PRs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

lightning_code_index-0.1.4-py3-none-win_amd64.whl (7.9 MB view details)

Uploaded Python 3Windows x86-64

lightning_code_index-0.1.4-py3-none-manylinux_2_17_x86_64.whl (7.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

lightning_code_index-0.1.4-py3-none-manylinux_2_17_aarch64.whl (7.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

lightning_code_index-0.1.4-py3-none-macosx_11_0_arm64.whl (7.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

lightning_code_index-0.1.4-py3-none-macosx_10_12_x86_64.whl (7.7 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file lightning_code_index-0.1.4-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for lightning_code_index-0.1.4-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 3b66b4267f43ca252e1f2fa41796f9564caaaaa6fd02610c8e391e2a342eaf04
MD5 df7e0142356e0b4272cdd399ab693acf
BLAKE2b-256 b13ce3f5e49fcef94f47c8605b246521397591d1a78a03bcf4734692554b8565

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightning_code_index-0.1.4-py3-none-win_amd64.whl:

Publisher: release.yml on standardbeagle/lci

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightning_code_index-0.1.4-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for lightning_code_index-0.1.4-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 074b900059d14b32dba9334360ec1257dcf980c3f10538ad42b8d32aff23e66d
MD5 f9eab389ab97fd1c1ef5997e81a1851d
BLAKE2b-256 5190bff867b4b2082742e5d918b7f021e91374bc1d18a3c1ef9a303baafc10dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightning_code_index-0.1.4-py3-none-manylinux_2_17_x86_64.whl:

Publisher: release.yml on standardbeagle/lci

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightning_code_index-0.1.4-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for lightning_code_index-0.1.4-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 46e2c5cf040c02a427e702d3073436b2ed529be9e1995965e6a032400e554c44
MD5 914fdaf643a336da722576c0ea24016d
BLAKE2b-256 0fa7854757f3ce6900d0dc6718a7b68d6ac009021637a7cca5593b57b0eb614b

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightning_code_index-0.1.4-py3-none-manylinux_2_17_aarch64.whl:

Publisher: release.yml on standardbeagle/lci

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightning_code_index-0.1.4-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightning_code_index-0.1.4-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8ef84310276af95bca7a92d6df74c1292e72c0c8fafdc184120b4a4319053933
MD5 293665532d7bb459fa677741068f0834
BLAKE2b-256 347a05b8fe1773e8df7bd082f7bd169b0952b5d8d4070f8ed8e77ca5ef88299c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightning_code_index-0.1.4-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on standardbeagle/lci

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lightning_code_index-0.1.4-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for lightning_code_index-0.1.4-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b7013277cecaec0feb750599628c99088b4ac6fdd74f4dc28dc39b78e0d14eb9
MD5 c1bc180d8d45f71bd082ef520f1f23c9
BLAKE2b-256 e6be950f987367c82f66a37a2dc3459d65057744eb3db1090a674967db8ea5c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightning_code_index-0.1.4-py3-none-macosx_10_12_x86_64.whl:

Publisher: release.yml on standardbeagle/lci

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page