@octocodeai/freellama-mcp-server 0.1.0 → 0.5.0
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.
- package/LICENSE-APACHE +202 -0
- package/LICENSE-MIT +18 -0
- package/README.md +203 -33
- package/adapters/agent_context.py +216 -29
- package/adapters/agent_transport.py +131 -0
- package/adapters/bash_agent.py +67 -92
- package/adapters/octocode_agent.py +63 -53
- package/adapters/shell_sandbox.py +487 -0
- package/assets/logo.jpg +0 -0
- package/dist/index.js +1287 -412
- package/docs/ARCHITECTURE.md +169 -26
- package/docs/CLI.md +107 -17
- package/docs/CPU_GPU_ROUTING.md +65 -20
- package/docs/ECONOMICS.md +20 -15
- package/docs/INDEX.md +8 -2
- package/docs/MODEL_METADATA.md +106 -0
- package/docs/MODEL_SELECTION.md +15 -2
- package/docs/MONITORING.md +285 -0
- package/docs/OLLAMA_SIDECAR.md +8 -6
- package/docs/PRODUCTION.md +49 -18
- package/docs/PRODUCT_POSITIONING.md +86 -256
- package/docs/README.md +40 -0
- package/docs/SCOPES_AND_WARMING.md +226 -0
- package/docs/TESTING.md +118 -1
- package/docs/dev/FINDINGS_AND_POSITIONING.md +290 -0
- package/docs/dev/LOCAL_PERFORMANCE_TESTING.md +298 -0
- package/docs/{OLLAMA_SYSTEM_OPTIMIZATION.md → dev/OLLAMA_SYSTEM_OPTIMIZATION.md} +19 -18
- package/native/index.d.ts +31 -0
- package/package.json +13 -10
- /package/docs/{ADR_RESOURCE_AWARE_BACKEND_ROUTING.md → dev/ADR_RESOURCE_AWARE_BACKEND_ROUTING.md} +0 -0
package/docs/CPU_GPU_ROUTING.md
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
# Run models on CPU and GPU
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
To separate GPU work from CPU helpers, configure two Ollama processes and assign exact helper-model
|
|
4
|
+
tags to the secondary process. FreeLlama routes managed tasks within those assignments, applies
|
|
5
|
+
`num_gpu: 0` to CPU requests, and reports both the selected backend and observed processor placement.
|
|
6
|
+
|
|
7
|
+
The calling agent submits tasks and placement preferences. FreeLlama coordinates admission,
|
|
8
|
+
memory checks, and model transitions for each backend; the operator configures the processes and
|
|
9
|
+
eligible tags. A configured CPU backend is intent: inspect the placement observation before
|
|
10
|
+
treating it as proof of CPU execution.
|
|
6
11
|
|
|
7
12
|
This configuration is useful for embeddings, intent interpretation, and other small helper models.
|
|
8
13
|
Benchmark large CPU workloads before adopting them. Apple silicon shares memory bandwidth; systems
|
|
@@ -110,7 +115,10 @@ unsafe or ambiguous configurations:
|
|
|
110
115
|
- A CPU model assignment without `--cpu-upstream`
|
|
111
116
|
- Empty model names
|
|
112
117
|
- The same socket expressed through aliases such as `localhost:11434` and `127.0.0.1:11434`
|
|
113
|
-
- A
|
|
118
|
+
- A nonloopback upstream
|
|
119
|
+
|
|
120
|
+
A nonloopback FreeLlama listener requires `--allow-remote` and bearer-token authentication.
|
|
121
|
+
See the [production runbook](PRODUCTION.md) for remote ingress requirements.
|
|
114
122
|
|
|
115
123
|
Set independent admission budgets when the defaults do not fit the workload:
|
|
116
124
|
|
|
@@ -120,13 +128,18 @@ Set independent admission budgets when the defaults do not fit the workload:
|
|
|
120
128
|
--cpu-upstream http://127.0.0.1:11436 \
|
|
121
129
|
--cpu-model nomic-embed-text:latest \
|
|
122
130
|
--max-concurrent-tasks 2 \
|
|
123
|
-
--cpu-max-concurrent-tasks 1
|
|
131
|
+
--cpu-max-concurrent-tasks 1 \
|
|
132
|
+
--max-queued-tasks 16 \
|
|
133
|
+
--cpu-max-queued-tasks 8
|
|
124
134
|
```
|
|
125
135
|
|
|
126
136
|
The defaults above admit one ordinary primary-backend chat (cost 2) and one CPU embedding (cost 1)
|
|
127
137
|
at the same time. They are conservative workload units for the common `OLLAMA_NUM_PARALLEL=1`
|
|
128
138
|
layout, not a profile of the development Mac. Increase them only after measuring queue wait,
|
|
129
139
|
resident memory, and Ollama's own parallel setting on the target host.
|
|
140
|
+
Queue cardinality and wait time are separate bounds: excess waiters are refused immediately, while
|
|
141
|
+
an admitted waiter may remain until `--max-queue-wait-seconds`. Automatic backend selection checks
|
|
142
|
+
that the actual task cost fits the current slot snapshot before following historical speed.
|
|
130
143
|
|
|
131
144
|
## Let an agent express placement intent
|
|
132
145
|
|
|
@@ -194,12 +207,14 @@ The `execution` object separates the configured `backend`, requested compatibili
|
|
|
194
207
|
post-run `observation`. The source is Ollama `/api/ps`; direct inspection remains useful:
|
|
195
208
|
|
|
196
209
|
```bash
|
|
197
|
-
curl --silent http://127.0.0.1:11434/api/ps | jq '.models[] | {name, size_vram}'
|
|
198
|
-
curl --silent http://127.0.0.1:11436/api/ps | jq '.models[] | {name, size_vram}'
|
|
210
|
+
curl --silent http://127.0.0.1:11434/api/ps | jq '.models[] | {name, size, size_vram}'
|
|
211
|
+
curl --silent http://127.0.0.1:11436/api/ps | jq '.models[] | {name, size, size_vram}'
|
|
199
212
|
```
|
|
200
213
|
|
|
201
|
-
A fully CPU-loaded model reports `size_vram:0`; a fully GPU-loaded model reports positive
|
|
202
|
-
|
|
214
|
+
A fully CPU-loaded model reports `size_vram:0`; a fully GPU-loaded model reports positive VRAM
|
|
215
|
+
covering its resident `size`. Compare both values from the same `/api/ps` entry. Installed `/api/tags`
|
|
216
|
+
file bytes can differ from resident memory and cannot prove a mixed placement. Positive VRAM without
|
|
217
|
+
total resident size stays unknown. `observation.status` is `verified`, `mismatch`, or unavailable. Unknown, mixed, and mismatched
|
|
203
218
|
samples are reported but excluded from adaptive feedback.
|
|
204
219
|
|
|
205
220
|
## Understand concurrency
|
|
@@ -208,10 +223,16 @@ Each backend has its own weighted admission pool and its own resident/shared and
|
|
|
208
223
|
transition/exclusive lock. CPU and GPU model transitions therefore do not block each other, and a
|
|
209
224
|
GPU burst cannot spend the CPU helper's permit:
|
|
210
225
|
|
|
226
|
+
Both pools also share local host-pressure sampling and forecast-memory reservations. Independent
|
|
227
|
+
queues do not imply independent RAM on a unified-memory machine. A request can wait for available
|
|
228
|
+
headroom even when its backend has a free weighted permit. Inspect `admission.resources` in health
|
|
229
|
+
and `execution.resource_admission` in task receipts. Unknown thermal or GPU measurements are not
|
|
230
|
+
reported as healthy readings. See [the execution architecture](ARCHITECTURE.md) for the complete gate.
|
|
231
|
+
|
|
211
232
|
```mermaid
|
|
212
233
|
flowchart TD
|
|
213
234
|
T["Managed task"] --> B{"Selected backend"}
|
|
214
|
-
B -->|"GPU"| GA["GPU admission pool<br/>default 2 units"]
|
|
235
|
+
B -->|"GPU"| GA["GPU admission pool<br/>default 2 units per Ollama slot"]
|
|
215
236
|
B -->|"CPU"| CA["CPU admission pool<br/>default 1 unit"]
|
|
216
237
|
GA --> GL{"Resident?"}
|
|
217
238
|
CA --> CL{"Resident?"}
|
|
@@ -229,16 +250,28 @@ FreeLlama can overlap requests across the two servers even when each Ollama proc
|
|
|
229
250
|
`OLLAMA_NUM_PARALLEL=1`. Raising `OLLAMA_NUM_PARALLEL` affects parallel requests within one server
|
|
230
251
|
and multiplies K/V-cache memory; it is a separate tuning decision. `OLLAMA_MAX_QUEUE` likewise
|
|
231
252
|
bounds each Ollama process after FreeLlama admission. It does not replace either backend's weighted
|
|
232
|
-
FreeLlama budget or queue-wait deadline.
|
|
253
|
+
FreeLlama budget, bounded waiter count, or queue-wait deadline. Raw passthrough uses a separate
|
|
254
|
+
one-stream default cap in `serve`; its permit is held until the streamed response ends or is dropped.
|
|
255
|
+
|
|
256
|
+
The runtime file's `[task_costs]` table can tune individual task-kind weights without increasing
|
|
257
|
+
the entire pool's ceiling. Default vision weight four can serialize two vision requests under a
|
|
258
|
+
four-unit budget even when Ollama has two slots. A lower weight requires a qualified workload;
|
|
259
|
+
it does not add engine slots or relax memory checks. See
|
|
260
|
+
[monitoring controls](MONITORING.md#adaptive-concurrency).
|
|
261
|
+
Mutating raw requests also require exclusive access to the primary backend's managed transition
|
|
262
|
+
lock and receive 503 while it is busy. Metadata GET/HEAD calls remain available. This prevents raw
|
|
263
|
+
inference or model lifecycle calls from overlapping a managed generation on that backend.
|
|
233
264
|
|
|
234
265
|
## Understand automatic feedback
|
|
235
266
|
|
|
236
267
|
With `executionPreference: "auto"`, unpinned `fastest` and `balanced` work can select a backend from
|
|
237
|
-
observed warm task duration.
|
|
268
|
+
comparable observed warm task duration. Learned hints require two eligible backends, explicit
|
|
269
|
+
context, and a known execution payload-control projection. A decision-only preview cannot supply
|
|
270
|
+
that payload projection and uses capacity and policy signals. The loop is bounded:
|
|
238
271
|
|
|
239
272
|
```mermaid
|
|
240
273
|
flowchart LR
|
|
241
|
-
X["
|
|
274
|
+
X["Comparable warm serial task"] --> O["Record duration by<br/>task + backend + profile"]
|
|
242
275
|
O --> N{"At least 3 samples<br/>on both backends?"}
|
|
243
276
|
N -->|"No"| D["Keep deterministic default"]
|
|
244
277
|
N -->|"Yes"| C{"More than 10% faster<br/>per work unit?"}
|
|
@@ -248,13 +281,25 @@ flowchart LR
|
|
|
248
281
|
```
|
|
249
282
|
|
|
250
283
|
Generation compares decode nanoseconds per output token; embeddings compare total nanoseconds per
|
|
251
|
-
input token.
|
|
252
|
-
|
|
284
|
+
input token. Each task/backend has one current profile window, reset when identity changes.
|
|
285
|
+
Identity includes installed/resident digest, rate metric kind, explicit observed context, effective controls,
|
|
286
|
+
endpoint-attributed process settings, and serial admission class. Unknown or changed evidence,
|
|
287
|
+
cold transitions, and overlapping managed work supply no speed sample. A difference
|
|
253
288
|
of 10% or less is treated as noise. Feedback never overrides an explicit model, session affinity,
|
|
254
289
|
capability or policy guards, or the `quality` objective. The CLI persists the bounded, versioned,
|
|
255
|
-
prompt-free
|
|
256
|
-
|
|
257
|
-
|
|
290
|
+
prompt-free snapshot atomically by default; `--ephemeral-feedback` opts into reset-on-restart
|
|
291
|
+
behavior. Legacy aggregate fields survive loading but do not qualify learned hints. Health's
|
|
292
|
+
`decision_ready` describes the stored profile window; the current request must independently
|
|
293
|
+
match it before routing can use its speed. `GET /_freellama/v1/health` exposes profile identity,
|
|
294
|
+
profile sample counts, persistence status, and per-backend admission capacity. Physically verified
|
|
295
|
+
warm completions still contribute legacy duration diagnostics even when their interval cannot
|
|
296
|
+
qualify a speed-learning sample.
|
|
297
|
+
|
|
298
|
+
Configured processor intent, verified placement, and speed-learning eligibility remain separate
|
|
299
|
+
receipt fields. Missing endpoint-attributed process inspection disables learned hints and recovery,
|
|
300
|
+
including remote backends; ordinary routing, admission, and pressure/error safeguards still work.
|
|
301
|
+
Fresh process probes run for candidate serial learning or an eligible learned-route lookup, not
|
|
302
|
+
for pinned, quality-only, preview-only, or single-backend route selection.
|
|
258
303
|
|
|
259
304
|
## Interpret the measured Mac result
|
|
260
305
|
|
|
@@ -318,7 +363,7 @@ Benchmark these assignments before adopting them:
|
|
|
318
363
|
|
|
319
364
|
The local measurement receipt is written to
|
|
320
365
|
`.octocode/evals/cpu-gpu-concurrency-benchmark.md`. Git intentionally ignores that path, so the
|
|
321
|
-
trial table in "Interpret the measured result" carries the durable result while the local artifact
|
|
366
|
+
trial table in ["Interpret the measured Mac result"](#interpret-the-measured-mac-result) carries the durable result while the local artifact
|
|
322
367
|
retains the full run detail.
|
|
323
368
|
|
|
324
369
|
## Troubleshoot the secondary backend
|
|
@@ -337,7 +382,7 @@ can also be unavailable until the secondary server returns. Raw passthrough to t
|
|
|
337
382
|
continues to work because it does not depend on catalog discovery.
|
|
338
383
|
|
|
339
384
|
For the surrounding runtime settings, see
|
|
340
|
-
[Ollama and FreeLlama optimization](OLLAMA_SYSTEM_OPTIMIZATION.md). For all `serve` flags, see the
|
|
385
|
+
[Ollama and FreeLlama optimization](dev/OLLAMA_SYSTEM_OPTIMIZATION.md). For all `serve` flags, see the
|
|
341
386
|
[CLI reference](CLI.md).
|
|
342
387
|
|
|
343
388
|
## Upstream sources
|
package/docs/ECONOMICS.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# Token economics
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Offloading can keep source material and intermediate tool output out of the calling agent's
|
|
4
|
+
context. FreeLlama returns compact results while the local model performs the work. This shifts
|
|
5
|
+
computation to local hardware; it does not eliminate model tokens, power use, or waiting time.
|
|
6
|
+
|
|
7
|
+
The per-call rows come from one machine (M4 Pro, 48 GB unified memory). Values marked with `~`
|
|
8
|
+
and the session projection are estimates derived from those calls.
|
|
6
9
|
|
|
7
10
|
## Per-call, measured
|
|
8
11
|
|
|
@@ -13,13 +16,13 @@ session projection are estimates derived from those calls.
|
|
|
13
16
|
| 1 image, OCR, byte-exact | 1,970 | 37 | **98.1%** |
|
|
14
17
|
| Historical tool-schema surface, per turn | <3.2k | 0 | **100%** |
|
|
15
18
|
|
|
16
|
-
##
|
|
19
|
+
## MCP-envelope audit (2026-09-03)
|
|
17
20
|
|
|
18
|
-
The earlier table describes a historical workload on an M4 Pro. This audit
|
|
19
|
-
eight-tool MCP build on
|
|
21
|
+
The earlier table describes a historical workload on an M4 Pro. This dated audit measured the
|
|
22
|
+
eight-tool MCP build available on September 3, 2026. JSON tokenization varies by client and model, so it records
|
|
20
23
|
bytes first and gives `characters / 4` only as a deliberately rough token estimate.
|
|
21
24
|
|
|
22
|
-
|
|
|
25
|
+
| Audited result | Canonical structured chars | Compact text chars | Duplicate chars avoided | Rough duplicate-token estimate |
|
|
23
26
|
|---|---:|---:|---:|---:|
|
|
24
27
|
| `doctor {view:"summary"}` | 3,099 | 35 | 3,064 | ~766 |
|
|
25
28
|
| `doctor {view:"scheduler"}` | 3,933 | 35 | 3,898 | ~975 |
|
|
@@ -32,9 +35,11 @@ that FreeLlama does not emit. An MCP host that feeds both `structuredContent` an
|
|
|
32
35
|
can avoid roughly the listed amount; a host that already keeps only one representation does not.
|
|
33
36
|
The canonical structured payload still exists for deterministic clients that need it.
|
|
34
37
|
|
|
35
|
-
The
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
The integration suite bounds the complete tool schema and initialization instructions using
|
|
39
|
+
the same rough token conversion. Read the
|
|
40
|
+
[protocol context-budget contract](../packages/mcp/test/integration/protocol.test.ts) for the
|
|
41
|
+
enforced ceiling.
|
|
42
|
+
This is tool-schema **rent**, not a saving: clients pay it whenever they expose
|
|
38
43
|
the entire tool list to a model. Read the bundled documentation resource on demand and do not expose
|
|
39
44
|
unneeded tools in a client that supports tool filtering.
|
|
40
45
|
|
|
@@ -64,11 +69,11 @@ because prompt caching makes cached input far cheaper,
|
|
|
64
69
|
and because the rent only accrues at all if a *separate* small model holds the tool schemas. The
|
|
65
70
|
first two rows are the uncontestable part: that data physically never reaches the orchestrator.
|
|
66
71
|
|
|
67
|
-
**Do not lead with this number.** Providers, caching strategies, context windows, and pricing
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
**Do not lead with this number.** Providers, caching strategies, context windows, and pricing
|
|
73
|
+
change. The durable benefit is context isolation: delegated research returns an answer and
|
|
74
|
+
citations in place of its full local transcript, and embedding responses omit vectors by default.
|
|
75
|
+
Caller-requested output and exposed tool schemas still enter the client's context. Measure that
|
|
76
|
+
client's actual transcript before claiming a token or billing reduction.
|
|
72
77
|
|
|
73
78
|
## The cost side
|
|
74
79
|
|
package/docs/INDEX.md
CHANGED
|
@@ -2,14 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Read only the document relevant to the current operation. Repository `docs/` is the source of truth.
|
|
4
4
|
|
|
5
|
-
- [ADR: Resource-aware backend routing](ADR_RESOURCE_AWARE_BACKEND_ROUTING.md)
|
|
6
5
|
- [FreeLlama architecture](ARCHITECTURE.md)
|
|
7
6
|
- [CLI reference](CLI.md)
|
|
8
7
|
- [Run models on CPU and GPU](CPU_GPU_ROUTING.md)
|
|
9
8
|
- [Token economics](ECONOMICS.md)
|
|
9
|
+
- [Ollama model metadata](MODEL_METADATA.md)
|
|
10
10
|
- [Choose local models](MODEL_SELECTION.md)
|
|
11
|
+
- [Runtime status and live tuning](MONITORING.md)
|
|
11
12
|
- [Ollama sidecar boundary](OLLAMA_SIDECAR.md)
|
|
12
|
-
- [Ollama and FreeLlama optimization boundary](OLLAMA_SYSTEM_OPTIMIZATION.md)
|
|
13
13
|
- [Prepare FreeLlama for production](PRODUCTION.md)
|
|
14
14
|
- [Product positioning](PRODUCT_POSITIONING.md)
|
|
15
|
+
- [FreeLlama documentation](README.md)
|
|
16
|
+
- [Scope history and model warming](SCOPES_AND_WARMING.md)
|
|
15
17
|
- [Test FreeLlama](TESTING.md)
|
|
18
|
+
- [ADR: Resource-aware backend routing](dev/ADR_RESOURCE_AWARE_BACKEND_ROUTING.md)
|
|
19
|
+
- [FreeLlama findings and open-source comparison](dev/FINDINGS_AND_POSITIONING.md)
|
|
20
|
+
- [Test throughput, CPU/GPU activity, and thermal behavior on macOS](dev/LOCAL_PERFORMANCE_TESTING.md)
|
|
21
|
+
- [Ollama and FreeLlama optimization boundary](dev/OLLAMA_SYSTEM_OPTIMIZATION.md)
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Ollama model metadata
|
|
2
|
+
|
|
3
|
+
The MCP `models` tool gives an agent the inventory and capability metadata it needs before
|
|
4
|
+
offloading work. It reads your Ollama instance and can enrich results with descriptions from
|
|
5
|
+
Ollama's public model library. Supported features and advertised use cases are metadata;
|
|
6
|
+
exact-model benchmarks and policy supply quality evidence. Public descriptions do not change
|
|
7
|
+
routing confidence, and a successful response still needs task-specific verification.
|
|
8
|
+
|
|
9
|
+
## Requests
|
|
10
|
+
|
|
11
|
+
| Request | Result | External access |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `models {view:"installed"}` | Managed inventory with a `knowledge` object for each model | Local backend data only |
|
|
14
|
+
| `models {view:"installed", includeLibrary:true}` | Inventory enriched with public guidance for verified local tags | Fetches model family and tag pages from ollama.com |
|
|
15
|
+
| `models {view:"detail", model:"gemma3:1b"}` | Ollama details, maximum context, and supported-use explanations | Selected Ollama endpoint only |
|
|
16
|
+
| `models {view:"detail", model:"gemma3:1b", includeLibrary:true}` | Details plus public guidance after a tag and digest check | Selected Ollama endpoint and ollama.com |
|
|
17
|
+
| `models {view:"library", query:"coding"}` | Public family search with descriptions and advertised feature chips | ollama.com and optional local inventory/profile reads |
|
|
18
|
+
| `models {view:"library", model:"gemma3"}` | All public tags with size, digest prefix, context, modalities, and cloud status | ollama.com and optional local inventory/profile reads |
|
|
19
|
+
|
|
20
|
+
These are MCP tool requests. The CLI's `models` command reports the core catalog and does not expose these enrichment flags. For CLI setup and routing, see the [CLI reference](CLI.md).
|
|
21
|
+
|
|
22
|
+
| Option | Valid views | Default | Meaning |
|
|
23
|
+
|---|---|---|---|
|
|
24
|
+
| `includeLibrary` | `installed`, `detail` | `false` | Requests public metadata; the default makes no website calls |
|
|
25
|
+
| `includeReadme` | Library step 2, or `detail` with `includeLibrary:true` | `false` | Returns README text, capped at 65,536 characters, with its format and truncation flag |
|
|
26
|
+
| `includeVerbose` | `detail` | `false` | Returns Ollama's license and Modelfile fields independently of README enrichment |
|
|
27
|
+
| `limit`, `cursor` | `raw`, library tag listings; `limit` also applies to library search | Tag/raw page size 20; search limit 10 | Pages large lists; the tag cursor rejects a changed tag list |
|
|
28
|
+
| `ollamaEndpoint` | Direct Ollama views and library inventory reads | Configured Ollama endpoint | Chooses the Ollama instance; enriched managed inventory uses each model's assigned backend |
|
|
29
|
+
|
|
30
|
+
An incompatible option returns an error before any lookup. Installed enrichment omits full READMEs to keep inventory responses bounded; request one model's detail to read its README.
|
|
31
|
+
|
|
32
|
+
## Supported features
|
|
33
|
+
|
|
34
|
+
`knowledge.supportedFeatures` preserves the feature strings available from the selected source. `supportedFeaturesSource` is `ollama_api` for direct Ollama metadata and `freellama_catalog` for the managed catalog. The catalog contains normalized routing capabilities; unknown future strings remain visible in `detail`, `raw`, or enriched installed inventory when Ollama's tag response supplies them. Unknown strings do not create new routing requirements.
|
|
35
|
+
|
|
36
|
+
`knowledge.supportedUseCases` explains each recognized feature:
|
|
37
|
+
|
|
38
|
+
| Feature | Supported workflow | What to evaluate separately |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| `completion` | Text generation | Coding, summarization, reasoning, and instruction-following accuracy |
|
|
41
|
+
| `tools` | Tool calls | Argument correctness, tool selection, and agent-loop reliability |
|
|
42
|
+
| `vision` | Image input | OCR and visual understanding accuracy |
|
|
43
|
+
| `audio` | Audio workflows advertised by the model | Supported audio task and accuracy |
|
|
44
|
+
| `embedding` | Retrieval and similarity vectors | Retrieval quality on your documents |
|
|
45
|
+
| `thinking` | A thinking mode | Reasoning accuracy, latency, and token cost |
|
|
46
|
+
| `insert` | Suffix-based text insertion | Completion accuracy in the target code or text |
|
|
47
|
+
| `image` | Image generation | Output quality and supported controls |
|
|
48
|
+
|
|
49
|
+
Each explanation contains its `capability`, `use`, `reason`, and `basis:"supported_feature"`. Ollama runtime/version support still applies. The inventory's existing benchmark and policy fields remain separate from `knowledge.quality:"metadata_only"`.
|
|
50
|
+
|
|
51
|
+
## Public guidance and provenance
|
|
52
|
+
|
|
53
|
+
For a verified installed model, `knowledge.library` contains the source page, full tag-page URL, `fetchedAt`, `expiresAt`, `cached`, and exact public tag metadata. It also contains:
|
|
54
|
+
|
|
55
|
+
| Field | Meaning |
|
|
56
|
+
|---|---|
|
|
57
|
+
| `description` | The public family description |
|
|
58
|
+
| `advertisedFamilyCapabilities` | Family feature chips; these do not extend the local tag's capabilities |
|
|
59
|
+
| `advertisedUseCases` | Recognized coding, tool-calling, image-understanding/OCR, reasoning, embedding, summarization, question-answering, translation, and long-context claims |
|
|
60
|
+
| `advertisedUseCases[].evidence` | A bounded source excerpt, source URL, and fetch timestamp |
|
|
61
|
+
| `usageNotes` | Bounded excerpts about requirements, restrictions, context, memory, languages, or query prefixes |
|
|
62
|
+
| `readmeAvailable` | Whether a README was extracted |
|
|
63
|
+
| `readme` | Requested text with `format` (`markdown` or `text`) and `truncated` |
|
|
64
|
+
|
|
65
|
+
Advertised uses have `basis:"advertised"`, `scope:"family"`, and `quality:"unmeasured"`. Extraction recognizes positive prose mentions and skips fenced code and explicit negative statements. It is a discovery aid, not a complete classification: an omitted use means extraction found no recognized claim. Usage notes also remain family-scoped and can describe other variants. Read the source for the full instructions. These use labels are not the `run_task` task enum; choose a supported routing profile with the capabilities and context your workload requires.
|
|
66
|
+
|
|
67
|
+
Local capabilities filter advertised uses. For example, `gemma3:1b` accepts text, while larger Gemma 3 variants accept images. A family-level vision chip cannot make the 1B tag a vision candidate. Likewise, an embedding-only tag does not acquire text-generation workflows from its family description.
|
|
68
|
+
|
|
69
|
+
Installed enrichment requires the exact public tag and a matching digest prefix of at least 12 hexadecimal characters against the local 64-character digest. Custom names are never mapped by architecture or guessed base model. Community names use their exact Ollama namespace. Without a verified match, public guidance is withheld. A local modification can therefore prevent enrichment even when its name resembles a public model.
|
|
70
|
+
|
|
71
|
+
Library step 2 describes public models before installation, so its top-level `library` guidance remains family-scoped without claiming a local digest match. Each `tags[]` entry carries its own modalities, context, digest prefix, and `cloud` flag. Search returns `cloudAvailable` for the hosted-access badge and `cloudOnly:null`: a family badge alone does not establish that local downloads are absent.
|
|
72
|
+
|
|
73
|
+
## Lookup states
|
|
74
|
+
|
|
75
|
+
| `library.status` | Meaning | Next action |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| `not_requested` | Website enrichment was not requested | Set `includeLibrary:true` if external lookup is useful |
|
|
78
|
+
| `matched` | Installed tag and public digest prefix match | Read the sourced guidance, then evaluate the exact tag |
|
|
79
|
+
| `available` | Public family and tag pages were parsed in library step 2 | Inspect the exact tag before recommending a download |
|
|
80
|
+
| `unverified` | Digest or current backend inventory could not be verified | Recheck local inventory; retain local feature information |
|
|
81
|
+
| `digest_mismatch` | The public tag differs from the installed digest | Treat public guidance as unavailable for this installed model |
|
|
82
|
+
| `tag_not_found` | The parsed public tag list has no exact matching tag | Check the source and custom-model provenance |
|
|
83
|
+
| `unmatched` | The name cannot resolve to an exact public Ollama name | Keep use-case suitability unknown until provenance is verified |
|
|
84
|
+
| `not_found` | A requested public page returned HTTP 404 | Check the source URL or custom name |
|
|
85
|
+
| `unavailable` | Transport, timeout, HTTP refusal, or page-size limit prevented lookup | Retry later; local results remain available |
|
|
86
|
+
| `parse_error` | HTML content or tag rows were not recognized | Inspect the source; do not conclude the model is absent |
|
|
87
|
+
| `remote_model`, `remote_tag` | Remote Ollama fields or a hosted tag identify cloud execution | Select a local download tag for local execution |
|
|
88
|
+
|
|
89
|
+
`localModel:false` flags detected remote entries. Known remote entries skip public enrichment, and cloud tags never become local trial recommendations. This metadata is not processor-placement evidence; inspect the execution observation for CPU/GPU placement.
|
|
90
|
+
|
|
91
|
+
## Cache and request bounds
|
|
92
|
+
|
|
93
|
+
Each MCP process caches at most 128 families. Successful lookups expire after one hour, failures after one minute; concurrent requests for a family share one lookup. Expired content is not served as current metadata. Restarting the MCP process clears this in-memory cache.
|
|
94
|
+
|
|
95
|
+
Installed enrichment runs at most four family lookups concurrently. Each lookup requests the family page and complete `/tags` page in parallel. Requests use GET, refuse redirects, cap each page at 2 MiB, and time out after the smaller of 10 seconds and `FREELLAMA_MCP_FETCH_TIMEOUT_SECONDS`. These requests retrieve metadata without loading or executing a model. They disclose the requested public family name to ollama.com.
|
|
96
|
+
|
|
97
|
+
The local inventory is not cached by the enrichment layer. A changed backend inventory or failed lookup leaves the managed model and its existing evidence intact. A size-based library recommendation is only a download trial candidate: download size does not establish runtime memory fit, CPU/GPU placement, or task quality. Model discovery never authorizes a pull.
|
|
98
|
+
|
|
99
|
+
## Sources and related documentation
|
|
100
|
+
|
|
101
|
+
- [Ollama model details API](https://docs.ollama.com/api-reference/show-model-details) provides runtime capability and architecture metadata.
|
|
102
|
+
- [Ollama model-list API](https://docs.ollama.com/api/tags) provides installed tags and digests.
|
|
103
|
+
- [Ollama Gemma 3 page](https://ollama.com/library/gemma3) illustrates variant-specific modalities.
|
|
104
|
+
- [MCP tool reference](../packages/mcp/README.md#tools) documents the complete tool surface.
|
|
105
|
+
- [Choose local models](MODEL_SELECTION.md) explains quality qualification and measured results.
|
|
106
|
+
- [Test FreeLlama](TESTING.md) lists the parser, enrichment, and protocol checks.
|
package/docs/MODEL_SELECTION.md
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
# Choose local models
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
To offload a task, select an installed model with the required capabilities and measured quality,
|
|
4
|
+
then check its memory fit under the intended concurrency. FreeLlama applies model eligibility
|
|
5
|
+
and admission; the calling agent still verifies the output.
|
|
6
|
+
|
|
7
|
+
The measurements in this guide come from one Apple M4 Pro machine with 48 GB unified memory and
|
|
8
|
+
are not compiled into routing. Re-run
|
|
5
9
|
`npx @octocodeai/freellama doctor`, `models`, `bench-all`, and your quality suite on the target hardware.
|
|
6
10
|
`doctor.machine.memory_bytes` is host RAM; a discrete GPU's usable VRAM must be observed separately.
|
|
7
11
|
|
|
12
|
+
For supported features and sourced publisher use-case guidance, inspect
|
|
13
|
+
`models {view:"installed", includeLibrary:true}` through MCP. The
|
|
14
|
+
[Ollama metadata reference](MODEL_METADATA.md) explains digest matching, variant capabilities,
|
|
15
|
+
custom-model fallbacks, and how to read family claims without treating them as quality measurements.
|
|
16
|
+
|
|
8
17
|
```mermaid
|
|
9
18
|
flowchart TD
|
|
10
19
|
T{"What must the task do?"}
|
|
@@ -24,6 +33,10 @@ flowchart TD
|
|
|
24
33
|
grounded research, image description, OCR, and summarization. Using one large multimodal model also
|
|
25
34
|
avoided contention between separate heavy text and vision runners.
|
|
26
35
|
|
|
36
|
+
Read the [retained model profile](../skills/freellama/references/model-profile-qwen3.8-27b-mlx.md)
|
|
37
|
+
and [delegation measurements](../skills/freellama/references/task-delegation.md) for scope and limits.
|
|
38
|
+
These examples do not establish that a tag is installed or suitable on your host.
|
|
39
|
+
|
|
27
40
|
`muse-glimmer:30b-mlx` was a credible alternative and answered 29 of 30 questions correctly
|
|
28
41
|
(96.7%) with the Bash adapter, but it was slower and did not add a required capability in this
|
|
29
42
|
workload.
|