@octocodeai/freellama-mcp-server 0.6.2 → 0.9.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/CONFIGURATION.md +11 -3
- package/DEVELOPING.md +6 -6
- package/README.md +224 -402
- package/dist/index.js +11714 -4251
- package/dist/research/bash-agent.js +1495 -71
- package/dist/research/coder-agent.js +4668 -0
- package/dist/research/github-agent.js +2923 -0
- package/dist/research/octocode-agent.js +1407 -116
- package/docs/ARCHITECTURE.md +101 -45
- package/docs/BUILD_AND_NOTES.md +31 -0
- package/docs/CLI.md +76 -27
- package/docs/COMPARISON.md +40 -0
- package/docs/CPU_GPU_ROUTING.md +127 -25
- package/docs/DEFERRED_JOBS.md +79 -0
- package/docs/FEATURES.md +303 -0
- package/docs/LOCAL_MODELS.md +190 -0
- package/docs/MODEL_FORMS_AND_RESULTS.md +55 -0
- package/docs/MODEL_INTROSPECTION.md +128 -0
- package/docs/MODEL_SELECTION.md +74 -22
- package/docs/MONITORING.md +115 -33
- package/docs/PRODUCTION.md +76 -13
- package/docs/README.md +11 -6
- package/docs/SCOPES_AND_WARMING.md +55 -7
- package/docs/TESTING.md +24 -2
- package/docs/TUNING.md +86 -0
- package/docs/cookbooks/README.md +22 -0
- package/docs/cookbooks/batch-text.md +19 -0
- package/docs/cookbooks/classify.md +25 -0
- package/docs/cookbooks/coding.md +17 -0
- package/docs/cookbooks/duplicates.md +17 -0
- package/docs/cookbooks/find-code.md +21 -0
- package/docs/cookbooks/image-recognition.md +15 -0
- package/docs/cookbooks/image-search.md +13 -0
- package/docs/cookbooks/jobs.md +60 -0
- package/docs/cookbooks/memory-and-caching.md +31 -0
- package/docs/cookbooks/ocr.md +17 -0
- package/docs/cookbooks/research-agent.md +27 -0
- package/docs/cookbooks/speech-to-text.md +19 -0
- package/docs/cookbooks/sweep.md +66 -0
- package/docs/cookbooks/text-to-speech.md +15 -0
- package/docs/octocode/GITHUB.md +30 -0
- package/docs/octocode/LOCAL.md +29 -0
- package/native/index.d.ts +1 -11
- package/native/index.js +18 -34
- package/package.json +13 -15
package/docs/TUNING.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Make local models faster and lighter
|
|
2
|
+
|
|
3
|
+
Moved from the root README.
|
|
4
|
+
|
|
5
|
+
## Make local models faster and lighter
|
|
6
|
+
|
|
7
|
+
Decode speed is fixed by the model and hardware. A task's real cost is mostly around decoding: cold
|
|
8
|
+
loads, reloads, re-evaluating a prompt the runner already saw, unneeded thinking and output, and
|
|
9
|
+
running out of memory. Best payoff first:
|
|
10
|
+
|
|
11
|
+
1. **Avoid reloads.** Ollama reuses a loaded runner only when `num_ctx`, `num_batch`, `num_gpu`,
|
|
12
|
+
`num_thread`, `use_mmap` and the context-shift setting match ([scheduler](https://github.com/ollama/ollama/blob/main/server/sched.go)).
|
|
13
|
+
Managed chat sends `truncate:false`, and by default `shift:false`, so an overflow is refused
|
|
14
|
+
instead of silently dropping context; raw clients that keep Ollama's default shift therefore
|
|
15
|
+
reload a runner FreeLlama loaded, and the reverse. Set `context_shift = "ollama_default"` in the
|
|
16
|
+
runtime file to omit `shift` so both share one runner (`truncate:false` is still sent; a long
|
|
17
|
+
generation may then drop its earliest tokens), or give raw and managed traffic separate models
|
|
18
|
+
or backends when both are busy. `freellama config` shows the active value and its source.
|
|
19
|
+
FreeLlama sizes `num_ctx` in fixed buckets (2k–32k), reuses a loaded runner's larger context, and
|
|
20
|
+
leaves thread selection to Ollama unless the operator or caller explicitly overrides it. Keep one model's callers on one
|
|
21
|
+
`contextTokens`, warm at that context, and compare `models`' `context_default` and
|
|
22
|
+
`resident_context`.
|
|
23
|
+
2. **Keep prompts prefix-stable.** Ollama's backends own prompt caching; its llama.cpp backend
|
|
24
|
+
reuses matching prompt prefixes. Cache behavior varies by engine and model. Put the stable part first (system prompt, tool list, documents) and
|
|
25
|
+
append, never edit. Warm a long prefix once with `ollama_manage{action:"warm",model,systemPrompt}` (or
|
|
26
|
+
`[preload]` `messages`) and use `scope` for follow-ups, which reuse the whole history. Receipts
|
|
27
|
+
and the usage ledger report `metrics.cached_prompt_tokens` and `uncached_prompt_tokens` from
|
|
28
|
+
Ollama's `prompt_eval_cached_count` when reported; missing counters stay unknown. Context changes
|
|
29
|
+
can reload a runner and lose its prefix cache.
|
|
30
|
+
3. **Spend output only where it helps.** Completion, tools, browser and vision tasks send
|
|
31
|
+
`think:false` (Ollama otherwise enables thinking on capable models); coding, code-repair and
|
|
32
|
+
long-context tasks send `think:"medium"` to thinking models. `stopOnRepetition` cut `glm-ocr` on 12
|
|
33
|
+
report strips from 12,948 to 6,452 output tokens with every label still read.
|
|
34
|
+
4. **Unload instead of swapping.** A load that does not fit waits instead of swapping, idle models are
|
|
35
|
+
unloaded under memory pressure, and `unload` frees a big model before a switch without ever
|
|
36
|
+
loading it.
|
|
37
|
+
5. **Shrink memory per runner.** Quantize the KV cache, keep `OLLAMA_NUM_PARALLEL=1` on a laptop
|
|
38
|
+
(every slot multiplies KV memory by the context), and bound llama-server's hidden prompt cache
|
|
39
|
+
with `LLAMA_ARG_CACHE_RAM`; see [Tune Ollama](#tune-ollama-for-local-models).
|
|
40
|
+
6. **Keep the agent's context small.** See [small agent context](FEATURES.md#small-agent-context).
|
|
41
|
+
|
|
42
|
+
Measured here (Apple M2 Pro, 32 GB, Ollama 0.40.13, FreeLlama 0.8.0, 2026-10-31, light load only):
|
|
43
|
+
`serve` prepared in 69–143 ms; a cold `nomic-embed-text:v1.5` load took 0.5 s and a resident embedding
|
|
44
|
+
13–26 ms in Ollama, plus 4 ms (median) for FreeLlama; `unload` took 5–56 ms; an MCP embedding result
|
|
45
|
+
was 2.6 KB inline with the vectors in its `response_file`.
|
|
46
|
+
|
|
47
|
+
### Tune Ollama for local models
|
|
48
|
+
|
|
49
|
+
FreeLlama never changes Ollama's settings. These matter most, per Ollama's docs and measured reports:
|
|
50
|
+
|
|
51
|
+
| Setting | What it does | Suggested start |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| `OLLAMA_NUM_PARALLEL` | Decoding slots per model, each with its own prompt cache; RAM grows with slots times context ([Ollama FAQ](https://github.com/ollama/ollama/blob/main/docs/faq.mdx)). Small gain on Apple silicon; some engines run one request at a time ([MLX engine](https://github.com/ollama/ollama/issues/17280)) | `1`, raised only after measuring. FreeLlama's budget follows it |
|
|
54
|
+
| `OLLAMA_FLASH_ATTENTION` + `OLLAMA_KV_CACHE_TYPE=q8_0` | A quantized KV cache roughly halves its memory and needs flash attention ([Ollama FAQ](https://github.com/ollama/ollama/blob/main/docs/faq.mdx)); with `OLLAMA_FLASH_ATTENTION` unset, Ollama enables it automatically on supported backends. See [KV cache and flash attention](#kv-cache-and-flash-attention) | On, when the model's quality holds |
|
|
55
|
+
| Context length | Ollama defaults to 4k below 24 GiB of VRAM and recommends at least 64k for agent and coding work ([context length](https://github.com/ollama/ollama/blob/main/docs/context-length.mdx)) | Size per task. FreeLlama keeps Ollama's default when it covers the prompt, otherwise sizes text tasks to the prompt; `contextTokens` overrides |
|
|
56
|
+
| `OLLAMA_MAX_LOADED_MODELS` | How many runners stay resident. Unset and `0` mean 3 per GPU, then Ollama unloads by count | More than the model memory budget can hold, so the budget decides by size and reload cost. `1` reloads on every switch |
|
|
57
|
+
| `keep_alive` | How long a runner stays loaded after use | Leave it out. FreeLlama picks a finite time from measured reuse |
|
|
58
|
+
| `LLAMA_ARG_CACHE_RAM` | Host RAM llama-server may use for displaced prompt caches (`--cache-ram`); default 8192 MiB per runner ([llama.cpp server](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md)), counted by no footprint estimate. Set it on the Ollama server, which passes its environment to llama-server; `doctor` checks it | `2048` on 32 GB or less; `0` disables it at the cost of re-evaluating prefixes |
|
|
59
|
+
|
|
60
|
+
#### KV cache and flash attention
|
|
61
|
+
|
|
62
|
+
FreeLlama sizes each backend's KV cache from that Ollama process's settings. A model whose metadata
|
|
63
|
+
does not describe its cache (hybrid, recurrent or sliding-window layers) is assumed to need a quarter
|
|
64
|
+
of its file size per 16K tokens of context, for each parallel slot, until its first load is
|
|
65
|
+
measured (`source: model_file_plus_assumed_kv_plus_graph` in the receipt):
|
|
66
|
+
|
|
67
|
+
| `OLLAMA_FLASH_ATTENTION` | State | KV share of f16 with `q8_0` / `q4_0` |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| unset | `auto`: Ollama enables flash attention where the backend supports it (Metal, CUDA) | 50% / 25% |
|
|
70
|
+
| `1`, `true` | `on` | 50% / 25% |
|
|
71
|
+
| `0`, `false` | `off`: Ollama ignores `OLLAMA_KV_CACHE_TYPE` | 100% |
|
|
72
|
+
|
|
73
|
+
`auto` is sized like `on`. A model or backend without flash attention falls back to an f16 cache, so
|
|
74
|
+
its first load can be larger than the estimate; the measured footprint, keyed by
|
|
75
|
+
`OLLAMA_NUM_PARALLEL` and the KV cache share, then sizes later loads. `status` reports the result
|
|
76
|
+
under `ollama.config.effective` (`cpu_config` for a CPU backend) and `config` under
|
|
77
|
+
`ollama.effective`: `flash_attention`, `kv_cache_type` and `kv_cache_percent_of_f16`.
|
|
78
|
+
|
|
79
|
+
Ollama's own fit check still predicts an f16 cache, and its scheduler evicts other runners or
|
|
80
|
+
offloads layers when that prediction passes 80% of free memory. FreeLlama reserves the quantized
|
|
81
|
+
estimate (or a measurement) and keeps Ollama's f16 figure beside it as
|
|
82
|
+
`memory_reservation.ollama_f16_preflight_bytes`. When the quantized estimate fits within 80% of the
|
|
83
|
+
available memory FreeLlama admitted against but the f16 figure does not, the receipt adds
|
|
84
|
+
`ollama_may_evict_or_offload: true` and `ollama_preflight_reason`. This applies to CPU and
|
|
85
|
+
unified-memory backends; on a discrete GPU Ollama compares against VRAM, which FreeLlama does not
|
|
86
|
+
attribute to a backend.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# FreeLlama cookbooks
|
|
2
|
+
|
|
3
|
+
Short recipes for one job each: when to use it, which model, the exact call, and how to check the result. To see what is installed and fits right now, ask `models {view:"catalog"}` or run `freellama catalog`.
|
|
4
|
+
|
|
5
|
+
| Job | Recipe |
|
|
6
|
+
|---|---|
|
|
7
|
+
| Classify, triage, yes/no | [classify](classify.md) |
|
|
8
|
+
| Find the code for an issue | [find-code](find-code.md) |
|
|
9
|
+
| Find duplicates | [duplicates](duplicates.md) |
|
|
10
|
+
| Read text from an image | [ocr](ocr.md) |
|
|
11
|
+
| Understand what an image shows | [image-recognition](image-recognition.md) |
|
|
12
|
+
| Find an image by describing it | [image-search](image-search.md) |
|
|
13
|
+
| Recording to text | [speech-to-text](speech-to-text.md) |
|
|
14
|
+
| Text to speech | [text-to-speech](text-to-speech.md) |
|
|
15
|
+
| Small coding tasks | [coding](coding.md) |
|
|
16
|
+
| Research a repository | [research-agent](research-agent.md) |
|
|
17
|
+
| Rewrite or summarize many texts | [batch-text](batch-text.md) |
|
|
18
|
+
| Check a code tree, log or site in small saved chunks | [sweep](sweep.md) |
|
|
19
|
+
| Let FreeLlama pick the model and prompt for a job | [jobs](jobs.md) |
|
|
20
|
+
| Memory, context and caching | [memory-and-caching](memory-and-caching.md) |
|
|
21
|
+
|
|
22
|
+
Every call here is checked against the tool schemas by a test. Measured results come from one machine: an Apple M2 Pro with 32 GB. Measure on yours before you rely on them.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Rewrite, summarize or extract across many texts
|
|
2
|
+
|
|
3
|
+
**Use when** you have 10 or more similar short texts. Send what they share once, and name each input by path.
|
|
4
|
+
|
|
5
|
+
**Skip it when** a pattern or script can do it exactly: checking a format with a regex beats any model.
|
|
6
|
+
|
|
7
|
+
**Model:** run `models {view:"catalog", job:"coding"}`; the same chat models apply.
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{"tool": "run_task", "arguments": {"task": "completion", "model": "bonsai-2:9b", "systemPrompt": "Summarize this release note in one line.", "options": {"num_predict": 120}, "tasks": [{"id": "v1", "independent": true, "task": {"prompt": "Release note:", "files": ["releases/v1.md"]}}, {"id": "v2", "independent": true, "task": {"prompt": "Release note:", "files": ["releases/v2.md"]}}]}}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Up to 64 items per call. Top-level `task`, `model`, `systemPrompt`, `questions`, `format` and `options` apply to every item; `prompt`, `state`, `input`, `files` and `images` stay per item.
|
|
14
|
+
|
|
15
|
+
`job:"summarize"` in place of `model` and `systemPrompt` lets FreeLlama pick the model and its summary prompt ([jobs](jobs.md)). On a single call, `saveAs` writes the answer to a handoff file a later task reads with `files`.
|
|
16
|
+
|
|
17
|
+
**Read the result:** one `## <id>` section per item, in order.
|
|
18
|
+
|
|
19
|
+
**Check it:** read 3 to 5, more where a mistake costs more.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Classify, triage and yes/no checks
|
|
2
|
+
|
|
3
|
+
**Use when** you have many items to label, route or check against a rule. A decision model answers in one forward pass with a probability, and generates no text to parse.
|
|
4
|
+
|
|
5
|
+
**Skip it when** there is one item you already understand, or a wrong label would be costly and unchecked.
|
|
6
|
+
|
|
7
|
+
**Model:** `strands-decider:2b-nvfp4` (1.3 GB). See `models {view:"catalog", job:"classify"}` for what is installed and fits now.
|
|
8
|
+
|
|
9
|
+
One item, with the question asked once:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{"tool": "run_task", "arguments": {"task": "decision", "model": "strands-decider:2b-nvfp4", "state": "Checkout returns 500 since 9am.", "questions": {"kind": {"type": "choice", "instructions": "What kind of issue is this?", "criteria": {"bug": "Something is broken", "feature": "A request for new capability", "question": "A question"}}, "urgent": {"type": "noul", "instructions": "Does this need action today?"}}}}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Many items: send the question once and let each item carry only its own text or file:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{"tool": "run_task", "arguments": {"task": "decision", "model": "strands-decider:2b-nvfp4", "questions": {"kind": {"type": "choice", "instructions": "What kind of issue is this?", "criteria": {"bug": "Something is broken", "feature": "A request for new capability"}}}, "tasks": [{"id": "a", "independent": true, "task": {"files": ["issues/a.md"]}}, {"id": "b", "independent": true, "task": {"files": ["issues/b.md"]}}]}}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
CLI: `freellama task --task decision --questions @questions.json --input-file issue.md`
|
|
22
|
+
|
|
23
|
+
**Read the result:** one line per question, such as `kind: bug (p 0.95, confidence 0.79)`.
|
|
24
|
+
|
|
25
|
+
**Check it:** spot-check 3 to 5 answers, and treat a low probability as unknown. Add an explicit `other` option when no listed label may fit. Do not use this model's `score` answers for severity.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Offload small coding tasks
|
|
2
|
+
|
|
3
|
+
**Use when** the task is small and self-contained, and you can check the answer cheaply: explain a function, write a regex, convert a snippet, draft a test.
|
|
4
|
+
|
|
5
|
+
**Skip it when** the change spans files, needs judgment you must stand behind, or is shorter than describing it. Local code review is unreliable: verify every finding.
|
|
6
|
+
|
|
7
|
+
**Model:** `lfm3:1.7b-q4_K_M` (1.1 GB, about 3.3 GB available needed). Measured here on 25 small questions over three rounds: lfm3 61 right, `bonsai-2:9b` 55, and Nemotron-3.5-Bolt 68, which needs about 13.5 GB available. Run `models {view:"catalog", job:"coding"}` for what fits now.
|
|
8
|
+
|
|
9
|
+
Pass the code by path:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{"tool": "run_task", "arguments": {"task": "coding", "model": "lfm3:1.7b-q4_K_M", "prompt": "Write a unit test for the function in this file. Reply with code only.", "files": ["src/parse.ts"], "options": {"num_predict": 800}}}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
CLI: `freellama task --task coding --model lfm3:1.7b-q4_K_M --input-file prompt.txt`
|
|
16
|
+
|
|
17
|
+
**Check it:** run the code. Set `num_predict` high enough for a thinking model's reasoning, which counts as output, or pass `think:false` for a short answer: an answer that comes back empty says which.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Find duplicates among issues or texts
|
|
2
|
+
|
|
3
|
+
**Use when** you need likely duplicate pairs from many short texts.
|
|
4
|
+
|
|
5
|
+
**Model:** `nomic-embed-text:v1.5` (0.3 GB).
|
|
6
|
+
|
|
7
|
+
Leave out `query`, and `nearest` returns the most similar pairs:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{"tool": "run_task", "arguments": {"task": "embedding", "model": "nomic-embed-text:v1.5", "files": ["issues/*.md"], "nearest": {"top": 10, "documentPrefix": "search_document: "}}}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Two chunks of one file are never reported as a pair.
|
|
14
|
+
|
|
15
|
+
**Read the result:** one line per pair, with a cosine score.
|
|
16
|
+
|
|
17
|
+
**Check it:** a high score is a candidate, never a verdict. Read both before you close anything. Measured here: 8 of 12 real related issues found their partner as the nearest neighbour.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Find the code for an issue or question
|
|
2
|
+
|
|
3
|
+
**Use when** you do not know which file to read and have no exact word to search for. The server embeds the files and returns ranked `path:Lstart-Lend` labels, so you read a few ranges instead of a repository.
|
|
4
|
+
|
|
5
|
+
**Skip it when** you know an identifier: `localSearch` or `grep` is faster and exact.
|
|
6
|
+
|
|
7
|
+
**Model:** `embeddinggemma-2:740m-q8_0` (1.3 GB). `nomic-embed-text:v1.5` (0.3 GB) indexes faster but found the right file less often.
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{"tool": "run_task", "arguments": {"task": "embedding", "model": "embeddinggemma-2:740m-q8_0", "files": ["src/**/*.rs"], "nearest": {"query": "task: search result | query: why does saving a long path crash", "top": 5, "documentPrefix": "title: none | text: "}}}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The prefixes belong to the model: `task: search result | query: ` and `title: none | text: ` for embeddinggemma; `search_query: ` and `search_document: ` for nomic. Other models have their own; check the model's page.
|
|
14
|
+
|
|
15
|
+
CLI, for items one per line: `freellama task --task embedding --model embeddinggemma-2:740m-q8_0 --input-file items.txt --nearest "task: search result | query: saving crashes" --top 5`
|
|
16
|
+
|
|
17
|
+
**Read the result:** one line per file, best chunk first, with a cosine score.
|
|
18
|
+
|
|
19
|
+
**Check it:** read the top ranges before you rely on them. Measured here on 10 questions about this repository: embeddinggemma put the right file first for 9 and in the top 3 for 9; nomic, 6 and 8. A miss is still normal; widen `top` or rephrase before you conclude anything.
|
|
20
|
+
|
|
21
|
+
Each call embeds the files again, so narrow the glob. A glob over about 900 chunks took about 67 s with embeddinggemma and 42 s with nomic.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Understand what an image shows
|
|
2
|
+
|
|
3
|
+
**Use when** you need to know what a picture, chart or screen shows, not just its text.
|
|
4
|
+
|
|
5
|
+
**Skip it when** you only need the words: see [OCR](ocr.md).
|
|
6
|
+
|
|
7
|
+
**Model:** `lfm3-vl:2b-q4_K_M` (1.5 GB). See `models {view:"catalog", job:"image-recognition"}` for the tested alternatives.
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{"tool": "run_task", "arguments": {"task": "vision", "model": "lfm3-vl:2b-q4_K_M", "prompt": "Which label has the tallest bar? Answer briefly.", "files": ["charts/usage.png"]}}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
CLI: `freellama task --task vision --model lfm3-vl:2b-q4_K_M --image chart.png "Which label has the tallest bar?"`
|
|
14
|
+
|
|
15
|
+
**Check it:** ask a specific question, not "describe this". Tested here on drawn images only; expect less on photos, and verify anything you act on.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Find an image by describing it
|
|
2
|
+
|
|
3
|
+
**Use when** you have a folder of screenshots or images and need the one that matches a description.
|
|
4
|
+
|
|
5
|
+
**Model:** `embeddinggemma-2:740m-q8_0` (1.3 GB). Its text-only tags do not embed images.
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{"tool": "run_task", "arguments": {"task": "embedding", "model": "embeddinggemma-2:740m-q8_0", "files": ["screenshots/*.png"], "nearest": {"query": "task: search result | query: a compiler error in a terminal", "top": 3}}}
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Image files are embedded whole, and each is one item. WAV files work the same way with a model that has audio input, such as the same model; audio has not been measured here.
|
|
12
|
+
|
|
13
|
+
**Check it:** open the top match. Measured here: 5 of 5 on five drawn screens, too few to say more.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Let FreeLlama pick the model and prompt (job mode)
|
|
2
|
+
|
|
3
|
+
**Use when** one of the jobs below fits the work and you would rather not write the local model's prompt, options and embedding prefixes yourself. Pass `job` to `run_task`: FreeLlama runs the job's first catalog pick that is installed and fits now, with its own prompt for that job. Any field you pass wins, and `job_profile.applied` in the result lists what job mode filled in.
|
|
4
|
+
|
|
5
|
+
**Skip it when** you need your own wording or decoding: pass `model`, `prompt` and `options` yourself, as the other recipes do.
|
|
6
|
+
|
|
7
|
+
| `job` | Task | First pick | What job mode fills in |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| `classify` | decision | `strands-decider:2b-nvfp4` | task and model; you send `questions` |
|
|
10
|
+
| `find-code` | embedding | `embeddinggemma-2:740m-q8_0` | `task: code retrieval \| query: ` before your query, `title: none \| text: ` before each chunk |
|
|
11
|
+
| `duplicates` | embedding | `nomic-embed-text:v1.5` | `clustering: ` before every item; the most similar pairs when you send no `nearest` |
|
|
12
|
+
| `ocr` | vision | `hf.co/openbmb/MiniCPM-OCR-1.0-gguf:Q4_K_M` | prompt `Text Recognition:`; send `Table Recognition:` or `Formula Recognition:` as `prompt` for those |
|
|
13
|
+
| `image-recognition` | vision | `lfm3-vl:2b-q4_K_M` | a brief-answer system prompt and the card's sampling; you send the question as `prompt` |
|
|
14
|
+
| `image-search` | embedding | `embeddinggemma-2:740m-q8_0` | `task: search result \| query: ` before your query; images go in bare |
|
|
15
|
+
| `coding` | coding | `lfm3:1.7b-q4_K_M` | a system prompt asking for SEARCH/REPLACE edits, and the card's sampling; you send the change as `prompt` |
|
|
16
|
+
| `summarize` | completion | `lfm3:1.7b-q4_K_M` | a short-bullets system prompt that quotes numbers and names and says "not stated" rather than guess |
|
|
17
|
+
|
|
18
|
+
The later picks of each job are the catalog's (`models {view:"catalog", job}`). Every value, with the model card it comes from, is in [local-prompts.ts](../../packages/mcp/src/local-prompts.ts); a sampling value is used only where the model's own card documents it.
|
|
19
|
+
|
|
20
|
+
Read the text in one image:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{"tool": "run_task", "arguments": {"job": "ocr", "files": ["screenshots/error.png"]}}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
One answer per image, with the job sent once:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{"tool": "run_task", "arguments": {"job": "ocr", "tasks": [{"id": "a", "independent": true, "task": {"files": ["screenshots/a.png"]}}, {"id": "b", "independent": true, "task": {"files": ["screenshots/b.png"]}}]}}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Find the code for an issue:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{"tool": "run_task", "arguments": {"job": "find-code", "files": ["src/**/*.rs"], "nearest": {"query": "why does saving a long path crash", "top": 5}}}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Draft one small change:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{"tool": "run_task", "arguments": {"job": "coding", "files": ["src/parse.ts"], "prompt": "Make parsePort reject ports above 65535."}}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Apply coding edits yourself.** The answer is blocks of a path line, `<<<<<<< SEARCH`, the current lines, `=======`, the replacement and `>>>>>>> REPLACE`, or a path and one fenced block for a whole new file. Check that each SEARCH text occurs exactly once in its file, indentation included, replace it, skip a block that matches zero or several times, then run the tests.
|
|
45
|
+
|
|
46
|
+
**Hand a result to the next task.** `saveAs` writes the answer to `handoffs/<name>.md` in the FreeLlama home, with a `## Summary` and a `## Result`, and returns its path as `handoff_file`. Another task reads it with `files`, so you never paste it back:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{"tool": "run_task", "arguments": {"job": "summarize", "files": ["logs/build.log"], "prompt": "Which steps failed, and why?", "saveAs": "build-failures"}}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{"tool": "run_task", "arguments": {"job": "coding", "files": ["/Users/me/.octocode/freellama/handoffs/build-failures.md", "scripts/build.mjs"], "prompt": "Fix the first failure the summary names."}}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**When nothing fits now,** the refusal lists each pick, the memory it needs and what is free. Tell the user; pass `model` for an installed model with the same capability, or ask them to approve pulling one exact tag at its size.
|
|
57
|
+
|
|
58
|
+
**MCP prompts.** Clients that show prompts (often as slash commands) list one per job: `ocr`, `image`, `classify`, `find-code`, `duplicates`, `coding`, `summarize`, `research`, `github-research` and `sweep`. Each returns the exact call to make; `freellama` explains when to offload and how to check results.
|
|
59
|
+
|
|
60
|
+
**Check it:** as the job's own recipe says; read 3 to 5 results before relying on the rest.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Keep local work light: memory, context and caching
|
|
2
|
+
|
|
3
|
+
**See what fits before you start:**
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{"tool": "models", "arguments": {"view": "catalog", "job": "classify"}}
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{"tool": "doctor", "arguments": {"view": "status"}}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Load before a burst.** This loads the model and evaluates a shared prompt once, so later calls that send the same prefix skip that work. It saves local time, not your tokens: you still send the prefix.
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{"tool": "ollama_manage", "arguments": {"action": "warm", "model": "bonsai-2:9b", "systemPrompt": "You review release notes.", "contextTokens": 8192}}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Free memory when a burst ends.** Unload a model you warmed, or one the user named. It waits for that model's running tasks.
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{"tool": "ollama_manage", "arguments": {"action": "unload", "model": "bonsai-2:9b"}}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Caching.** Reuse needs the same text at the start of the prompt, so put stable text first and append rather than edit. `metrics.cached_prompt_tokens` shows what was reused. Measured here on `gpt-oss:20b`: 1,251 of 1,266 tokens reused, with prompt evaluation falling from 544 ms to under 40 ms.
|
|
26
|
+
|
|
27
|
+
**Context window.** `contextTokens` is input plus output. A larger window uses more memory and can reload the model, so ask for what the prompt needs. FreeLlama never cuts a prompt silently.
|
|
28
|
+
|
|
29
|
+
**When a load is refused,** the message says how much memory is available and needed. Tell the user, and never stop their processes. Retry once they free memory, or use a smaller installed model with the same capability; do not retry in a loop.
|
|
30
|
+
|
|
31
|
+
Each pick's memory need is `memory_gb` in `models {view:"catalog"}`; measured models and their speeds are in [Choose local models](../MODEL_SELECTION.md).
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Read text from an image (OCR)
|
|
2
|
+
|
|
3
|
+
**Use when** a screenshot, scan or photo of text must become text. Name the image by path: base64 pasted into your call costs you tens of thousands of tokens.
|
|
4
|
+
|
|
5
|
+
**Skip it when** you need to know what an image shows rather than what it says: see [image recognition](image-recognition.md).
|
|
6
|
+
|
|
7
|
+
**Model:** `hf.co/openbmb/MiniCPM-OCR-1.0-gguf:Q4_K_M` (1.4 GB), or `glm-ocr:latest` (2.2 GB).
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{"tool": "run_task", "arguments": {"task": "vision", "model": "hf.co/openbmb/MiniCPM-OCR-1.0-gguf:Q4_K_M", "prompt": "Text Recognition:", "files": ["screenshots/error.png"]}}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Both models document the prompt `Text Recognition:`. Paths must be under the server's working directory, the temp directory or `FREELLAMA_FILE_ROOTS`.
|
|
14
|
+
|
|
15
|
+
CLI: `freellama task --task vision --model glm-ocr:latest --image shot.png "Text Recognition:"`
|
|
16
|
+
|
|
17
|
+
**Check it:** crop to the text first; a whole page with one line on it can read as garbage. A note that the model looped means low confidence, so check that text. Measured here on clean rendered text only, not scans.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Ask a local agent to research a repository
|
|
2
|
+
|
|
3
|
+
**Use when** a question would take you several searches and reads, and the answer is cheap to check: where is X, what calls Y, which PR added Z.
|
|
4
|
+
|
|
5
|
+
**Skip it when** one search answers it, or when the answer needs your judgment.
|
|
6
|
+
|
|
7
|
+
**Model:** `bonsai-2:9b` (3.2 GB), needing about 8.6 GB available.
|
|
8
|
+
|
|
9
|
+
Local code, using the installed Octocode CLI's read-only tools. Pass the project's absolute path; a relative one resolves against the server's working directory, which is often not your project. The path must be under `FREELLAMA_MCP_ALLOWED_ROOTS`, which a published install requires:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{"tool": "delegate_research", "arguments": {"question": "Which files call the function memory_holders?", "workspacePath": "/Users/me/code/my-project", "adapter": "octocode", "model": "bonsai-2:9b"}}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
GitHub, without cloning or a `workspacePath`:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{"tool": "delegate_research", "arguments": {"question": "Which file in ollama/ollama defines SystemOneRequest?", "adapter": "github", "model": "bonsai-2:9b"}}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The agent's instructions are [local](../octocode/LOCAL.md) and [GitHub](../octocode/GITHUB.md), which also work for any agent using the CLI directly.
|
|
22
|
+
|
|
23
|
+
With `adapter:"bash"` (the default) the model gets structured `search`, `read` and `list` actions that FreeLlama runs correctly and confined (a literal search by default; a path written relative to a package is resolved; a regex sent as a literal is retried as one), plus a read-only shell for `rg`, `grep`, `find`, `sed -n` and `git`. The GitHub adapter also takes the GitHub CLI read-only (`gh search`, `gh repo view`, `gh pr view`, `gh api` GET) through your existing `gh` login.
|
|
24
|
+
|
|
25
|
+
Every run starts with a short workspace overview (top level, file types, source folders). An answer that cites a file that does not exist, or names no source although its results did, gets one repair turn; an answer that still cites a missing file is marked unverified. Bigger models get more time (180 s up to 4 GB, then 20 s per GB); pass `agent.timeoutSeconds` to choose.
|
|
26
|
+
|
|
27
|
+
**Check it:** discard `verification.recommendation:"escalate"`, and verify the citations otherwise. Measured here it was often right but also wrong with confidence, so treat answers as leads.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Turn a recording into text
|
|
2
|
+
|
|
3
|
+
**Use when** a WAV recording must become text. You cannot hear audio yourself, so this has no self-service alternative.
|
|
4
|
+
|
|
5
|
+
**Model:** `lfm3-audio:2b-q4_K_M` (1.7 GB), or `lfm3-omni:2b-q4_K_M` (2.0 GB), which also does images.
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{"tool": "audio", "arguments": {"action": "transcribe", "model": "lfm3-audio:2b-q4_K_M", "file": "recordings/standup.wav", "language": "en"}}
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Translate into another language:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{"tool": "audio", "arguments": {"action": "translate", "model": "lfm3-audio:2b-q4_K_M", "file": "recordings/standup.wav", "toLanguage": "fr"}}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The input must be WAV; convert other formats first (`ffmpeg -i a.mp3 a.wav`). Ollama splits long audio at pauses.
|
|
18
|
+
|
|
19
|
+
**Check it:** numbers and names are the usual misses. Measured here on generated speech only (1.7% word error); expect more errors on real recordings.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Sweep a large job in small, checked chunks
|
|
2
|
+
|
|
3
|
+
**Use when** a check is too big to read yourself but splits cleanly: every file of a code tree, a long log, the pages of a docs site. A small local model judges each chunk with your questions, in the background and one chunk at a time. Every result is saved as it lands, and you read only what was flagged.
|
|
4
|
+
|
|
5
|
+
**Skip it when** there are only a few items (use `run_task` with `tasks`), or when a missed finding would be costly and you will not verify the flagged ones.
|
|
6
|
+
|
|
7
|
+
**Models:** a decision model for triage, such as the catalog's `classify` pick `strands-decider:2b-nvfp4`. Optionally add a stronger `verifyModel` that re-asks only what was flagged or unsure, and an `explainModel` with an `explainPrompt` that writes one note per confirmed flag. See `models {view:"catalog", job:"classify"}` for what is installed and fits now.
|
|
8
|
+
|
|
9
|
+
## How it works
|
|
10
|
+
|
|
11
|
+
1. **Split.** `files` (paths or globs) or `urls` (a polite crawl of public pages: robots.txt honored, GET only, at most 200 pages, no local or private hosts) are cut into labelled chunks of about 750 tokens: `path:Lstart-Lend` or `url#n`.
|
|
12
|
+
2. **Triage.** The decision model answers your `questions` for every chunk. Yes/no (`noul`) questions flag a chunk at probability 0.5 or more; `flags` sets other rules, such as `{question:"kind", when:"bug", atLeast:0.7}`. A probability just below a threshold is **unsure**, not clear.
|
|
13
|
+
3. **Verify and explain.** Flagged and unsure chunks are re-asked by `verifyModel`. Chunks that stay flagged get a short note from `explainModel`.
|
|
14
|
+
4. **Save.** Each result is appended to `~/.octocode/freellama/sweeps/<id>/results.jsonl` before the next chunk starts. Transient refusals retry; memory refusals wait for memory. After a cancel or a server restart, `resume` continues where the sweep stopped.
|
|
15
|
+
5. **Compare.** Pass `baseline` (an earlier sweep of the same source) and unchanged chunks reuse its results. The status then reports what is new, changed, unchanged and removed, so a re-run costs only what changed.
|
|
16
|
+
|
|
17
|
+
## Calls
|
|
18
|
+
|
|
19
|
+
Start a code check; it returns at once:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{"tool": "sweep", "arguments": {"action": "start", "name": "error handling", "files": ["src/**/*.ts"], "model": "strands-decider:2b-nvfp4", "questions": {"swallowed": {"type": "noul", "instructions": "Does this code catch an error and silently ignore it?"}}, "verifyModel": "bonsai-2:9b"}}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Follow it. Each call blocks up to 50 s and streams progress when the client sends a progressToken:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{"tool": "sweep", "arguments": {"action": "wait", "sweepId": "00000000-0000-4000-8000-000000000000"}}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Read the flagged chunks, then open the cited ranges yourself:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{"tool": "sweep", "arguments": {"action": "results", "sweepId": "00000000-0000-4000-8000-000000000000", "filter": "flagged"}}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Hand every flagged chunk to another task: `saveAs` writes them, under a summary of the counts, to `handoffs/<name>.md` and returns `handoff_file`, which a later `run_task` reads with `files`:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{"tool": "sweep", "arguments": {"action": "results", "sweepId": "00000000-0000-4000-8000-000000000000", "filter": "flagged", "saveAs": "swallowed-errors"}}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Check a docs site for outdated install steps, two link hops deep:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{"tool": "sweep", "arguments": {"action": "start", "urls": ["https://docs.example.com/"], "crawl": {"maxPages": 40, "maxDepth": 2}, "model": "strands-decider:2b-nvfp4", "questions": {"outdated": {"type": "noul", "instructions": "Does this page tell the reader to run a command or install a version that looks deprecated?"}}}}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Re-run next week and see only what happened since:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{"tool": "sweep", "arguments": {"action": "start", "files": ["src/**/*.ts"], "model": "strands-decider:2b-nvfp4", "questions": {"swallowed": {"type": "noul", "instructions": "Does this code catch an error and silently ignore it?"}}, "baseline": "00000000-0000-4000-8000-000000000000"}}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{"tool": "sweep", "arguments": {"action": "results", "sweepId": "00000000-0000-4000-8000-000000000000", "filter": "changed"}}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Split the work well
|
|
60
|
+
|
|
61
|
+
- One question per concern, phrased about one chunk ("Does this code…"), never about the whole repository.
|
|
62
|
+
- Put judgment you must stand behind in your own review of the flagged chunks, not in the questions.
|
|
63
|
+
- Keep one model per sweep. `maxParallelism` stays 1 unless the machine has spare slots (`doctor {view:"status"}`).
|
|
64
|
+
- Split a source of more than 5,000 chunks into several sweeps, for example one per directory.
|
|
65
|
+
|
|
66
|
+
**Check it:** read 3 to 5 flagged chunks and 2 clear ones before trusting the rest. Raise a threshold with `atLeast` when too much is flagged, and add `verifyModel` when too little of what is flagged holds up.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Speak text aloud
|
|
2
|
+
|
|
3
|
+
**Use when** the user wants to hear a result. It does not save tokens: it is for the person, not for you.
|
|
4
|
+
|
|
5
|
+
**Model:** `phonon:en` (0.1 GB, Apple silicon, Ollama 0.40.9 or later). See `models {view:"catalog", job:"text-to-speech"}` for rivals and languages.
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{"tool": "audio", "arguments": {"action": "speak", "model": "phonon:en", "text": "Tests passed. The release is ready.", "outputFile": "reply.wav"}}
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Without `outputFile`, the WAV goes to the temp directory. The result is its path and length, never the audio. Input is limited to 4,096 characters; omit `voice` for the default.
|
|
12
|
+
|
|
13
|
+
On macOS, play it with `afplay reply.wav`.
|
|
14
|
+
|
|
15
|
+
**Check it:** listen once. The score in the catalog measures how well a machine transcribes the audio, not how natural it sounds.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Octocode's GitHub tools research public and private repositories without cloning them: find a repo, its code, its history, and its packages.
|
|
2
|
+
Call: octocode <tool> '{"queries":[{...}]}' (1-5 queries per call)
|
|
3
|
+
Result: JSON with results[].data. Exit 0 found, 1 nothing found, 2 bad input (the message names the field), 3 not found, 4 not logged in (octocode auth login), 7 rate limited (wait).
|
|
4
|
+
More: follow a printed next or {"cursor":"..."}; no next and no hasMore means the result is complete.
|
|
5
|
+
|
|
6
|
+
ghSearchRepo: find a repository when you do not know its owner or name.
|
|
7
|
+
{"operation":"search","keywords":["local llm router"],"filters":{"language":"Rust"}}
|
|
8
|
+
{"operation":"get","owner":"ollama","repo":"ollama"} one repo: description, stars, default branch
|
|
9
|
+
artifactSearch: find a package's repository and versions.
|
|
10
|
+
{"operation":"resolve","ecosystem":"npm","packageName":"zod"} also pypi, maven
|
|
11
|
+
ghStructure: see a repo's layout; operation "refs" lists branches, "languages" its languages.
|
|
12
|
+
{"operation":"tree","owner":"ollama","repo":"ollama","path":"server","maxDepth":2}
|
|
13
|
+
ghSearchCode: find a word or name inside a repo when you do not know the file.
|
|
14
|
+
{"owner":"ollama","repo":"ollama","keywords":["SystemOneRequest"]} returns paths, lines and a commitSha
|
|
15
|
+
ghGetFileContent: read a file you found; ask for the least that answers.
|
|
16
|
+
{"owner":"ollama","repo":"ollama","path":"api/types.go","view":"symbols"} outline
|
|
17
|
+
{"owner":"ollama","repo":"ollama","path":"api/types.go","ranges":[{"startLine":600,"endLine":640}]}
|
|
18
|
+
{"owner":"ollama","repo":"ollama","path":"api/types.go","matchString":["type SystemOneRequest"]}
|
|
19
|
+
ghSearchHistory: find why something changed: pull requests, issues, commits.
|
|
20
|
+
{"operation":"pullRequest","owner":"ollama","repo":"ollama","keywords":["systemone"]}
|
|
21
|
+
{"operation":"commit","owner":"ollama","repo":"ollama","keywords":["decision"]} or operation "issue" with "filters":{"state":"open"}
|
|
22
|
+
ghGetHistoryItem: read one pull request, or issue, you found.
|
|
23
|
+
{"operation":"pullRequest","owner":"ollama","repo":"ollama","number":18606,"sections":["body","files"]}
|
|
24
|
+
|
|
25
|
+
Work smart:
|
|
26
|
+
1. Narrow: repo, then search, then read only the ranges you need. Never read whole files first.
|
|
27
|
+
2. Reuse what a result returns: its path, commitSha (as ref) and the next step it suggests.
|
|
28
|
+
3. Search words are exact code words, not sentences: one to three identifiers beat a question.
|
|
29
|
+
4. Nothing found proves little: try another word or check the repo name before saying it does not exist.
|
|
30
|
+
5. Answer with owner/repo, path:line or PR number as evidence, and stop as soon as the question is answered.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Octocode is a read-only code research CLI: it finds code in a directory so you read a few exact lines, not whole files.
|
|
2
|
+
Call: octocode <tool> '{"queries":[{...}]}' (1-5 queries per call; paths relative to the working directory)
|
|
3
|
+
Result: lines of findings, then "#" notes. Exit 0 found, 1 nothing found, 2 bad input (the message names the field), 3 path not found.
|
|
4
|
+
More: copy a printed {"cursor":"..."} as the whole input. No cursor means the result is complete.
|
|
5
|
+
|
|
6
|
+
structureSearch: see the layout or list files, when you do not know where to look.
|
|
7
|
+
{"operation":"tree","path":".","maxDepth":2}
|
|
8
|
+
{"operation":"files","path":".","include":["**/*.rs"],"view":"paths"}
|
|
9
|
+
localSearch: find a word, name or error text, when you do not know the file.
|
|
10
|
+
{"path":".","matchString":["memory_holders"],"view":"files"} which files
|
|
11
|
+
{"path":".","matchString":["memory_holders","holders"]} matching lines with line numbers; several words mean any of them
|
|
12
|
+
localFetch: read a file an earlier result named (src/a.rs below is a placeholder); ask for the least that answers.
|
|
13
|
+
{"path":"src/a.rs","view":"symbols"} outline with line numbers
|
|
14
|
+
{"path":"src/a.rs","ranges":[{"startLine":40,"endLine":90}]}
|
|
15
|
+
{"path":"src/a.rs","matchString":["fn run"],"contextLines":{"before":2,"after":15}}
|
|
16
|
+
astSearch: find code by shape, not by text. Use it to find where something is declared.
|
|
17
|
+
{"operation":"symbols","path":".","symbolFilter":{"terms":["run"],"mode":"exact"}} declarations named run
|
|
18
|
+
{"operation":"match","path":".","rule":{"pattern":"eval($X)"}} every call of this shape
|
|
19
|
+
lspSearch: who defines, uses or calls a symbol; exact where text search only guesses. Take path and line from an earlier result, never guess them.
|
|
20
|
+
{"path":"src/a.rs","symbolName":"run","line":35} its definition
|
|
21
|
+
{"operation":"references","path":"src/a.rs","symbolName":"run","line":35,"view":"files"} where it is used
|
|
22
|
+
{"operation":"callers","path":"src/a.rs","symbolName":"run","line":35} also callees, hover, documentSymbols
|
|
23
|
+
|
|
24
|
+
Work smart:
|
|
25
|
+
1. Narrow before reading: list files or matching lines first, then read only those ranges.
|
|
26
|
+
2. Try several words at once: put synonyms in one matchString, or several queries in one call.
|
|
27
|
+
3. Build and dependency folders are skipped already; add "testCode":"exclude" to skip tests.
|
|
28
|
+
4. Nothing found proves little: widen the words or the path before saying something does not exist. If lspSearch is empty, use localSearch.
|
|
29
|
+
5. Answer with file:line evidence, and stop as soon as the question is answered.
|
package/native/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* Cancels one deferred task and waits for its local admission permits to be released.
|
|
5
6
|
*
|
|
@@ -139,17 +140,6 @@ export declare function removeTaskJob(endpoint: string | undefined | null, jobId
|
|
|
139
140
|
*/
|
|
140
141
|
export declare function route(endpoint: string | undefined | null, task: string, objective?: string | undefined | null, model?: string | undefined | null, sessionId?: string | undefined | null, contextTokens?: number | undefined | null, requiredCapabilities?: Array<string> | undefined | null, minConfidence?: string | undefined | null, executionPreference?: string | undefined | null, minPlacementEvidence?: string | undefined | null): Promise<string>
|
|
141
142
|
|
|
142
|
-
/**
|
|
143
|
-
* Executes caller-declared independent managed tasks with bounded, priority-fair dispatch.
|
|
144
|
-
*
|
|
145
|
-
* # Errors
|
|
146
|
-
*
|
|
147
|
-
* Returns an error if `freellama serve` is unreachable or rejects the batch envelope. Individual
|
|
148
|
-
* task failures remain explicit entries in the successful batch response so sibling work is not
|
|
149
|
-
* discarded.
|
|
150
|
-
*/
|
|
151
|
-
export declare function runTaskBatchRequest(endpoint: string | undefined | null, request: unknown): Promise<string>
|
|
152
|
-
|
|
153
143
|
/**
|
|
154
144
|
* Object-based managed task API for callers that need the complete task contract without a long,
|
|
155
145
|
* ABI-fragile positional argument list. The request is forwarded to `/_freellama/v1/tasks`, where
|