codehaven 0.14.0__tar.gz → 0.14.1__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.14.1}/PKG-INFO +22 -22
- {codehaven-0.14.0 → codehaven-0.14.1}/README.md +21 -21
- {codehaven-0.14.0 → codehaven-0.14.1}/codehaven.egg-info/PKG-INFO +22 -22
- {codehaven-0.14.0 → codehaven-0.14.1}/codehaven.egg-info/SOURCES.txt +3 -1
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/__init__.py +1 -1
- {codehaven-0.14.0 → codehaven-0.14.1}/pyproject.toml +1 -1
- codehaven-0.14.1/tests/test_readme.py +19 -0
- codehaven-0.14.1/tests/test_wording.py +42 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/LICENSE +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/codehaven.egg-info/dependency_links.txt +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/codehaven.egg-info/entry_points.txt +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/codehaven.egg-info/requires.txt +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/codehaven.egg-info/top_level.txt +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/__main__.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/agent.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/answers.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/arabic.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/changes.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/chats.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/cli.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/coder.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/dependencies.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/doctor.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/documents.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/edits.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/errors.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/evaluation.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/evidence.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/exclusions.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/export.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/gui.css +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/gui.html +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/gui.js +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/gui.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/gui_arabic.js +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/guides.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/history.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/index_cache.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/insights.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/javascript.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/knowledge.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/languages.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/memory.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/messages.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/model.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/more_languages.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/ocr.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/prompts.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/references/langgraph-approvals.md +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/references/langgraph-checkpoints.md +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/references/langgraph-graphs.md +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/references/langgraph.md +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/review.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/scans.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/semantic.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/slash.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/study.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/symbols.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/tasks.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/test_runner.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/trace.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/tracebacks.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/offline_agent/workspace.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/setup.cfg +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_agent.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_arabic.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_browser.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_changes.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_chats.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_citations.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_comments.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_dependencies.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_doctor.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_documents.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_edit_and_paging.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_edits.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_evaluation.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_evidence.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_exclusions.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_export.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_graph.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_gui.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_guides.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_harness.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_history.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_index_speed.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_insights.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_knowledge.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_languages.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_memory.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_more_languages.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_ocr.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_phrases.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_presentation.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_prompt_budget.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_real_evals.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_repository_rag.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_retrieval_upgrade.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_review.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_run_python.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_sandbox_integration.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_sandbox_unit.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_scans.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_search.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_semantic.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_setup.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_several_repos.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_slash.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_start_ollama.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_stop.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_study.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_symbols.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_test_runner.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_trace.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_tracebacks.py +0 -0
- {codehaven-0.14.0 → codehaven-0.14.1}/tests/test_tracing.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codehaven
|
|
3
|
-
Version: 0.14.
|
|
3
|
+
Version: 0.14.1
|
|
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,7 +92,7 @@ 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
|
|
|
@@ -141,9 +141,9 @@ pipx install git+https://github.com/Walid-Ahmed/codehaven.git
|
|
|
141
141
|
|
|
142
142
|
## How it is built
|
|
143
143
|
|
|
144
|
-

|
|
144
|
+

|
|
145
145
|
|
|
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.
|
|
146
|
+
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
147
|
|
|
148
148
|
### The workflow
|
|
149
149
|
|
|
@@ -190,9 +190,9 @@ Passages reach the model four ways: keyword ranking (BM25), definition lookup fo
|
|
|
190
190
|
|
|
191
191
|
### The agent loop in detail
|
|
192
192
|
|
|
193
|
-

|
|
193
|
+

