Project: Project AI Chatbot Memstore Version: 1.0.2 Date: 2026-10-26 Another collaboration between Andrew.human and Claude.ai
Written to be read by people and by AI models.
A terminal chat with a local Qwen server. Qwen itself remembers nothing between chats. At the start of each chat this program asks memstore.py inject for the entries the operator has approved, and gives them to the model as background facts. It never changes the memory store.
/root/memstore. It holds memstore.py, qwen_propose.py and qwen_memchat.py side by side.export MEMSTORE_DB=/root/memstore/memstore.db (add it to your shell profile). From memstore 1.1.1 the default is /root/memstore/memstore.db whatever folder you run from, so the export is only needed to point somewhere else.Qwen34B.sh for port 8080, or Qwen25_05B.sh for port 8081).python3.8 /root/memstore/qwen_memchat.py --python python3.6 (the Clone's python3.8 has no SQLite; run memstore.py itself with python3.6 too) (add --profile 05b for the small model).qwen_memchat.py saves each chat in ~/qwen_logs as memchat_DATE_TIME.md, with Human: and Qwen: line labels.python3.8 qwen_propose.py ~/qwen_logs/memchat_X.md --operator-marker '^Human:' --assistant-marker '^Qwen:' --out p1.json --verbosepython3.8 memstore.py propose p1.json, then memstore.py review, then approve ID.... Nothing is memory until you approve it.(The proposer's closing line says "on the VPS"; ignore that when everything runs on the Clone.)
You can also add entries by hand at any time: memstore.py add "Operator prefers X" --quote "...".
| Option | Meaning |
|---|---|
--profile 4b|05b |
Model settings. Default 4b (Qwen3-4B, port 8080). 05b is Qwen2.5-0.5B on port 8081. |
--url, --model, --timeout |
Override the profile. |
--context-chars N |
Characters of system text plus history kept (profile: 16000 for 4b, 6000 for 05b). Older turns are dropped first when over. |
--max-tokens N |
Longest reply. Default 400. |
--memstore PATH |
Path to memstore.py. Default: next to this program. |
--python PATH |
Python used to run memstore.py. It needs SQLite. Default: the Python running this program. On the Clone python3.8 has no SQLite but python3.6 does, so use --python python3.6. |
--db FILE |
Database file; same as setting MEMSTORE_DB for this run. |
--limit N |
Most facts handed to the model. Default 20. Corrections do not count against it. |
--no-memory |
Chat without memory. |
--system TEXT |
Extra system text, placed before the memory. |
--print-system |
Print the system text with the memory in it, and exit. Used by the start scripts. |
--print-webui-config |
Same text as web page settings JSON, and exit. |
--logdir DIR |
Where chats are saved. Default ~/qwen_logs. |
Every run prints qwen_memchat 1.0.2 (2026-10-26) once to stderr at start.
Qwen34B.sh (1.2.0) and Qwen25_05B.sh (1.1.0) build the memory text with --print-system / --print-webui-config when they start, save it in the memstore folder, and give it to llama-server using whichever flag that build has: --webui-config-file (web page settings) or --system-prompt-file. They print which one they used, or say that neither exists. Memory is read once at start, so after approving new entries stop the server in your usual ordered way and start it again. If the web page keeps its own saved system message from earlier use, that saved one can override the server's; clear it in the page's settings if the memory seems ignored.
/quit or /exit (or Ctrl-D) leaves.The system text says the listed facts were approved by the operator, to use them as background without reciting them, not to claim anything about the operator beyond them, and to follow lines marked CORRECTION. Small models can still ignore or misuse this; the facts are a nudge, not a guarantee. Check the Memory: N approved entries line at start to confirm they were passed.
-c 8192 for the 4B) is the hard ceiling. --context-chars keeps the chat under it using a rough character count, not exact tokens.memstore.py is missing or fails, the chat continues without memory and says so on stderr.0 normal exit, 2 usage error or log folder cannot be created.
No service is involved. Leave the chat with /quit, then stop the Qwen server in your usual ordered way.
| Version | Date | Change |
|---|---|---|
| 1.0.2 | 2026-10-26 | Added --print-system and --print-webui-config for the start scripts. |
| 1.0.1 | 2026-10-26 | Added --python, since the chat's own Python may lack SQLite. |
| 1.0.0 | 2026-10-26 | First release. |