GC

glommer/codemogger

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

349 stars 30 forks 品質 73 トレンド 23MIT

Codemoggerは、AIコーディングエージェント向けのコードインデックスライブラリおよびMCPサーバーです

概要

AIコーディングエージェント向けのコードインデックスライブラリ。ソースコードをツリーシッターで解析し、それを意味単位(関数、構造体、クラス、実装ブロック)にチャンクし、ローカルに埋め込み、すべてをベクター+全文検索付きの単一のSQLiteファイルに保存します。 DockerもサーバーもAPIキーも使いません。コードベースごとに1つの.dbファイル。 コーディングエージェントはコードベースを理解する必要があります。定義されている場所を見つけ、ファイル間で概念がどのように実装されているかを発見し、慣れないコードを素早くナビゲートする必要があります。これにはキーワード検索(正確な識別子検索)と意味検索(正確な名前がわからない場合の自然言語クエリ)の両方が必要です。 AIコーディングツールがより構成可能になるにつれて(エージェント同士が呼びかけたり、MCPサーバーが異なるホストに接続したり)、この機能はローカルで動作するライブラリとして存在する必要があります。外部サーバーもAPIキーもDockerコンテナも不要です。結果を返す関数呼び出しだけです。 CodeMoggerはそのライブラリです。

概要(AI 翻訳)

AIコーディングエージェント向けのコードインデックスライブラリ。ソースコードをツリーシッターで解析し、それを意味単位(関数、構造体、クラス、実装ブロック)にチャンクし、ローカルに埋め込み、すべてをベクター+全文検索付きの単一のSQLiteファイルに保存します。

DockerもサーバーもAPIキーも使いません。コードベースごとに.dbファイルが1つだけです。

なぜ

コーディングエージェントはコードベースを理解する必要があります。定義されている場所を見つけ、ファイル間で概念がどのように実装されているかを発見し、慣れないコードを素早くナビゲートする必要があります。これにはキーワード検索(正確な識別子検索)と意味検索(正確な名前がわからない場合の自然言語クエリ)の両方が必要です。

AIコーディングツールがより構成可能になるにつれて(エージェント同士が呼びかけたり、MCPサーバーが異なるホストに接続したり)、この機能はローカルで動作するライブラリとして存在する必要があります。外部サーバーもAPIキーもDockerコンテナも不要です。結果を返す関数呼び出しだけです。

codemoggerがそのライブラリです。Turso経由でFTS+ベクトル検索を備えた組み込みSQLiteで、単一の.dbファイルに収録されています。

インストール

またはnpxを使ってインストールせずに実行してもいいです。

クイックスタート

コーディングエージェントのMCP設定(Claude Code、OpenCodeなど)に追加してください:

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

codemogger

Code indexing library for AI coding agents. Parses source code with tree-sitter, chunks it into semantic units (functions, structs, classes, impl blocks), embeds them locally, and stores everything in a single SQLite file with vector + full-text search.

No Docker, no server, no API keys. One .db file per codebase.

Why

Coding agents need to understand codebases. They need to find where things are defined, discover how concepts are implemented across files, and navigate unfamiliar code quickly. This requires both keyword search (precise identifier lookup) and semantic search (natural language queries when you don’t know the exact names).

As AI coding tools become more composable - agents calling agents, MCP servers plugging into different hosts - this capability needs to exist as a library that runs locally. No external servers, no API keys, no Docker containers. Just a function call that returns results.

codemogger is that library. Embedded SQLite (via Turso) with FTS + vector search in a single .db file.

Install

npm install -g codemogger

Or use npx to run without installing.

Quick start

# Index a project
codemogger index ./my-project

# Search
codemogger search "authentication middleware"

Add to your coding agent’s MCP config (Claude Code, OpenCode, etc.):

{
  "mcpServers": {
    "codemogger": {
      "command": "npx",
      "args": ["-y", "codemogger", "mcp"]
    }
  }
}

The MCP server exposes three tools:

  • codemogger_search - semantic and keyword search over indexed code
  • codemogger_index - index a codebase for the first time
  • codemogger_reindex - update the index after modifying files

Add the local db to .gitignore:

# codemogger db
.codemogger/

SDK

codemogger is also usable as a library. The SDK has no model dependency - you provide your own embedding function:

import { CodeIndex } from "codemogger"
import { pipeline } from "@huggingface/transformers"

// Load embedding model (runs locally, no API keys)
const extractor = await pipeline("feature-extraction", "Xenova/all-MiniLM-L6-v2", { dtype: "q8" })

const embedder = async (texts: string[]): Promise => {
  const output = await extractor(texts, { pooling: "mean", normalize: true })
  return output.tolist() as number[][]
}

const db = new CodeIndex({
  dbPath: "./my-project.db",
  embedder,
  embeddingModel: "all-MiniLM-L6-v2",
})

await db.index("/path/to/project")

// Semantic: "what does this codebase do?"
const results = await db.search("authentication middleware", { mode: "semantic" })

// Keyword: precise identifier lookup
const results = await db.search("BTreeCursor", { mode: "keyword" })

await db.close()

The MCP server and CLI ship with all-MiniLM-L6-v2 by default.

CLI

# Install globally
npm install -g codemogger
GitHub で README 全文を見る

インストール

npx -y codemogger mcp
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "codemogger": { "command": "npx", "args": ["-y", "codemogger", "mcp"] } } }