Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "lumen",
"owner": {
"name": "Aeneas Rekkas",
"email": "aeneas@ory.com"
},
"metadata": {
"description": "Lumen — local semantic code search for AI coding agents",
"version": "0.2.0"
},
"plugins": [
{
"name": "lumen",
"source": "./",
"description": "Precise local semantic code search via MCP. Indexes your codebase with Go AST parsing, embeds with Ollama or LM Studio, and exposes vector search to Claude through an MCP server — no cloud, no npm.",
"version": "0.2.0",
"author": {
"name": "Aeneas Rekkas",
"url": "https://github.com/aeneasr"
},
"homepage": "https://github.com/aeneasr/lumen",
"repository": "https://github.com/aeneasr/lumen",
"license": "Apache-2.0",
"keywords": ["semantic-search", "code-index", "mcp", "embeddings", "ollama", "rag"],
"category": "developer-tools",
"tags": ["code-search", "mcp", "ai", "local"]
}
]
}
12 changes: 12 additions & 0 deletions .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "lumen",
"description": "Local semantic code search for AI coding agents",
"author": {
"name": "Aeneas Rekkas",
"url": "https://github.com/aeneasr"
},
"homepage": "https://github.com/aeneasr/lumen",
"repository": "https://github.com/aeneasr/lumen",
"license": "Apache-2.0",
"keywords": ["semantic-search", "code-index", "mcp", "embeddings", "ollama", "rag"]
}
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,4 @@ jobs:
OLLAMA_HOST: http://localhost:11434
LUMEN_EMBED_MODEL: all-minilm
LUMEN_EMBED_DIMS: '384'

60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: '1.26'
cache: true

- name: Test
run: make test

- name: Vet
run: go vet -tags=fts5 ./...

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: '1.26'
cache: false

- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: latest
args: --build-tags=fts5

release:
name: Release
runs-on: ubuntu-latest
container:
image: oryd/xgoreleaser:1.26.0-2.14.1
needs: [test, lint]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Release
run: goreleaser release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Binary
lumen
# Build output
bin/
dist/
./lumen

# IDE
.idea/
.vscode/
*.swp

# OS
.DS_Store
.DS_Store
89 changes: 89 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
version: 2
project_name: lumen

before:
hooks:
- apt-get update -qq
- apt-get install -y libsqlite3-dev
- cp /usr/include/sqlite3.h /usr/x86_64-w64-mingw32/include/sqlite3.h

builds:
- id: macos
main: .
binary: lumen
flags:
- -tags=fts5
ldflags:
- -s -w
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
goos:
- darwin
goarch:
- amd64
- arm64

- id: linux-amd64
main: .
binary: lumen
flags:
- -tags=fts5
ldflags:
- -s -w
env:
- CGO_ENABLED=1
goos:
- linux
goarch:
- amd64

- id: linux-arm64
main: .
binary: lumen
flags:
- -tags=fts5
ldflags:
- -s -w
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
goos:
- linux
goarch:
- arm64

- id: windows
main: .
binary: lumen
flags:
- -tags=fts5
ldflags:
- -s -w
env:
- CGO_ENABLED=1
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
goos:
- windows
goarch:
- amd64

archives:
- id: default
formats:
- tar.gz
format_overrides:
- goos: windows
formats:
- zip
name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"

checksum:
name_template: checksums.txt

release:
github:
owner: aeneasr
name: lumen
8 changes: 8 additions & 0 deletions .mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mcpServers": {
"lumen": {
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/run.sh",
"args": ["stdio"]
}
}
}
53 changes: 49 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# CLAUDE.md — lumen

Lumen is a code search and indexing tool designed for integration with the Claude Code plugin system. It provides fast, semantic search capabilities over codebases by leveraging vector embeddings
and a Merkle tree structure to efficiently detect changes and minimize re-indexing.

This repository is structured as a claude plugin available via the claude marketplace.

## Go Standards

- **Version**: Go 1.26+
- **Build**: `CGO_ENABLED=1 go build -o lumen .` (sqlite-vec requires CGO)
- **Build**: `CGO_ENABLED=1 go build -o bin/lumen-<os>-<arch> .` (sqlite-vec requires CGO)
- **Format**: `gofmt` (enforced in CI)
- **Lint**: `golangci-lint run` (zero issues, see `.golangci.yml`)
- **Vet**: `go vet ./...` (external dependency warnings OK)
Expand Down Expand Up @@ -58,25 +63,57 @@
See `Makefile` for all commands:

```bash
make build # Build binary (CGO_ENABLED=1)
make build # Build binary to bin/ (CGO_ENABLED=1)
make test # Run unit + integration tests
make e2e # Run E2E tests (requires Ollama/LM Studio)
make lint # Run golangci-lint
make vet # Run go vet
make format # Format code & markdown
make tidy # Update go.mod
make clean # Remove binary
make install # Install binary
make clean # Remove bin/ and dist/
make plugin-dev # Build + print plugin-dir usage
```

## Plugin Development

```bash
make build
claude --plugin-dir .
```

This loads lumen as a Claude Code plugin directly from the repo. The plugin system handles MCP registration, hooks, and skills declaratively via:
- `.claude-plugin/plugin.json` — plugin manifest
- `.mcp.json` — MCP server config
- `hooks/hooks.json` — SessionStart + PreToolUse hooks
- `skills/` — `/lumen:doctor` and `/lumen:reindex` skills

## Environment Variables

| Variable | Default | Description |
| ------------------------- | -------------------- | ------------------------------------------ |
| `LUMEN_BACKEND` | `ollama` | Embedding backend (`ollama` or `lmstudio`) |
| `LUMEN_EMBED_MODEL` | see note ¹ | Embedding model (must be in registry) |
| `OLLAMA_HOST` | `localhost:11434` | Ollama server URL |
| `LM_STUDIO_HOST` | `localhost:1234` | LM Studio server URL |
| `LUMEN_MAX_CHUNK_TOKENS` | `512` | Max tokens per chunk before splitting |

¹ `ordis/jina-embeddings-v2-base-code` (Ollama), `nomic-ai/nomic-embed-code-GGUF` (LM Studio)

## Project Structure

```
.
├── main.go # 3-line entrypoint
├── .claude-plugin/ # Plugin manifest
├── .mcp.json # MCP server config
├── hooks/ # Hook declarations
├── skills/ # Skill definitions
├── scripts/ # Platform wrappers (run.sh, run.bat)
├── cmd/
│ ├── root.go # Cobra root command
│ ├── stdio.go # MCP server
│ ├── hook.go # Hook handlers
│ ├── purge.go # Index data cleanup
│ └── index.go # CLI indexing
├── internal/
│ ├── config/ # Config loading & paths
Expand All @@ -96,4 +133,12 @@ make install # Install binary
- **Chunk splitting at line boundaries**: Oversized chunks split at `LUMEN_MAX_CHUNK_TOKENS` (512 default)
- **32-batch embedding**: Balance memory vs. API round-trips
- **Cosine distance KNN**: Normalized for semantic similarity
- **Plugin system**: Declarative hooks/MCP/skills via `.claude-plugin/`, replacing manual install/uninstall

## Claude Integration Notes

When planning any work related to claude code plugin, marketplace, hooks, ensuring tool use, and other areas around the claude
integration you MUST base your thinking on the following AUTHORATIVE reference docs:

- Marketplace Plugin: https://code.claude.com/docs/en/plugin-marketplaces#marketplace-schema
- Plugin Reference: https://code.claude.com/docs/en/plugins-reference
19 changes: 12 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
BINARY := lumen
GO := go
GOTAGS := fts5
GOFLAGS := -tags=$(GOTAGS)

.PHONY: build test e2e lint vet tidy clean format
XGORELEASER_IMAGE := oryd/xgoreleaser:1.26.0-2.14.1

.PHONY: build build-local test e2e lint vet tidy clean format plugin-dev

build:
CGO_ENABLED=1 $(GO) build $(GOFLAGS) -o $(BINARY) .
docker run --platform linux/amd64 --mount type=bind,source="$$(pwd)",target=/project \
$(XGORELEASER_IMAGE) --snapshot --clean

build-local:
CGO_ENABLED=1 $(GO) build $(GOFLAGS) -o bin/lumen .

test:
CGO_ENABLED=1 $(GO) test $(GOFLAGS) ./...

install:
CGO_ENABLED=1 $(GO) install $(GOFLAGS) ./...

e2e:
CGO_ENABLED=1 $(GO) test -tags=$(GOTAGS),e2e -timeout=20m -v -count=1 ./...

Expand All @@ -27,8 +29,11 @@ tidy:
$(GO) mod tidy

clean:
rm -f $(BINARY)
rm -rf bin/ dist/

format:
goimports -w .
npx --yes prettier --write "**/*.{json,md,mdx,yaml,yml}"

plugin-dev: build-local
@echo "Run: claude --plugin-dir ."
Loading