|
|
194
194
|
|
|
195
|
-
A high-resolution [PNG version](docs/assets/how-codehaven-works.png) is available for slides.
|
|
195
|
+
A high-resolution [PNG version](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/assets/how-codehaven-works.png) is available for slides.
|
|
196
196
|
|
|
197
197
|
```text
|
|
198
198
|
START -> model -> read, search, retrieve, or run_tests -> model
|
|
@@ -443,7 +443,7 @@ Answers stream to the terminal as the model writes them; add `--no-stream` to pr
|
|
|
443
443
|
|
|
444
444
|
## Use it from VS Code
|
|
445
445
|
|
|
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.
|
|
446
|
+
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
447
|
|
|
448
448
|
## Choosing a model
|
|
449
449
|
|
|
@@ -453,7 +453,7 @@ The [VS Code extension](editors/vscode) adds commands to ask about the open fold
|
|
|
453
453
|
codehaven --model qwen2.5:14b --workspace /path/to/project 'Explain this project'
|
|
454
454
|
```
|
|
455
455
|
|
|
456
|
-
Measured on 34 questions about three real libraries (see [docs/EVALS.md](docs/EVALS.md)), with the same code and one run each:
|
|
456
|
+
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
457
|
|
|
458
458
|
| Model | Size on disk | Correct | Verified | Time for 34 questions | Per question |
|
|
459
459
|
|---|---|---|---|---|---|
|
|
@@ -468,7 +468,7 @@ Names of cloud models (ending in `-cloud` or `:cloud`) are refused, and so are m
|
|
|
468
468
|
|
|
469
469
|
## Ollama and offline use
|
|
470
470
|
|
|
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). Run it from this repository on macOS, Linux, or Windows (use `python` if that is your Python command). Leave that terminal open; Ctrl+C stops the server. Check its logs for `Ollama cloud disabled: true`.
|
|
471
|
+
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). Run it from this repository on macOS, Linux, or Windows (use `python` if that is your Python command). Leave that terminal open; Ctrl+C stops the server. Check its logs for `Ollama cloud disabled: true`.
|
|
472
472
|
|
|
473
473
|
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
474
|
|
|
@@ -480,9 +480,9 @@ Also new in 0.14: CodeHaven can change code when you start it with `--allow-edit
|
|
|
480
480
|
|
|
481
481
|
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
482
|
|
|
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).
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
484
484
|
|
|
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).
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
486
486
|
|
|
487
487
|
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
488
|
|
|
@@ -520,7 +520,7 @@ codehaven --workspace /path/to/repo \
|
|
|
520
520
|
--exclude 'private/**' --exclude '*.pem' 'Explain this project'
|
|
521
521
|
```
|
|
522
522
|
|
|
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.
|
|
523
|
+
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
524
|
|
|
525
525
|
## Change code (opt-in)
|
|
526
526
|
|
|
@@ -557,7 +557,7 @@ codehaven --workspace /path/to/project --knowledge-base /path/to/references \
|
|
|
557
557
|
'Use my references to explain LangGraph conditional edges'
|
|
558
558
|
```
|
|
559
559
|
|
|
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.
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/KNOWLEDGE_BASE.md) for supported formats, limits, and examples.
|
|
561
561
|
|
|
562
562
|
## Dependency-aware retrieval and complete functions
|
|
563
563
|
|
|
@@ -574,7 +574,7 @@ codehaven --workspace /path/to/repo --retrieval-budget 8000 \
|
|
|
574
574
|
'Explain checkout_total and its imported helpers'
|
|
575
575
|
```
|
|
576
576
|
|
|
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.
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/KNOWLEDGE_BASE.md#retrieval-budgets-and-complete-symbols) for metadata and limitations.
|
|
578
578
|
|
|
579
579
|
## Local inference speed
|
|
580
580
|
|
|
@@ -638,7 +638,7 @@ codehaven --workspace /path/to/project --test-runner pytest \
|
|
|
638
638
|
|
|
639
639
|
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
640
|
|
|
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).
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/ISOLATED_TESTS.md).
|
|
642
642
|
|
|
643
643
|
## Current limits
|
|
644
644
|
|
|
@@ -664,15 +664,15 @@ python3 -m offline_agent.evaluation
|
|
|
664
664
|
python3 -m offline_agent.evaluation --only low-stock-bug --only last-product
|
|
665
665
|
```
|
|
666
666
|
|
|
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):
|
|
667
|
+
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
668
|
|
|
669
669
|
```sh
|
|
670
670
|
python3 -m offline_agent.evaluation --tasks evals/bookings_tasks.json --repo evals/bookings_repo
|
|
671
671
|
```
|
|
672
672
|
|
|
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.
|
|
673
|
+
[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
674
|
|
|
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).
|
|
675
|
+
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
676
|
|
|
677
677
|
**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
678
|
|
|
@@ -681,6 +681,6 @@ python3 scripts/fetch_eval_repos.py
|
|
|
681
681
|
python3 -m offline_agent.evaluation --suite requests
|
|
682
682
|
```
|
|
683
683
|
|
|
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).
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
685
685
|
|
|
686
686
|
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,7 +53,7 @@ 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
|
|
|
@@ -102,9 +102,9 @@ pipx install git+https://github.com/Walid-Ahmed/codehaven.git
|
|
|
102
102
|
|
|
103
103
|
## How it is built
|
|
104
104
|
|
|
105
|
-

