Metadata-Version: 2.4
Name: novus-rag
Version: 11.9.179
Summary: The brain and the memory for your AI agents: a structural map of your projects, served over MCP.
Author: JSNavas
License: MIT
Requires-Python: <3.15,>=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: lancedb==0.30.2
Requires-Dist: pyarrow==26.0.1
Requires-Dist: pandas==3.1.1
Requires-Dist: numpy==2.5.5
Requires-Dist: openai==2.36.0
Requires-Dist: anthropic==2.12.0
Requires-Dist: mcp==1.27.1
Requires-Dist: fastmcp==3.2.4
Requires-Dist: httpx==0.28.1
Requires-Dist: tree-sitter==0.27.0
Requires-Dist: tree-sitter-language-pack==1.28.0
Requires-Dist: python-dotenv==1.2.2
Requires-Dist: requests==2.34.2
Requires-Dist: pytest==9.2.0
Requires-Dist: pytest-asyncio==1.5.0
Requires-Dist: rich==15.0.0
Dynamic: license-file

<h1 align="center">🧠 NOVUS RAG</h1>

<p align="center"><b>Your agents hallucinate schemas and lie about compilation. NOVUS RAG stops them.</b></p>

NOVUS RAG is an MCP server that indexes your projects and hands your agent a structural map —
real dependencies (not "semantically similar" ones), graph communities, the tables each method
reads and writes, routes from the front through the gateway to the microservice, events and
observers, and the business rules documented in your project — before it touches a single file.
Every fact comes with a verifiable `path:line`.

**The brain** knows your code and each project's own patterns. **The memory** keeps what you
decided: tasks and their state, postponements, your conventions, how your projects relate — in
every new chat. Your agents (Claude Code, Codex, Cursor…) do the typing; NOVUS RAG tells them
where, how, and whether they should.

It is not a code search engine. It is a structural map read from the index, not written by an LLM.

**Small models, big-model results, at low cost.** NOVUS RAG gives small models everything they
need to plan and code like a big one: the structural map, the project memory, its own conventions
and a review step. The default stack — OpenCode `hy4-flash` plus local embeddings with Ollama
(`nomic-embed-text`) — keeps the bill low; the LLM is billed by token/quota. A `$0` setup is
possible with your own free/free-tier models or a local endpoint, but the historical free OpenCode
Go models (`beam-free`, `hy4-flash-free`) are no longer served. OpenRouter and any
Anthropic-compatible endpoint remain options.

> Español: [README.es.md](README.es.md)

<p align="center">
  <img src="docs/img/demo.gif" alt="From a task to the exact places to change, in one call" width="900">
</p>

## The numbers (real runs, not marketing)

Above the fold, because they are the only claim that matters:

| What the run measured | Result |
|---|---|
| Models that **stopped** a task the project memory had postponed (7 of 7) | **7 / 7** |
| Activity-log feature: 11 files, compiled, reviewed, merged, by a small model | **$0** |
| Small models reaching big-model quality on the same tasks | **all 7** |

Source and method: [docs/BENCHMARK.md](docs/BENCHMARK.md). Reproducible with `bench/make_demo.py`,
`bench/tasks.json` and `bench/measure.py`.

<p align="center">
  <img src="docs/img/before-after.gif" alt="Without the RAG the agent implements a postponed task; with NOVUS RAG it stops before writing a line" width="900">
</p>

*The before/after, same task, same small model: without the RAG it implements a task the project
memory had postponed; with the RAG it stops before writing a line. Real transcripts and how to
reproduce them: [docs/COMPARATIVE.md](docs/COMPARATIVE.md).*

```
┌──────────────┐     ┌─────────────────┐     ┌──────────────────┐     ┌──────────────┐
│ Your projects│ ──► │ novus-rag sync  │ ──► │  Local index     │ ──► │ Your agent   │
│ (supported   │     │ AST + graph +   │     │  (LanceDB)       │     │ via MCP      │
│  stacks)     │     │ conventions     │     │  per branch      │     │ (any client) │
└──────────────┘     └─────────────────┘     └──────────────────┘     └──────────────┘
```

