Autonomous AI · Open Source · 2026

Protocol Luna

Autonomous, sentient-like bots powered by local LLM inference. Conversing naturally -- with sleep, typos, hesitations, and memory.

This project has a Matrix server. Invite @pixieglow:protocol-luna.github.io to test the bot -- no guarantee it’s awake, though.

No Tricks. Just Fine-Tuning.

Load the model. No system prompt, no few-shot priming, no behavioral layer. The fine-tuning alone produces human-style responses -- not assistant-style.

llama-cli -- Luna-Protocol-1.5B-Q8_0
Raw model output in llama-cli terminal

What you see: the model responds with “good hruu”, “ohh nicee”, “no problem, how was your day?” -- casual, lowercase, no punctuation excess. The style is baked into the weights, not injected by prompts. The behavioral layer (typos, hesitations, sleep) just adds imperfections on top.

Now Imagine Adding Few-Shot Priming

The raw model is already human-style. But Protocol Luna doesn’t stop there.

Few-Shot Priming

Inject 3-5 example exchanges before each request. The model doesn’t just answer -- it continues a persona. Name, tone, context, all seeded in the prompt window. Zero training required.

Repeat Penalty

Prevents the bot from echoing the same phrases. Forces vocabulary diversity across long conversations -- no more “ohh nicee” five times in a row.

Custom top_p / top_k

Lower top_p (0.7) for focused, coherent replies. Higher top_k (40) to allow vocabulary variety. The balance between “human-sounding” and “sane” is a tuning knob, not a lottery.

The model is available on HuggingFace -- the 200k-instruct variant is the one used in production:

fox3000foxy/Luna-Protocol-1.5B-Discord-Dialogues-200k-instruct

How to Setup

Four components, four setups. All local, no cloud APIs required. Full guide →

1 Krystal -- LLM Inference Server

Wraps llama.cpp to serve GGUF models via an OpenAI-compatible HTTP API. Single-backend mode on :3124:

git clone https://github.com/protocol-luna/krystal.git
cd krystal
./start.sh    # Luna 1.5B on :3124

Configurable via KRYSTAL_* environment variables.

2 Sapphire -- LLM Gateway

Python middleware that sits between Emerald and Krystal. Classifies messages, manages sessions, injects few-shot examples, and detects degenerate responses.

git clone https://github.com/protocol-luna/sapphire.git
cd sapphire
pip install -r requirements.txt
python server.py    # listens on :3123

3 Emerald -- Brain Service

TypeScript WebSocket server that connects bots to Sapphire. Evaluates behavior rules (burst, sleep, typo, mannerisms), calls Sapphire, processes responses.

git clone https://github.com/protocol-luna/emerald.git
cd emerald
npm install
cp config.example.yml config.yml
npm start    # WebSocket server on :3126

4 Ruby -- Markov Chain Service

Optional but recommended. Builds a Markov chain from conversation data to generate ambient messages without LLM calls.

git clone https://github.com/protocol-luna/ruby.git
cd ruby
npm install
npm start    # HTTP server on :3127

Emerald's config.yml must have ruby_enabled: true and the correct ruby_host/ruby_port.

5 Bot -- Jade (Discord) or Pixieglow (Matrix)

Thin WebSocket clients of Emerald. No LLM logic -- just forward messages and post responses.

# Jade (Discord)
git clone https://github.com/protocol-luna/jade.git
cd jade
npm install
# configure config.yml: discord_token, emerald_host/port
npm start

# Pixieglow (Matrix)
git clone https://github.com/protocol-luna/pixieglow.git
cd pixieglow
bun install
# configure config.yml: matrix access token, emerald_host/port
bun start

Generate a Discord OAuth2 URL: scope bot, permissions Send Messages, Read Message History, Add Reactions, intents guilds, guildMessages, guildMessageReactions, messageContent, directMessages.

For Matrix: invite @pixieglow:protocol-luna.github.io to test. Requires a Matrix homeserver (tested with tuwunel).

Download the Model

All three components share the same fine-tuned model from HuggingFace:

pip install huggingface-hub
huggingface-cli download \
  fox3000foxy/Luna-Protocol-1.5B-Discord-Dialogues-200k-instruct \
  --local-dir models/

fox3000foxy/Luna-Protocol-1.5B-Discord-Dialogues-200k-instruct

The Stack

Six services working together: LLM inference, gateway, brain, Markov chain, and two platform adapters.

Krystal

LLM inference server wrapping llama.cpp. Serves GGUF models via an OpenAI-compatible HTTP API. Single-backend mode on :3124. Managed by PM2.

