@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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Ollama and FreeLlama optimization boundary
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
FreeLlama manages model selection and resources for tasks offloaded by agents. Ollama owns
|
|
4
|
+
inference optimization. FreeLlama can improve completed work per hour by avoiding unsuitable
|
|
5
|
+
routes and unnecessary model transitions; measure that effect for the target workload.
|
|
6
6
|
|
|
7
7
|
This page explains the active request flow, the settings Ollama owns, the
|
|
8
8
|
current machine audit, and the optimization work that remains.
|
|
@@ -19,8 +19,9 @@ control plane for evidence-qualified routing, bounded request profiles, session
|
|
|
19
19
|
affinity, and policy enforcement.
|
|
20
20
|
|
|
21
21
|
Do not advertise FreeLlama as an accelerator or an Ollama inference plugin. It does not tune
|
|
22
|
-
kernels
|
|
23
|
-
|
|
22
|
+
kernels or split one model's layers across CPU and GPU. It responds to observed host pressure by
|
|
23
|
+
holding managed work; the operating system manages physical memory. FreeLlama can assign different
|
|
24
|
+
models to isolated CPU and GPU-capable Ollama
|
|
24
25
|
processes, allowing independent workloads to overlap.
|
|
25
26
|
|
|
26
27
|
## Request flow
|
|
@@ -86,10 +87,10 @@ request-specific `num_ctx` from the selected task profile. The coding adapters f
|
|
|
86
87
|
conversation inside `FREELLAMA_AGENT_NUM_CTX`: by default, they preserve the system prompt and
|
|
87
88
|
original question, compact the oldest observations first, retain recent evidence, and fail before
|
|
88
89
|
the Ollama call if pinned content cannot fit. Raising the Ollama server's global context does not
|
|
89
|
-
disable adapter compaction or increase its configured budget. See [
|
|
90
|
+
disable adapter compaction or increase its configured budget. See [adapter contracts](../../benchmark/local/docs/07-adapter-contracts.md)
|
|
90
91
|
for the complete pagination and compaction contract.
|
|
91
92
|
|
|
92
|
-
##
|
|
93
|
+
## Mac audit (2026-09-01)
|
|
93
94
|
|
|
94
95
|
This audit captures the following snapshot from September 1, 2026. Treat it as machine
|
|
95
96
|
evidence, not a portable default.
|
|
@@ -164,15 +165,15 @@ than an inference-speed claim.
|
|
|
164
165
|
|
|
165
166
|
FreeLlama does not provide:
|
|
166
167
|
|
|
167
|
-
-
|
|
168
|
-
and
|
|
169
|
-
|
|
170
|
-
-
|
|
171
|
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
168
|
+
- exact runner-allocation prediction. Managed admission uses observed available RAM, free VRAM
|
|
169
|
+
when available, and a metadata-backed F16 K/V estimate; unknown layouts remain unknown. Ollama
|
|
170
|
+
remains authoritative for runner allocation and final loading;
|
|
171
|
+
- coordination for processes that bypass FreeLlama. Mutating passthrough requests in `serve`
|
|
172
|
+
share the primary transition lock;
|
|
173
|
+
- direct control over thermal state, power mode, or swapping. Observed pressure can hold admission;
|
|
174
|
+
- model-quality scoring inferred from operational latency or errors;
|
|
174
175
|
- per-engine tuning for GGUF compared with MLX;
|
|
175
|
-
-
|
|
176
|
+
- unbounded automatic residency or concurrency. Runtime limits remain operator-owned;
|
|
176
177
|
- an atomic natural-language route-and-run operation;
|
|
177
178
|
- held-out quality policies for completion, coding, tools, browser, vision, or
|
|
178
179
|
long-context tasks in the example policy;
|
|
@@ -200,7 +201,7 @@ Use this table before changing Ollama or FreeLlama:
|
|
|
200
201
|
| Leave Ollama's queue without a deployment limit | Do not add | Set a measured `OLLAMA_MAX_QUEUE`; it remains separate from FreeLlama's admission deadline |
|
|
201
202
|
| Pin multiple 18–21 GB models | Do not add by default | The observed 36 GiB Metal budget cannot safely establish that two heavy models plus contexts fit |
|
|
202
203
|
| Force Flash Attention | Benchmark per engine and model | The inspected GGUF path already enabled it automatically; MLX has a different runner |
|
|
203
|
-
| Use `q8_0` K/V cache |
|
|
204
|
+
| Use `q8_0` K/V cache | Qualify quality and memory effects per workload | KV quantization changes memory use and precision for the whole process; compare representative task quality and resident memory before deployment |
|
|
204
205
|
| Use `q4_0` K/V cache | Reject as a default | It saves more memory with a larger possible quality loss |
|
|
205
206
|
| Enable High Power Mode | Sustained-load experiment only | Apple documents higher sustained performance. Local token-rate and energy effects are not measured |
|
|
206
207
|
| Keep the small intent model resident | Keep bounded | It reduces routing latency but consumes memory and can affect a large-model transition |
|
|
@@ -222,10 +223,10 @@ memory, swap, and failure counts. A higher token rate is not an improvement if
|
|
|
222
223
|
quality falls, requests fail, or model transitions dominate the workload.
|
|
223
224
|
|
|
224
225
|
Use `cargo run -- bench-all` (`packages/rust-core/src/model_bench.rs`) for model selection evidence.
|
|
225
|
-
Use [CPU and GPU model routing](CPU_GPU_ROUTING.md) for the separate-process benchmark and
|
|
226
|
+
Use [CPU and GPU model routing](../CPU_GPU_ROUTING.md) for the separate-process benchmark and
|
|
226
227
|
verification procedure.
|
|
227
228
|
|
|
228
|
-
- Local-model router RFC — lived in the gitignored `.octocode/` workspace and is no longer in the tree; the shipped design it argued for is [ARCHITECTURE.md](ARCHITECTURE.md)
|
|
229
|
+
- Local-model router RFC — lived in the gitignored `.octocode/` workspace and is no longer in the tree; the shipped design it argued for is [ARCHITECTURE.md](../ARCHITECTURE.md)
|
|
229
230
|
|
|
230
231
|
## Recommended next work
|
|
231
232
|
|
package/native/index.d.ts
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
// exactly — keep the two in sync if you change one. `npm run build` no longer overwrites this
|
|
4
4
|
// file (it previously did, silently emptying it — see package.json's build script comment).
|
|
5
5
|
|
|
6
|
+
/** Crate version this native addon was compiled from. */
|
|
7
|
+
export function version(): string;
|
|
8
|
+
|
|
6
9
|
/**
|
|
7
10
|
* Runs `freellama doctor` against Ollama directly — no running `freellama serve` required.
|
|
8
11
|
* Cross-checks the Ollama CLI and server versions and confirms the endpoint is reachable.
|
|
@@ -20,9 +23,20 @@ export function machine(endpoint?: string | undefined | null): Promise<string>;
|
|
|
20
23
|
/** Current managed-platform health, including admission and session bounds. */
|
|
21
24
|
export function health(endpoint?: string | undefined | null): Promise<string>;
|
|
22
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Live platform view: admission, queues, adaptive limits and circuit breakers per backend,
|
|
28
|
+
* loaded models, host memory, Ollama's effective settings, and today's usage.
|
|
29
|
+
*/
|
|
30
|
+
export function status(endpoint?: string | undefined | null): Promise<string>;
|
|
31
|
+
|
|
32
|
+
/** Usage totals per day and per model over the last `days` days (default 7). */
|
|
33
|
+
export function usage(endpoint?: string | undefined | null, days?: number | undefined | null): Promise<string>;
|
|
34
|
+
|
|
23
35
|
/** Create a bounded, idle-expiring model-affinity handle; it stores no prompt history or KV. */
|
|
24
36
|
export function createSession(endpoint?: string | undefined | null): Promise<string>;
|
|
25
37
|
|
|
38
|
+
export function killSession(endpoint: string | undefined | null, sessionId: string): Promise<string>;
|
|
39
|
+
|
|
26
40
|
/** Release a model-affinity handle after related work has completed. */
|
|
27
41
|
export function deleteSession(
|
|
28
42
|
endpoint: string | undefined | null,
|
|
@@ -145,6 +159,15 @@ export function runTaskBatchRequest(
|
|
|
145
159
|
request: unknown,
|
|
146
160
|
): Promise<string>;
|
|
147
161
|
|
|
162
|
+
/** Lists process-local job metadata without prompts or results. */
|
|
163
|
+
export function listTaskJobs(endpoint?: string | undefined | null): Promise<string>;
|
|
164
|
+
/** Reads one deferred job and its retained result. */
|
|
165
|
+
export function getTaskJob(endpoint: string | undefined | null, jobId: string): Promise<string>;
|
|
166
|
+
/** Cancels one deferred job and waits for its local permits to be released. */
|
|
167
|
+
export function cancelTaskJob(endpoint: string | undefined | null, jobId: string): Promise<string>;
|
|
168
|
+
/** Stop one deferred task, release local permits, then discard its retained record. */
|
|
169
|
+
export function removeTaskJob(endpoint: string | undefined | null, jobId: string): Promise<string>;
|
|
170
|
+
|
|
148
171
|
/**
|
|
149
172
|
* Converts a free-text natural-language intent into a route.
|
|
150
173
|
* @param endpoint FreeLlama serve endpoint, defaults to http://127.0.0.1:11435
|
|
@@ -156,3 +179,11 @@ export function naturalRoute(
|
|
|
156
179
|
text: string,
|
|
157
180
|
sessionId?: string | undefined | null,
|
|
158
181
|
): Promise<string>;
|
|
182
|
+
|
|
183
|
+
/** Opt-in bounded process-local history. Metadata by default. */
|
|
184
|
+
export function createScope(endpoint: string | undefined | null, request: unknown): Promise<string>;
|
|
185
|
+
export function getScope(endpoint: string | undefined | null, scopeId: string, includeMessages?: boolean | null): Promise<string>;
|
|
186
|
+
export function forkScope(endpoint: string | undefined | null, scopeId: string, request: unknown): Promise<string>;
|
|
187
|
+
export function deleteScope(endpoint: string | undefined | null, scopeId: string): Promise<void>;
|
|
188
|
+
/** Empty-payload preload through managed admission and deadlines. */
|
|
189
|
+
export function warmModelRequest(endpoint: string | undefined | null, request: unknown): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octocodeai/freellama-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "MCP server exposing FreeLlama core as tools, via native NAPI bindings into packages/rust-core.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,10 @@
|
|
|
28
28
|
"native/package.json",
|
|
29
29
|
"adapters/*.py",
|
|
30
30
|
"docs",
|
|
31
|
-
"README.md"
|
|
31
|
+
"README.md",
|
|
32
|
+
"LICENSE-APACHE",
|
|
33
|
+
"LICENSE-MIT",
|
|
34
|
+
"assets/logo.jpg"
|
|
32
35
|
],
|
|
33
36
|
"scripts": {
|
|
34
37
|
"build": "node scripts/build.mjs",
|
|
@@ -46,14 +49,14 @@
|
|
|
46
49
|
"zod": "^3.24.1"
|
|
47
50
|
},
|
|
48
51
|
"optionalDependencies": {
|
|
49
|
-
"@octocodeai/freellama-native-darwin-arm64": "0.
|
|
50
|
-
"@octocodeai/freellama-native-darwin-x64": "0.
|
|
51
|
-
"@octocodeai/freellama-native-linux-arm64-gnu": "0.
|
|
52
|
-
"@octocodeai/freellama-native-linux-arm64-musl": "0.
|
|
53
|
-
"@octocodeai/freellama-native-linux-x64-gnu": "0.
|
|
54
|
-
"@octocodeai/freellama-native-linux-x64-musl": "0.
|
|
55
|
-
"@octocodeai/freellama-native-win32-arm64-msvc": "0.
|
|
56
|
-
"@octocodeai/freellama-native-win32-x64-msvc": "0.
|
|
52
|
+
"@octocodeai/freellama-native-darwin-arm64": "0.5.0",
|
|
53
|
+
"@octocodeai/freellama-native-darwin-x64": "0.5.0",
|
|
54
|
+
"@octocodeai/freellama-native-linux-arm64-gnu": "0.5.0",
|
|
55
|
+
"@octocodeai/freellama-native-linux-arm64-musl": "0.5.0",
|
|
56
|
+
"@octocodeai/freellama-native-linux-x64-gnu": "0.5.0",
|
|
57
|
+
"@octocodeai/freellama-native-linux-x64-musl": "0.5.0",
|
|
58
|
+
"@octocodeai/freellama-native-win32-arm64-msvc": "0.5.0",
|
|
59
|
+
"@octocodeai/freellama-native-win32-x64-msvc": "0.5.0"
|
|
57
60
|
},
|
|
58
61
|
"license": "Apache-2.0 OR MIT",
|
|
59
62
|
"publishConfig": {
|
/package/docs/{ADR_RESOURCE_AWARE_BACKEND_ROUTING.md → dev/ADR_RESOURCE_AWARE_BACKEND_ROUTING.md}
RENAMED
|
File without changes
|