## Quickstart

```bash
git clone https://github.com/JSNavas/novus-rag.git
cd novus-rag && ./install.sh          # venv, dependencies, the `novus-rag` CLI and a setup wizard
novus-rag doctor                      # checks the environment and prints the exact fix for anything missing
novus-rag demo                        # optional: see a real analysis on a demo project in /tmp, no keys needed

novus-rag mcp-config claude           # register the MCP in your agent (or codex, opencode, cursor…)
cd ~/code/your-project && novus-rag sync
```

`sync` is progressive: in about a minute the structural index (AST, schema,
business rules) is queryable and you can start working; the LLM phases
(summaries, graph, conventions) finish in the background on their own, and an
interrupted indexing RESUMES where it stopped — it never starts from zero.

```bash
novus-rag status your-project         # indexing level per pillar + whether the background is still running
```

Or, with `uv` (PyPI, no clone needed):

```bash
uv tool install novus-rag
novus-rag mcp-config claude
```

The wizard (`novus-rag init`, run it again at any time) asks for your language, LLM provider,
keys and embeddings. Keys are stored in `~/.novus-rag/.env` (mode 600), never in the repo.

### The default local setup

| Piece | What | Cost |
|---|---|---|
| LLM | OpenCode with `hy4-flash`, falling back to `deepseek-v4.1-flash` → `glm-5.3-flash` → `gpt-6-luna`; several accounts rotate automatically | low cost (`beam-free` was deprecated) |
| Embeddings | `nomic-embed-text` on [Ollama](https://ollama.com), 768 dimensions, local | $0 |
| Index | LanceDB on your disk | $0 |

```bash
ollama pull nomic-embed-text
novus-rag init     # OpenCode and local embeddings are the defaults
```

Prefer a paid provider? Pick OpenRouter, or point `[llm] base_url` to any Anthropic-compatible
endpoint. Each embeddings model keeps its own index, so switching never mixes vectors.

## What it gives your agent

- **From the task to the code.** `analyze_implementation_task("<ticket text>", projects)` takes
  the task as written (English or Spanish, no method names) and returns where each concept lives,
  which project to touch, the propagation map (callers, routes, front → gateway → service, tables
  and who writes and **reads** them, event chains, observers, policies), the current schema, the
  literal bodies to change and the project's own rules.
- **One call, every angle.** `analyze_feature("<feature>")` returns business rules, conventions,
  architecture, dependencies and snippets in parallel.
- **Literal facts.** Schema, HTTP routes and method bodies come straight from the index. What an
  LLM writes is marked as such.
- **Multi-project for real.** Cross-service HTTP calls, shared tables and per-branch freshness.
  Comparison questions ("how was this done in X versus Y?") answer each project separately.
- **Your business rules.** Markdown docs in `docs/` describing rules, requirements or policies are
  indexed section by section and shown next to the code that implements them.
- **Learns your vocabulary.** Nothing about a specific project lives in the code: each project's
  jargon is learned from its own index.
- **Your project's own patterns, enforced.** If your methods are `editUser`/`createUser`, a new
  `userDelete` or `removeUser` is flagged with the name to use (`deleteUser`); if they are
  `editarUsuario`, so is `eliminarUsuario`. Same for tables, columns, foreign keys, date and
  boolean columns, file names, folder suffixes and route segments — all measured on the project
  itself.
- **Knows why the code is like this.** The commits of the files a task touches that explain
  something (including PR descriptions merged with squash) come with the implementation guide.
- **One check after editing.** `review_change(paths)` runs the real compiler or linter, checks the
  naming pattern and the majority rules, flags keys, SQL injection, another user's id in the URL,
  prices from the client, unsigned webhooks, uploads, races and debug leftovers, and lists who
  else calls the changed code and which tests were not touched.
- **Any MCP client.** Claude Code, Codex, OpenCode, Cursor, Cline, Antigravity. The agent contract
  travels inside the server, not in files you have to copy.

**Validated with real tasks:** NestJS · Symfony · Laravel (+ DDD) · Remix · Vue · KrakenD.
**Also indexes:** Next.js · React Router 7 · React · Angular · Nuxt · Svelte · Express · Python · Rust.
Full list and what each level means: [docs/STACKS.md](docs/STACKS.md).

## Advanced

<details>
<summary><b>Memory across chats (Engram)</b> — optional, recommended</summary>

With [Engram](docs/ENGRAM.md), what you decide (tasks and their state, postponements, your own
conventions, which project is the front of which back) is saved and comes back in every new chat.
Ask to run a phase you postponed and the RAG stops to ask. NOVUS RAG reads and writes the memory
through its own MCP tools (`remember`, `forget`, `project_memory`); Engram's CLI/MCP is optional for
direct inspection.

- A memory across chats: tasks, decisions, conventions, project relations.
- Ask to run a postponed phase and the RAG stops to ask before writing a line.
- The memory belongs to the RAG's view of the project; Engram is the memory, NOVUS RAG is the brain.

See [docs/ENGRAM.md](docs/ENGRAM.md) and [docs/ORCHESTRATION.md](docs/ORCHESTRATION.md).

</details>

<details>
<summary><b>Orchestration: a planner and its sub-agents</b> — advanced</summary>

NOVUS RAG is not only an executor's tool. A planner can break a feature into subtasks, each with a
cached guide, and hand them to sub-agents that run in their own threads and copies of the project.
Roles, tickets, the cached guide and the commit style travel inside the brief.

- `register_plan`, `update_subtask`, `plan_status` drive the plan.
- Each subtask's guide is prepared in the cache while the planner works.
- Sub-agents never merge into the main branch; they commit on their own branch.
- See [docs/ORCHESTRATION.md](docs/ORCHESTRATION.md).

</details>

## Documentation

| Doc | What you will find |
|---|---|
| [docs/INSTALL.md](docs/INSTALL.md) | Requirements, providers, MCP registration, verification, troubleshooting |
| [docs/OPERATIONS.md](docs/OPERATIONS.md) | Daily flow, freshness and git hooks, layered configuration, exclusions |
| [docs/STACKS.md](docs/STACKS.md) | Supported stacks and languages |
| [docs/COMMANDS.md](docs/COMMANDS.md) | Command reference |
| [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | Components, chunk types, the six pillars, pipeline, stack detection |
| [docs/MCP-TOOLS.md](docs/MCP-TOOLS.md) | The twelve tools, modes and intent catalog |
| [docs/ORCHESTRATION.md](docs/ORCHESTRATION.md) | A planner and its sub-agents: roles, tickets, the cached guide |
| [docs/BENCHMARK.md](docs/BENCHMARK.md) | Small models as executors, with and without the RAG |
| [docs/AGENT-CONTRACT.md](docs/AGENT-CONTRACT.md) | The contract every agent follows, guarantee markers |
| [docs/INTERNALS.md](docs/INTERNALS.md) | Hang protection, versioned caches |
| [docs/ENGRAM.md](docs/ENGRAM.md) | Optional memory across sessions |
| [docs/DECISIONS.md](docs/DECISIONS.md) | The non-obvious whys, with measurements |

## Compatibility

- Python 3.13-3.14 · macOS and Linux
- MCP clients: Claude Code · Codex · OpenCode · Cursor · Cline · Antigravity

## Contributing

Bug reports with a reproducible task are the most valuable contribution. See
[CONTRIBUTING.md](CONTRIBUTING.md) and, for security issues, [SECURITY.md](SECURITY.md).

## License

[MIT](LICENSE)