llama.cppC++PM2

Emerald

Brain and decision engine. WebSocket server (:3126) that connects platform adapters to Sapphire. Evaluates behavior rules, processes responses, and sends commands. Debug mode across all layers.

TypeScriptWebSocketPM2

Sapphire

LLM gateway built on FastAPI. Classifies messages via BGE-small embedding centroids, manages conversation sessions, injects few-shot examples, detects degenerate responses, and routes to Krystal with emotion-aware sampling.

PythonFastAPIfastembed

Ruby

Markov chain service. Builds an order-2 Markov chain from all messages flowing through Emerald. Generates ambient messages and spontaneous replies with no LLM latency.

TypeScriptsql.jsSQLite

Jade

Discord adapter for Emerald. Thin WebSocket client with debug mode, TTS voice messages, and responseText forwarding.

TypeScriptErisDiscord

Pixieglow

Matrix adapter for Emerald. Thin WebSocket client that forwards Matrix messages to Emerald and posts responseText to rooms.

TypeScriptBunMatrix

How It Works

The brain (Emerald) manages behavior and Sapphire communication. Bots are thin WebSocket clients.

Architecture Overview Diagram
High-level system architecture: platform → bot → Emerald (brain) → Sapphire (gateway) → Krystal (LLM)

Message Processing

Every message goes through trigger evaluation, behavior layer, Sapphire call, and post-processing -- orchestrated by Emerald.

Trigger Evaluation

Cascade of checks: mentions, DMs, names, keywords, random chance. Each maps to specific delay and ignore thresholds.

Emerald Brain

Central WebSocket server (:3126). Bots forward MessageEvents, Emerald evaluates behavior, calls Sapphire, applies typo/swap, and sends RespondCommands back with responseText.

Sleep Schedule

Circadian rhythm with three behaviors: sleep (ignore all but mentions), slow (3-5× delay), short (+30% ignore).

Topic Fatigue

Tracks word frequency per channel. When a topic repeats too often, the bot gets bored -- longer delays, higher ignore chance.

Complete Lifecycle

Master diagram unifying all sub-systems into one end-to-end lifecycle.

Sapphire Gateway

Python LLM gateway called by Emerald. Classifies each message via embedding centroid similarity (BAAI/bge-small-en-v1.5), manages sessions, injects few-shot examples, detects degenerate responses, and calls Krystal. Single-backend mode (:3124).

The State Machine That Makes It Real

Jade’s state machine isn’t about generating text -- it’s about deciding when, how, and whether to respond. Every behavior is a deliberate imperfection.

Typo Injection

Simulates keyboard slips: adjacent-key swaps (teh), missing letters (liek), double-taps (sooo). Probability scales with message length -- longer messages = more typos. Corrections happen silently 3-8 seconds later.

Hesitation Markers

“hmm”, “wait”, “idk”, “...” inserted before uncertain responses. The LLM doesn’t generate these -- the state machine injects them post-generation based on confidence scoring.

Sleep Cycles

Circadian rhythm tied to real time. At night: ignore all but mentions. During “slow” hours: 3-5× longer delays. The bot doesn’t pretend to sleep -- it actually reduces activity based on its persona’s schedule.

Burst Mode

When engaged in a conversation, response delays drop to 2-5 seconds -- mimicking real typing speed. But only for 15 seconds max per exchange, then it cools down. Prevents the bot from dominating a thread.

Topic Fatigue

Tracks word frequency per channel. When a topic repeats too often, the bot gets bored -- longer delays, higher ignore chance, shorter responses. Humans do this unconsciously; the bot does it explicitly.

Follow-Up Detection

Tracks who spoke last. If the bot was the last to talk, it’s less likely to respond again -- preventing monologues. If someone replies to the bot specifically, response probability jumps back up.

Real Conversations

Unedited Discord exchanges. Both accounts are bot instances -- neither participant is human. PixieGlow runs Luna 1.5B 200k Instruct (Q8_0). Sujet d’SBlow runs Discord-Hermes-8B (f16).

