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
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,18 @@ Benchmarked on the cora-code repository (1,864 symbols, 115 Rust files, x86_64):
- **Cross-platform** — Linux (x86_64, ARM64), macOS (Apple Silicon), Windows (x86_64)
- **MIT License** — fully open source

[Unreleased]: https://github.com/codecoradev/cora-code/compare/v0.6.1...develop
[Unreleased]: https://github.com/codecoradev/cora-code/compare/v0.13.0...develop
[0.13.0]: https://github.com/codecoradev/cora-code/compare/v0.12.0...v0.13.0
[0.12.0]: https://github.com/codecoradev/cora-code/compare/v0.11.1...v0.12.0
[0.11.1]: https://github.com/codecoradev/cora-code/compare/v0.11.0...v0.11.1
[0.11.0]: https://github.com/codecoradev/cora-code/compare/v0.9.0...v0.11.0
[0.9.0]: https://github.com/codecoradev/cora-code/compare/v0.8.3...v0.9.0
[0.8.3]: https://github.com/codecoradev/cora-code/compare/v0.8.2...v0.8.3
[0.8.2]: https://github.com/codecoradev/cora-code/compare/v0.8.1...v0.8.2
[0.8.1]: https://github.com/codecoradev/cora-code/compare/v0.8.0...v0.8.1
[0.8.0]: https://github.com/codecoradev/cora-code/compare/v0.7.0...v0.8.0
[0.7.0]: https://github.com/codecoradev/cora-code/compare/v0.6.2...v0.7.0
[0.6.2]: https://github.com/codecoradev/cora-code/compare/v0.6.1...v0.6.2
[0.6.1]: https://github.com/codecoradev/cora-code/compare/v0.6.0...v0.6.1
[0.6.0]: https://github.com/codecoradev/cora-code/compare/v0.5.0...v0.6.0
[0.5.0]: https://github.com/codecoradev/cora-code/compare/v0.4.6...v0.5.0
Expand Down
1 change: 1 addition & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default createConfig({
items: [
{ text: 'Usage', link: '/usage' },
{ text: 'Configuration', link: '/configuration' },
{ text: 'Code Intelligence', link: '/code-intelligence' },
{ text: 'Providers', link: '/providers' },
{ text: 'CLI Reference', link: '/cli-reference' },
{ text: 'Examples', link: '/examples' },
Expand Down
307 changes: 199 additions & 108 deletions docs/changelog.md

Large diffs are not rendered by default.

33 changes: 20 additions & 13 deletions docs/code-intelligence.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Scans your project, extracts symbol definitions (functions, structs, enums, trai
|-----------|-----------|---------|
| Symbol table (regex) | Regex extractors (15 languages) | SQLite FTS5 |
| Symbol table (AST) | Tree-sitter grammars (12 languages, opt-in) | SQLite FTS5 |
| Vector embeddings | Static token hashing (256d) | usearch HNSW index |
| Vector embeddings | Static hashing (256d) or pretrained nomic (768d), runtime-selectable | usearch HNSW index |
| Call graph | Regex scope tracking + tree-sitter AST edges | SQLite `edges` table |

```bash
Expand Down Expand Up @@ -151,16 +151,21 @@ The `signals` field shows which search signals matched: `"fts"`, `"vector"`, `"g

#### Embedding Engine

Phase 3 uses **static token embeddings** — a zero-dependency bag-of-tokens hashing method that produces 256-dimensional vectors. No model download, no GPU, no external service.
Cora supports multiple embedding backends, selectable at runtime via `brain.embedding` in `.cora.yaml`. No recompilation needed to switch.

| Property | Value |
----------|-------|
| Dimensions | 256 (fixed) |
| Method | Bag-of-tokens hashing |
| Dependencies | None (pure Rust) |
| Quality | Good for near-duplicate detection and semantic grouping |
| Backend | Dimensions | Method | Feature Flag | When to use |
|---------|------------|--------|--------------|-------------|
| `hashing` | 256 | Bag-of-tokens hashing | Always available | Zero-dependency, fast, good for near-duplicate detection |
| `pretrained` | 768 | Nomic-embed-code distilled | `pretrained-embed` | Better semantic matching, real code embeddings |
| `auto` (default) | — | Picks best available | — | Uses `pretrained` if compiled, falls back to `hashing` |

Future phases will add optional higher-quality embedding models (see Roadmap).
```yaml
# .cora.yaml
brain:
embedding: auto # auto | hashing | pretrained
```

> **Note:** 256d and 768d embeddings cannot be mixed in the same index. Changing the backend requires `cora index --rebuild`. Future phases will add ONNX-based embedding models (see Roadmap).

## Call Graph Commands

Expand Down Expand Up @@ -284,12 +289,13 @@ All code intelligence features are available as MCP tools for AI coding agents:

```
~/.codecora/cora-code/
├── graph.db # SQLite database
├── cora.db # SQLite database (renamed from graph.db in v0.9)
│ ├── projects # One row per indexed project
│ ├── symbols # All symbols from all projects
│ ├── symbols_fts # FTS5 virtual table for keyword search
│ ├── edges # Call relationships (caller_id → callee_id)
│ └── reviews # Review history for tech debt tracking
│ ├── reviews # Review history for tech debt tracking
│ └── findings # Review findings + finding_events
└── cora_index.usearch # usearch HNSW vector index
├── cora_index.usearch.keys # Key-to-symbol-id mapping
└── cora_index.usearch.lock # File lock (fs2)
Expand All @@ -304,7 +310,7 @@ cora index --rebuild

## Schema Versioning

The database uses automatic migrations. Current schema version: **v6**.
The database uses automatic migrations. Current schema version: **v7**.

| Version | Changes |
|---------|---------|
Expand All @@ -313,4 +319,5 @@ The database uses automatic migrations. Current schema version: **v6**.
| v3 | Added `edges` table for call graph |
| v4 | Added `embedding_tier`, `embedding_dims`, `embedding_model`, `last_embedded_at` to projects |
| v5 | Added `reviews`, `findings`, `finding_events` tables for review history and findings tracking |
| v6 | Added index config hash column for fingerprint invalidation on config changes |
| v6 | Added index config hash column for fingerprint invalidation on config changes; rebuilt FTS5 with `file` column for camelCase search |
| v7 | Added `embed_fingerprint TEXT` column to `symbols` for incremental per-symbol embedding |
22 changes: 22 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ analysis:
- "*Handler"
- "resolve_*"

brain:
embedding: auto # auto | hashing | pretrained

profile: clean-code # security-first | performance | clean-code | beginner-friendly | minimal | rust-strict | typescript-strict | go-pragmatic
```

Expand Down Expand Up @@ -461,6 +464,25 @@ Default `index_skip_files` patterns (bundled with cora):

Glob patterns support: exact match (`main.rs`), wildcard suffix (`*.config.ts`), wildcard prefix (`vite.*`), and any-directory (`**/main.ts`).

### Brain Embedding Backend

Control which embedding backend Brain Mode uses for vector search. Selectable at runtime — no recompilation needed to switch.

```yaml
brain:
embedding: auto # auto | hashing | pretrained
```

| Value | Dimensions | Description |
|-------|------------|-------------|
| `auto` (default) | 256 or 768 | Best available — uses `pretrained` if compiled with `pretrained-embed` feature, otherwise `hashing` |
| `hashing` | 256 | Force zero-dependency bag-of-tokens hashing. Always available, no model download |
| `pretrained` | 768 | Force nomic-embed-code distilled embeddings. Requires `pretrained-embed` feature at build time |

> **⚠️ Cannot mix dimensions.** 256d and 768d vectors cannot coexist in the same usearch index. After changing this setting, run `cora index --rebuild` to regenerate embeddings with the new backend.

> **Note:** If you select `pretrained` but cora was built without the `pretrained-embed` feature, it falls back to `hashing` with a warning.

## Ignore Files

Exclude files or directories from **all** cora operations — review, scan, and indexing. This is the broadest exclusion mechanism.
Expand Down
2 changes: 2 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Key configuration options:
| `ignore` | File patterns and rules to skip |
| `hook` | Pre-commit hook settings: mode, severity threshold, max diff size |
| `llm` | LLM parameters: temperature, max_tokens, timeout |
| `brain.embedding` | Embedding backend: `auto`, `hashing` (256d), or `pretrained` (768d) |

## Next Steps

Expand All @@ -131,6 +132,7 @@ Now that you have cora running, explore these topics to get the most out of it:
- [Installation](./installation) — install options and shell completions
- [Usage](./usage) — review modes, output formats, and configuration
- [Configuration](./configuration) — full .cora.yaml reference, quality gate, security scanner, MCP server
- [Code Intelligence](./code-intelligence) — symbol index, call graph, brain mode, embedding backends
- [Providers](./providers) — setting up OpenAI, Anthropic, Groq, Ollama, and Z.AI
- [CLI Reference](./cli-reference) — full command documentation
- [Examples](./examples) — CI/CD setup for GitHub, GitLab, Gitea, Bitbucket
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ features:
details: OpenAI, Anthropic, Groq, Ollama, Z.AI, or any OpenAI-compatible API. Bring your own key, pick any model.
- icon: ⚡
title: Native Rust
details: Fast binary, no runtime dependencies, cross-platform. 10.4 MB single static binary.
details: Fast binary, no runtime dependencies, cross-platform. ~7.4 MB release binary.
- icon: 🪝
title: Pre-commit Hooks
details: Catch issues before they reach CI. Review staged changes, unpushed commits, or any diff.
Expand Down
19 changes: 14 additions & 5 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
Pin a specific version:

```bash
$ CORA_VERSION=v0.6.1 curl -fsSL https://raw.githubusercontent.com/codecoradev/cora-code/main/install.sh | sh
$ CORA_VERSION=v0.13.0 curl -fsSL https://raw.githubusercontent.com/codecoradev/cora-code/main/install.sh | sh
```

## Install via Cargo
Expand All @@ -46,11 +46,20 @@ Supported platforms:
- Windows x86_64

```bash
# Download and extract
$ curl -sL https://github.com/codecoradev/cora-code/releases/latest/download/cora-linux-x86_64.tar.gz | tar xz
# Download and extract (Linux x86_64 example)
$ curl -sL https://github.com/codecoradev/cora-code/releases/latest/download/cora-x86_64-unknown-linux-gnu-v0.13.0.tar.gz | tar xz
$ mv cora ~/.local/bin/cora
```

Asset naming convention: `cora-{target-triple}-{version}.tar.gz` (Linux/macOS) or `.zip` (Windows). Replace the target triple as needed:

| Platform | Asset name |
|----------|------------|
| Linux x86_64 | `cora-x86_64-unknown-linux-gnu-v0.13.0.tar.gz` |
| Linux ARM64 | `cora-aarch64-unknown-linux-gnu-v0.13.0.tar.gz` |
| macOS ARM64 | `cora-aarch64-apple-darwin-v0.13.0.tar.gz` |
| Windows x86_64 | `cora-x86_64-pc-windows-msvc-v0.13.0.zip` |

## Build from Source

If you prefer to build from the latest source:
Expand Down Expand Up @@ -85,7 +94,7 @@ Confirm cora is installed correctly:

```bash
$ cora --version
cora 0.6.1
cora 0.13.0

$ cora auth status
Provider: openai
Expand All @@ -103,7 +112,7 @@ $ which -a cora

# Should match the latest release
$ cora --version
cora 0.6.1
cora 0.13.0
```

If `which -a cora` shows more than one path (e.g. `~/.local/bin/cora` and `~/.cargo/bin/cora`), remove the one you don't want or reorder your `PATH`. See [Issue #314](https://github.com/codecoradev/cora-code/issues/314) for background.
Expand Down
40 changes: 40 additions & 0 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,46 @@ Unified data layer and massive performance improvements.
- [#410](https://github.com/codecoradev/cora-code/issues/410) Batch symbol lookup in RRF — ✓ Done
- [#422](https://github.com/codecoradev/cora-code/pull/422) Rayon parallel embedding — ✓ Done

## v0.10 — Governance & Hardening

Open-source governance and project-level hardening.

- [CONTRIBUTING.md](https://github.com/codecoradev/cora-code/blob/main/CONTRIBUTING.md) Contribution guide — ✓ Done
- [CODE_OF_CONDUCT.md](https://github.com/codecoradev/cora-code/blob/main/CODE_OF_CONDUCT.md) Code of Conduct — ✓ Done
- [SECURITY.md](https://github.com/codecoradev/cora-code/blob/main/SECURITY.md) Security policy — ✓ Done
- PR template, issue templates (bug report + feature request) — ✓ Done
- Branch naming + conventional commits CI checks — ✓ Done

## v0.11 — Review Intelligence

Index-powered review pipeline — deterministic findings wired into every review.

- Unused import detection via symbol graph — ✓ Done
- Dead code detection in changed files during review — ✓ Done
- Breaking change detection (removed public symbols) — ✓ Done
- HTTP route extraction (Axum, Actix, Express, Go net/http) as `EdgeKind::Route` — ✓ Done
- Brain enrichment Tier 1 — caller resolution, impact analysis, affected tests in review prompt — ✓ Done
- `index_skip_files` config for bundler/entry-point false positive suppression — ✓ Done

## v0.12 — Search Quality & Accuracy

Fixes for FTS5 search and dead-code false positives.

- [#451](https://github.com/codecoradev/cora-code/issues/451) FTS5 camelCase search fix — `file` column + `split_camel_case()` — ✓ Done
- [#452](https://github.com/codecoradev/cora-code/issues/452) Dead-code false positives on framework entry points — `FRAMEWORK_ENTRY_PREFIXES` + `// cora: keep` suppression — ✓ Done
- [#453](https://github.com/codecoradev/cora-code/issues/453) Sticky skip files fix — `index_config_hash` invalidation — ✓ Done
- Schema v6 — FTS5 rebuild with `file` column, config hash tracking — ✓ Done

## v0.13 — Runtime Brain Mode

Runtime embedding backend selection — no recompilation needed to switch.

- `brain.embedding` config (`auto` | `hashing` | `pretrained`) in `.cora.yaml` — ✓ Done
- `Backend` enum + `resolve_backend()` with `OnceLock` caching — ✓ Done
- Incremental per-symbol embedding via `embed_fingerprint` — ✓ Done
- `BrainConfig` + `BrainEmbeddingMode` in config schema — ✓ Done
- Schema v7 — `embed_fingerprint TEXT` column on `symbols` — ✓ Done

## Future — What's Next

### Other
Expand Down
Loading