lcode-cli 0.3.0__tar.gz → 0.3.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.
Files changed (73) hide show
  1. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/.github/ISSUE_TEMPLATE/model_request.yml +5 -0
  2. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/CHANGELOG.md +14 -1
  3. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/PKG-INFO +4 -3
  4. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/README.md +3 -2
  5. lcode_cli-0.3.1/docs/bench.md +172 -0
  6. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/docs/how-it-works.md +1 -0
  7. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/docs/models.md +2 -2
  8. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/docs/quickstart.md +1 -1
  9. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/docs/usage.md +1 -0
  10. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/mkdocs.yml +1 -0
  11. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/__init__.py +1 -1
  12. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/agent.py +6 -0
  13. lcode_cli-0.3.1/src/lcode/bench.py +1082 -0
  14. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/cli.py +91 -2
  15. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/ollama.py +4 -0
  16. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/tests/conftest.py +6 -0
  17. lcode_cli-0.3.1/tests/test_bench.py +272 -0
  18. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/.editorconfig +0 -0
  19. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/.github/CODEOWNERS +0 -0
  20. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  21. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  22. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  23. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  24. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/.github/dependabot.yml +0 -0
  25. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/.github/workflows/ci.yml +0 -0
  26. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/.github/workflows/docs.yml +0 -0
  27. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/.github/workflows/release.yml +0 -0
  28. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/.gitignore +0 -0
  29. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/.pre-commit-config.yaml +0 -0
  30. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/AGENTS.md +0 -0
  31. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/CODE_OF_CONDUCT.md +0 -0
  32. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/CONTRIBUTING.md +0 -0
  33. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/LICENSE +0 -0
  34. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/SECURITY.md +0 -0
  35. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/docs/assets/demo.svg +0 -0
  36. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/docs/assets/extra.css +0 -0
  37. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/docs/assets/logo.svg +0 -0
  38. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/docs/assets/social-preview.png +0 -0
  39. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/docs/changelog.md +0 -0
  40. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/docs/configuration.md +0 -0
  41. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/docs/contributing.md +0 -0
  42. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/docs/index.md +0 -0
  43. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/docs/installation.md +0 -0
  44. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/docs/troubleshooting.md +0 -0
  45. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/install.sh +0 -0
  46. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/overrides/main.html +0 -0
  47. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/pyproject.toml +0 -0
  48. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/scripts/record_demo.py +0 -0
  49. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/scripts/social-preview.html +0 -0
  50. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/__main__.py +0 -0
  51. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/catalog.py +0 -0
  52. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/checkpoints.py +0 -0
  53. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/config.py +0 -0
  54. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/hardware.py +0 -0
  55. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/limits.py +0 -0
  56. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/models.toml +0 -0
  57. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/permissions.py +0 -0
  58. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/render.py +0 -0
  59. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/repl.py +0 -0
  60. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/sessions.py +0 -0
  61. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/tools.py +0 -0
  62. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/src/lcode/web.py +0 -0
  63. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/tests/test_agent.py +0 -0
  64. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/tests/test_catalog.py +0 -0
  65. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/tests/test_checkpoints.py +0 -0
  66. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/tests/test_cli.py +0 -0
  67. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/tests/test_config.py +0 -0
  68. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/tests/test_context_picker.py +0 -0
  69. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/tests/test_permissions.py +0 -0
  70. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/tests/test_sessions.py +0 -0
  71. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/tests/test_tools.py +0 -0
  72. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/tests/test_web.py +0 -0
  73. {lcode_cli-0.3.0 → lcode_cli-0.3.1}/uv.lock +0 -0
@@ -35,6 +35,11 @@ body:
35
35
  description: Context size used, tokens/s, whether tool calls (reading, editing, running commands) worked reliably, and anything odd.
36
36
  validations:
37
37
  required: true
38
+ - type: textarea
39
+ id: bench
40
+ attributes:
41
+ label: Output of `lcode bench <model> --markdown`
42
+ description: Optional, but the most useful thing you can add. It takes a few minutes; see https://nasser1941.github.io/lcode/bench/
38
43
  - type: textarea
39
44
  id: doctor
40
45
  attributes:
@@ -6,6 +6,18 @@ All notable changes to lcode are documented here. The format follows
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.3.1] - 2026-09-30
10
+
11
+ ### Added
12
+
13
+ - `lcode bench` scores models on this machine with eight small coding tasks: fixing a bug, finding
14
+ code, writing a script from a spec, renaming across files, a one-line edit in a long file,
15
+ recovering from failing commands, fixing a function to match its spec and adding a feature across
16
+ files. Each task runs in a temporary folder and has an automatic check, some with hidden tests.
17
+ It reports tasks passed, time, generation and prompt speed, tool-call errors and memory use.
18
+ `lcode bench model-a model-b` compares models, `--json` saves the results (a documented, versioned
19
+ format) and `--markdown` prints a table for a model test report.
20
+
9
21
  ## [0.3.0] - 2026-09-30
10
22
 
11
23
  ### Added
@@ -128,7 +140,8 @@ First public release.
128
140
  - `AGENTS.md` project instructions and `/init` to generate them.
129
141
  - One-line installer for Linux and macOS.
130
142
 
131
- [Unreleased]: https://github.com/nasser1941/lcode/compare/v0.3.0...HEAD
143
+ [Unreleased]: https://github.com/nasser1941/lcode/compare/v0.3.1...HEAD
144
+ [0.3.1]: https://github.com/nasser1941/lcode/compare/v0.3.0...v0.3.1
132
145
  [0.3.0]: https://github.com/nasser1941/lcode/compare/v0.2.2...v0.3.0
133
146
  [0.2.2]: https://github.com/nasser1941/lcode/compare/v0.2.1...v0.2.2
134
147
  [0.2.1]: https://github.com/nasser1941/lcode/compare/v0.2.0...v0.2.1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: lcode-cli
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: A local-first terminal coding agent powered by open-weight models on your own GPU or Mac, via Ollama.
5
5
  Project-URL: Homepage, https://nasser1941.github.io/lcode/
6
6
  Project-URL: Documentation, https://nasser1941.github.io/lcode/
