← Back to all posts
[AI Project]

Arwanos v10 — The Mental State Monitor and ML Pipeline

June 3, 202612 min read

A few weeks ago, I traveled across the Arab world — almost ten days. It was a remarkable journey, and I met many people along the way, but one person stood out: Feras, a Quality Assurance Engineer who also teaches at a university in Prague, Czech Republic. He's sharp, thoughtful, and we ended up having a long conversation about software testing and — more importantly — how to present a program to an end user in a way that actually makes sense to them.

That conversation stuck with me. So here I am — and this article is an update. A lot has changed since the first introduction. Arwanos is now at v10, and the biggest addition is something I want to walk through in real technical depth: the Mental State Monitor.



Overview: What is Arwanos?

Arwanos is a privacy-first AI personal assistant that runs entirely on your own machine — no cloud, no subscriptions, and no data ever leaves your device. It's built in Python on top of Ollama as the local inference backend, using llama3:8b-instruct-q4_K_M as its main reasoning model.


The core idea is straightforward: Arwanos runs entirely on your own hardware. Every response, every journal entry, every private conversation stays on your machine — nothing is sent to a server. There are other local AI tools out there (PrivateGPT, Jan, LM Studio), but Arwanos is specifically built around psychological self-analysis and adaptive resource management — not just model serving.


Underneath the surface, there's a system called ARM (Adaptive Resource Management) that scores every query before it reaches the model. It asks: Does this question need a web search? Does it need conversation history? How long should the answer be? The answers determine exactly how many resources get used for that specific query. A simple math question uses almost nothing. A complex research question automatically enables web search and extended output — without you changing any settings.



How did Arwanos come to be?

Arwanos went through many stages of development. I started writing it at the end of 2024 under the name Rona — initially to experiment with graph-based algorithms and push the model in unconventional directions. But over time I decided to refactor everything and build something that would actually be useful to me, both psychologically and intellectually.


By early 2025 it had a proper name — Arwanos — and a clear purpose: a personal AI that knows you, not just a generic chatbot. As of v10, it has ten distinct input modes, full bilingual support in English and Arabic, a psychological journal analysis pipeline, and a new machine-learning-backed monitoring system I'll describe in detail below.



What problems did Arwanos help me with?

On the psychological side, I was going through a rough stretch. I was spread too thin — too many goals, too much pressure, pushing myself to the edge of burnout. I needed something personal to help me make sense of it all.


I had been studying self-knowledge and psychology from an Islamic perspective for a while, and I came to appreciate the practice of solitude through self-observation and writing — something close to what Western psychology calls writing therapy. So I built Arwanos to support exactly that: a private journal the AI can read, analyze, and reflect back to you — without sending a single character outside your machine.



The input modes

Let me walk you through the modes you'll actually use day-to-day. Some of these have been renamed since v9.


Mode 1 — Normal Conversation

Just type your question. ARM handles the rest. If the question needs a web search, it fires one automatically. If it doesn't, it skips it entirely and answers from the model's existing knowledge. You don't configure anything — it just works.


Mode 2 — /deep

/deep what is the latest version of Python?

Use this when you know you need fresh, sourced information. It bypasses ARM's decision and always searches the web, returning numbered sources alongside a synthesized answer.


Mode 3 — /analyze (Journal Analysis)

This is the most personal mode, and honestly the one I use most. You write journal entries in psychoanalytical.json — date, mood score, and a description of your day. Then you ask Arwanos questions about your own patterns:

/analyze what are my recurring behavioral patterns?
/analyze where do I tend to avoid things I should face?
/analyze where am I actually growing?

It reads every entry you've written, detects the intent behind your question — behavioral patterns, emotional arc, growth, contradictions — and responds like someone who has genuinely read your diary. Everything is processed locally. Nothing leaves your machine.


Intent is detected across six analytical lenses:


Keywords in your questionAnalytical lens activated
pattern, trigger, habit, behaviorBehavioral Patterns & Triggers
feel, mood, anxious, sad, emotionEmotional Arc Analysis
avoid, procrastinate, delay, skipAvoidance Patterns
contradict, promise, said I wouldContradictions (stated vs actual)
progress, improve, grow, betterGrowth Tracking
friend, family, alone, relationshipSocial / Relationship Patterns

