codehaven 0.14.0__tar.gz → 0.15.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codehaven-0.14.0 → codehaven-0.15.0}/PKG-INFO +59 -50
- {codehaven-0.14.0 → codehaven-0.15.0}/README.md +58 -49
- {codehaven-0.14.0 → codehaven-0.15.0}/codehaven.egg-info/PKG-INFO +59 -50
- {codehaven-0.14.0 → codehaven-0.15.0}/codehaven.egg-info/SOURCES.txt +3 -1
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/__init__.py +1 -1
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/documents.py +70 -8
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/gui.js +5 -3
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/gui.py +5 -3
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/gui_arabic.js +2 -2
- {codehaven-0.14.0 → codehaven-0.15.0}/pyproject.toml +1 -1
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_documents.py +37 -0
- codehaven-0.15.0/tests/test_readme.py +19 -0
- codehaven-0.15.0/tests/test_wording.py +42 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/LICENSE +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/codehaven.egg-info/dependency_links.txt +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/codehaven.egg-info/entry_points.txt +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/codehaven.egg-info/requires.txt +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/codehaven.egg-info/top_level.txt +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/__main__.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/agent.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/answers.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/arabic.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/changes.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/chats.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/cli.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/coder.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/dependencies.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/doctor.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/edits.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/errors.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/evaluation.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/evidence.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/exclusions.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/export.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/gui.css +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/gui.html +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/guides.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/history.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/index_cache.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/insights.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/javascript.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/knowledge.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/languages.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/memory.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/messages.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/model.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/more_languages.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/ocr.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/prompts.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/references/langgraph-approvals.md +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/references/langgraph-checkpoints.md +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/references/langgraph-graphs.md +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/references/langgraph.md +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/review.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/scans.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/semantic.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/slash.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/study.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/symbols.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/tasks.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/test_runner.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/trace.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/tracebacks.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/offline_agent/workspace.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/setup.cfg +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_agent.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_arabic.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_browser.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_changes.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_chats.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_citations.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_comments.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_dependencies.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_doctor.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_edit_and_paging.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_edits.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_evaluation.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_evidence.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_exclusions.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_export.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_graph.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_gui.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_guides.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_harness.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_history.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_index_speed.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_insights.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_knowledge.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_languages.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_memory.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_more_languages.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_ocr.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_phrases.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_presentation.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_prompt_budget.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_real_evals.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_repository_rag.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_retrieval_upgrade.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_review.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_run_python.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_sandbox_integration.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_sandbox_unit.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_scans.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_search.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_semantic.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_setup.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_several_repos.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_slash.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_start_ollama.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_stop.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_study.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_symbols.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_test_runner.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_trace.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_tracebacks.py +0 -0
- {codehaven-0.14.0 → codehaven-0.15.0}/tests/test_tracing.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codehaven
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.15.0
|
|
4
4
|
Summary: CodeHaven: a read-only, offline assistant for understanding code. Your code. Your machine. No API fees.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/Walid-Ahmed/codehaven
|
|
@@ -43,7 +43,7 @@ Dynamic: license-file
|
|
|
43
43
|
|
|
44
44
|
*Your code. Your machine. No API fees.*
|
|
45
45
|
|
|
46
|
-

|
|
46
|
+