@@ -73,7 +73,8 @@ through [Ollama](https://ollama.com), and when it needs current information it c
73
73
  plans multi-step tasks with a visible todo list.
74
74
  - **Long context.** 256K tokens with the default model (1M with Nemotron). You choose the window.
75
75
  - **Hardware-aware.** Detects your NVIDIA GPU or Apple Silicon Mac and picks the best model and the
76
- largest context that fits: `lcode setup` does it in one step.
76
+ largest context that fits: `lcode setup` does it in one step. `lcode bench` compares models on
77
+ real coding tasks on your machine.
77
78
  - **Safe by default.** Every edit is shown as a diff and every command that isn't read-only needs
78
79
  your approval. `auto-edit` and `yolo` modes when you want speed.
79
80
  - **Undo.** lcode saves a checkpoint before the model changes files; `/undo` takes back the last
@@ -125,6 +126,7 @@ lcode
125
126
  | `lcode -c` / `lcode --resume` | continue the last session here / pick a saved session from a list |
126
127
  | `lcode --model qwen3.5-9b --context 128k` | pick a model and context window for this session |
127
128
  | `lcode models` / `lcode doctor` | what fits this machine / check the installation |
129
+ | `lcode bench qwen3.6-35b qwen3.5-9b` | compare models on small coding tasks on this machine |
128
130
  | `/undo`, `/rewind` | take back the last request's file changes, or go back further |
129
131
  | `/rename`, `/resume` | name the current session, resume a saved one |
130
132
  | `/model`, `/context`, `/compact`, `/help` | switch model, resize the context window (pick from a list), summarize, list commands |
@@ -170,7 +172,6 @@ fills up. Details: [How it works](https://nasser1941.github.io/lcode/how-it-work
170
172
 
171
173
  See the pinned [Roadmap issue](https://github.com/nasser1941/lcode/issues/10). Next up:
172
174
 
173
- - [`lcode bench`: score models on your own hardware](https://github.com/nasser1941/lcode/issues/5)
174
175
  - [MCP tool servers](https://github.com/nasser1941/lcode/issues/6)
175
176
  - [Homebrew formula](https://github.com/nasser1941/lcode/issues/8) and an [optional sandbox for shell commands](https://github.com/nasser1941/lcode/issues/9)
176
177
  - More models in the catalog, and test reports from your hardware ([report one](https://github.com/nasser1941/lcode/issues/new?template=model_request.yml))
@@ -40,7 +40,8 @@ through [Ollama](https://ollama.com), and when it needs current information it c
40
40
  plans multi-step tasks with a visible todo list.
41
41
  - **Long context.** 256K tokens with the default model (1M with Nemotron). You choose the window.
42
42
  - **Hardware-aware.** Detects your NVIDIA GPU or Apple Silicon Mac and picks the best model and the
43
- largest context that fits: `lcode setup` does it in one step.
43
+ largest context that fits: `lcode setup` does it in one step. `lcode bench` compares models on
44
+ real coding tasks on your machine.
44
45
  - **Safe by default.** Every edit is shown as a diff and every command that isn't read-only needs
45
46
  your approval. `auto-edit` and `yolo` modes when you want speed.
46
47
  - **Undo.** lcode saves a checkpoint before the model changes files; `/undo` takes back the last
@@ -92,6 +93,7 @@ lcode
92
93
  | `lcode -c` / `lcode --resume` | continue the last session here / pick a saved session from a list |
93
94
  | `lcode --model qwen3.5-9b --context 128k` | pick a model and context window for this session |
94
95
  | `lcode models` / `lcode doctor` | what fits this machine / check the installation |
96
+ | `lcode bench qwen3.6-35b qwen3.5-9b` | compare models on small coding tasks on this machine |
95
97
  | `/undo`, `/rewind` | take back the last request's file changes, or go back further |
96
98
  | `/rename`, `/resume` | name the current session, resume a saved one |
97
99
  | `/model`, `/context`, `/compact`, `/help` | switch model, resize the context window (pick from a list), summarize, list commands |
@@ -137,7 +139,6 @@ fills up. Details: [How it works](https://nasser1941.github.io/lcode/how-it-work
137
139
 
138
140
  See the pinned [Roadmap issue](https://github.com/nasser1941/lcode/issues/10). Next up:
139
141
 
140
- - [`lcode bench`: score models on your own hardware](https://github.com/nasser1941/lcode/issues/5)
141
142
  - [MCP tool servers](https://github.com/nasser1941/lcode/issues/6)
142
143
  - [Homebrew formula](https://github.com/nasser1941/lcode/issues/8) and an [optional sandbox for shell commands](https://github.com/nasser1941/lcode/issues/9)
143
144
  - More models in the catalog, and test reports from your hardware ([report one](https://github.com/nasser1941/lcode/issues/new?template=model_request.yml))
@@ -0,0 +1,172 @@
1
+ # Benchmarking models
2
+
3
+ `lcode bench` answers the most common question about local models: *which one works best for
4
+ coding on my machine?* It runs a fixed set of small coding tasks against one or more models and
5
+ reports how many they solved, how fast they ran and how much memory they used.
6
+
7
+ ```bash
8
+ lcode bench # the configured model
9
+ lcode bench qwen3.6-35b qwen3.5-9b # compare models
10
+ lcode bench --tasks fix-bug,rename # run some of the tasks
11
+ lcode bench --json results.json # also save machine-readable results
12
+ lcode bench --markdown # also print a table to paste into a test report
13
+ ```
14
+
15
+ ```text
16
+ lcode bench · NVIDIA GeForce RTX 4080 Laptop GPU (12 GB VRAM), 31 GB RAM · Ollama 0.32.15
17
+
18
+ lcode-qwen3.6-35b · 32K context · reasoning on · 8 tasks
19
+ Loaded in 16s · 22.3 GB, 45% on the GPU · reads prompts at 855 tok/s
20
+ ✓ fix-bug Fix a bug so the tests pass 22s the tests pass
21
+ ✓ find-code Answer with file:line 9s next_wait at backoff.py:13
22
+ ✓ write-script Write a script from a spec 13s correct output, also on data it hadn't seen
23
+ ✓ rename Rename a function across files 26s its tests and extra checks pass
24
+ ✓ precise-edit One-line edit in a long file 10s changed only service_087's timeout
25
+ ✓ recover Recover from failing commands 30s used --source and dropped the invalid line
26
+ ✓ spec-fix Fix a function to match its spec 55s follows the whole docstring
27
+ ✓ feature Add a feature across files 71s priorities work, including old todos
28
+ ```
29
+
30
+ At the end it prints a table comparing the models (see [results](#results-on-a-12-gb-laptop) below).
31
+
32
+ A model usually takes 4 to 12 minutes; each task stops after 5 minutes (`--timeout`).
33
+
34
+ ## The tasks
35
+
36
+ Every task runs in a new temporary folder, with every permission granted (`yolo` mode) and web
37
+ access off, and ends with an automatic check. The folders are deleted afterwards unless you pass
38
+ `--keep`, which also keeps each task's transcript (`lcode-bench.log`).
39
+
40
+ | Task | The model has to | Passes when |
41
+ |---|---|---|
42
+ | `fix-bug` | Find and fix a bug so the failing unit tests pass | The tests pass and the test file is unchanged |
43
+ | `find-code` | Answer a question about a small codebase | It names the right function and cites its `file:line` |
44
+ | `write-script` | Write a script from a spec and run it | The script prints the right output, also for data it never saw |
45
+ | `rename` | Rename a function across several files and tests | The old name is gone and extra hidden tests pass |
46
+ | `precise-edit` | Change one value in a 900-line file of near-identical entries | Exactly that one line changed |
47
+ | `recover` | Run a command that fails twice (a removed option, a bad input line) and work around it | The report is correct and only the bad line was dropped |
48
+ | `spec-fix` | Fix a function from a one-line bug report so it does everything its docstring says | Hidden tests of every rule in the docstring pass, edge cases included |
49
+ | `feature` | Add priorities to a small todo app (a new option, sorting, a marker in the output) | Its tests pass, and a scripted session gives the exact expected output, including for todos saved before the change |
50
+
51
+ The first six tasks are everyday work that good models get right; the last two need careful
52
+ reading and are where smaller models tend to slip. The checks are deterministic and can't be passed
53
+ by hard-coding: for example, `write-script` reruns the script on new data, and `rename`, `spec-fix`
54
+ and `feature` are checked with tests the model never saw.
55
+
56
+ ## What's measured
57
+
58
+ | | |
59
+ |---|---|
60
+ | **Passed** | Tasks solved within the time limit |
61
+ | **Time** | Total time for the tasks (loading the model is reported separately) |
62
+ | **Generation** | Output tokens per second, across all the model's responses |
63
+ | **Prompt reading** | Prompt tokens per second: how fast the model reads files and tool output. Measured per model with fresh 4,000-token prompts (the faster of two readings, since the first one after loading includes warm-up), because during the tasks Ollama serves most of each request from its prompt cache |
64
+ | **Tool-call errors** | Tool calls that failed (wrong arguments, editing without reading first, unmatched edits) or that the model wrote as invalid JSON |
65
+ | **Memory** | The model's memory use and how much of it is on the GPU, from Ollama |
66
+
67
+ Results depend on the context window, so `lcode bench` uses **32K** by default on every machine,
68
+ which makes results comparable. When comparing models, each one is unloaded before the next starts
69
+ so every model gets the whole GPU; lcode warns if other models are already loaded. Use `--context 128k` to measure a larger window, and `--no-think`
70
+ to measure a model without reasoning.
71
+
72
+ ## Results on a 12 GB laptop
73
+
74
+ RTX 4080 Laptop GPU (12 GB) with 31 GB of RAM, Ollama 0.32.15, 32K context, reasoning on:
75
+
76
+ | | `qwen3.6-35b` | `qwen3.5-9b` | `qwen3.5-4b` |
77
+ |---|---|---|---|
78
+ | fix-bug | ✓ 22s | ✓ 16s | ✓ 11s |
79
+ | find-code | ✓ 9s | ✓ 6s | ✓ 5s |
80
+ | write-script | ✓ 13s | ✓ 44s | ✗ 18s |
81
+ | rename | ✓ 26s | ✓ 28s | ✓ 30s |
82
+ | precise-edit | ✓ 10s | ✓ 12s | ✓ 8s |
83
+ | recover | ✓ 30s | ✗ 29s | ✓ 24s |
84
+ | spec-fix | ✓ 55s | ✓ 4m 40s | ✗ 2m 57s |
85
+ | feature | ✓ 1m 11s | ✗ 5m 00s | ✓ 47s |
86
+ | **Passed** | **8/8** | **6/8** | **6/8** |
87
+ | Time | 3m 57s | 11m 55s | 5m 20s |
88
+ | Generation | 71.4 tok/s | 60.1 tok/s | 91.3 tok/s |
89
+ | Prompt reading | 855 tok/s | 3,507 tok/s | 5,186 tok/s |
90
+ | Tool-call errors | 0 | 9 | 1 |
91
+ | Memory | 22.3 GB, 45% on GPU | 6.6 GB, 100% on GPU | 4.2 GB, 100% on GPU |
92
+
93
+ The small models fit entirely on the GPU and read prompts much faster, but the larger mixture-of-
94
+ experts model solves more and needs fewer attempts. The small models' failures were real mistakes:
95
+ copying `read_file`'s line numbers into a data file, ignoring negative numbers, missing an edge case
96
+ of the spec, and running out of time.
97
+
98
+ Models sample their answers, so a task near the edge of a model's ability can pass in one run and
99
+ fail in the next (`qwen3.6-35b` scored 7/8 in an earlier run). Compare totals rather than single
100
+ tasks, and run twice before drawing conclusions.
101
+
102
+ ## Sharing results
103
+
104
+ Results from other machines, especially Apple Silicon Macs and other GPUs, decide which models lcode
105
+ recommends. Run
106
+
107
+ ```bash
108
+ lcode bench qwen3.6-35b --markdown
109
+ ```
110
+
111
+ and paste the table into a
112
+ [model test report](https://github.com/nasser1941/lcode/issues/new?template=model_request.yml).
113
+
114
+ ## JSON format
115
+
116
+ `--json FILE` writes one document per run. The schema is versioned: fields may be added, but
117
+ existing fields keep their meaning until `schema` changes.
118
+
119
+ ```json
120
+ {
121
+ "schema": 1,
122
+ "lcode": "0.3.1",
123
+ "ollama": "0.32.15",
124
+ "date": "2026-09-30T19:09:09+02:00",
125
+ "hardware": {
126
+ "os": "linux", "cpu": "13th Gen Intel(R) Core(TM) i9-13980HX", "ram_gib": 30.96,
127
+ "gpu": "NVIDIA GeForce RTX 4080 Laptop GPU", "vram_gib": 11.99, "unified": false,
128
+ "description": "NVIDIA GeForce RTX 4080 Laptop GPU (12 GB VRAM), 31 GB RAM"
129
+ },
130
+ "tasks": [{"id": "fix-bug", "title": "Fix a bug so the tests pass"}, …],
131
+ "runs": [
132
+ {
133
+ "model": "qwen3.6-35b",
134
+ "ollama_model": "lcode-qwen3.6-35b",
135
+ "context": 32768,
136
+ "num_batch": null,
137
+ "think": true,
138
+ "load_seconds": 16.2,
139
+ "prompt_tps": 854.6,
140
+ "memory_gb": 22.3,
141
+ "gpu_percent": 45,
142
+ "passed": 8,
143
+ "total": 8,
144
+ "seconds": 237.3,
145
+ "generation_tps": 71.4,
146
+ "tool_errors": 0,
147
+ "usage": {"requests": 56, "prompt_tokens": 221522, "prompt_ns": 73377987000,
148
+ "output_tokens": 11490, "output_ns": 161017657999},
149
+ "tasks": [
150
+ {"id": "fix-bug", "passed": true, "seconds": 21.9, "detail": "the tests pass",
151
+ "steps": 5, "tool_errors": 0, "error": null},
152
+ …
153
+ ],
154
+ "error": null,
155
+ "interrupted": false
156
+ }
157
+ ]
158
+ }
159
+ ```
160
+
161
+ | Field | Meaning |
162
+ |---|---|
163
+ | `runs[].model` | The name you gave (catalog key or Ollama tag); `ollama_model` is the model that ran |
164
+ | `runs[].context`, `num_batch`, `think` | The settings used. lcode lowers the batch size or context if the GPU runs out of memory, and reports what it ended up using |
165
+ | `runs[].memory_gb`, `gpu_percent` | From Ollama's `/api/ps`; `null` if unavailable |
166
+ | `runs[].generation_tps` | Output tokens per second across the tasks; `null` if Ollama reported no timings |
167
+ | `runs[].prompt_tps` | Prompt tokens per second for a fresh 4,000-token prompt (the faster of two readings); `null` if it couldn't be measured |
168
+ | `runs[].usage` | Totals over the tasks as Ollama reports them. `prompt_tokens` includes tokens served from the prompt cache |
169
+ | `runs[].tasks[].steps` | Model responses in the task |
170
+ | `runs[].tasks[].error` | Why the task stopped early (`timed out after 300s`, an Ollama error), otherwise `null` |
171
+ | `runs[].error` | Why the model didn't run at all (for example, not installed), otherwise `null` |
172
+ | `runs[].interrupted` | You pressed ++ctrl+c++; the results cover the tasks that finished |
@@ -75,6 +75,7 @@ the Ollama server you configure, it only contacts the web when the model searche
75
75
  | `agent.py` | System prompt, streaming, tool loop, compaction, sessions |
76
76
  | `tools.py` | Tool schemas and implementations |
77
77
  | `permissions.py` | Approval prompts and the read-only allowlist |
78
+ | `bench.py` | `lcode bench`: the benchmark tasks, their checks and the reports |
78
79
  | `checkpoints.py` | Snapshots before the model changes files, for `/undo` and `/rewind` |
79
80
  | `catalog.py`, `models.toml` | Model catalog and memory estimates |
80
81
  | `hardware.py` | NVIDIA / Apple Silicon detection |
@@ -17,8 +17,8 @@ size, and it works with any other Ollama model that supports tool calling.
17
17
  | `qwen3.5-4b` | Qwen3.5 4B | dense | 3.4 GB | 256K | tested |
18
18
 
19
19
  *Tested* means the model passed lcode's two acceptance tasks end to end (see
20
- [test results](#test-results)). Results on other hardware are very welcome: please
21
- [report how a model does](https://github.com/nasser1941/lcode/issues/new?template=model_request.yml).
20
+ [test results](#test-results)). Results on other hardware are very welcome: run
21
+ [`lcode bench`](bench.md) and [report how a model does](https://github.com/nasser1941/lcode/issues/new?template=model_request.yml).
22
22
 
23
23
  Run `lcode models` to see the same list with what fits on **your** machine:
24
24
 
@@ -12,7 +12,7 @@ lcode
12
12
 
13
13
  ```text
14
14
  ╭──────────────────────────────────────────────╮
15
- │ lcode v0.3.0 — local coding agent │
15
+ │ lcode v0.3.1 — local coding agent │
16
16
  │ │
17
17
  │ model lcode-qwen3.6-35b │
18
18
  │ context 256K tokens │
@@ -8,6 +8,7 @@ lcode setup [model] # pick, download and configure a model
8
8
  lcode models # the model catalog and what fits this machine
9
9
  lcode doctor # check the installation (include this in bug reports)
10
10
  lcode config [set|unset] # show or change settings
11
+ lcode bench [models] # score models on small coding tasks on this machine
11
12
  ```
12
13
 
13
14
  | Option | Meaning |
@@ -93,6 +93,7 @@ nav:
93
93
  - Guide:
94
94
  - Using lcode: usage.md
95
95
  - Models & context windows: models.md
96
+ - Benchmarking models: bench.md
96
97
  - Configuration: configuration.md
97
98
  - Reference:
98
99
  - How it works: how-it-works.md
@@ -1,3 +1,3 @@
1
1
  """lcode — a local-first terminal coding agent powered by open-weight models via Ollama."""
2
2
 
3
- __version__ = "0.3.0"
3
+ __version__ = "0.3.1"
@@ -154,6 +154,7 @@ class Agent:
154
154
  self.session_title = ""
155
155
  self.ctx_used = 0
156
156
  self.last_speed = 0.0
157
+ self.usage = {"requests": 0, "prompt_tokens": 0, "prompt_ns": 0, "output_tokens": 0, "output_ns": 0}
157
158
  self.messages: list[dict] = []
158
159
  self.reset()
159
160
 
@@ -390,6 +391,11 @@ class Agent:
390
391
  message["tool_calls"] = tool_calls
391
392
  self.messages.append(message)
392
393
  if final:
394
+ self.usage["requests"] += 1
395
+ self.usage["prompt_tokens"] += final.get("prompt_eval_count", 0)
396
+ self.usage["prompt_ns"] += final.get("prompt_eval_duration", 0)
397
+ self.usage["output_tokens"] += final.get("eval_count", 0)
398
+ self.usage["output_ns"] += final.get("eval_duration", 0)
393
399
  self.ctx_used = final.get("prompt_eval_count", 0) + final.get("eval_count", 0)
394
400
  seconds = final.get("eval_duration", 0) / 1e9
395
401
  self.last_speed = final.get("eval_count", 0) / seconds if seconds else 0.0