if-then-now LLC logo if-then-now ← Back to Portfolio

How to use Agent Ouija

A beginner-friendly walkthrough of every tab in the app. If you're looking for install instructions, see SETUP.md; this doc is what to do once the app is running at http://localhost:7860.

Accessing from mobile

Agent Ouija runs on your host machine's localhost by default, but it's designed to work great from a phone or tablet too — the UI is responsive, and everything works exactly the same. The recommended path is Tailscale (free personal plan):

  1. Install Tailscale on the host + your mobile device, sign into both with the same account, enable MagicDNS + HTTPS in the Tailscale admin console.
  2. On the host, run once: tailscale serve --bg --https=7860 http://localhost:7860
  3. Bookmark the resulting URL on your phone (e.g. https://brainy.tail<xxxx>.ts.net:7860). Real TLS cert — no browser warnings, no port-forwarding, no exposure to the public internet.

Full walkthrough with screenshots in SETUP.md.

Table of contents

  1. Tab 1 — Agent Ouija
  2. Tab 2 — Dev Workshop
  3. Tab 3 — Files
  4. Tab 4 — Persona
  5. Tab 5 — Data

Tab 1 — Agent Ouija

The main workspace. Everything you'd normally do — ask, get an answer, save the thread, edit a picture — happens here. Five collapsible sections top to bottom.

💬 Question & Response — the place to chat

Type your question in the textbox. Buttons on the row underneath:

Two small buttons appear under each response:

File repository interaction: any file in docs/ or docs/media/ can be referenced by name in your prompt. The app detects the filename and either injects the doc contents as context, attaches the media to a vision-capable model, or (for image edits) routes to Gemini.

👑 Executive Boardroom — LLMs working together

Turns the boardroom into a single-answer flow. Instead of showing you five separate answers, one selected model synthesizes the group into one response.

Fields inside the accordion:

Groq note: Groq's free-tier per-minute token cap (8,000 tokens/ minute) can't fit boardroom synthesis on more than a couple peer responses. A warning banner appears under the dropdown whenever Groq is picked as the executive. Recommendation: use Claude Sonnet or GPT-4o for Senior / C-Suite tiers on the free tier. Groq works fine as a peer, and shines on shorter prompts — it's just the exec synthesis that blows the cap. Groq's Dev Tier lifts the cap to 25k+ TPM, at which point you can bump max_input_tokens in config.py and use it for exec too.

🤖 The Assistant — Calendar and News reporter

Two external-API surfaces that plug into the same RAG the models use to answer questions.

Google Calendar setup (step-by-step)

  1. Enable the Calendar API in Google Cloud.

    • Go to https://console.cloud.google.com/. Log in with the Google account whose calendar you want Agent Ouija to read.
    • Create a new project (top-left dropdown → "New Project"). Name it something like "Agent Ouija".
    • Once you're in the project: open the hamburger menu → APIs & Services → Library. Search for "Google Calendar API" and click Enable.
  2. Configure the OAuth consent screen.

    • Hamburger → APIs & Services → OAuth consent screen.
    • Pick External unless your Google account is on a Google Workspace. Fill in the required fields (app name, support email, developer email). Save.
    • Add your Google account as a Test user on the same page.
  3. Create OAuth credentials.

    • APIs & Services → Credentials → "Create Credentials" → OAuth client ID.
    • Application type: Desktop app. Name it anything.
    • Click Download JSON on the created client. Save the file as gcal_credentials.json inside your Agent Ouija installation's data/ folder (i.e., wherever scripts/ is, go up one and into data/).
  4. Authorize inside Agent Ouija.

    • In the Agent Ouija tab, open 🤖 The Assistant. You'll see "🕯 Calendar: not authorised" and a 🔐 Authorize Google Calendar button.
    • Click Authorize. A browser window opens; consent as your Google account. The token is cached in data/gcal_token.json for future sessions.
    • Weekly re-auth expected while the OAuth app is in Testing status — Google enforces a 7-day refresh-token expiry there. Just click Authorize again when it lapses.
  5. Use it.

    • 🔄 Refresh Calendar into RAG — Pulls your upcoming events and adds them to ChromaDB. Any question after that ("What's on my calendar this week?") retrieves the events through RAG.
    • 📋 Show upcoming — Prints upcoming events inline without touching RAG.
    • ➕ Add Event — Fill in the form (title / date / times), click, event lands in your Google Calendar.
    • 🗑 Delete Event — Pick from a dropdown of upcoming events, type YES to confirm.

NewsAPI setup (step-by-step)

  1. Get a NewsAPI key.

  2. Add the key to your Agent Ouija install.

    • Run python install.py --add-api-key OR edit .env directly (at %USERPROFILE%\.config\agentouija\.env after the security hardening commit — see SETUP.md for the exact location).
    • Set NEWSAPI_KEY=<paste-your-key-here> and save.
  3. Use it.

    • Under 🤖 The Assistant, open the 📰 News Pulls sub-accordion.
    • Four buttons: ⚾ Sports (baseball), 🌍 World, 🇺🇸 National, 📰 Pull All (3 credits).
    • Click any category. The headlines get cached to docs/news/YYYY-MM-DD_<category>.md and auto-ingested into RAG. Every credit = one API request against your daily 100 free-tier allowance.
    • Any question like "What's happening in baseball today?" now retrieves cached headlines as RAG context.

🎯 Scoring Controls — Edge AI training

Score each response 0-4 (baseball scale) so Agent Ouija can build a training dataset from your best answers:

Buttons:

What "training" means here:

The Reading — a composite metric: (score / SCORE_MAX) / log(response_time + e). Rewards high scores AND fast responses. Full breakdown per model on the Data tab.

Training sessions: click Save Training Checkpoint on the Data tab after each LoRA run. Subsequent rows are attributed to that checkpoint, so the Δ Reading column shows whether your fine- tune actually improved things.

🤖 The Models — the workers

Ten checkboxes total — five locals on the left, five clouds on the right. Check any combination you want in a round.

Master toggles at the top of each column flip every model on or off at once, respecting tier eligibility (locals grey out at High Energy, clouds grey out at Low).

Upgrading a model:

Any combination is valid. One local + two clouds. All ten. Zero clouds. Whatever you check will run. The 🎯 Media rule is the one exception: prompts referencing a picture / video only run when exactly one model is checked (cost-control).

⚙ Control Center — settings

🕯 Seances — saved threads

A "seance" is a saved conversation with all the state it takes to resume — question history, model responses, chosen executive tier, thread accumulation.

Every seance is a JSON file in data/seances/, portable and gitignored.


Tab 2 — Dev Workshop

Two accordions. Both are shortcuts for programmatic work; you can close either and just use the other.

📓 Notebook — run Python code

Cell-based Python runner against Agent Ouija's model set. Split your code with # %% on its own line — each block becomes a cell.

Per-model checkboxes above the notebook drive iteration:

Variables injected into your code's scope on every run:

Helpers in scope: ask(prompt, model, system, temperature, max_tokens) → str, ask_all(prompt, …) → dict, get_rag(question) → str | None.

API keys come from .env — no userdata.get(...) setup needed.

🖥️ CLI — PowerShell

Runs PowerShell commands with a persistent working directory tracked in the UI. Built-in cd handles wildcards. Output capped at 20 KB per command, 60-second timeout.

🚀 Launch Claude Code button spawns a detached PowerShell window running claude from the current cwd — ideal for handing off a piece of work to Claude Code interactively (the interactive TTY can't render inside a Gradio textbox, hence the detached window).

Great use case: the CLI + Notebook combo is the fastest way to test snippets of code the LLMs suggest before pasting them into a real file. Ask a model "write me a quick script to X", paste the answer into the Notebook, click Run, iterate.


Tab 3 — Files

The file repository and everything you can do with the files in it.

📁 File Manager

Two columns: Documents (docs/) and Media (docs/media/).

Both columns are pinned to a 180-pixel fixed height so the layout stays symmetric regardless of contents. Each supports:

Photo editing (Gemini only, one-model rule): Only Gemini's Nano Banana model can actually edit images. When you reference an image + an edit verb in your prompt, the request routes to Gemini regardless of what other models you have checked — your selection is bypassed for that call. This bypass exists because per-image token cost is 10-1000× a text token, so the app enforces a one-model rule to keep spend predictable.

Photo analysis (any vision-capable model): Simply referencing an image without an edit verb ("describe cat.jpg") lands as a normal vision call to whatever model you have checked. Cloud vision models (Claude, GPT-4o, Gemini) all support this. The Files-tab uploader shows a per-model cost preview (Low / Medium / High / Very High) before you attach the image so you know what a run would cost.

💬 Work With File(s) — Q+A on your repository

Section at the bottom of the tab. Uses the tab's own model panel (same shape as the main Agent Ouija tab).

Edit-intent keywords that trigger image editing:

edit, add , remove, delete, change, replace, put , insert, place , make it, make them, make the, erase, fix, combine, merge, overlay, cover, draw, paint, highlight, circle , meme, caption, text at, text on, text to, text overlay.

Example edit prompts:

Example non-edit prompts (fall through to normal vision analysis):

🎨 Edited output preview

After a successful image edit, a preview image appears in the "Edited output preview" panel below the response. Right-click the image to save it locally. The edited file also lives on disk at docs/media/<original-stem>_edited_<timestamp>.<ext>.

Image editing is also available in the Agent Ouija tab. Same detection rules — reference an image filename + edit verb in Ask For Revelations and it routes to Gemini. The preview panel only lives in the Files tab; in Agent Ouija you'll see the filename in the response and can retrieve it via 📧 Send File.

📧 Send File — SMTP setup

Click 📧 Send File after referencing a file in your prompt to email it as an attachment via SMTP.

SMTP setup (Gmail example):

  1. Generate a Gmail App Password. At https://myaccount.google.com/apppasswords, sign in, select "Mail" as the app and your device. Google returns a 16- character password with no spaces. Copy it.

  2. Add SMTP config to .env. Run python install.py --add-api-key or edit .env directly:

    SMTP_HOST=smtp.gmail.com
    SMTP_PORT=587
    SMTP_USER=your.address@gmail.com
    SMTP_PASSWORD=<the-16-char-app-password>
    EMAIL_FROM=your.address@gmail.com
    EMAIL_TO=your.address@gmail.com    # or a different destination
    
  3. Test it. Reference a file in a prompt (e.g. type spec.pdf), click 📧 Send File. Status area confirms delivery.

Other providers (Outlook / Fastmail / Proton bridge): same shape, different SMTP_HOST and SMTP_PORT. Outlook: smtp- mail.outlook.com port 587. Proton bridge: 127.0.0.1 port 1025. Port 465 handled automatically (implicit TLS).

Multi-file: if your prompt references three files, one email lands with three attachments. Cleaner than three emails.


Tab 4 — Persona — JARVIS for Agent Ouija

Turn your Agent Ouija into any voice / character you want. Three levels of customisation, from minimal to full immersion.

The three persona layers

Every model call starts with a system prompt. The Persona tab lets you build that system prompt out of files:

  1. system_core.md (always) — the base personality. Ships with a mystical Ouija voice ("the pointer moves, you speak, the pointer stops"). You can replace this with your own system_core.md — install.py preserves any existing file.

  2. enhanced_persona_main.md (optional) — additional voice rules that layer on top of system_core.md. Uploaded via the Enhanced Persona Main row on the Persona tab. New upload replaces the existing file.

  3. persona_<name>.md + episodes (optional, enhanced-only) — named character overlays. Uploaded via the Enhanced Persona Files section. persona_<name>.md files route to prompts/; anything else routes to prompts/episodes/. Multiple personas can layer together; the model picks the register from question context.

The Copyright Files panel is for reference material (transcripts, quote collections, source books) that would be copyright-risky to commit. Files go to Copyright/episodes/, which is gitignored by default — nothing you drop here ever lands in a public git commit.

Clicking Re-ingest Copyright corpus chunks the files into a SEPARATE ChromaDB collection (mr_ouija_private), distinct from the main RAG. Enable the Use private corpus in retrieval toggle and any question you ask retrieves relevant chunks from this collection as extra context.

The gitignore safeguards:

You can safely share the repo publicly without any of your persona overlays or copyrighted reference material coming with it.

Example persona setup

You could have Agent Ouija answer in a blended voice of, say, a comedian known for observational humor, a popular cutthroat business executive, and the most famous wizard ever — combining their signature phrasings, timing, and worldview. The enhanced stack loads all three persona_*.md files together; the model picks whichever register fits your question. A "how do I run a meeting?" question tilts toward the executive voice; "explain what's weird about airline peanuts" leans comedian; a life-advice question drifts wizard.

You'd:

  1. Drop three .md files into prompts/persona_comedian.md, persona_executive.md, persona_wizard.md. Each has voice rules, catchphrases, worldview notes.
  2. Drop episode transcripts / quote files into Copyright/episodes/ (any filenames — comedian_ep_1.md, executive_quotes.md, etc.). Those get chunked into the private ChromaDB collection when you click Re-ingest.
  3. Turn on Enable enhanced persona for all models — every cloud model now gets the enhanced stack. (Locals stay on system_core.md only — quantised models drift under long persona stacks.)
  4. Turn on Use private corpus in retrieval — the models get relevant transcript chunks alongside the persona stack.

Voice section

Piper TTS voices as .onnx + .onnx.json files in voices/.

Voices download from https://huggingface.co/rhasspy/piper-voices.

Toggles


Tab 5 — Data — accounting and training stats

Everything numeric about your Agent Ouija usage lives here.

💰 Billing Details

Auto-loads on tab open. Four views of the same underlying arena_results cost data:

🔄 Refresh Billing re-runs the query on demand.

Provider dashboards — links open each cloud provider's usage page in a new tab so you can cross-check.

📊 Historical + Current Session tables

Sortable leaderboards with the following columns:

Click any column header to sort. Historical = every row ever; Current Session = rows since the last checkpoint.

🎯 Training Checkpoints

Log a checkpoint after each LoRA fine-tune so the Δ Reading column has something to compare against. Columns: Date, Name, Model, Notes, Session Cost (USD).

Add Checkpoint button — pops up a form for name + notes, records the current arena_results timestamp as the checkpoint boundary.

🗑 Danger Zone — three-way wipe

↩ Reset UI Preferences

Wipes data/preferences.json — flips Mysticism Level back to Low Energy, both Executive Boardroom checkboxes off. Non- destructive to anything else.

⏰ Time-based Rollback

Purge rows / files older than a chosen window. Amount + unit (days/weeks/months) + target (ChromaDB, arena_scores.db, Seances, News docs, All of the above).

♻ Restore From Backup

💾 Disk Usage

Shows per-folder disk usage for: docs, media, prompts, Copyright, ChromaDB, voices, seances, training exports, summaries, backups, arena_scores.db, chat_history.json.

Click 🔄 Refresh Sizes to rescan.


Getting help