What I Built

I built Shadow Guardian—an air-gapped, local memory-keeping command-line interface (CLI) designed to preserve precious childhood milestones, quotes, and memories for a child, Casey.

Powered entirely offline by a local instance of Gemma 2 (gemma2:2b) running via Ollama and backed by SQLite3, the tool acts as a protective, elegant digital guardian. It greets parents with atmospheric dark-fairy ambiance (using pygame to loop background audio), renders regal responses with a custom typewriter effect, and locks every entry securely inside an un-networked local database.

Demo

Code

Here is a look at the core engine that hooks into Ollama locally, manages SQLite persistence, and handles the atmospheric typewriter pacing:

async def summarize_and_reflect(raw_note: str): prompt = f"{SYSTEM_PROMPT}\n\nParent's Note: {raw_note}\nShadow Guardian:" payload = { "model": MODEL_NAME, "prompt": prompt, "stream": False } async with aiohttp.ClientSession() as session: try: async with session.post(OLLAMA_URL, json=payload) as resp: if resp.status == 200: data = await resp.json() return data.get("response", "").strip() else: return "🌙 *The guardian glares silently through the mist... (Ollama error)*" except Exception: return "🌙 *The shadow realm slumbers. Verify Ollama is running at localhost:11434!*" def dark_typewriter_effect(text: str): """Prints response with regal pacing and triggers soft ambient audio.""" for char in text: sys.stdout.write(char) sys.stdout.flush() if char in ['.', '!', '?']: time.sleep(0.12) elif char == ',': time.sleep(0.05) else: time.sleep(0.018) print() 

How I Built It

Shadow Guardian is built with a lightweight, privacy-first Python stack:

  1. Local Inference Engine: Leveraged Ollama running Gemma 2 (gemma2:2b) locally via asynchronous HTTP (aiohttp). No cloud roundtrips, no API keys, and zero telemetry.
  2. Persistence Layer: Used SQLite3 (whispering_spirit.db) for lightweight, self-contained data storage that lives entirely on an encrypted, local volume.
  3. Atmospheric Interface: Integrated pygame to handle looping background audio (mmaudio-a-cute-ghost-story-512522.mp3), giving the CLI an immersive, storybook-like mood whenever a parent interacts with it.
  4. Terminal UI & Pacing: Utilized rich for gorgeous purple panels, status spinners (Weaving dark enchantments...), and paired it with a custom character-by-character typewriter delay for dramatic effect.

Why Does Open Innovation Matter?

When building a digital time capsule or memory vault for your family—especially your children—trust is everything.

Relying on closed APIs means shipping your most intimate family milestones and journal entries to remote, third-party server farms. Open innovation and local open-weight models (gemma2:2b) make it possible to own your infrastructure entirely, ensuring that your memories remain air-gapped, sovereign, and entirely under your control forever.

The Spirit of It

Building Shadow Guardian started as an exploration of local AI tooling, but the moment it clicked was when I tested it with a real milestone for Casey. Hearing the soft, atmospheric audio loop in the background while local Gemma 2 generated a warm, fiercely protective reflection on screen transformed cold terminal text into a living, breathing digital keepsake that will stand the test of time.