|
|
105
|
+

|
|
106
106
|
|
|
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.
|
|
107
|
+
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
108
|
|
|
109
109
|
### The workflow
|
|
110
110
|
|
|
@@ -151,9 +151,9 @@ Passages reach the model four ways: keyword ranking (BM25), definition lookup fo
|
|
|
151
151
|
|
|
152
152
|
### The agent loop in detail
|
|
153
153
|
|
|
154
|
-

|
|
154
|
+

|
|
155
155
|
|
|
156
|
-
A high-resolution [PNG version](docs/assets/how-codehaven-works.png) is available for slides.
|
|
156
|
+
A high-resolution [PNG version](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/assets/how-codehaven-works.png) is available for slides.
|
|
157
157
|
|
|
158
158
|
```text
|
|
159
159
|
START -> model -> read, search, retrieve, or run_tests -> model
|
|
@@ -404,7 +404,7 @@ Answers stream to the terminal as the model writes them; add `--no-stream` to pr
|
|
|
404
404
|
|
|
405
405
|
## Use it from VS Code
|
|
406
406
|
|
|
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.
|
|
407
|
+
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
408
|
|
|
409
409
|
## Choosing a model
|
|
410
410
|
|
|
@@ -414,7 +414,7 @@ The [VS Code extension](editors/vscode) adds commands to ask about the open fold
|
|
|
414
414
|
codehaven --model qwen2.5:14b --workspace /path/to/project 'Explain this project'
|
|
415
415
|
```
|
|
416
416
|
|
|
417
|
-
Measured on 34 questions about three real libraries (see [docs/EVALS.md](docs/EVALS.md)), with the same code and one run each:
|
|
417
|
+
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
418
|
|
|
419
419
|
| Model | Size on disk | Correct | Verified | Time for 34 questions | Per question |
|
|
420
420
|
|---|---|---|---|---|---|
|
|
@@ -429,7 +429,7 @@ Names of cloud models (ending in `-cloud` or `:cloud`) are refused, and so are m
|
|
|
429
429
|
|
|
430
430
|
## Ollama and offline use
|
|
431
431
|
|
|
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). Run it from this repository on macOS, Linux, or Windows (use `python` if that is your Python command). Leave that terminal open; Ctrl+C stops the server. Check its logs for `Ollama cloud disabled: true`.
|
|
432
|
+
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). Run it from this repository on macOS, Linux, or Windows (use `python` if that is your Python command). Leave that terminal open; Ctrl+C stops the server. Check its logs for `Ollama cloud disabled: true`.
|
|
433
433
|
|
|
434
434
|
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
435
|
|
|
@@ -441,9 +441,9 @@ Also new in 0.14: CodeHaven can change code when you start it with `--allow-edit
|
|
|
441
441
|
|
|
442
442
|
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
443
|
|
|
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).
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
445
445
|
|
|
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).
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
447
447
|
|
|
448
448
|
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
449
|
|
|
@@ -481,7 +481,7 @@ codehaven --workspace /path/to/repo \
|
|
|
481
481
|
--exclude 'private/**' --exclude '*.pem' 'Explain this project'
|
|
482
482
|
```
|
|
483
483
|
|
|
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.
|
|
484
|
+
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
485
|
|
|
486
486
|
## Change code (opt-in)
|
|
487
487
|
|
|
@@ -518,7 +518,7 @@ codehaven --workspace /path/to/project --knowledge-base /path/to/references \
|
|
|
518
518
|
'Use my references to explain LangGraph conditional edges'
|
|
519
519
|
```
|
|
520
520
|
|
|
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.
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/KNOWLEDGE_BASE.md) for supported formats, limits, and examples.
|
|
522
522
|
|
|
523
523
|
## Dependency-aware retrieval and complete functions
|
|
524
524
|
|
|
@@ -535,7 +535,7 @@ codehaven --workspace /path/to/repo --retrieval-budget 8000 \
|
|
|
535
535
|
'Explain checkout_total and its imported helpers'
|
|
536
536
|
```
|
|
537
537
|
|
|
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.
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/KNOWLEDGE_BASE.md#retrieval-budgets-and-complete-symbols) for metadata and limitations.
|
|
539
539
|
|
|
540
540
|
## Local inference speed
|
|
541
541
|
|
|
@@ -599,7 +599,7 @@ codehaven --workspace /path/to/project --test-runner pytest \
|
|
|
599
599
|
|
|
600
600
|
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
601
|
|
|
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).
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/ISOLATED_TESTS.md).
|
|
603
603
|
|
|
604
604
|
## Current limits
|
|
605
605
|
|
|
@@ -625,15 +625,15 @@ python3 -m offline_agent.evaluation
|
|
|
625
625
|
python3 -m offline_agent.evaluation --only low-stock-bug --only last-product
|
|
626
626
|
```
|
|
627
627
|
|
|
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):
|
|
628
|
+
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
629
|
|
|
630
630
|
```sh
|
|
631
631
|
python3 -m offline_agent.evaluation --tasks evals/bookings_tasks.json --repo evals/bookings_repo
|
|
632
632
|
```
|
|
633
633
|
|
|
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.
|
|
634
|
+
[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
635
|
|
|
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).
|
|
636
|
+
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
637
|
|
|
638
638
|
**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
639
|
|
|
@@ -642,6 +642,6 @@ python3 scripts/fetch_eval_repos.py
|
|
|
642
642
|
python3 -m offline_agent.evaluation --suite requests
|
|
643
643
|
```
|
|
644
644
|
|
|
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).
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
646
646
|
|
|
647
647
|
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.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codehaven
|
|
3
|
-
Version: 0.14.
|
|
3
|
+
Version: 0.14.1
|
|
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,7 +92,7 @@ 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
|
|
|
@@ -141,9 +141,9 @@ pipx install git+https://github.com/Walid-Ahmed/codehaven.git
|
|
|
141
141
|
|
|
142
142
|
## How it is built
|
|
143
143
|
|
|
144
|
-