Mode 4 — /lo (Companion Mode)

Where /analyze reads your journal and reports back what it finds, /lo simply talks with you. Think of it as a close friend who remembers your previous conversations and responds with emotional depth rather than cold information dumps.


Mode 5 — /rag (Your Own Documents)

Import any JSON session — your study notes, research summaries, anything you've collected. Then ask questions against it:

/rag what is RAG?
/rag summarize the key points on transformer attention

It searches using a keyword inverted index built at import time — near-instant lookups in O(query keywords), not O(session size). Answers come entirely from what you imported, not from the model's general training. No hallucinations from mixed sources.


Mode 6 — Reply-to-Selection (fast path)

Highlight any text already on screen in the chat, click Reply, and ask a follow-up question about it. Arwanos skips the full ARM pipeline entirely — it takes the selected excerpt (up to 600 characters) directly to the LLM with your question. Response time drops to around 10 seconds because the context is already in front of you. No web search, no history scan.


Mode 7 — /tr (Translation)

Type /tr your sentence here and Arwanos detects the language and translates it. It has full Arabic support with proper BiDi/RTL rendering, so Arabic text displays in the correct direction. If you're bilingual or studying Arabic, this one is genuinely useful.


Mode 8 — /ap (Arabic Processing Pipeline)

This is the full AR → EN → pipeline → AR translation sandwich. Write your query in Arabic — Arwanos translates to English using qwen2.5:7b, runs it through your chosen pipeline on llama3:8b, then translates the answer back to Arabic. You can combine it with any other mode using a flag:

/ap <query>          — normal RAG pipeline
/ap -lo <query>      — companion mode
/ap -analyze <query> — journal analysis
/ap -rag <query>     — RAG session search
/ap -deep <query>    — forced live web search



The Mental State Monitor — ML-Powered Self-Analysis

This is the headline feature of v10. It transforms Arwanos from a journaling assistant into an intelligent psychological monitoring system that learns from your history, adapts to your patterns, and asks progressively deeper questions over time.


Access it by clicking 🧭 Monitor in the web UI sidebar. It opens as a dedicated page in your browser, all served from 127.0.0.1 — nothing goes outside your machine.


Phase 1 — Tuning (psychological profiling)

When you click Start Session, the system does not generate random questions. It first performs a full tuning pass over all your data:


  • Every journal entry you have ever written
  • The complete habits history — total success/failure counts, failure dates, patterns
  • The analyzed.json deep conversation transcript (up to 5,000 characters)
  • All past monitor session insights — distilled analysis from previous check-ins
  • Past journal cross-reference inferences — what past sessions revealed when your answers were compared against journal history

The LLM synthesizes all of this into a structured psychological profile:

{
  "dominant_themes": ["..."],
  "recurring_patterns": ["..."],
  "habit_struggles": ["..."],
  "mood_trend": "...",
  "unresolved_tensions": ["..."],
  "unexplored_areas": ["..."],
  "strengths": ["..."]
}

This profile is the foundation for everything else in the session.


Phase 2 — Question generation (three training sources)

Questions are generated using three simultaneous sources, all cross-referenced before any question is written:


SourceWhat it contains
Source A — analyzed.jsonDeep conversation transcript revealing core patterns
Source B — Monitor session historyEvery answer from past check-ins + AI insights from those sessions
Source C — Professional psychology datasets7,557 real examples from licensed therapists and counselors

Source C is not used as a generic template library. It is keyword-searched using your profile themes and inferences from previous sessions — only the most contextually relevant professional examples are pulled in. The datasets are three publicly available research corpora:


  • CounselChat — 2,749 entries from licensed therapist Q&A sessions
  • Mental Health Counseling Conversations — 3,508 entries of real counseling dialogues
  • ESConv (ACL 2021) — 1,300 emotional support conversation examples

Total: 7,557 professional examples, locally indexed in data/psych_datasets_index.json. After setup, the Monitor runs 100% offline — no API calls, no external service.


Phase 3 — Insight pipeline (after you answer)

After you complete the session questions, a three-step analysis pipeline runs automatically:


Step 1 — Journal cross-reference. Your answers are compared against all your journal entries. The LLM identifies:

  • confirmed_patterns — what your answers confirm that journals already showed
  • contradictions — where what you said today conflicts with what journals show
  • new_revelations — insights only visible by comparing both sources together
  • progression — what has moved forward since older entries
  • key_inference — one sentence capturing the most significant finding

Step 2 — Dataset enrichment. The inferences from Step 1 — not the raw answers — become the keyword search signal against the 7,557 professional examples. Searching on inferences rather than raw text produces far more precise therapeutic references because the LLM has already abstracted the pattern from the noise.


Step 3 — Final insights. The LLM generates four focused paragraphs using all three phases combined: what today's answers confirm or contradict in journal history, the most significant new revelation from cross-referencing, what skipped questions signal and how they connect to confirmed patterns, and one specific actionable step for tomorrow grounded in the key inference.


Anti-duplication — questions never repeat

A three-layer programmatic check runs after every generation to ensure no question appears twice across sessions:


LayerWhat it catches
Character n-gram similarity (≥ 0.22)Morphological variants — "strategies" / "strategy", "emotional" / "emotionally"
Named entity overlap (≥ 2 shared)Same real-world subject — person names, exam codes, named habits
Key noun overlap (≥ 3 shared)Same topic domain even with completely different wording

If any generated question is flagged by any layer, a targeted second LLM call regenerates only that question with explicit instructions to explore different territory. The regeneration prompt also includes a per-category covered-topics map — extracted keywords from every past question grouped by category — so the model knows exactly which ground is already exhausted.


Angle rotation — depth scales with session count

Each psychological category has five dimensions that rotate with session count. To take one example:


Sessionemotional_awareness explores…
#1what the emotion actually is
#2where it originates
#3how it drives decisions
#4when it first appeared
#5what consistently triggers it
#6+cycle repeats — with full session history to reference

Early sessions establish baseline awareness. Mid-range sessions probe the gaps between what you say and what journals show. Deep sessions challenge resistance to change directly. The system becomes more precise with each cycle because the tuning phase in Phase 1 reads all previous session insights as input.


Progress tracking

The Monitor tracks cumulative engagement across sessions: topic progress bars showing how often each psychological category was engaged vs skipped, average mood shift over time, and session history with full Q&A and AI insights viewable in the browser. Each session's cross-reference findings are stored and fed back into the next session's tuning phase — the system accumulates knowledge of your patterns rather than starting from scratch each time.




What does it look like in practice?

Arwanos runs as a native desktop application built with CustomTkinter — no browser tab required, no Electron overhead. The local web interface (Flask, bound to 127.0.0.1:5005) gives you journal browsing, date-range analysis, weekly reports, and access to the Mental State Monitor. You launch the desktop app, click Open Predictive, and it opens in your browser alongside the desktop window. It even has an animated dragon mascot if that's your thing.


The system requirements are reasonable: Python 3.11+, Ollama installed and running, and a GPU with around 6GB of VRAM. It will still run on CPU if you don't have a discrete GPU — just at reduced speed. The Mental State Monitor additionally requires the psychology datasets to be built once with python build_datasets.py; after that it works fully offline.


On Linux, the included arwanos_launcher.sh detects your NVIDIA GPU and VRAM, checks whether Ollama is running on GPU or CPU, starts Ollama automatically if it's offline, and shows a confirmation dialog before launch. On Windows, you can build a standalone Arwanos.exe using PyInstaller — Ollama still needs to be installed separately, but everything else is bundled.



Watch it in action

I recorded a walkthrough where I discuss Arwanos, what it does, and how I use it personally. Worth watching if you're considering setting it up:




Source code

Arwanos is open source. You can read the code, open issues, or fork it from the GitHub repository:


github.com/GMMB1/Transmitted-Ai


The Mental State Monitor is the part of this project I'm most proud of technically. It's not a chatbot wrapper — it's a pipeline that accumulates structured inferences from your own writing over time, cross-references them against professional therapeutic data, and produces questions that deepen with every session. All of it runs on your own hardware, on models you control, against data that never leaves your machine.


The best way to understand a tool like this is to use it for something real — not test queries, but something you actually want to know about yourself. That's when the privacy matters. That's when the journal analysis means something. And that's when the ML pipeline proves its value quietly in the background, without asking you to think about it.


Author: GMM

buy me a coffee: ko-fi.com/ghostman77506