Version 1.0.0 — 2026-10-27 — Andrew.human & Claude.ai
Written for humans and for other AIs/machines. Everything a reader needs to run, check or extend the tool is here.
A trial: send a few queries through the small (0.5B) model on a llama-server and see what context definition comes out, how long it takes, and how it differs from the query's own words. It exists to answer, cheaply: can the 0.5B produce a usable subject, intent and list of important terms?
It is not the context definer. It does not read or write the real context-definition store. Everything it saves goes under ctxdef_try/.
http://127.0.0.1:8081).contextdef_05b.py to the folder you run your scripts from. Nothing else to install.contextdef_05b.py --text "Why is serotonin syndrome so dangerous with MDMA?" --text "Is 2C-B safe with SSRIs?"
contextdef_05b.py --file queries.txt # one query per line, blank lines skipped
cat queries.txt | contextdef_05b.py --file -
| Option | Default | Meaning |
|---|---|---|
--text QUERY |
A query. Repeat for several. | |
--file PATH |
Queries, one per line. - is standard input. |
|
--url |
http://127.0.0.1:8081 (or env CTXDEF_URL) |
Where the llama-server is. |
--api chat|completion |
chat |
chat uses /v1/chat/completions (the server applies the model's own chat template). completion uses /completion with Qwen's chat tags written into the prompt, for older builds that lack the chat route. |
--n-predict |
160 | Most tokens the model may write. |
--temperature |
0 | 0 with top_k 1 and a fixed seed, so a repeat gives the same reply. |
--timeout |
180 | Seconds to wait for one reply. |
--out |
$MEMDIR/ctxdef_try |
Output folder (MEMDIR default /root/memstore). |
Before the first query it asks the server for /health and stops with a clear message if the server cannot be reached. Exit code 0 when every reply parsed cleanly, 1 when any query had a note or failed, 2 on an error.
A fixed system prompt plus one worked example (a forum-slowness query and its three-line answer), then your query. The model is asked for exactly three lines:
SUBJECT: the main thing the query is about, in 1 to 4 words
INTENT: one of: question, how-to, troubleshoot, compare, explain, opinion, other
TERMS: 4 to 8 words or short phrases that matter most, most important first, comma separated
The prompt's SHA-256 is saved with every result, so a changed prompt is visible in the record. The worked example is there on purpose: a 0.5B model follows an example far better than an instruction.
[1/2] Why is serotonin syndrome so dangerous with MDMA?
subject : serotonin syndrome
intent : explain
terms : serotonin syndrome | mdma | danger [+] | symptoms [+]
([+] = added by the model, not in the query)
note : no INTENT line
time : 1.84 s (prompt 120 tok, 40 tok out, 33.3 tok/s)
[+] marks a term whose words are not all in the query. These are the model's own additions. Comparison ignores case, accents, hyphens and apostrophes, so 2c-b counts as in the query 2-CB.note lines say what was wrong with the reply: a missing line, an intent not on the list, extra chatter outside the three lines. The reply is never silently repaired; the raw reply is saved untouched.time is wall-clock seconds, plus the server's own figures when it reports them.Under $MEMDIR/ctxdef_try/<run>/ (run = UTC date-time; a second run in the same second gets -2, never overwrites):
| File | Holds |
|---|---|
001.json, 002.json … |
One per query: the query, the raw reply, the parsed subject / intent / terms (each term with in_query), notes, timing, settings, UTC time. |
run.json |
Settings, number of queries, number with a problem, total seconds. |
Files are mode 600 and the folders mode 700.
What matters for Experiment 001 (where LLM2 adds no words):
[+] terms appear, and are they sensible? Each is a word the model brought in.completion route are untried against your llama-server build.completion route assumes Qwen's chat tags (<|im_start|> … <|im_end|>). Another model family needs different tags.| Version | Date | Change |
|---|---|---|
| 1.0.0 | 2026-10-27 | First release: queries through the 0.5B llama-server, SUBJECT / INTENT / TERMS parsed forgivingly, terms marked as in the query or added, timing, one JSON file per query plus a run record under ctxdef_try/. |