|
|
144
|
+

|
|
145
145
|
|
|
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.
|
|
146
|
+
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
147
|
|
|
148
148
|
### The workflow
|
|
149
149
|
|
|
@@ -190,9 +190,9 @@ Passages reach the model four ways: keyword ranking (BM25), definition lookup fo
|
|
|
190
190
|
|
|
191
191
|
### The agent loop in detail
|
|
192
192
|
|
|
193
|
-

|
|
193
|
+

|
|
194
194
|
|
|
195
|
-
A high-resolution [PNG version](docs/assets/how-codehaven-works.png) is available for slides.
|
|
195
|
+
A high-resolution [PNG version](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/assets/how-codehaven-works.png) is available for slides.
|
|
196
196
|
|
|
197
197
|
```text
|
|
198
198
|
START -> model -> read, search, retrieve, or run_tests -> model
|
|
@@ -443,7 +443,7 @@ Answers stream to the terminal as the model writes them; add `--no-stream` to pr
|
|
|
443
443
|
|
|
444
444
|
## Use it from VS Code
|
|
445
445
|
|
|
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.
|
|
446
|
+
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
447
|
|
|
448
448
|
## Choosing a model
|
|
449
449
|
|
|
@@ -453,7 +453,7 @@ The [VS Code extension](editors/vscode) adds commands to ask about the open fold
|
|
|
453
453
|
codehaven --model qwen2.5:14b --workspace /path/to/project 'Explain this project'
|
|
454
454
|
```
|
|
455
455
|
|
|
456
|
-
Measured on 34 questions about three real libraries (see [docs/EVALS.md](docs/EVALS.md)), with the same code and one run each:
|
|
456
|
+
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
457
|
|
|
458
458
|
| Model | Size on disk | Correct | Verified | Time for 34 questions | Per question |
|
|
459
459
|
|---|---|---|---|---|---|
|
|
@@ -468,7 +468,7 @@ Names of cloud models (ending in `-cloud` or `:cloud`) are refused, and so are m
|
|
|
468
468
|
|
|
469
469
|
## Ollama and offline use
|
|
470
470
|
|
|
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). Run it from this repository on macOS, Linux, or Windows (use `python` if that is your Python command). Leave that terminal open; Ctrl+C stops the server. Check its logs for `Ollama cloud disabled: true`.
|
|
471
|
+
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). Run it from this repository on macOS, Linux, or Windows (use `python` if that is your Python command). Leave that terminal open; Ctrl+C stops the server. Check its logs for `Ollama cloud disabled: true`.
|
|
472
472
|
|
|
473
473
|
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
474
|
|
|
@@ -480,9 +480,9 @@ Also new in 0.14: CodeHaven can change code when you start it with `--allow-edit
|
|
|
480
480
|
|
|
481
481
|
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
482
|
|
|
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).
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
484
484
|
|
|
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).
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
486
486
|
|
|
487
487
|
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
488
|
|
|
@@ -520,7 +520,7 @@ codehaven --workspace /path/to/repo \
|
|
|
520
520
|
--exclude 'private/**' --exclude '*.pem' 'Explain this project'
|
|
521
521
|
```
|
|
522
522
|
|
|
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.
|
|
523
|
+
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
524
|
|
|
525
525
|
## Change code (opt-in)
|
|
526
526
|
|
|
@@ -557,7 +557,7 @@ codehaven --workspace /path/to/project --knowledge-base /path/to/references \
|
|
|
557
557
|
'Use my references to explain LangGraph conditional edges'
|
|
558
558
|
```
|
|
559
559
|
|
|
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.
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/KNOWLEDGE_BASE.md) for supported formats, limits, and examples.
|
|
561
561
|
|
|
562
562
|
## Dependency-aware retrieval and complete functions
|
|
563
563
|
|
|
@@ -574,7 +574,7 @@ codehaven --workspace /path/to/repo --retrieval-budget 8000 \
|
|
|
574
574
|
'Explain checkout_total and its imported helpers'
|
|
575
575
|
```
|
|
576
576
|
|
|
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.
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/KNOWLEDGE_BASE.md#retrieval-budgets-and-complete-symbols) for metadata and limitations.
|
|
578
578
|
|
|
579
579
|
## Local inference speed
|
|
580
580
|
|
|
@@ -638,7 +638,7 @@ codehaven --workspace /path/to/project --test-runner pytest \
|
|
|
638
638
|
|
|
639
639
|
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
640
|
|
|
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).
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/ISOLATED_TESTS.md).
|
|
642
642
|
|
|
643
643
|
## Current limits
|
|
644
644
|
|
|
@@ -664,15 +664,15 @@ python3 -m offline_agent.evaluation
|
|
|
664
664
|
python3 -m offline_agent.evaluation --only low-stock-bug --only last-product
|
|
665
665
|
```
|
|
666
666
|
|
|
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):
|
|
667
|
+
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
668
|
|
|
669
669
|
```sh
|
|
670
670
|
python3 -m offline_agent.evaluation --tasks evals/bookings_tasks.json --repo evals/bookings_repo
|
|
671
671
|
```
|
|
672
672
|
|
|
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.
|
|
673
|
+
[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
674
|
|
|
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).
|
|
675
|
+
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
676
|
|
|
677
677
|
**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
678
|
|
|
@@ -681,6 +681,6 @@ python3 scripts/fetch_eval_repos.py
|
|
|
681
681
|
python3 -m offline_agent.evaluation --suite requests
|
|
682
682
|
```
|
|
683
683
|
|
|
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).
|
|
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](https://github.com/Walid-Ahmed/codehaven/blob/main/docs/EVALS.md).
|
|
685
685
|
|
|
686
686
|
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.
|
|
@@ -89,6 +89,7 @@ tests/test_ocr.py
|
|
|
89
89
|
tests/test_phrases.py
|
|
90
90
|
tests/test_presentation.py
|
|
91
91
|
tests/test_prompt_budget.py
|
|
92
|
+
tests/test_readme.py
|
|
92
93
|
tests/test_real_evals.py
|
|
93
94
|
tests/test_repository_rag.py
|
|
94
95
|
tests/test_retrieval_upgrade.py
|
|
@@ -109,4 +110,5 @@ tests/test_symbols.py
|
|
|
109
110
|
tests/test_test_runner.py
|
|
110
111
|
tests/test_trace.py
|
|
111
112
|
tests/test_tracebacks.py
|
|
112
|
-
tests/test_tracing.py
|
|
113
|
+
tests/test_tracing.py
|
|
114
|
+
tests/test_wording.py
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""Local-only coding assistant."""
|
|
2
|
-
__version__ = "0.14.
|
|
2
|
+
__version__ = "0.14.1"
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "codehaven"
|
|
7
|
-
version = "0.14.
|
|
7
|
+
version = "0.14.1"
|
|
8
8
|
description = "CodeHaven: a read-only, offline assistant for understanding code. Your code. Your machine. No API fees."
|
|
9
9
|
requires-python = ">=3.10"
|
|
10
10
|
readme = "README.md"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""The README is also the PyPI page, which cannot resolve paths inside the repository: every link and image must be a full URL."""
|
|
2
|
+
import re
|
|
3
|
+
import unittest
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
README = Path(__file__).resolve().parent.parent / "README.md"
|
|
7
|
+
LINK = re.compile(r"\]\(([^)\s]+)\)|<img[^>]+src=[\"']([^\"']+)")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ReadmeTests(unittest.TestCase):
|
|
11
|
+
def test_links_and_images_work_on_pypi(self):
|
|
12
|
+
relative = [target for match in LINK.finditer(README.read_text(encoding="utf-8"))
|
|
13
|
+
if not re.match(r"(?:https?:|mailto:|#)", target := match.group(1) or match.group(2))]
|
|
14
|
+
self.assertEqual(relative, [], "PyPI shows these as broken; use https://github.com/... or "
|
|
15
|
+
"https://raw.githubusercontent.com/... URLs instead.")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
if __name__ == "__main__":
|
|
19
|
+
unittest.main()
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Words CodeHaven never uses: Walid's standing rule is that one search technique is never named anywhere in the project,
|
|
2
|
+
in code, docs, release notes, package text, or marketing. This test fails if it appears in any file git tracks."""
|
|
3
|
+
import re
|
|
4
|
+
import subprocess
|
|
5
|
+
import unittest
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
ROOT = Path(__file__).resolve().parent.parent
|
|
9
|
+
# Built from parts so this file does not contain the words it forbids.
|
|
10
|
+
FORBIDDEN = re.compile(r"\b" + "f" + r"ts\d*\b|\b" + "full" + r"[\s_-]*text[\s_-]*(?:search|index)", re.I)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def tracked_files():
|
|
14
|
+
"""Every file git tracks, or every file under the project when git is not available."""
|
|
15
|
+
try:
|
|
16
|
+
listed = subprocess.run(["git", "-C", str(ROOT), "ls-files", "-z"], capture_output=True, check=True).stdout
|
|
17
|
+
return [ROOT / name for name in listed.decode().split("\0") if name]
|
|
18
|
+
except (OSError, subprocess.CalledProcessError):
|
|
19
|
+
return [path for path in ROOT.rglob("*") if path.is_file() and ".git" not in path.parts]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class WordingTests(unittest.TestCase):
|
|
23
|
+
def test_the_pattern_catches_the_words(self):
|
|
24
|
+
for text in ("F" + "TS5 index", "sqlite " + "f" + "ts", "Full-" + "text search", "full " + "text index"):
|
|
25
|
+
self.assertRegex(text, FORBIDDEN)
|
|
26
|
+
for text in ("shifts", "drafts", "fetch the text", "full answer"):
|
|
27
|
+
self.assertNotRegex(text, FORBIDDEN)
|
|
28
|
+
|
|
29
|
+
def test_no_tracked_file_names_it(self):
|
|
30
|
+
found = []
|
|
31
|
+
for path in tracked_files():
|
|
32
|
+
try:
|
|
33
|
+
text = path.read_text(encoding="utf-8")
|
|
34
|
+
except (OSError, UnicodeError):
|
|
35
|
+
continue # Images and other binary files.
|
|
36
|
+
found += [f"{path.relative_to(ROOT)}:{number}" for number, line in enumerate(text.splitlines(), 1)
|
|
37
|
+
if FORBIDDEN.search(line)]
|
|
38
|
+
self.assertEqual(found, [], "These lines name a search technique CodeHaven never mentions; reword them.")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
if __name__ == "__main__":
|
|
42
|
+
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|