Metadata-Version: 2.4
Name: vice-ai
Version: 0.2.0
Summary: Context retrieval engine for AI agents.
Author: Niklas Jacobsen
License-Expression: MIT
Project-URL: Homepage, https://github.com/niklas-jacobsen/vice
Project-URL: Issues, https://github.com/niklas-jacobsen/vice/issues
Keywords: retrieval,context,agents,mcp,obsidian,typesafe,jev
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typesafe-sdk[http2]>=0.7.5
Requires-Dist: numpy
Requires-Dist: onnxruntime
Requires-Dist: tokenizers
Requires-Dist: huggingface_hub
Requires-Dist: bm25s
Requires-Dist: opentelemetry-sdk
Requires-Dist: keyring
Provides-Extra: mcp
Requires-Dist: mcp>=1.2; extra == "mcp"
Provides-Extra: eval
Requires-Dist: scikit-learn; extra == "eval"
Requires-Dist: fastembed; extra == "eval"
Requires-Dist: tiktoken; extra == "eval"
Requires-Dist: model2vec; extra == "eval"
Requires-Dist: sqlite-vec; extra == "eval"
Requires-Dist: lancedb; extra == "eval"
Requires-Dist: hnswlib; extra == "eval"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: build; extra == "dev"
Dynamic: license-file

# vice

A context retrieval engine for AI agents.

> [!WARNING]
> vice is a work in progress. Interfaces, configuration and output formats may change
> without notice. macOS only.

vice takes information retrieval over your own knowledge off the agent. It decides
whether a prompt needs context, finds and reads the relevant sources, and resolves
conflicting or outdated information. Relevant context is pushed to the agent before it
processes the prompt, and is also available on demand over MCP. The agent's context
window holds the result, not the search.

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="docs/assets/flow-dark.svg">
  <img alt="A prompt enters vice, which decides whether it needs context, retrieves and judges blocks from the sources, selects the final set, and passes relevant blocks or nothing to the agent. The agent can also call recall over MCP mid-task." src="docs/assets/flow-light.svg">
</picture>

For the prompt `draft the Atlas launch announcement`, the agent receives:

```text
Relevant information from the user's sources (vice):
[2026-10-20] Atlas launches December 2.
[2026-11-03] Atlas messaging: lead with offline sync; pricing is unchanged.
```

A prompt that needs no context adds nothing.

Relevance and contradiction judgments come from TypeSafe's
[Jev](https://docs.typesafe.ai), which returns calibrated probabilities for typed
questions. Retrieval, thresholds and decisions are deterministic code.

## Features

- Source types so far: Obsidian vaults, Markdown folders, and JSONL, which any other
  system can export blocks to. Further types install as plugins with `vice plugin install`
  ([Sources](docs/sources.md))
- Claude Code integration in one command: context arrives with the prompt, and the agent
  cannot read indexed files directly
- MCP server for lookups mid-task, for Claude Code, Claude Desktop and other stdio clients
- `vice ask` for scripts
- Outputs: context file, command, webhook

## Quickstart

Requires macOS and a [TypeSafe](https://typesafe.ai) API key.

Install:

```bash
brew install niklas-jacobsen/tap/vice-ai
```

Store the API key and choose sources:

```bash
vice setup
```

Build the index (first run downloads a 90 MB model):

```bash
vice sync
```

Run the service in the background and at login:

```bash
vice start
```

Connect Claude Code (prompt hook, read guard, MCP server):

```bash
vice connect claude-code
```

Full instructions, other install methods and uninstalling: [Installation](docs/installation.md).

## Commands

| Command | |
|---|---|
| `vice setup` | Write the configuration and store the API key. |
| `vice sync` | Index all sources. |
| `vice start` / `stop` | Run or stop the background service. |
| `vice status` | Configuration, sources, plugins, index and service state. |
| `vice connect claude-code` | Register hooks and MCP server. `--remove` undoes it. |
| `vice sources types` / `add` / `remove` | List source types, add or remove a source. |
| `vice plugin install` / `list` / `remove` | Manage packages that add source types. |
| `vice ask "..."` | Print what an agent receives for the text. |
| `vice logs` | Follow the service log. |
| `vice key set` / `delete` | Manage the API key in the Keychain. |

All commands and options: [Usage](docs/usage.md#commands).

## Benchmark

Synthetic dataset, held-out test split: 150 events over 1,500 blocks, `jev-1.14.0`.

| Measure | Result |
|---|---|
| Acted when no context was needed | 0 of 60 |
| Missed when context was needed | 2 of 90 |
| Context precision / recall | 0.896 / 0.906 |
| Superseded fact included | 6.8% |
| Latency | 210 ms p50, 404 ms p95 |
| Cost per event | ~4,500 input tokens, ~$0.0002 |

Method, ablations and limits: [Evaluation](docs/evaluation.md).

## Documentation

- [Installation](docs/installation.md)
- [Usage](docs/usage.md)
- [Configuration](docs/configuration.md)
- [Sources](docs/sources.md)
- [Integrations](docs/integrations.md)
- [Privacy](docs/privacy.md)
- [Troubleshooting](docs/troubleshooting.md)
- [Evaluation](docs/evaluation.md)
- [Contributing](CONTRIBUTING.md)

## Privacy

Sources are indexed and searched locally. Event text and about 20 candidate blocks per
event are sent to TypeSafe's API, after credential redaction. See
[Privacy](docs/privacy.md).

## License

MIT