|
|
47
47
|
|
|
48
48
|
CodeHaven is a read-only assistant for understanding code. Point it at a project, ask a question in plain English, and get an answer that cites the exact lines it relies on. One click shows you those lines. It runs on a local [Ollama](https://ollama.com/) model (`qwen2.5-coder:7b` by default), so there is no cloud service, no account, and no bill.
|
|
49
49
|
|
|
@@ -54,9 +54,9 @@ CodeHaven is a read-only assistant for understanding code. Point it at a project
|
|
|
54
54
|
| **Checked** | Line numbers are looked up in the real file, never taken from the model. An answer it cannot back up is marked **Unverified**. |
|
|
55
55
|
| **Free** | It runs on a model you download once. After that it works with the network unplugged. |
|
|
56
56
|
|
|
57
|
-

|
|
57
|
+

|
|
58
58
|
|
|
59
|
-
Watch the [narrated demo video on YouTube](https://youtu.be/d18wHCz8LFs) (or the [video file](docs/assets/codehaven-demo.mp4) in this repository), or read on.
|
|
59
|
+
Watch the [narrated demo video on YouTube](https://youtu.be/d18wHCz8LFs) (or the [video file](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/assets/codehaven-demo.mp4) in this repository), or read on.
|
|
60
60
|
|
|
61
61
|
## What you can ask
|
|
62
62
|
|
|
@@ -92,58 +92,67 @@ In the browser page you can also draw a **structure map** of your files, make **
|
|
|
92
92
|
- Features: [Git changes](#explain-your-git-changes) · [File review](#review-a-file) · [Test gaps and project tour](#test-gaps-and-a-project-tour) · [Call trace](#trace-a-function) · [Notebooks and PDFs](#notebooks-and-pdfs) · [Pictures of code](#read-code-from-a-picture) · [Long-term memory](#long-term-memory) · [Saved chats](#saved-chats) · [Search by meaning](#search-by-meaning) · [Arabic](#ask-in-arabic) · [VS Code](#use-it-from-vs-code)
|
|
93
93
|
- Reference: [Choosing a model](#choosing-a-model) · [Ollama and offline use](#ollama-and-offline-use) · [What v0.14 does](#what-v014-does) · [File exclusions](#file-exclusions) · [RAG](#local-reference-knowledge-base-rag) · [Speed](#local-inference-speed) · [Search](#search-file-contents) · [Isolated tests](#run-isolated-project-tests) · [Limits](#current-limits)
|
|
94
94
|
- [Development](#development)
|
|
95
|
-
- [Technical report](docs/TECHNICAL_REPORT.md)
|
|
95
|
+
- [Technical report](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/TECHNICAL_REPORT.md)
|
|
96
96
|
|
|
97
97
|
## Get started
|
|
98
98
|
|
|
99
|
-
You need Python 3.10+ and [Ollama](https://ollama.com/). While you are online, do this once:
|
|
99
|
+
You need Python 3.10+ and [Ollama](https://ollama.com/). While you are online, do this once, in any folder:
|
|
100
100
|
|
|
101
101
|
```sh
|
|
102
|
-
# 1.
|
|
103
|
-
python3
|
|
102
|
+
# 1. Install CodeHaven in a virtual environment
|
|
103
|
+
python3 -m venv ~/.codehaven-venv
|
|
104
|
+
source ~/.codehaven-venv/bin/activate # Windows PowerShell: ~\.codehaven-venv\Scripts\Activate.ps1
|
|
105
|
+
python -m pip install codehaven
|
|
104
106
|
|
|
105
|
-
# 2.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
# 3. Install CodeHaven in a virtual environment
|
|
109
|
-
python3 -m venv .venv
|
|
110
|
-
source .venv/bin/activate # Windows PowerShell: .venv\Scripts\Activate.ps1
|
|
111
|
-
python -m pip install -e .
|
|
107
|
+
# 2. Start Ollama if needed, pick a model for this computer's memory, and download it (asks first)
|
|
108
|
+
codehaven --setup
|
|
109
|
+
```
|
|
112
110
|
|
|
113
|
-
|
|
114
|
-
brew install tesseract # Ubuntu or Debian: sudo apt install tesseract-ocr
|
|
111
|
+
`codehaven --setup` starts Ollama if it is not running, suggests a model for this computer's memory (`qwen2.5-coder:3b` under 12 GB, the tested `qwen2.5-coder:7b` up to 32 GB, `qwen2.5:14b` above), and downloads it with `ollama pull` only if you answer `y`. That download is the only time CodeHaven uses the internet. With [pipx](https://pipx.pypa.io/), `pipx install codehaven` replaces step 1 and puts the `codehaven` command on your path without a virtual environment.
|
|
115
112
|
|
|
116
|
-
|
|
117
|
-
ollama pull nomic-embed-text
|
|
113
|
+
After that, everything works offline. Each time, activate the environment and open the browser page:
|
|
118
114
|
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
```sh
|
|
116
|
+
source ~/.codehaven-venv/bin/activate
|
|
117
|
+
codehaven --gui --start-ollama
|
|
121
118
|
```
|
|
122
119
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
**Or let CodeHaven do steps 1, 2, and 5 for you.** After installing Ollama and CodeHaven, run `codehaven --setup`. It starts Ollama if needed, suggests a model for this computer's memory (`qwen2.5-coder:3b` under 12 GB, the tested `qwen2.5-coder:7b` up to 32 GB, `qwen2.5:14b` above), and downloads it with `ollama pull` only if you answer `y`. That download is the only time CodeHaven uses the internet. `codehaven --doctor` also names the suggested model.
|
|
120
|
+
`--start-ollama` starts Ollama for this run if it is not already running, on `127.0.0.1` with its cloud features off, and stops it when CodeHaven exits. If Ollama is already running, for example the desktop app, CodeHaven uses it as it is. If something is missing, `codehaven --doctor` says what and prints the command that fixes it: Ollama itself, the model, and the optional tools for pictures, PDFs, isolated tests, and Git changes.
|
|
126
121
|
|
|
127
|
-
|
|
122
|
+
**Optional extras**, each only if you want the feature. None of them needs a particular folder. Run the `pip` line with CodeHaven's environment activated, so `pypdf` goes where CodeHaven can use it; `brew`, `apt`, and `ollama` install for the whole computer.
|
|
128
123
|
|
|
129
124
|
```sh
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
# Read code from pictures and scanned PDFs: Tesseract, a separate local program (not an Ollama model)
|
|
126
|
+
brew install tesseract # Ubuntu or Debian: sudo apt install tesseract-ocr
|
|
127
|
+
|
|
128
|
+
# Search by meaning: a local embedding model
|
|
129
|
+
ollama pull nomic-embed-text
|
|
130
|
+
|
|
131
|
+
# Chat about PDFs: a PDF reader
|
|
132
|
+
python -m pip install pypdf # with the environment activated; or: brew install poppler
|
|
133
|
+
# Scanned PDFs need both Poppler and Tesseract: brew install poppler tesseract
|
|
132
134
|
```
|
|
133
135
|
|
|
134
|
-
|
|
136
|
+
Tesseract is needed only for [pictures of code](#read-code-from-a-picture). On Windows, use an installer from the [Tesseract installation page](https://tesseract-ocr.github.io/tessdoc/Installation.html) and make sure `tesseract --version` works in a new terminal.
|
|
135
137
|
|
|
136
|
-
**
|
|
138
|
+
**From a clone of this repository**, for working on CodeHaven itself, run these from the repository's own folder, because the paths are relative to it:
|
|
137
139
|
|
|
138
140
|
```sh
|
|
139
|
-
|
|
141
|
+
git clone https://github.com/Walid-Ahmed/codehaven.git
|
|
142
|
+
cd codehaven
|
|
143
|
+
python3 scripts/start_ollama.py # leave this terminal open; Ctrl+C stops the server
|
|
144
|
+
# in another terminal, in the same folder:
|
|
145
|
+
python3 -m venv .venv
|
|
146
|
+
source .venv/bin/activate
|
|
147
|
+
python -m pip install -e .
|
|
148
|
+
ollama pull qwen2.5-coder:7b
|
|
140
149
|
```
|
|
141
150
|
|
|
142
151
|
## How it is built
|
|
143
152
|
|
|
144
|
-

|
|
153
|
+

|
|
145
154
|
|
|
146
|
-
CodeHaven is one agent, five tools, and a set of purpose-built helpers. The [technical report](docs/TECHNICAL_REPORT.md) covers each part in depth.
|
|
155
|
+
CodeHaven is one agent, five tools, and a set of purpose-built helpers. The [technical report](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/TECHNICAL_REPORT.md) covers each part in depth.
|
|
147
156
|
|
|
148
157
|
### The workflow
|
|
149
158
|
|
|
@@ -190,9 +199,9 @@ Passages reach the model four ways: keyword ranking (BM25), definition lookup fo
|
|
|
190
199
|
|
|
191
200
|
### The agent loop in detail
|
|
192
201
|
|
|
193
|
-

|
|
202
|
+

|
|
194
203
|
|
|
195
|
-
A high-resolution [PNG version](docs/assets/how-codehaven-works.png) is available for slides.
|
|
204
|
+
A high-resolution [PNG version](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/assets/how-codehaven-works.png) is available for slides.
|
|
196
205
|
|
|
197
206
|
```text
|
|
198
207
|
START -> model -> read, search, retrieve, or run_tests -> model
|
|
@@ -219,7 +228,7 @@ Implementation follows the [LangGraph graph API](https://docs.langchain.com/oss/
|
|
|
219
228
|
**Or upload a single file.** No folder needed for a quick question: click **Upload a file…** or drop a file anywhere on the page. Any UTF-8 text file up to 64 KB works, and every question is about that file, so "What does this file do?" works without naming it. The file is sent only to the local server, which reads a copy kept in a private temporary folder and deletes it when you open something else or stop the server; your original file is never touched. Hidden files such as `.env`, and names matched by `--exclude`, are refused. The paperclip button beside the question box and pasting a copied file do the same, and the conversation is kept when a file is opened this way.
|
|
220
229
|
**Or download a GitHub repository (opt-in).** Start with `codehaven --gui --allow-clone` and the sidebar shows a box for an address such as `github.com/owner/repository`. This is the only time CodeHaven uses the internet, and only when you click **Download and index**: git on your computer downloads the latest snapshot (no history, tags, submodules, or Git LFS files; stopped after 3 minutes or 500 MB) into `~/CodeHaven/repos/owner/repository` (change it with `--clone-dir`). Nothing of yours is uploaded. The copy stays on your computer, so later it opens offline from **Recent**, and asking for the same address again opens it without downloading. Without `--allow-clone` the box is hidden, the server refuses to clone, and CodeHaven stays fully offline.
|
|
221
230
|
**Private repositories.** CodeHaven never asks for, sees, or stores a GitHub password or token, and refuses addresses that contain one. A private repository downloads only if git on this computer is already signed in to an account that can read it: a credential helper (for example after `gh auth login`), or an SSH key with a `git@github.com:owner/repository.git` address. git is not allowed to prompt for a password or passphrase. Otherwise, clone it yourself with your usual tools and index the folder.
|
|
222
|
-
**Or upload a notebook or a PDF.** The same button and drop area take a Jupyter notebook (`.ipynb`) or a PDF, up to
|
|
231
|
+
**Or upload a notebook or a PDF.** The same button and drop area take a Jupyter notebook (`.ipynb`) or a PDF, up to 200 MB. See [Notebooks and PDFs](#notebooks-and-pdfs).
|
|
223
232
|
**Or upload a picture of code.** The same button and drop area take a screenshot or photo of code, which CodeHaven turns into a file you can chat about and save. See [Read code from a picture](#read-code-from-a-picture).
|
|
224
233
|
2. **Pick a model.** **Settings** in the sidebar lists the chat models installed in Ollama on this computer, with `qwen2.5-coder:7b` selected when it is installed. That default is the model all of CodeHaven's tests were tuned and measured on; other models may answer differently, and the first answer after switching is slower while the model loads. Cloud-backed and embedding-only models are never offered.
|
|
225
234
|
3. **Ask questions.** Answers stream in as they are written. While one is being written, the **Ask** button becomes **Stop**: click it to end the answer at once, even while the model is still loading. The text written so far stays on the page, and a stopped question is not remembered by follow-ups or saved. **Make flashcards** turns into **Stop** the same way, and keeps the cards already made. Follow-up questions see your earlier questions and answers, and **New chat** starts over. Try "Explain this project", "Which function calls `checkout_total`?", or "Explain `src/app.py`".
|
|
@@ -306,10 +315,10 @@ Called from: app/main.py:21 in checkout
|
|
|
306
315
|
|
|
307
316
|
## Notebooks and PDFs
|
|
308
317
|
|
|
309
|
-
Upload, drop, attach, or paste a Jupyter notebook (`.ipynb`) or a PDF, up to
|
|
318
|
+
Upload, drop, attach, or paste a Jupyter notebook (`.ipynb`) or a PDF, up to 200 MB, and chat about it like any single file. It is read into a text file on this computer, which you can view and save from the page; your original is never changed.
|
|
310
319
|
|
|
311
320
|
- **Notebook.** Code and Markdown cells become one file (`analysis.ipynb` becomes `analysis.py` for a Python notebook). Each cell starts with a `# %% Cell 3` line, Markdown becomes comments, and `%magic` and `!shell` lines are commented out so the file stays valid Python. Outputs and pictures are left out.
|
|
312
|
-
- **PDF.** The text of each page is kept under a `===== Page 3 =====` line, with indentation preserved where the PDF allows. This needs either the `pypdf` package or the `pdftotext` program (Poppler) on this computer; if neither is there, CodeHaven says how to install one and everything else keeps working. Columns and tables can lose their layout. A scanned PDF holds pictures, not text:
|
|
321
|
+
- **PDF.** The text of each page is kept under a `===== Page 3 =====` line, with indentation preserved where the PDF allows. This needs either the `pypdf` package or the `pdftotext` program (Poppler) on this computer; if neither is there, CodeHaven says how to install one and everything else keeps working. Columns and tables can lose their layout. A scanned PDF holds pictures, not text, so CodeHaven reads its pages itself: each page is drawn as a picture by Poppler's `pdftoppm` and read by Tesseract, several pages at once, on this computer. A 29-page, 23 MB scan takes about 20 seconds. This needs Poppler and Tesseract (`brew install poppler tesseract`; Ubuntu or Debian: `sudo apt install poppler-utils tesseract-ocr`); without them, CodeHaven says how to get them.
|
|
313
322
|
- **Length.** CodeHaven reads 64 KB of text at once, so a longer document is cut at a cell or page boundary and the note says how much was kept.
|
|
314
323
|
|
|
315
324
|
## Read code from a picture
|
|
@@ -443,7 +452,7 @@ Answers stream to the terminal as the model writes them; add `--no-stream` to pr
|
|
|
443
452
|
|
|
444
453
|
## Use it from VS Code
|
|
445
454
|
|
|
446
|
-
The [VS Code extension](editors/vscode) adds commands to ask about the open folder, explain the file or the selected lines, and trace the function under the cursor. It turns every `path:line` citation in a terminal into a link that opens the cited lines. It runs the `codehaven` command on this computer and holds no model of its own; see [its README](editors/vscode/README.md) to install it. Its logic is tested without VS Code, but it has not yet been tried inside a running VS Code.
|
|
455
|
+
The [VS Code extension](https://github.com/Walid-Ahmed/codehaven/tree/main/editors/vscode) adds commands to ask about the open folder, explain the file or the selected lines, and trace the function under the cursor. It turns every `path:line` citation in a terminal into a link that opens the cited lines. It runs the `codehaven` command on this computer and holds no model of its own; see [its README](https://github.com/Walid-Ahmed/codehaven/blob/main/editors/vscode/README.md) to install it. Its logic is tested without VS Code, but it has not yet been tried inside a running VS Code.
|
|
447
456
|
|
|
448
457
|
## Choosing a model
|
|
449
458
|
|
|
@@ -453,7 +462,7 @@ The [VS Code extension](editors/vscode) adds commands to ask about the open fold
|
|
|
453
462
|
codehaven --model qwen2.5:14b --workspace /path/to/project 'Explain this project'
|
|
454
463
|
```
|
|
455
464
|
|
|
456
|
-
Measured on 34 questions about three real libraries (see [docs/EVALS.md](docs/EVALS.md)), with the same code and one run each:
|
|
465
|
+
Measured on 34 questions about three real libraries (see [docs/EVALS.md](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md)), with the same code and one run each:
|
|
457
466
|
|
|
458
467
|
| Model | Size on disk | Correct | Verified | Time for 34 questions | Per question |
|
|
459
468
|
|---|---|---|---|---|---|
|
|
@@ -468,7 +477,7 @@ Names of cloud models (ending in `-cloud` or `:cloud`) are refused, and so are m
|
|
|
468
477
|
|
|
469
478
|
## Ollama and offline use
|
|
470
479
|
|
|
471
|
-
The [startup script](scripts/start_ollama.py) sets `OLLAMA_NO_CLOUD=1` and binds the server to `127.0.0.1:11434`, following [Ollama's local-only instructions](https://docs.ollama.com/faq).
|
|
480
|
+
The [startup script](https://github.com/Walid-Ahmed/codehaven/blob/main/scripts/start_ollama.py) sets `OLLAMA_NO_CLOUD=1` and binds the server to `127.0.0.1:11434`, following [Ollama's local-only instructions](https://docs.ollama.com/faq). It is in the repository, not in the installed package, so run it from the root of a clone, on macOS, Linux, or Windows (use `python` if that is your Python command). With an installed `codehaven`, `codehaven --start-ollama` does the same for one run. Leave that terminal open; Ctrl+C stops the server. Check its logs for `Ollama cloud disabled: true`.
|
|
472
481
|
|
|
473
482
|
If Ollama is already running, the script checks its local API, prints a friendly message, and exits successfully without launching a second server. It cannot change or verify that server's cloud setting. To enforce `OLLAMA_NO_CLOUD=1`, quit the existing desktop app or stop its service, then run the script again. An unrecognized listener on the port still produces an error. These environment settings apply only to a server launched by the script.
|
|
474
483
|
|
|
@@ -480,9 +489,9 @@ Also new in 0.14: CodeHaven can change code when you start it with `--allow-edit
|
|
|
480
489
|
|
|
481
490
|
New in 0.14: faster on large projects and clearer when something goes wrong. The keyword index is saved between runs, so a large repository reopens in about a quarter of the time (FastAPI, 2,400 files: 8.5 s on 0.13, 2.0 s), and after you edit a file only that file is indexed again (8.5 s to 2.8 s). Listing, searching, and checking for changed files are two to three times faster. An answer whose cited lines use code that is not in the repository, such as a library or a file that was never checked in, says so under its own heading. When preloaded files leave too little room in the prompt, the reference excerpts are retrieved again to fit, instead of being gathered and then compacted away. Plain `codehaven` at a terminal starts an interactive session with arrow-key history. An unexpected problem is explained in a sentence in the terminal and on the page, never as a traceback or a bare "Failed to fetch".
|
|
482
491
|
|
|
483
|
-
New in 0.13: looks for each value an answer reports (a quoted string or a number) in the code the model was shown. A value on the lines the answer cites needs nothing; a value shown on another line gets a citation of that line; a value on no shown line was not read from the code, and the answer is marked **Unverified**. On the seven real repositories this flags two wrong answers the citation checks passed, including an OpenAPI version of `3.0.2` (it is `3.1.0`), and one correct answer whose quoted code the model made up. No correct answer was lost. See [the eval results](docs/EVALS.md).
|
|
492
|
+
New in 0.13: looks for each value an answer reports (a quoted string or a number) in the code the model was shown. A value on the lines the answer cites needs nothing; a value shown on another line gets a citation of that line; a value on no shown line was not read from the code, and the answer is marked **Unverified**. On the seven real repositories this flags two wrong answers the citation checks passed, including an OpenAPI version of `3.0.2` (it is `3.1.0`), and one correct answer whose quoted code the model made up. No correct answer was lost. See [the eval results](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
484
493
|
|
|
485
|
-
New in 0.12: searches for quoted settings and dotted names a question mentions, so an answer that is one line somewhere in the project is found; checks citations against every line the model was shown, and cites the code names an uncited answer mentions; sees project files of up to 1 MB, where files over 64 KB, often a project's central modules, were invisible before; stops indexing and downloads from the page; and is measured on a fourth, much larger repository. On the real repositories nearly every correct answer now passes the answer checks (39 of 41, from 26 of 40). The checks confirm that an answer cites lines the model was shown, not that it read them right, so read **Unverified** as "a citation does not hold" and a checked answer as "quick to check at the cited lines". See [the eval results](docs/EVALS.md).
|
|
494
|
+
New in 0.12: searches for quoted settings and dotted names a question mentions, so an answer that is one line somewhere in the project is found; checks citations against every line the model was shown, and cites the code names an uncited answer mentions; sees project files of up to 1 MB, where files over 64 KB, often a project's central modules, were invisible before; stops indexing and downloads from the page; and is measured on a fourth, much larger repository. On the real repositories nearly every correct answer now passes the answer checks (39 of 41, from 26 of 40). The checks confirm that an answer cites lines the model was shown, not that it read them right, so read **Unverified** as "a citation does not hold" and a checked answer as "quick to check at the cited lines". See [the eval results](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
486
495
|
|
|
487
496
|
New in 0.11: shows the model the definitions a question names, with the constants they use, before it answers; traces a function's calls and callers; stops an answer in progress; indexes projects of up to 5,000 files and keeps the index while nothing changes; parses Go, Java, and Rust with Tree-sitter; starts Ollama for a run and says what is missing; saves chats and flashcards; adds a VS Code extension; and is tested on macOS, Windows, and Linux, with evals on three real repositories.
|
|
488
497
|
|
|
@@ -520,7 +529,7 @@ codehaven --workspace /path/to/repo \
|
|
|
520
529
|
--exclude 'private/**' --exclude '*.pem' 'Explain this project'
|
|
521
530
|
```
|
|
522
531
|
|
|
523
|
-
Hidden/built-in paths stay blocked. User exclusions add restrictions; they cannot undo Git ignores. Rules apply to tracked files too. [Exclusion details](docs/EXCLUSIONS.md) cover precedence, negation, root scope, and reference libraries.
|
|
532
|
+
Hidden/built-in paths stay blocked. User exclusions add restrictions; they cannot undo Git ignores. Rules apply to tracked files too. [Exclusion details](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EXCLUSIONS.md) cover precedence, negation, root scope, and reference libraries.
|
|
524
533
|
|
|
525
534
|
## Change code (opt-in)
|
|
526
535
|
|
|
@@ -557,7 +566,7 @@ codehaven --workspace /path/to/project --knowledge-base /path/to/references \
|
|
|
557
566
|
'Use my references to explain LangGraph conditional edges'
|
|
558
567
|
```
|
|
559
568
|
|
|
560
|
-
The model can call `retrieve` for more passages, with source and line citations. Indexing and retrieval run entirely on your device using BM25 keyword ranking. No vector database, embeddings, extra model, or internet access is needed. Startup reports the repository-file count and warns if index limits were reached. The index is built at the start of each run. Between questions in a session CodeHaven lists the files again and rebuilds the index only if a file was added, removed, or changed, so edits you make yourself are picked up and an unchanged project costs almost nothing. A project at the 5,000-file limit takes about 8 seconds to index and about 1 second to check. For a larger project, open the subfolder you are working in. See [how to add manuals and your own references](docs/KNOWLEDGE_BASE.md) for supported formats, limits, and examples.
|
|
569
|
+
The model can call `retrieve` for more passages, with source and line citations. Indexing and retrieval run entirely on your device using BM25 keyword ranking. No vector database, embeddings, extra model, or internet access is needed. Startup reports the repository-file count and warns if index limits were reached. The index is built at the start of each run. Between questions in a session CodeHaven lists the files again and rebuilds the index only if a file was added, removed, or changed, so edits you make yourself are picked up and an unchanged project costs almost nothing. A project at the 5,000-file limit takes about 8 seconds to index and about 1 second to check. For a larger project, open the subfolder you are working in. See [how to add manuals and your own references](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/KNOWLEDGE_BASE.md) for supported formats, limits, and examples.
|
|
561
570
|
|
|
562
571
|
## Dependency-aware retrieval and complete functions
|
|
563
572
|
|
|
@@ -574,7 +583,7 @@ codehaven --workspace /path/to/repo --retrieval-budget 8000 \
|
|
|
574
583
|
'Explain checkout_total and its imported helpers'
|
|
575
584
|
```
|
|
576
585
|
|
|
577
|
-
`--retrieval-budget` accepts 2,000–16,000 bytes. It controls retrieved context only; it does not measure model tokens or cap accumulated conversation history. Imports are followed up to two hops over already indexed files. See [retrieval details](docs/KNOWLEDGE_BASE.md#retrieval-budgets-and-complete-symbols) for metadata and limitations.
|
|
586
|
+
`--retrieval-budget` accepts 2,000–16,000 bytes. It controls retrieved context only; it does not measure model tokens or cap accumulated conversation history. Imports are followed up to two hops over already indexed files. See [retrieval details](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/KNOWLEDGE_BASE.md#retrieval-budgets-and-complete-symbols) for metadata and limitations.
|
|
578
587
|
|
|
579
588
|
## Local inference speed
|
|
580
589
|
|
|
@@ -638,7 +647,7 @@ codehaven --workspace /path/to/project --test-runner pytest \
|
|
|
638
647
|
|
|
639
648
|
CodeHaven asks for approval before each run. Tests receive a filtered, read-only project copy, disabled networking, and a writable temporary area. They cannot change the original project through the mounted filesystem. Host environment variables and the Docker socket are not exposed. Time/resource/output limits and forced container cleanup apply.
|
|
640
649
|
|
|
641
|
-
**No host fallback:** Docker and a prepared local image are required. CodeHaven never pulls images or installs packages during a test run. For project dependencies, prepare an image and select `--test-image my-project-tests:local`. See [isolated test setup and limits](docs/ISOLATED_TESTS.md).
|
|
650
|
+
**No host fallback:** Docker and a prepared local image are required. CodeHaven never pulls images or installs packages during a test run. For project dependencies, prepare an image and select `--test-image my-project-tests:local`. See [isolated test setup and limits](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/ISOLATED_TESTS.md).
|
|
642
651
|
|
|
643
652
|
## Current limits
|
|
644
653
|
|
|
@@ -664,15 +673,15 @@ python3 -m offline_agent.evaluation
|
|
|
664
673
|
python3 -m offline_agent.evaluation --only low-stock-bug --only last-product
|
|
665
674
|
```
|
|
666
675
|
|
|
667
|
-
To check that a change is not fitted to those tasks, also run the [second set](evals/bookings_tasks.json) over a [different small repository](evals/bookings_repo). Results are recorded in [the plan](docs/PLAN.md):
|
|
676
|
+
To check that a change is not fitted to those tasks, also run the [second set](https://github.com/Walid-Ahmed/codehaven/blob/main/evals/bookings_tasks.json) over a [different small repository](https://github.com/Walid-Ahmed/codehaven/tree/main/evals/bookings_repo). Results are recorded in [the plan](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/PLAN.md):
|
|
668
677
|
|
|
669
678
|
```sh
|
|
670
679
|
python3 -m offline_agent.evaluation --tasks evals/bookings_tasks.json --repo evals/bookings_repo
|
|
671
680
|
```
|
|
672
681
|
|
|
673
|
-
[evals/tasks.json](evals/tasks.json) holds 12 questions over the small [sample repository](evals/sample_repo), including a paged read of a 600-line file, entry-point discovery, and explaining a bug and its fix. Every task is a question checked by regexes on the answer; three tasks also ask follow-up questions in the same session ("What tax rate does *that function* add?"), each checked on its own answer, to test the follow-up memory. Each task runs on a fresh temporary copy with test runs declined, and **a task fails if any file in the copy changed**, so the evals also check that CodeHaven stays read-only. The run prints a table of pass/fail, exit code, steps, tokens, and time, and writes the full report, including each task's run log, raw model replies, and changed files, to `evals/results/latest.json`, which Git ignores. The summary separately counts tasks that also passed CodeHaven's own answer checks (exit code 0), and warns if model reloads made the timings unrepresentative. Use `--model` to score another installed model. Like normal use, evaluation talks only to loopback Ollama. Compare reports before and after a change. Results vary between runs, so look at trends rather than one pass or fail.
|
|
682
|
+
[evals/tasks.json](https://github.com/Walid-Ahmed/codehaven/blob/main/evals/tasks.json) holds 12 questions over the small [sample repository](https://github.com/Walid-Ahmed/codehaven/tree/main/evals/sample_repo), including a paged read of a 600-line file, entry-point discovery, and explaining a bug and its fix. Every task is a question checked by regexes on the answer; three tasks also ask follow-up questions in the same session ("What tax rate does *that function* add?"), each checked on its own answer, to test the follow-up memory. Each task runs on a fresh temporary copy with test runs declined, and **a task fails if any file in the copy changed**, so the evals also check that CodeHaven stays read-only. The run prints a table of pass/fail, exit code, steps, tokens, and time, and writes the full report, including each task's run log, raw model replies, and changed files, to `evals/results/latest.json`, which Git ignores. The summary separately counts tasks that also passed CodeHaven's own answer checks (exit code 0), and warns if model reloads made the timings unrepresentative. Use `--model` to score another installed model. Like normal use, evaluation talks only to loopback Ollama. Compare reports before and after a change. Results vary between runs, so look at trends rather than one pass or fail.
|
|
674
683
|
|
|
675
|
-
See [the implementation plan and roadmap](docs/PLAN.md) for architecture, acceptance criteria, and next steps. API integration follows [Ollama chat](https://docs.ollama.com/api/chat) and [structured outputs](https://docs.ollama.com/capabilities/structured-outputs).
|
|
684
|
+
See [the implementation plan and roadmap](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/PLAN.md) for architecture, acceptance criteria, and next steps. API integration follows [Ollama chat](https://docs.ollama.com/api/chat) and [structured outputs](https://docs.ollama.com/capabilities/structured-outputs).
|
|
676
685
|
|
|
677
686
|
**Real repositories.** Six more question sets run on real open-source libraries, each pinned to one release: requests, click, and express, and a held-out group of flask, cobra, and axios whose questions were written before any change was tried on them. They are not kept in this repository, so download them once, while online:
|
|
678
687
|
|
|
@@ -681,6 +690,6 @@ python3 scripts/fetch_eval_repos.py
|
|
|
681
690
|
python3 -m offline_agent.evaluation --suite requests
|
|
682
691
|
```
|
|
683
692
|
|
|
684
|
-
The script is a developer tool and the only eval step that uses the internet; the installed package never runs it. Scores for every set, and what they do not measure, are recorded in [docs/EVALS.md](docs/EVALS.md).
|
|
693
|
+
The script is a developer tool and the only eval step that uses the internet; the installed package never runs it. Scores for every set, and what they do not measure, are recorded in [docs/EVALS.md](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
685
694
|
|
|
686
695
|
Automated tests use fake model responses and a loopback HTTP fixture, so they do not establish answer quality. The local evals measure the real model on short questions with one right answer; they do not establish quality on whole-project explanations or on large monorepos.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
*Your code. Your machine. No API fees.*
|
|
6
6
|
|
|
7
|
-

|
|
7
|
+

|
|
8
8
|
|
|
9
9
|
CodeHaven is a read-only assistant for understanding code. Point it at a project, ask a question in plain English, and get an answer that cites the exact lines it relies on. One click shows you those lines. It runs on a local [Ollama](https://ollama.com/) model (`qwen2.5-coder:7b` by default), so there is no cloud service, no account, and no bill.
|
|
10
10
|
|
|
@@ -15,9 +15,9 @@ CodeHaven is a read-only assistant for understanding code. Point it at a project
|
|
|
15
15
|
| **Checked** | Line numbers are looked up in the real file, never taken from the model. An answer it cannot back up is marked **Unverified**. |
|
|
16
16
|
| **Free** | It runs on a model you download once. After that it works with the network unplugged. |
|
|
17
17
|
|
|
18
|
-

|
|
18
|
+

|
|
19
19
|
|
|
20
|
-
Watch the [narrated demo video on YouTube](https://youtu.be/d18wHCz8LFs) (or the [video file](docs/assets/codehaven-demo.mp4) in this repository), or read on.
|
|
20
|
+
Watch the [narrated demo video on YouTube](https://youtu.be/d18wHCz8LFs) (or the [video file](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/assets/codehaven-demo.mp4) in this repository), or read on.
|
|
21
21
|
|
|
22
22
|
## What you can ask
|
|
23
23
|
|
|
@@ -53,58 +53,67 @@ In the browser page you can also draw a **structure map** of your files, make **
|
|
|
53
53
|
- Features: [Git changes](#explain-your-git-changes) · [File review](#review-a-file) · [Test gaps and project tour](#test-gaps-and-a-project-tour) · [Call trace](#trace-a-function) · [Notebooks and PDFs](#notebooks-and-pdfs) · [Pictures of code](#read-code-from-a-picture) · [Long-term memory](#long-term-memory) · [Saved chats](#saved-chats) · [Search by meaning](#search-by-meaning) · [Arabic](#ask-in-arabic) · [VS Code](#use-it-from-vs-code)
|
|
54
54
|
- Reference: [Choosing a model](#choosing-a-model) · [Ollama and offline use](#ollama-and-offline-use) · [What v0.14 does](#what-v014-does) · [File exclusions](#file-exclusions) · [RAG](#local-reference-knowledge-base-rag) · [Speed](#local-inference-speed) · [Search](#search-file-contents) · [Isolated tests](#run-isolated-project-tests) · [Limits](#current-limits)
|
|
55
55
|
- [Development](#development)
|
|
56
|
-
- [Technical report](docs/TECHNICAL_REPORT.md)
|
|
56
|
+
- [Technical report](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/TECHNICAL_REPORT.md)
|
|
57
57
|
|
|
58
58
|
## Get started
|
|
59
59
|
|
|
60
|
-
You need Python 3.10+ and [Ollama](https://ollama.com/). While you are online, do this once:
|
|
60
|
+
You need Python 3.10+ and [Ollama](https://ollama.com/). While you are online, do this once, in any folder:
|
|
61
61
|
|
|
62
62
|
```sh
|
|
63
|
-
# 1.
|
|
64
|
-
python3
|
|
63
|
+
# 1. Install CodeHaven in a virtual environment
|
|
64
|
+
python3 -m venv ~/.codehaven-venv
|
|
65
|
+
source ~/.codehaven-venv/bin/activate # Windows PowerShell: ~\.codehaven-venv\Scripts\Activate.ps1
|
|
66
|
+
python -m pip install codehaven
|
|
65
67
|
|
|
66
|
-
# 2.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
# 3. Install CodeHaven in a virtual environment
|
|
70
|
-
python3 -m venv .venv
|
|
71
|
-
source .venv/bin/activate # Windows PowerShell: .venv\Scripts\Activate.ps1
|
|
72
|
-
python -m pip install -e .
|
|
68
|
+
# 2. Start Ollama if needed, pick a model for this computer's memory, and download it (asks first)
|
|
69
|
+
codehaven --setup
|
|
70
|
+
```
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
brew install tesseract # Ubuntu or Debian: sudo apt install tesseract-ocr
|
|
72
|
+
`codehaven --setup` starts Ollama if it is not running, suggests a model for this computer's memory (`qwen2.5-coder:3b` under 12 GB, the tested `qwen2.5-coder:7b` up to 32 GB, `qwen2.5:14b` above), and downloads it with `ollama pull` only if you answer `y`. That download is the only time CodeHaven uses the internet. With [pipx](https://pipx.pypa.io/), `pipx install codehaven` replaces step 1 and puts the `codehaven` command on your path without a virtual environment.
|
|
76
73
|
|
|
77
|
-
|
|
78
|
-
ollama pull nomic-embed-text
|
|
74
|
+
After that, everything works offline. Each time, activate the environment and open the browser page:
|
|
79
75
|
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
```sh
|
|
77
|
+
source ~/.codehaven-venv/bin/activate
|
|
78
|
+
codehaven --gui --start-ollama
|
|
82
79
|
```
|
|
83
80
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
**Or let CodeHaven do steps 1, 2, and 5 for you.** After installing Ollama and CodeHaven, run `codehaven --setup`. It starts Ollama if needed, suggests a model for this computer's memory (`qwen2.5-coder:3b` under 12 GB, the tested `qwen2.5-coder:7b` up to 32 GB, `qwen2.5:14b` above), and downloads it with `ollama pull` only if you answer `y`. That download is the only time CodeHaven uses the internet. `codehaven --doctor` also names the suggested model.
|
|
81
|
+
`--start-ollama` starts Ollama for this run if it is not already running, on `127.0.0.1` with its cloud features off, and stops it when CodeHaven exits. If Ollama is already running, for example the desktop app, CodeHaven uses it as it is. If something is missing, `codehaven --doctor` says what and prints the command that fixes it: Ollama itself, the model, and the optional tools for pictures, PDFs, isolated tests, and Git changes.
|
|
87
82
|
|
|
88
|
-
|
|
83
|
+
**Optional extras**, each only if you want the feature. None of them needs a particular folder. Run the `pip` line with CodeHaven's environment activated, so `pypdf` goes where CodeHaven can use it; `brew`, `apt`, and `ollama` install for the whole computer.
|
|
89
84
|
|
|
90
85
|
```sh
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
# Read code from pictures and scanned PDFs: Tesseract, a separate local program (not an Ollama model)
|
|
87
|
+
brew install tesseract # Ubuntu or Debian: sudo apt install tesseract-ocr
|
|
88
|
+
|
|
89
|
+
# Search by meaning: a local embedding model
|
|
90
|
+
ollama pull nomic-embed-text
|
|
91
|
+
|
|
92
|
+
# Chat about PDFs: a PDF reader
|
|
93
|
+
python -m pip install pypdf # with the environment activated; or: brew install poppler
|
|
94
|
+
# Scanned PDFs need both Poppler and Tesseract: brew install poppler tesseract
|
|
93
95
|
```
|
|
94
96
|
|
|
95
|
-
|
|
97
|
+
Tesseract is needed only for [pictures of code](#read-code-from-a-picture). On Windows, use an installer from the [Tesseract installation page](https://tesseract-ocr.github.io/tessdoc/Installation.html) and make sure `tesseract --version` works in a new terminal.
|
|
96
98
|
|
|
97
|
-
**
|
|
99
|
+
**From a clone of this repository**, for working on CodeHaven itself, run these from the repository's own folder, because the paths are relative to it:
|
|
98
100
|
|
|
99
101
|
```sh
|
|
100
|
-
|
|
102
|
+
git clone https://github.com/Walid-Ahmed/codehaven.git
|
|
103
|
+
cd codehaven
|
|
104
|
+
python3 scripts/start_ollama.py # leave this terminal open; Ctrl+C stops the server
|
|
105
|
+
# in another terminal, in the same folder:
|
|
106
|
+
python3 -m venv .venv
|
|
107
|
+
source .venv/bin/activate
|
|
108
|
+
python -m pip install -e .
|
|
109
|
+
ollama pull qwen2.5-coder:7b
|
|
101
110
|
```
|
|
102
111
|
|
|
103
112
|
## How it is built
|
|
104
113
|
|
|
105
|
-

|
|
114
|
+

|
|
106
115
|
|
|
107
|
-
CodeHaven is one agent, five tools, and a set of purpose-built helpers. The [technical report](docs/TECHNICAL_REPORT.md) covers each part in depth.
|
|
116
|
+
CodeHaven is one agent, five tools, and a set of purpose-built helpers. The [technical report](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/TECHNICAL_REPORT.md) covers each part in depth.
|
|
108
117
|
|
|
109
118
|
### The workflow
|
|
110
119
|
|
|
@@ -151,9 +160,9 @@ Passages reach the model four ways: keyword ranking (BM25), definition lookup fo
|
|
|
151
160
|
|
|
152
161
|
### The agent loop in detail
|
|
153
162
|
|
|
154
|
-

|
|
163
|
+

|
|
155
164
|
|
|
156
|
-
A high-resolution [PNG version](docs/assets/how-codehaven-works.png) is available for slides.
|
|
165
|
+
A high-resolution [PNG version](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/assets/how-codehaven-works.png) is available for slides.
|
|
157
166
|
|
|
158
167
|
```text
|
|
159
168
|
START -> model -> read, search, retrieve, or run_tests -> model
|
|
@@ -180,7 +189,7 @@ Implementation follows the [LangGraph graph API](https://docs.langchain.com/oss/
|
|
|
180
189
|
**Or upload a single file.** No folder needed for a quick question: click **Upload a file…** or drop a file anywhere on the page. Any UTF-8 text file up to 64 KB works, and every question is about that file, so "What does this file do?" works without naming it. The file is sent only to the local server, which reads a copy kept in a private temporary folder and deletes it when you open something else or stop the server; your original file is never touched. Hidden files such as `.env`, and names matched by `--exclude`, are refused. The paperclip button beside the question box and pasting a copied file do the same, and the conversation is kept when a file is opened this way.
|
|
181
190
|
**Or download a GitHub repository (opt-in).** Start with `codehaven --gui --allow-clone` and the sidebar shows a box for an address such as `github.com/owner/repository`. This is the only time CodeHaven uses the internet, and only when you click **Download and index**: git on your computer downloads the latest snapshot (no history, tags, submodules, or Git LFS files; stopped after 3 minutes or 500 MB) into `~/CodeHaven/repos/owner/repository` (change it with `--clone-dir`). Nothing of yours is uploaded. The copy stays on your computer, so later it opens offline from **Recent**, and asking for the same address again opens it without downloading. Without `--allow-clone` the box is hidden, the server refuses to clone, and CodeHaven stays fully offline.
|
|
182
191
|
**Private repositories.** CodeHaven never asks for, sees, or stores a GitHub password or token, and refuses addresses that contain one. A private repository downloads only if git on this computer is already signed in to an account that can read it: a credential helper (for example after `gh auth login`), or an SSH key with a `git@github.com:owner/repository.git` address. git is not allowed to prompt for a password or passphrase. Otherwise, clone it yourself with your usual tools and index the folder.
|
|
183
|
-
**Or upload a notebook or a PDF.** The same button and drop area take a Jupyter notebook (`.ipynb`) or a PDF, up to
|
|
192
|
+
**Or upload a notebook or a PDF.** The same button and drop area take a Jupyter notebook (`.ipynb`) or a PDF, up to 200 MB. See [Notebooks and PDFs](#notebooks-and-pdfs).
|
|
184
193
|
**Or upload a picture of code.** The same button and drop area take a screenshot or photo of code, which CodeHaven turns into a file you can chat about and save. See [Read code from a picture](#read-code-from-a-picture).
|
|
185
194
|
2. **Pick a model.** **Settings** in the sidebar lists the chat models installed in Ollama on this computer, with `qwen2.5-coder:7b` selected when it is installed. That default is the model all of CodeHaven's tests were tuned and measured on; other models may answer differently, and the first answer after switching is slower while the model loads. Cloud-backed and embedding-only models are never offered.
|
|
186
195
|
3. **Ask questions.** Answers stream in as they are written. While one is being written, the **Ask** button becomes **Stop**: click it to end the answer at once, even while the model is still loading. The text written so far stays on the page, and a stopped question is not remembered by follow-ups or saved. **Make flashcards** turns into **Stop** the same way, and keeps the cards already made. Follow-up questions see your earlier questions and answers, and **New chat** starts over. Try "Explain this project", "Which function calls `checkout_total`?", or "Explain `src/app.py`".
|
|
@@ -267,10 +276,10 @@ Called from: app/main.py:21 in checkout
|
|
|
267
276
|
|
|
268
277
|
## Notebooks and PDFs
|
|
269
278
|
|
|
270
|
-
Upload, drop, attach, or paste a Jupyter notebook (`.ipynb`) or a PDF, up to
|
|
279
|
+
Upload, drop, attach, or paste a Jupyter notebook (`.ipynb`) or a PDF, up to 200 MB, and chat about it like any single file. It is read into a text file on this computer, which you can view and save from the page; your original is never changed.
|
|
271
280
|
|
|
272
281
|
- **Notebook.** Code and Markdown cells become one file (`analysis.ipynb` becomes `analysis.py` for a Python notebook). Each cell starts with a `# %% Cell 3` line, Markdown becomes comments, and `%magic` and `!shell` lines are commented out so the file stays valid Python. Outputs and pictures are left out.
|
|
273
|
-
- **PDF.** The text of each page is kept under a `===== Page 3 =====` line, with indentation preserved where the PDF allows. This needs either the `pypdf` package or the `pdftotext` program (Poppler) on this computer; if neither is there, CodeHaven says how to install one and everything else keeps working. Columns and tables can lose their layout. A scanned PDF holds pictures, not text:
|
|
282
|
+
- **PDF.** The text of each page is kept under a `===== Page 3 =====` line, with indentation preserved where the PDF allows. This needs either the `pypdf` package or the `pdftotext` program (Poppler) on this computer; if neither is there, CodeHaven says how to install one and everything else keeps working. Columns and tables can lose their layout. A scanned PDF holds pictures, not text, so CodeHaven reads its pages itself: each page is drawn as a picture by Poppler's `pdftoppm` and read by Tesseract, several pages at once, on this computer. A 29-page, 23 MB scan takes about 20 seconds. This needs Poppler and Tesseract (`brew install poppler tesseract`; Ubuntu or Debian: `sudo apt install poppler-utils tesseract-ocr`); without them, CodeHaven says how to get them.
|
|
274
283
|
- **Length.** CodeHaven reads 64 KB of text at once, so a longer document is cut at a cell or page boundary and the note says how much was kept.
|
|
275
284
|
|
|
276
285
|
## Read code from a picture
|
|
@@ -404,7 +413,7 @@ Answers stream to the terminal as the model writes them; add `--no-stream` to pr
|
|
|
404
413
|
|
|
405
414
|
## Use it from VS Code
|
|
406
415
|
|
|
407
|
-
The [VS Code extension](editors/vscode) adds commands to ask about the open folder, explain the file or the selected lines, and trace the function under the cursor. It turns every `path:line` citation in a terminal into a link that opens the cited lines. It runs the `codehaven` command on this computer and holds no model of its own; see [its README](editors/vscode/README.md) to install it. Its logic is tested without VS Code, but it has not yet been tried inside a running VS Code.
|
|
416
|
+
The [VS Code extension](https://github.com/Walid-Ahmed/codehaven/tree/main/editors/vscode) adds commands to ask about the open folder, explain the file or the selected lines, and trace the function under the cursor. It turns every `path:line` citation in a terminal into a link that opens the cited lines. It runs the `codehaven` command on this computer and holds no model of its own; see [its README](https://github.com/Walid-Ahmed/codehaven/blob/main/editors/vscode/README.md) to install it. Its logic is tested without VS Code, but it has not yet been tried inside a running VS Code.
|
|
408
417
|
|
|
409
418
|
## Choosing a model
|
|
410
419
|
|
|
@@ -414,7 +423,7 @@ The [VS Code extension](editors/vscode) adds commands to ask about the open fold
|
|
|
414
423
|
codehaven --model qwen2.5:14b --workspace /path/to/project 'Explain this project'
|
|
415
424
|
```
|
|
416
425
|
|
|
417
|
-
Measured on 34 questions about three real libraries (see [docs/EVALS.md](docs/EVALS.md)), with the same code and one run each:
|
|
426
|
+
Measured on 34 questions about three real libraries (see [docs/EVALS.md](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md)), with the same code and one run each:
|
|
418
427
|
|
|
419
428
|
| Model | Size on disk | Correct | Verified | Time for 34 questions | Per question |
|
|
420
429
|
|---|---|---|---|---|---|
|
|
@@ -429,7 +438,7 @@ Names of cloud models (ending in `-cloud` or `:cloud`) are refused, and so are m
|
|
|
429
438
|
|
|
430
439
|
## Ollama and offline use
|
|
431
440
|
|
|
432
|
-
The [startup script](scripts/start_ollama.py) sets `OLLAMA_NO_CLOUD=1` and binds the server to `127.0.0.1:11434`, following [Ollama's local-only instructions](https://docs.ollama.com/faq).
|
|
441
|
+
The [startup script](https://github.com/Walid-Ahmed/codehaven/blob/main/scripts/start_ollama.py) sets `OLLAMA_NO_CLOUD=1` and binds the server to `127.0.0.1:11434`, following [Ollama's local-only instructions](https://docs.ollama.com/faq). It is in the repository, not in the installed package, so run it from the root of a clone, on macOS, Linux, or Windows (use `python` if that is your Python command). With an installed `codehaven`, `codehaven --start-ollama` does the same for one run. Leave that terminal open; Ctrl+C stops the server. Check its logs for `Ollama cloud disabled: true`.
|
|
433
442
|
|
|
434
443
|
If Ollama is already running, the script checks its local API, prints a friendly message, and exits successfully without launching a second server. It cannot change or verify that server's cloud setting. To enforce `OLLAMA_NO_CLOUD=1`, quit the existing desktop app or stop its service, then run the script again. An unrecognized listener on the port still produces an error. These environment settings apply only to a server launched by the script.
|
|
435
444
|
|
|
@@ -441,9 +450,9 @@ Also new in 0.14: CodeHaven can change code when you start it with `--allow-edit
|
|
|
441
450
|
|
|
442
451
|
New in 0.14: faster on large projects and clearer when something goes wrong. The keyword index is saved between runs, so a large repository reopens in about a quarter of the time (FastAPI, 2,400 files: 8.5 s on 0.13, 2.0 s), and after you edit a file only that file is indexed again (8.5 s to 2.8 s). Listing, searching, and checking for changed files are two to three times faster. An answer whose cited lines use code that is not in the repository, such as a library or a file that was never checked in, says so under its own heading. When preloaded files leave too little room in the prompt, the reference excerpts are retrieved again to fit, instead of being gathered and then compacted away. Plain `codehaven` at a terminal starts an interactive session with arrow-key history. An unexpected problem is explained in a sentence in the terminal and on the page, never as a traceback or a bare "Failed to fetch".
|
|
443
452
|
|
|
444
|
-
New in 0.13: looks for each value an answer reports (a quoted string or a number) in the code the model was shown. A value on the lines the answer cites needs nothing; a value shown on another line gets a citation of that line; a value on no shown line was not read from the code, and the answer is marked **Unverified**. On the seven real repositories this flags two wrong answers the citation checks passed, including an OpenAPI version of `3.0.2` (it is `3.1.0`), and one correct answer whose quoted code the model made up. No correct answer was lost. See [the eval results](docs/EVALS.md).
|
|
453
|
+
New in 0.13: looks for each value an answer reports (a quoted string or a number) in the code the model was shown. A value on the lines the answer cites needs nothing; a value shown on another line gets a citation of that line; a value on no shown line was not read from the code, and the answer is marked **Unverified**. On the seven real repositories this flags two wrong answers the citation checks passed, including an OpenAPI version of `3.0.2` (it is `3.1.0`), and one correct answer whose quoted code the model made up. No correct answer was lost. See [the eval results](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
445
454
|
|
|
446
|
-
New in 0.12: searches for quoted settings and dotted names a question mentions, so an answer that is one line somewhere in the project is found; checks citations against every line the model was shown, and cites the code names an uncited answer mentions; sees project files of up to 1 MB, where files over 64 KB, often a project's central modules, were invisible before; stops indexing and downloads from the page; and is measured on a fourth, much larger repository. On the real repositories nearly every correct answer now passes the answer checks (39 of 41, from 26 of 40). The checks confirm that an answer cites lines the model was shown, not that it read them right, so read **Unverified** as "a citation does not hold" and a checked answer as "quick to check at the cited lines". See [the eval results](docs/EVALS.md).
|
|
455
|
+
New in 0.12: searches for quoted settings and dotted names a question mentions, so an answer that is one line somewhere in the project is found; checks citations against every line the model was shown, and cites the code names an uncited answer mentions; sees project files of up to 1 MB, where files over 64 KB, often a project's central modules, were invisible before; stops indexing and downloads from the page; and is measured on a fourth, much larger repository. On the real repositories nearly every correct answer now passes the answer checks (39 of 41, from 26 of 40). The checks confirm that an answer cites lines the model was shown, not that it read them right, so read **Unverified** as "a citation does not hold" and a checked answer as "quick to check at the cited lines". See [the eval results](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
447
456
|
|
|
448
457
|
New in 0.11: shows the model the definitions a question names, with the constants they use, before it answers; traces a function's calls and callers; stops an answer in progress; indexes projects of up to 5,000 files and keeps the index while nothing changes; parses Go, Java, and Rust with Tree-sitter; starts Ollama for a run and says what is missing; saves chats and flashcards; adds a VS Code extension; and is tested on macOS, Windows, and Linux, with evals on three real repositories.
|
|
449
458
|
|
|
@@ -481,7 +490,7 @@ codehaven --workspace /path/to/repo \
|
|
|
481
490
|
--exclude 'private/**' --exclude '*.pem' 'Explain this project'
|
|
482
491
|
```
|
|
483
492
|
|
|
484
|
-
Hidden/built-in paths stay blocked. User exclusions add restrictions; they cannot undo Git ignores. Rules apply to tracked files too. [Exclusion details](docs/EXCLUSIONS.md) cover precedence, negation, root scope, and reference libraries.
|
|
493
|
+
Hidden/built-in paths stay blocked. User exclusions add restrictions; they cannot undo Git ignores. Rules apply to tracked files too. [Exclusion details](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EXCLUSIONS.md) cover precedence, negation, root scope, and reference libraries.
|
|
485
494
|
|
|
486
495
|
## Change code (opt-in)
|
|
487
496
|
|
|
@@ -518,7 +527,7 @@ codehaven --workspace /path/to/project --knowledge-base /path/to/references \
|
|
|
518
527
|
'Use my references to explain LangGraph conditional edges'
|
|
519
528
|
```
|
|
520
529
|
|
|
521
|
-
The model can call `retrieve` for more passages, with source and line citations. Indexing and retrieval run entirely on your device using BM25 keyword ranking. No vector database, embeddings, extra model, or internet access is needed. Startup reports the repository-file count and warns if index limits were reached. The index is built at the start of each run. Between questions in a session CodeHaven lists the files again and rebuilds the index only if a file was added, removed, or changed, so edits you make yourself are picked up and an unchanged project costs almost nothing. A project at the 5,000-file limit takes about 8 seconds to index and about 1 second to check. For a larger project, open the subfolder you are working in. See [how to add manuals and your own references](docs/KNOWLEDGE_BASE.md) for supported formats, limits, and examples.
|
|
530
|
+
The model can call `retrieve` for more passages, with source and line citations. Indexing and retrieval run entirely on your device using BM25 keyword ranking. No vector database, embeddings, extra model, or internet access is needed. Startup reports the repository-file count and warns if index limits were reached. The index is built at the start of each run. Between questions in a session CodeHaven lists the files again and rebuilds the index only if a file was added, removed, or changed, so edits you make yourself are picked up and an unchanged project costs almost nothing. A project at the 5,000-file limit takes about 8 seconds to index and about 1 second to check. For a larger project, open the subfolder you are working in. See [how to add manuals and your own references](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/KNOWLEDGE_BASE.md) for supported formats, limits, and examples.
|
|
522
531
|
|
|
523
532
|
## Dependency-aware retrieval and complete functions
|
|
524
533
|
|
|
@@ -535,7 +544,7 @@ codehaven --workspace /path/to/repo --retrieval-budget 8000 \
|
|
|
535
544
|
'Explain checkout_total and its imported helpers'
|
|
536
545
|
```
|
|
537
546
|
|
|
538
|
-
`--retrieval-budget` accepts 2,000–16,000 bytes. It controls retrieved context only; it does not measure model tokens or cap accumulated conversation history. Imports are followed up to two hops over already indexed files. See [retrieval details](docs/KNOWLEDGE_BASE.md#retrieval-budgets-and-complete-symbols) for metadata and limitations.
|
|
547
|
+
`--retrieval-budget` accepts 2,000–16,000 bytes. It controls retrieved context only; it does not measure model tokens or cap accumulated conversation history. Imports are followed up to two hops over already indexed files. See [retrieval details](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/KNOWLEDGE_BASE.md#retrieval-budgets-and-complete-symbols) for metadata and limitations.
|
|
539
548
|
|
|
540
549
|
## Local inference speed
|
|
541
550
|
|
|
@@ -599,7 +608,7 @@ codehaven --workspace /path/to/project --test-runner pytest \
|
|
|
599
608
|
|
|
600
609
|
CodeHaven asks for approval before each run. Tests receive a filtered, read-only project copy, disabled networking, and a writable temporary area. They cannot change the original project through the mounted filesystem. Host environment variables and the Docker socket are not exposed. Time/resource/output limits and forced container cleanup apply.
|
|
601
610
|
|
|
602
|
-
**No host fallback:** Docker and a prepared local image are required. CodeHaven never pulls images or installs packages during a test run. For project dependencies, prepare an image and select `--test-image my-project-tests:local`. See [isolated test setup and limits](docs/ISOLATED_TESTS.md).
|
|
611
|
+
**No host fallback:** Docker and a prepared local image are required. CodeHaven never pulls images or installs packages during a test run. For project dependencies, prepare an image and select `--test-image my-project-tests:local`. See [isolated test setup and limits](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/ISOLATED_TESTS.md).
|
|
603
612
|
|
|
604
613
|
## Current limits
|
|
605
614
|
|
|
@@ -625,15 +634,15 @@ python3 -m offline_agent.evaluation
|
|
|
625
634
|
python3 -m offline_agent.evaluation --only low-stock-bug --only last-product
|
|
626
635
|
```
|
|
627
636
|
|
|
628
|
-
To check that a change is not fitted to those tasks, also run the [second set](evals/bookings_tasks.json) over a [different small repository](evals/bookings_repo). Results are recorded in [the plan](docs/PLAN.md):
|
|
637
|
+
To check that a change is not fitted to those tasks, also run the [second set](https://github.com/Walid-Ahmed/codehaven/blob/main/evals/bookings_tasks.json) over a [different small repository](https://github.com/Walid-Ahmed/codehaven/tree/main/evals/bookings_repo). Results are recorded in [the plan](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/PLAN.md):
|
|
629
638
|
|
|
630
639
|
```sh
|
|
631
640
|
python3 -m offline_agent.evaluation --tasks evals/bookings_tasks.json --repo evals/bookings_repo
|
|
632
641
|
```
|
|
633
642
|
|
|
634
|
-
[evals/tasks.json](evals/tasks.json) holds 12 questions over the small [sample repository](evals/sample_repo), including a paged read of a 600-line file, entry-point discovery, and explaining a bug and its fix. Every task is a question checked by regexes on the answer; three tasks also ask follow-up questions in the same session ("What tax rate does *that function* add?"), each checked on its own answer, to test the follow-up memory. Each task runs on a fresh temporary copy with test runs declined, and **a task fails if any file in the copy changed**, so the evals also check that CodeHaven stays read-only. The run prints a table of pass/fail, exit code, steps, tokens, and time, and writes the full report, including each task's run log, raw model replies, and changed files, to `evals/results/latest.json`, which Git ignores. The summary separately counts tasks that also passed CodeHaven's own answer checks (exit code 0), and warns if model reloads made the timings unrepresentative. Use `--model` to score another installed model. Like normal use, evaluation talks only to loopback Ollama. Compare reports before and after a change. Results vary between runs, so look at trends rather than one pass or fail.
|
|
643
|
+
[evals/tasks.json](https://github.com/Walid-Ahmed/codehaven/blob/main/evals/tasks.json) holds 12 questions over the small [sample repository](https://github.com/Walid-Ahmed/codehaven/tree/main/evals/sample_repo), including a paged read of a 600-line file, entry-point discovery, and explaining a bug and its fix. Every task is a question checked by regexes on the answer; three tasks also ask follow-up questions in the same session ("What tax rate does *that function* add?"), each checked on its own answer, to test the follow-up memory. Each task runs on a fresh temporary copy with test runs declined, and **a task fails if any file in the copy changed**, so the evals also check that CodeHaven stays read-only. The run prints a table of pass/fail, exit code, steps, tokens, and time, and writes the full report, including each task's run log, raw model replies, and changed files, to `evals/results/latest.json`, which Git ignores. The summary separately counts tasks that also passed CodeHaven's own answer checks (exit code 0), and warns if model reloads made the timings unrepresentative. Use `--model` to score another installed model. Like normal use, evaluation talks only to loopback Ollama. Compare reports before and after a change. Results vary between runs, so look at trends rather than one pass or fail.
|
|
635
644
|
|
|
636
|
-
See [the implementation plan and roadmap](docs/PLAN.md) for architecture, acceptance criteria, and next steps. API integration follows [Ollama chat](https://docs.ollama.com/api/chat) and [structured outputs](https://docs.ollama.com/capabilities/structured-outputs).
|
|
645
|
+
See [the implementation plan and roadmap](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/PLAN.md) for architecture, acceptance criteria, and next steps. API integration follows [Ollama chat](https://docs.ollama.com/api/chat) and [structured outputs](https://docs.ollama.com/capabilities/structured-outputs).
|
|
637
646
|
|
|
638
647
|
**Real repositories.** Six more question sets run on real open-source libraries, each pinned to one release: requests, click, and express, and a held-out group of flask, cobra, and axios whose questions were written before any change was tried on them. They are not kept in this repository, so download them once, while online:
|
|
639
648
|
|
|
@@ -642,6 +651,6 @@ python3 scripts/fetch_eval_repos.py
|
|
|
642
651
|
python3 -m offline_agent.evaluation --suite requests
|
|
643
652
|
```
|
|
644
653
|
|
|
645
|
-
The script is a developer tool and the only eval step that uses the internet; the installed package never runs it. Scores for every set, and what they do not measure, are recorded in [docs/EVALS.md](docs/EVALS.md).
|
|
654
|
+
The script is a developer tool and the only eval step that uses the internet; the installed package never runs it. Scores for every set, and what they do not measure, are recorded in [docs/EVALS.md](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
646
655
|
|
|
647
656
|
Automated tests use fake model responses and a loopback HTTP fixture, so they do not establish answer quality. The local evals measure the real model on short questions with one right answer; they do not establish quality on whole-project explanations or on large monorepos.
|