📝 CONTEXTDEF05B_MANUAL.mdv4.6.0 · 2026-10-19

contextdef_05b.py — manual

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.

1. Purpose

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/.

2. Requirements and install

3. Running it

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.

4. What it asks the model

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.

5. What you see

[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)

6. What it saves

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.

7. Reading the results

What matters for Experiment 001 (where LLM2 adds no words):

8. Known limits in 1.0.0

9. Version history

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/.