Metadata-Version: 2.4
Name: mnemosyne-ollama
Version: 0.1.1
Summary: Ask your codebase questions using Ollama and Mnemosyne -- zero-config local code search
Author: Cast Rock Innovation L.L.C.
License-Expression: AGPL-3.0-or-later
Project-URL: Homepage, https://castnettechnology.com
Project-URL: Repository, https://github.com/castnettech/mnemosyne
Project-URL: Issues, https://github.com/castnettech/mnemosyne/issues
Keywords: mnemosyne,ollama,mcp,code-search,local-llm,rag,tool-calling
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Text Processing :: Indexing
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: mnemosyne-mcp>=0.1.0

# Mnemosyne-Ollama

Ask your codebase questions using local LLMs. Zero config, zero cloud, zero new dependencies.

Bridges [Ollama](https://ollama.com) to [Mnemosyne](https://pypi.org/project/mnemosyne-engine/) via [MCP](https://modelcontextprotocol.io) -- the same 6-signal hybrid retrieval that powers Mnemosyne's Claude Code integration, now available with any tool-calling Ollama model.

## Install

```bash
pip install mnemosyne-ollama
```

This installs everything: the Ollama bridge, the MCP server, and the Mnemosyne retrieval engine.

## Quick Start

```bash
cd /your/project
mnemosyne-ollama "how does authentication work"
```

That's it. Auto-detects your Ollama model, indexes if needed, searches with ranked hybrid retrieval, and returns an answer with file paths and line numbers.

## Requirements

- Python 3.11+
- [Ollama](https://ollama.com) running locally with a tool-calling model

### Supported Models

Any Ollama model with function/tool-calling support:

- `qwen2.5`, `qwen3`
- `llama3.1`, `llama3.2`, `llama3.3`, `llama4`
- `gemma3`, `gemma4`
- `phi4`
- `mistral-nemo`
- `command-r`

If no `--model` is specified, the first installed tool-capable model is used automatically.

## Usage

### Single query

```bash
mnemosyne-ollama "how does the rate limiter work"
mnemosyne-ollama "find all database queries" --model qwen2.5 --budget 12000
mnemosyne-ollama "explain the auth flow" -v   # verbose: shows tool calls
```

### Interactive mode

```bash
mnemosyne-ollama
> how does the auth middleware work?
[searches, responds with code citations]
> what about rate limiting?
[follows up with conversation context]
> ^C
```

### Python library

```python
from mnemosyne_ollama import run

result = await run("how does auth work", model="qwen2.5", budget=8000)
print(result.response)
```

## CLI Reference

```
mnemosyne-ollama [QUERY] [OPTIONS]

positional:
  query                    Question about the codebase (omit for interactive)

options:
  -m, --model MODEL        Ollama model (auto-detected if omitted)
  -b, --budget INT         Token budget for search results (default: 8000)
  -r, --project-root PATH  Project root directory (default: cwd)
  --ollama-url URL         Ollama URL (default: OLLAMA_HOST env or localhost:11434)
  -v, --verbose            Print tool calls to stderr
  --version                Show version
```

## How It Works

```
mnemosyne-ollama
  |
  | 1. Spawns mnemosyne-mcp as subprocess (stdio)
  | 2. Discovers tools: search, index, stats
  | 3. Sends query + tools to Ollama /api/chat
  |
Ollama (local model)
  |
  | 4. Model calls search tool with your question
  |
mnemosyne-mcp
  |
  | 5. 6-signal hybrid retrieval (BM25 + TF-IDF + symbols + usage + prefetch + RRF)
  | 6. AST-aware compression, budget-cut to token limit
  |
  | 7. Results fed back to model
  | 8. Model generates answer with file citations
```

Everything runs locally. No API keys, no cloud, no data leaves your machine.

## Configuration

Mnemosyne search settings are configured via `.mnemosyne/config.toml` in your project root (created on first index). See the [Mnemosyne documentation](https://github.com/castnettech/mnemosyne#readme) for details.

The `--budget` flag overrides the configured default per query.

## Trademarks

Ollama, Qwen, Llama, Gemma, Phi, Mistral, and Command-R are trademarks of their respective owners. mnemosyne-ollama is an independent project and is not endorsed by or affiliated with any of these companies.

## License

AGPL-3.0 -- commercial licensing available from [Cast Net Technology](https://castnettechnology.com).

Copyright 2026 Cast Rock Innovation L.L.C.
