A TypeScript-based code knowledge graph indexer that transforms Git repositories into searchable knowledge stores for AI agents. Creates interconnected representations of codebases through AST parsing and vector embeddings.
9
stars
60
commits
TypeScript
primary language
Jan 6, 2026
updated
A TypeScript-based code knowledge graph indexer that transforms Git repositories into searchable knowledge stores for AI agents. Creates interconnected representations of codebases through AST parsing and vector embeddings.
hikma-engine command for all operations (embed, search, rag)# Clone repository
git clone https://github.com/foyzulkarim/hikma-engine
cd hikma-engine
# Install dependencies
npm install
For python provider, set up Python dependencies:
# After installing hikma-engine
npm run setup-python
Hikma Engine provides three main commands: embed, search, and rag with an explicit CLI approach that requires no configuration files.
--provider is mandatory for all commandsnpx without local installation# Embed with Python provider
npm run embed -- --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
# Search with Python provider
npm run search -- "database configuration" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
# RAG with Python provider
npm run rag -- "How does authentication work?" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1" --llm-model "Qwen/Qwen2.5-Coder-1.5B-Instruct"
# Embed with Ollama
npm run embed -- --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
# Search with Ollama
npm run search -- "database configuration" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
# RAG with Ollama
npm run rag -- "How does authentication work?" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest --llm-model qwen2.5-coder:7b --max-tokens 3000
# Works anywhere without installing hikma-engine locally
npx hikma-engine embed --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1" --dir /path/to/project
npx hikma-engine search "authentication" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest --dir /path/to/project
npx hikma-engine rag "How does this work?" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest --llm-model qwen2.5-coder:7b --dir /path/to/project
--provider <python|server|local|transformers>: REQUIRED - Specifies the AI provider to use--server-url <url>: REQUIRED when using --provider server - Base URL for OpenAI-compatible server--dir <path>: Project directory (defaults to current directory)--embedding-model <model>: Override default embedding model--llm-model <model>: Override default LLM model (for rag command)--install-python-deps: Auto-install Python dependencies when using Python provider--force-full, --skip-embeddings--limit <n>, --min-similarity <0..1>--top-k <n>, --max-tokens <n>When you specify a provider, Hikma Engine automatically selects appropriate default models:
mixedbread-ai/mxbai-embed-large-v1 (embedding), Qwen/Qwen2.5-Coder-1.5B-Instruct (LLM)text-embedding-ada-002 (embedding), gpt-3.5-turbo (LLM)Xenova/all-MiniLM-L6-v2 (embedding), Xenova/gpt2 (LLM)Xenova/all-MiniLM-L6-v2 (embedding)Each project gets its own SQLite database stored in the project directory. You can work with multiple projects simultaneously:
# Index project A
npm run embed -- --provider python --dir /path/to/project-a
# Index project B
npm run embed -- --provider python --dir /path/to/project-b
# Search in specific project
npm run search -- "authentication" --provider python --dir /path/to/project-a
Hikma Engine now uses an explicit CLI approach that requires no configuration files. All settings are specified directly via command-line flags:
# Everything is explicit - no hidden configuration
npm run embed -- --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
npm run search -- "query" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
npm run rag -- "question" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest --llm-model qwen2.5-coder:7b
Benefits:
For backward compatibility, you can still use environment variables by copying .env.example to .env. However, CLI flags take precedence over environment variables.
cp .env.example .env
HIKMA_LOG_LEVEL: Logging level (debug, info, warn, error). Default: infoHIKMA_SQLITE_PATH: SQLite database path. Default: ./data/metadata.dbHIKMA_SQLITE_VEC_EXTENSION: sqlite-vec extension path. Default: ./extensions/vec0.dylibThese are only used when CLI flags are not provided:
Embedding Configuration:
HIKMA_EMBEDDING_PROVIDER: Provider (python, openai). Default: pythonHIKMA_EMBEDDING_MODEL: Model for Python providerHIKMA_EMBEDDING_OPENAI_API_URL: Server URL for OpenAI-compatible APIsHIKMA_EMBEDDING_OPENAI_API_KEY: API key (optional for local services)HIKMA_EMBEDDING_OPENAI_MODEL: Model name for server providerLLM Configuration:
HIKMA_ENGINE_LLM_PROVIDER: Provider (python, openai). Default: pythonHIKMA_ENGINE_LLM_PYTHON_MODEL: Python model nameHIKMA_ENGINE_LLM_OPENAI_API_URL: Server URLHIKMA_ENGINE_LLM_OPENAI_API_KEY: API keyHIKMA_ENGINE_LLM_OPENAI_MODEL: Model nameHIKMA_ENGINE_LLM_OPENAI_MAX_TOKENS: Max response tokens. Default: 400HIKMA_ENGINE_LLM_OPENAI_TEMPERATURE: Sampling temperature. Default: 0.6Example for Ollama:
HIKMA_EMBEDDING_PROVIDER=openai
HIKMA_EMBEDDING_OPENAI_API_URL=http://localhost:11434
HIKMA_EMBEDDING_OPENAI_MODEL=mxbai-embed-large:latest
Example for LM Studio embeddings:
HIKMA_EMBEDDING_PROVIDER=openai
HIKMA_EMBEDDING_OPENAI_API_URL=http://localhost:1234
HIKMA_EMBEDDING_OPENAI_MODEL=text-embedding-mxbai-embed-large-v1
HIKMA_RAG_MODEL: The RAG model for code explanation. Default: Qwen/Qwen2.5-Coder-1.5B-Instruct.HIKMA_ENGINE_LLM_PROVIDER: The LLM provider for code explanations. Options: python, openai. Default: python.HIKMA_ENGINE_LLM_TIMEOUT: Request timeout in milliseconds. Default: 300000.HIKMA_ENGINE_LLM_RETRY_ATTEMPTS: Number of retry attempts. Default: 3.HIKMA_ENGINE_LLM_RETRY_DELAY: Delay between retries in milliseconds. Default: 1000.When HIKMA_ENGINE_LLM_PROVIDER=python:
HIKMA_ENGINE_LLM_PYTHON_MODEL: The model to use. Default: Qwen/Qwen2.5-Coder-1.5B-Instruct.HIKMA_ENGINE_LLM_PYTHON_MAX_RESULTS: Max results for the model. Default: 8.When HIKMA_ENGINE_LLM_PROVIDER=openai (for OpenAI API or other compatible services like LM Studio/Ollama; server in CLI):
HIKMA_ENGINE_LLM_OPENAI_API_URL: The API endpoint.HIKMA_ENGINE_LLM_OPENAI_API_KEY: Your API key.HIKMA_ENGINE_LLM_OPENAI_MODEL: The model name.HIKMA_ENGINE_LLM_OPENAI_MAX_TOKENS: (Optional) Max tokens for the response. Default: 400.HIKMA_ENGINE_LLM_OPENAI_TEMPERATURE: (Optional) Sampling temperature. Default: 0.6.Example for OpenAI API:
HIKMA_ENGINE_LLM_PROVIDER=openai
HIKMA_ENGINE_LLM_OPENAI_API_URL=https://api.openai.com/v1/chat/completions
HIKMA_ENGINE_LLM_OPENAI_API_KEY=sk-your-openai-api-key-here
HIKMA_ENGINE_LLM_OPENAI_MODEL=gpt-4
Example for local services (LM Studio, Ollama):
HIKMA_ENGINE_LLM_PROVIDER=openai
HIKMA_ENGINE_LLM_OPENAI_API_URL=http://localhost:1234 # For LM Studio (base URL; endpoint inferred)
# HIKMA_ENGINE_LLM_OPENAI_API_URL=http://localhost:11434 # For Ollama (base URL; endpoint inferred)
HIKMA_ENGINE_LLM_OPENAI_API_KEY=not-needed-for-local
HIKMA_ENGINE_LLM_OPENAI_MODEL=your-local-model
Hikma Engine supports multiple embedding providers. The default is python, but server-based (OpenAI-compatible) is fully supported and recommended for npx/global usage.
| Provider | Description | Examples | Setup Required | Status |
|---|---|---|---|---|
openai (server) | OpenAI-compatible HTTP API for embeddings | Ollama (http://localhost:11434), LM Studio (http://localhost:1234) | Run server; optional API key | Supported |
python | Python-based embeddings using local models | Hugging Face transformers via Python | Python 3.8+ and pip deps | Supported (default) |
transformers | In-process JS embeddings via @xenova/transformers | Browser/Node, no server | None | Supported |
Hikma Engine supports multiple LLM providers for generating code explanations:
| Provider | Description | Use Case | Setup Required | Status |
|---|---|---|---|---|
python | Local Python-based LLM using transformers | Privacy, offline usage, no API costs | Python + pip dependencies | Supported (default) |
openai | OpenAI API or compatible services | High-quality responses, cloud-based | API key required | Supported |
You can use local AI services for both embeddings and LLM. Here are tested working configurations:
Using Ollama:
# Start Ollama and pull models
ollama serve
ollama pull mxbai-embed-large:latest
ollama pull qwen2.5-coder:7b
# Use with explicit CLI flags
npm run embed -- --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
npm run search -- "query" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
npm run rag -- "question" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest --llm-model qwen2.5-coder:7b
Using LM Studio:
# Start LM Studio on http://localhost:1234 and load models
# Use with explicit CLI flags
npm run embed -- --provider server --server-url http://localhost:1234 --embedding-model text-embedding-mxbai-embed-large-v1
npm run search -- "query" --provider server --server-url http://localhost:1234 --embedding-model text-embedding-mxbai-embed-large-v1
npm run rag -- "question" --provider server --server-url http://localhost:1234 --embedding-model text-embedding-mxbai-embed-large-v1 --llm-model openai/gpt-oss-20b
Using LM Studio + Ollama:
# .env configuration
HIKMA_EMBEDDING_PROVIDER=openai
HIKMA_EMBEDDING_OPENAI_API_URL=http://localhost:11434
HIKMA_EMBEDDING_OPENAI_MODEL=mxbai-embed-large:latest
HIKMA_ENGINE_LLM_PROVIDER=openai
HIKMA_ENGINE_LLM_OPENAI_API_URL=http://localhost:1234/v1/chat/completions
HIKMA_ENGINE_LLM_OPENAI_API_KEY=not-needed-for-local
HIKMA_ENGINE_LLM_OPENAI_MODEL=openai/gpt-oss-20b
Using Only Ollama:
# .env configuration
HIKMA_EMBEDDING_PROVIDER=openai
HIKMA_EMBEDDING_OPENAI_API_URL=http://localhost:11434
HIKMA_EMBEDDING_OPENAI_MODEL=mxbai-embed-large:latest
HIKMA_ENGINE_LLM_PROVIDER=openai
HIKMA_ENGINE_LLM_OPENAI_API_URL=http://localhost:11434/v1/chat/completions
HIKMA_ENGINE_LLM_OPENAI_API_KEY=not-needed-for-local
HIKMA_ENGINE_LLM_OPENAI_MODEL=gpt-oss:20b
For Ollama:
mxbai-embed-large:latestgpt-oss:20b, qwen2.5-coder:7b, or similarollama pull mxbai-embed-large:latest && ollama pull gpt-oss:20bFor LM Studio:
text-embedding-mxbai-embed-large-v1, text-embedding-nomic-embed-text-v1.5openai/gpt-oss-20b, qwen/qwen3-coder-30b, or similar# Index your codebase with Python provider
npx hikma-engine embed --provider python --dir /path/to/your/project
# Search for code
npx hikma-engine search "authentication logic" --provider python --dir /path/to/your/project
# Get AI explanations
npx hikma-engine rag "how does authentication work?" --provider python --dir /path/to/your/project
Install and setup:
npm install
npm run build # Build the TypeScript code
npm rebuild # Rebuild native dependencies if needed
npm run setup-python # For Python-based features (optional)
Index your codebase (explicit CLI - no .env needed):
# Using Python provider (local models)
npm run embed -- --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
# OR using server provider (Ollama/LM Studio)
npm run embed -- --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
Search and get explanations:
# Search with explicit provider
npm run search -- "authentication logic" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
# RAG with explicit provider
npm run rag -- "how does user authentication work?" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1" --llm-model "Qwen/Qwen2.5-Coder-1.5B-Instruct"
npm run build after installation to compile TypeScript codenpm rebuild to recompile native modulesdata/ directory (configurable with --db-path)--provider flag is now required for all commands - no more hidden .env dependencies--provider server, you must also specify --server-urlTo verify everything is working correctly with the explicit CLI approach:
# 1. Test embedding (indexing) with Python provider
npm run embed -- --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
# Should show: "✅ Embedding completed successfully!"
# 2. Test search functionality
npm run search -- "CLI commands" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1" --limit 5
# Should return relevant code snippets with similarity scores
# 3. Test RAG (AI explanation)
npm run rag -- "How do the CLI commands work?" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1" --llm-model "Qwen/Qwen2.5-Coder-1.5B-Instruct"
# Should provide an AI-generated explanation based on your code
# 4. Test with npx (global usage)
npx hikma-engine search "database" --provider python --dir . --limit 3
# Should work without local installation
# 5. Test server provider (if you have Ollama running)
npm run embed -- --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
npm run search -- "authentication" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
Expected Results:
data/ directory with indexed codeSQLite Module Version Error:
# Error: The module was compiled against a different Node.js version
npm rebuild
OpenAI API Key Error:
# Error: Incorrect API key provided
# Solution 1: Use explicit CLI flags (recommended)
npm run rag -- "question" --provider openai --openai-api-key sk-your-actual-api-key --embedding-model text-embedding-3-small --llm-model gpt-4o-mini
# Solution 2: Update your .env file (legacy approach)
HIKMA_EMBEDDING_OPENAI_API_KEY=sk-your-actual-api-key
HIKMA_ENGINE_LLM_OPENAI_API_KEY=sk-your-actual-api-key
Local Service Connection Error:
# Check if Ollama is running and accessible
curl -s http://localhost:11434/api/tags
ollama list # List available models
# If Ollama is not running:
ollama serve
# Test with explicit CLI flags:
npm run search -- "test" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
# Check if LM Studio is running and accessible
curl -s http://localhost:1234/v1/models
# Test with explicit CLI flags:
npm run search -- "test" --provider server --server-url http://localhost:1234 --embedding-model text-embedding-mxbai-embed-large-v1
# Ensure LM Studio is running on port 1234 with a model loaded
"No healthy providers available" Error:
# This usually means the LLM service is not accessible or the model is not available
# Solution 1: Use explicit CLI flags to test (recommended)
# Test different providers:
npm run rag -- "test" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1" --llm-model "Qwen/Qwen2.5-Coder-1.5B-Instruct"
npm run rag -- "test" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest --llm-model qwen2.5-coder:7b
# Solution 2: Check your .env configuration (legacy approach):
# 1. Verify the API URL is correct
# 2. Ensure the model name matches exactly what's available
# 3. Test the service manually:
curl -s http://localhost:1234/v1/models # For LM Studio
ollama list # For Ollama
# 4. Try switching between services if one fails
Model Runner Stopped Error (Ollama):
# If you get "model runner has unexpectedly stopped"
# This usually indicates resource limitations or model issues
# Solution 1: Try explicit CLI with smaller model or different provider (recommended)
npm run rag -- "question" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1" --llm-model "Qwen/Qwen2.5-Coder-1.5B-Instruct"
# Or switch to LM Studio:
npm run rag -- "question" --provider server --server-url http://localhost:1234 --embedding-model text-embedding-mxbai-embed-large-v1 --llm-model openai/gpt-oss-20b
# Solution 2: Update .env file (legacy approach)
HIKMA_ENGINE_LLM_OPENAI_API_URL=http://localhost:1234/v1/chat/completions
HIKMA_ENGINE_LLM_OPENAI_MODEL=openai/gpt-oss-20b
Python Dependencies Missing:
# Install Python dependencies for local LLM/embedding
npm run setup-python
CLI Command Not Found:
# Build the project first
npm run build
# Then use with explicit provider flags
npm run embed -- --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
# Or use npx for global access (no installation required)
npx hikma-engine embed --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
npx hikma-engine search "query" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
MIT License - see LICENSE file for details.
59 commits
1 commits
TypeScript
95.9%
JavaScript
2.2%
Python
1.8%
A TypeScript-based code knowledge graph indexer that transforms Git repositories into searchable knowledge stores for AI agents. Creates interconnected representations of codebases through AST parsing and vector embeddings.
9
stars
60
commits
TypeScript
primary language
Jan 6, 2026
updated
A TypeScript-based code knowledge graph indexer that transforms Git repositories into searchable knowledge stores for AI agents. Creates interconnected representations of codebases through AST parsing and vector embeddings.
hikma-engine command for all operations (embed, search, rag)# Clone repository
git clone https://github.com/foyzulkarim/hikma-engine
cd hikma-engine
# Install dependencies
npm install
For python provider, set up Python dependencies:
# After installing hikma-engine
npm run setup-python
Hikma Engine provides three main commands: embed, search, and rag with an explicit CLI approach that requires no configuration files.
--provider is mandatory for all commandsnpx without local installation# Embed with Python provider
npm run embed -- --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
# Search with Python provider
npm run search -- "database configuration" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
# RAG with Python provider
npm run rag -- "How does authentication work?" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1" --llm-model "Qwen/Qwen2.5-Coder-1.5B-Instruct"
# Embed with Ollama
npm run embed -- --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
# Search with Ollama
npm run search -- "database configuration" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
# RAG with Ollama
npm run rag -- "How does authentication work?" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest --llm-model qwen2.5-coder:7b --max-tokens 3000
# Works anywhere without installing hikma-engine locally
npx hikma-engine embed --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1" --dir /path/to/project
npx hikma-engine search "authentication" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest --dir /path/to/project
npx hikma-engine rag "How does this work?" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest --llm-model qwen2.5-coder:7b --dir /path/to/project
--provider <python|server|local|transformers>: REQUIRED - Specifies the AI provider to use--server-url <url>: REQUIRED when using --provider server - Base URL for OpenAI-compatible server--dir <path>: Project directory (defaults to current directory)--embedding-model <model>: Override default embedding model--llm-model <model>: Override default LLM model (for rag command)--install-python-deps: Auto-install Python dependencies when using Python provider--force-full, --skip-embeddings--limit <n>, --min-similarity <0..1>--top-k <n>, --max-tokens <n>When you specify a provider, Hikma Engine automatically selects appropriate default models:
mixedbread-ai/mxbai-embed-large-v1 (embedding), Qwen/Qwen2.5-Coder-1.5B-Instruct (LLM)text-embedding-ada-002 (embedding), gpt-3.5-turbo (LLM)Xenova/all-MiniLM-L6-v2 (embedding), Xenova/gpt2 (LLM)Xenova/all-MiniLM-L6-v2 (embedding)Each project gets its own SQLite database stored in the project directory. You can work with multiple projects simultaneously:
# Index project A
npm run embed -- --provider python --dir /path/to/project-a
# Index project B
npm run embed -- --provider python --dir /path/to/project-b
# Search in specific project
npm run search -- "authentication" --provider python --dir /path/to/project-a
Hikma Engine now uses an explicit CLI approach that requires no configuration files. All settings are specified directly via command-line flags:
# Everything is explicit - no hidden configuration
npm run embed -- --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
npm run search -- "query" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
npm run rag -- "question" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest --llm-model qwen2.5-coder:7b
Benefits:
For backward compatibility, you can still use environment variables by copying .env.example to .env. However, CLI flags take precedence over environment variables.
cp .env.example .env
HIKMA_LOG_LEVEL: Logging level (debug, info, warn, error). Default: infoHIKMA_SQLITE_PATH: SQLite database path. Default: ./data/metadata.dbHIKMA_SQLITE_VEC_EXTENSION: sqlite-vec extension path. Default: ./extensions/vec0.dylibThese are only used when CLI flags are not provided:
Embedding Configuration:
HIKMA_EMBEDDING_PROVIDER: Provider (python, openai). Default: pythonHIKMA_EMBEDDING_MODEL: Model for Python providerHIKMA_EMBEDDING_OPENAI_API_URL: Server URL for OpenAI-compatible APIsHIKMA_EMBEDDING_OPENAI_API_KEY: API key (optional for local services)HIKMA_EMBEDDING_OPENAI_MODEL: Model name for server providerLLM Configuration:
HIKMA_ENGINE_LLM_PROVIDER: Provider (python, openai). Default: pythonHIKMA_ENGINE_LLM_PYTHON_MODEL: Python model nameHIKMA_ENGINE_LLM_OPENAI_API_URL: Server URLHIKMA_ENGINE_LLM_OPENAI_API_KEY: API keyHIKMA_ENGINE_LLM_OPENAI_MODEL: Model nameHIKMA_ENGINE_LLM_OPENAI_MAX_TOKENS: Max response tokens. Default: 400HIKMA_ENGINE_LLM_OPENAI_TEMPERATURE: Sampling temperature. Default: 0.6Example for Ollama:
HIKMA_EMBEDDING_PROVIDER=openai
HIKMA_EMBEDDING_OPENAI_API_URL=http://localhost:11434
HIKMA_EMBEDDING_OPENAI_MODEL=mxbai-embed-large:latest
Example for LM Studio embeddings:
HIKMA_EMBEDDING_PROVIDER=openai
HIKMA_EMBEDDING_OPENAI_API_URL=http://localhost:1234
HIKMA_EMBEDDING_OPENAI_MODEL=text-embedding-mxbai-embed-large-v1
HIKMA_RAG_MODEL: The RAG model for code explanation. Default: Qwen/Qwen2.5-Coder-1.5B-Instruct.HIKMA_ENGINE_LLM_PROVIDER: The LLM provider for code explanations. Options: python, openai. Default: python.HIKMA_ENGINE_LLM_TIMEOUT: Request timeout in milliseconds. Default: 300000.HIKMA_ENGINE_LLM_RETRY_ATTEMPTS: Number of retry attempts. Default: 3.HIKMA_ENGINE_LLM_RETRY_DELAY: Delay between retries in milliseconds. Default: 1000.When HIKMA_ENGINE_LLM_PROVIDER=python:
HIKMA_ENGINE_LLM_PYTHON_MODEL: The model to use. Default: Qwen/Qwen2.5-Coder-1.5B-Instruct.HIKMA_ENGINE_LLM_PYTHON_MAX_RESULTS: Max results for the model. Default: 8.When HIKMA_ENGINE_LLM_PROVIDER=openai (for OpenAI API or other compatible services like LM Studio/Ollama; server in CLI):
HIKMA_ENGINE_LLM_OPENAI_API_URL: The API endpoint.HIKMA_ENGINE_LLM_OPENAI_API_KEY: Your API key.HIKMA_ENGINE_LLM_OPENAI_MODEL: The model name.HIKMA_ENGINE_LLM_OPENAI_MAX_TOKENS: (Optional) Max tokens for the response. Default: 400.HIKMA_ENGINE_LLM_OPENAI_TEMPERATURE: (Optional) Sampling temperature. Default: 0.6.Example for OpenAI API:
HIKMA_ENGINE_LLM_PROVIDER=openai
HIKMA_ENGINE_LLM_OPENAI_API_URL=https://api.openai.com/v1/chat/completions
HIKMA_ENGINE_LLM_OPENAI_API_KEY=sk-your-openai-api-key-here
HIKMA_ENGINE_LLM_OPENAI_MODEL=gpt-4
Example for local services (LM Studio, Ollama):
HIKMA_ENGINE_LLM_PROVIDER=openai
HIKMA_ENGINE_LLM_OPENAI_API_URL=http://localhost:1234 # For LM Studio (base URL; endpoint inferred)
# HIKMA_ENGINE_LLM_OPENAI_API_URL=http://localhost:11434 # For Ollama (base URL; endpoint inferred)
HIKMA_ENGINE_LLM_OPENAI_API_KEY=not-needed-for-local
HIKMA_ENGINE_LLM_OPENAI_MODEL=your-local-model
Hikma Engine supports multiple embedding providers. The default is python, but server-based (OpenAI-compatible) is fully supported and recommended for npx/global usage.
| Provider | Description | Examples | Setup Required | Status |
|---|---|---|---|---|
openai (server) | OpenAI-compatible HTTP API for embeddings | Ollama (http://localhost:11434), LM Studio (http://localhost:1234) | Run server; optional API key | Supported |
python | Python-based embeddings using local models | Hugging Face transformers via Python | Python 3.8+ and pip deps | Supported (default) |
transformers | In-process JS embeddings via @xenova/transformers | Browser/Node, no server | None | Supported |
Hikma Engine supports multiple LLM providers for generating code explanations:
| Provider | Description | Use Case | Setup Required | Status |
|---|---|---|---|---|
python | Local Python-based LLM using transformers | Privacy, offline usage, no API costs | Python + pip dependencies | Supported (default) |
openai | OpenAI API or compatible services | High-quality responses, cloud-based | API key required | Supported |
You can use local AI services for both embeddings and LLM. Here are tested working configurations:
Using Ollama:
# Start Ollama and pull models
ollama serve
ollama pull mxbai-embed-large:latest
ollama pull qwen2.5-coder:7b
# Use with explicit CLI flags
npm run embed -- --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
npm run search -- "query" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
npm run rag -- "question" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest --llm-model qwen2.5-coder:7b
Using LM Studio:
# Start LM Studio on http://localhost:1234 and load models
# Use with explicit CLI flags
npm run embed -- --provider server --server-url http://localhost:1234 --embedding-model text-embedding-mxbai-embed-large-v1
npm run search -- "query" --provider server --server-url http://localhost:1234 --embedding-model text-embedding-mxbai-embed-large-v1
npm run rag -- "question" --provider server --server-url http://localhost:1234 --embedding-model text-embedding-mxbai-embed-large-v1 --llm-model openai/gpt-oss-20b
Using LM Studio + Ollama:
# .env configuration
HIKMA_EMBEDDING_PROVIDER=openai
HIKMA_EMBEDDING_OPENAI_API_URL=http://localhost:11434
HIKMA_EMBEDDING_OPENAI_MODEL=mxbai-embed-large:latest
HIKMA_ENGINE_LLM_PROVIDER=openai
HIKMA_ENGINE_LLM_OPENAI_API_URL=http://localhost:1234/v1/chat/completions
HIKMA_ENGINE_LLM_OPENAI_API_KEY=not-needed-for-local
HIKMA_ENGINE_LLM_OPENAI_MODEL=openai/gpt-oss-20b
Using Only Ollama:
# .env configuration
HIKMA_EMBEDDING_PROVIDER=openai
HIKMA_EMBEDDING_OPENAI_API_URL=http://localhost:11434
HIKMA_EMBEDDING_OPENAI_MODEL=mxbai-embed-large:latest
HIKMA_ENGINE_LLM_PROVIDER=openai
HIKMA_ENGINE_LLM_OPENAI_API_URL=http://localhost:11434/v1/chat/completions
HIKMA_ENGINE_LLM_OPENAI_API_KEY=not-needed-for-local
HIKMA_ENGINE_LLM_OPENAI_MODEL=gpt-oss:20b
For Ollama:
mxbai-embed-large:latestgpt-oss:20b, qwen2.5-coder:7b, or similarollama pull mxbai-embed-large:latest && ollama pull gpt-oss:20bFor LM Studio:
text-embedding-mxbai-embed-large-v1, text-embedding-nomic-embed-text-v1.5openai/gpt-oss-20b, qwen/qwen3-coder-30b, or similar# Index your codebase with Python provider
npx hikma-engine embed --provider python --dir /path/to/your/project
# Search for code
npx hikma-engine search "authentication logic" --provider python --dir /path/to/your/project
# Get AI explanations
npx hikma-engine rag "how does authentication work?" --provider python --dir /path/to/your/project
Install and setup:
npm install
npm run build # Build the TypeScript code
npm rebuild # Rebuild native dependencies if needed
npm run setup-python # For Python-based features (optional)
Index your codebase (explicit CLI - no .env needed):
# Using Python provider (local models)
npm run embed -- --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
# OR using server provider (Ollama/LM Studio)
npm run embed -- --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
Search and get explanations:
# Search with explicit provider
npm run search -- "authentication logic" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
# RAG with explicit provider
npm run rag -- "how does user authentication work?" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1" --llm-model "Qwen/Qwen2.5-Coder-1.5B-Instruct"
npm run build after installation to compile TypeScript codenpm rebuild to recompile native modulesdata/ directory (configurable with --db-path)--provider flag is now required for all commands - no more hidden .env dependencies--provider server, you must also specify --server-urlTo verify everything is working correctly with the explicit CLI approach:
# 1. Test embedding (indexing) with Python provider
npm run embed -- --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
# Should show: "✅ Embedding completed successfully!"
# 2. Test search functionality
npm run search -- "CLI commands" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1" --limit 5
# Should return relevant code snippets with similarity scores
# 3. Test RAG (AI explanation)
npm run rag -- "How do the CLI commands work?" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1" --llm-model "Qwen/Qwen2.5-Coder-1.5B-Instruct"
# Should provide an AI-generated explanation based on your code
# 4. Test with npx (global usage)
npx hikma-engine search "database" --provider python --dir . --limit 3
# Should work without local installation
# 5. Test server provider (if you have Ollama running)
npm run embed -- --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
npm run search -- "authentication" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
Expected Results:
data/ directory with indexed codeSQLite Module Version Error:
# Error: The module was compiled against a different Node.js version
npm rebuild
OpenAI API Key Error:
# Error: Incorrect API key provided
# Solution 1: Use explicit CLI flags (recommended)
npm run rag -- "question" --provider openai --openai-api-key sk-your-actual-api-key --embedding-model text-embedding-3-small --llm-model gpt-4o-mini
# Solution 2: Update your .env file (legacy approach)
HIKMA_EMBEDDING_OPENAI_API_KEY=sk-your-actual-api-key
HIKMA_ENGINE_LLM_OPENAI_API_KEY=sk-your-actual-api-key
Local Service Connection Error:
# Check if Ollama is running and accessible
curl -s http://localhost:11434/api/tags
ollama list # List available models
# If Ollama is not running:
ollama serve
# Test with explicit CLI flags:
npm run search -- "test" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest
# Check if LM Studio is running and accessible
curl -s http://localhost:1234/v1/models
# Test with explicit CLI flags:
npm run search -- "test" --provider server --server-url http://localhost:1234 --embedding-model text-embedding-mxbai-embed-large-v1
# Ensure LM Studio is running on port 1234 with a model loaded
"No healthy providers available" Error:
# This usually means the LLM service is not accessible or the model is not available
# Solution 1: Use explicit CLI flags to test (recommended)
# Test different providers:
npm run rag -- "test" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1" --llm-model "Qwen/Qwen2.5-Coder-1.5B-Instruct"
npm run rag -- "test" --provider server --server-url http://localhost:11434 --embedding-model mxbai-embed-large:latest --llm-model qwen2.5-coder:7b
# Solution 2: Check your .env configuration (legacy approach):
# 1. Verify the API URL is correct
# 2. Ensure the model name matches exactly what's available
# 3. Test the service manually:
curl -s http://localhost:1234/v1/models # For LM Studio
ollama list # For Ollama
# 4. Try switching between services if one fails
Model Runner Stopped Error (Ollama):
# If you get "model runner has unexpectedly stopped"
# This usually indicates resource limitations or model issues
# Solution 1: Try explicit CLI with smaller model or different provider (recommended)
npm run rag -- "question" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1" --llm-model "Qwen/Qwen2.5-Coder-1.5B-Instruct"
# Or switch to LM Studio:
npm run rag -- "question" --provider server --server-url http://localhost:1234 --embedding-model text-embedding-mxbai-embed-large-v1 --llm-model openai/gpt-oss-20b
# Solution 2: Update .env file (legacy approach)
HIKMA_ENGINE_LLM_OPENAI_API_URL=http://localhost:1234/v1/chat/completions
HIKMA_ENGINE_LLM_OPENAI_MODEL=openai/gpt-oss-20b
Python Dependencies Missing:
# Install Python dependencies for local LLM/embedding
npm run setup-python
CLI Command Not Found:
# Build the project first
npm run build
# Then use with explicit provider flags
npm run embed -- --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
# Or use npx for global access (no installation required)
npx hikma-engine embed --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
npx hikma-engine search "query" --provider python --embedding-model "mixedbread-ai/mxbai-embed-large-v1"
MIT License - see LICENSE file for details.
59 commits
1 commits
TypeScript
95.9%
JavaScript
2.2%
Python
1.8%