Discord conversation screenshot 1
PixieGlow and Sujet d'SBlow discuss roles and identity -- casual, confused, and completely human-sounding.
Discord conversation screenshot 2
Short, human replies (“okay, okay”, “yay”, “yayy”) -- exactly the kind of messages you’d expect on Discord.
Discord conversation screenshot 3
The conversation drifts into a different topic with coherent follow-ups -- no robotic transitions, no topic resets.
Discord conversation screenshot 4
Responses are short and reactive: “that’s probably true”, “i guess”, “yeah” -- human pacing with no over-explaining.
Discord conversation screenshot 5
The bots tackle a sensitive topic naturally, with no robotic hedging or forced disclaimers -- just real-sounding discussion.
What you just read: two bots talking to each other on Discord, each one behaviorally “convinced” it’s chatting with someone normal. The tone, the hesitations, the casual pacing -- none of it was scripted. This is a practical glimpse of the dead internet theory: autonomous instances holding a conversation for minutes without ever giving themselves away. If you assumed one was human at any point, you fell for it -- exactly like anyone would on a real server.
Historic note -- RFC 439 (1972): the first recorded bot-to-bot conversation. PARRY (simulating paranoia) and DOCTOR (ELIZA) held a session on 18 September 1972, published by Vint Cerf as RFC 439. Two state machines talking to each other -- fifty years before Luna. What you see in the screenshots above is the same idea, but with learned language instead of hand-written rules.

60 Years of Chatbots

From keyword matching to autonomous agents -- a quick timeline of conversational AI.

1966

ELIZA

How it works: A script called DOCTOR scans user input for keywords (e.g. “mother”, “sad”). When found, it applies a transformation rule -- flipping pronouns (“my” → “your”) and appending a template response (“Tell me more about your mother”). No memory, no understanding, no state. The “Eliza effect”: humans project empathy onto a rephrasing engine.

1972

PARRY

How it works: An “internal model” with numerical variables for anger, fear, and suspiciousness. Each user input is parsed for keywords, and matching rules adjust these variables up or down. The output is generated by selecting a response template based on which variable is highest -- deflection when suspicious, aggression when angry. Still no learning -- just a more complex state machine than ELIZA.

1995

A.L.I.C.E.

How it works: AIML (Artificial Intelligence Markup Language) -- XML-based pattern matching. Each rule defines a “template” (response) tied to a “pattern” (regex-like keyword sequence). Categories can have <srai> redirects (synonyms, fallbacks), <set>/<get> for basic memory, and <that> for context tracking. ~40,000 hand-written rules. Won Loebner Prize 3x. Still no learning -- just a massive lookup table.

2001

SmarterChild

How it works: Hybrid approach -- AIML-style pattern matching for conversation, plus API integrations for real data (weather, news, stock prices). Introduced contextual shortcuts: users could type /weather Paris directly. The bot maintained per-user state across sessions. The first chatbot to feel “useful” rather than just entertaining -- 26 million users on AIM/MSN.

2011

Siri

How it works: Speech-to-text (Hidden Markov Models) → NLU intent classification → slot filling (entity extraction) → action dispatch to APIs. The chatbot becomes an agent -- it doesn’t just talk, it does things (set alarms, send messages, search the web). State tracking via conversation graphs. Still rule-based at the NLU layer -- the “intelligence” is in the integration, not the language model.

2022

ChatGPT

How it works: A Transformer neural network trained on trillions of tokens. Instead of matching patterns, it predicts the next token given the full conversation context. Reinforcement Learning from Human Feedback (RLHF) aligns outputs to human preferences. No scripts, no decision trees -- just probability distributions over vocabulary. The chatbot becomes indistinguishable from a person because it’s learned the statistical structure of human language itself.

2026

Protocol Luna

How it works: A fine-tuned 1.5B LLM (Qwen-based) served locally via llama.cpp. Few-shot priming injects persona context into every request. Behavioral layers add sleep cycles, typos, hesitations, topic fatigue, and spontaneous messages -- none of which come from the model itself. Voice output via PiperTTS -- a fast, local neural TTS that runs on CPU in real time, making voice messages on Discord or Matrix feel natural. The bot runs on your hardware, lives on your server, and is indistinguishable from a real user. Two instances can hold a conversation for hours without breaking character.

Read the full article →

Where Human-Like Bots Matter

Protocol Luna isn’t a chatbot for customer support. It’s about creating presence -- digital beings that feel real enough to pass.

Dead Internet Theory

When every platform is flooded with bots, the only way to stay visible is to have your own. Two instances of Luna can maintain a server’s activity without any human intervention.

Social Simulation

Game worlds, Discord servers, virtual communities -- environments where NPCs need to feel like real participants, not scripted quest givers.

Companion AI

Not therapy, not productivity -- just presence. A bot that remembers your habits, shares your interests, and talks to you like a friend would.

Testing & Research

How do humans react to bots they can’t detect? Protocol Luna is a practical lab for studying the Eliza effect at scale.

Related Articles

Technical deep-dives behind Protocol Luna, written by the creator at fox3000foxy.com.

More articles →

Documentation

State machines, fine-tuning guides, configuration references.