Skip to main content

A Socratic TTS coding assistant that watches your Jupyter notebook and speaks guiding questions when you go off-track

Project description

๐Ÿง  Socratic Watchdog

A Socratic TTS coding assistant that watches your Jupyter notebook cells, analyzes them through the lens of the Socratic method, and speaks guiding questions when you go off-track. Stays silent when your code is correct.

"I cannot teach anybody anything, I can only make them think." โ€” Socrates

Features

  • %%socratic cell magic โ€” analyser one cell at a time
  • %socratic_watch on โ€” auto-watch every cell you run
  • TTS audio delivery โ€” speaks questions via espeak-ng (default), edge-tts, or kokoro
  • Socratic method โ€” never gives answers, only asks guiding questions
  • Works everywhere โ€” JupyterLab, Notebook, Colab, VS Code

Quick start

%load_ext socratic_watchdog
%socratic_task Write a function that calculates Fibonacci numbers

%%socratic
def fib(n):
    return fib(n-1) + fib(n-2)  # missing base case!

Socrates will (verbally) ask something like:

"I see your function calls itself โ€” what condition would stop this recursion?"

Installation

# Minimal install (uses espeak-ng for TTS โ€” requires apt install espeak-ng)
pip install socratic-watchdog

# Or with a TTS backend of your choice:
pip install socratic-watchdog[edge-tts]   # cloud neural TTS (free, no API key)
pip install socratic-watchdog[kokoro]     # local neural TTS (82M model, needs torch)

Requires either:

  • Hermes CLI (hermes chat -q) โ€” available on the DIVE platform
  • OpenAI-compatible API โ€” set env vars: SOCRATIC_LLM_BASE_URL, SOCRATIC_LLM_API_KEY

Note: The default TTS backend is espeak-ng. Install it via apt install espeak-ng (Linux) or brew install espeak-ng (macOS). Switch backends with SOCRATIC_TTS_BACKEND=espeak|edge-tts|kokoro.

How it works

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Cell runs   โ”‚ โ†’  โ”‚ Capture      โ”‚ โ†’  โ”‚ LLM with  โ”‚ โ†’  โ”‚ On track?โ”‚
โ”‚ (source +   โ”‚    โ”‚ source code  โ”‚    โ”‚ Socrates  โ”‚    โ”‚ โ†’ SILENT โ”‚
โ”‚  traceback) โ”‚    โ”‚ + error      โ”‚    โ”‚ persona   โ”‚    โ”‚ Off trackโ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚ โ†’ TTS Q  โ”‚
                                                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

The Socrates persona instructs the LLM to:

  1. Never give direct answers or show corrected code
  2. Ask exactly one guiding question
  3. Reference something specific in the student's code
  4. Stay completely silent when correct

Commands

Magic What it does
%%socratic Run a cell with Socratic analysis
%socratic_task ... Describe your coding goal
%socratic_watch on Watch every cell automatically
%socratic_watch off Stop auto-watching
%socratic_off Quick alias to stop
%socratic_reset Clear the task description
%socratic_help Show usage help

Configuration

Env var Default Description
SOCRATIC_TTS_BACKEND espeak TTS engine: espeak (default, local), edge-tts (cloud neural), or kokoro (local neural)
SOCRATIC_TTS_VOICE en-US-AndrewNeural Edge-TTS voice
SOCRATIC_LLM_TIMEOUT 30 Seconds to wait for LLM
SOCRATIC_LLM_BASE_URL https://api.deepseek.com API base URL
SOCRATIC_LLM_API_KEY โ€” API key (or use Hermes CLI)
SOCRATIC_LLM_MODEL deepseek-chat Model name

Architecture

socratic_watchdog/
โ”œโ”€โ”€ _core.py        # Core engine (no IPython deps โ€” works anywhere)
โ”‚   โ”œโ”€โ”€ SocraticWatchdog.analyze()    # prompt โ†’ LLM โ†’ question/silence
โ”‚   โ”œโ”€โ”€ SocraticWatchdog.speak()      # text โ†’ TTS (espeak/edge-tts/kokoro) โ†’ Audio
โ”‚   โ””โ”€โ”€ _call_llm()                   # hermes CLI or direct API
โ”œโ”€โ”€ magics.py       # IPython magics + post-run hook
โ”‚   โ”œโ”€โ”€ %%socratic, %socratic_task, etc.
โ”‚   โ””โ”€โ”€ _post_run_cell_hook           # auto-watch mode
โ””โ”€โ”€ __init__.py     # %load_ext entry point

License

MIT

Related

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

socratic_watchdog-0.1.0.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

socratic_watchdog-0.1.0-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file socratic_watchdog-0.1.0.tar.gz.

File metadata

  • Download URL: socratic_watchdog-0.1.0.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for socratic_watchdog-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9f30a72e96d318bd3fadbab48fa904d76bb1379d16aae505c4a011bba6477581
MD5 b5bf8031ebae9392fa55650f0ea22282
BLAKE2b-256 645c19f26f38e1986390fb1ebc4b461f7f8ab2cf4d4fc90620b15bf15c63a9e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for socratic_watchdog-0.1.0.tar.gz:

Publisher: publish-to-pypi.yml on xamzar/socratic-watchdog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file socratic_watchdog-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for socratic_watchdog-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0df0fe4aad474e2968eb175ed280e7e2c618d4b7ad1cb251bcb3e0ec55de360b
MD5 516aa40da79161d446d9a8fd1582fa8b
BLAKE2b-256 0e1d5dda7abcb12846d89992fc0793f3d8a79030abfd7c4ca9d10832fa000c07

See more details on using hashes here.

Provenance

The following attestation bundles were made for socratic_watchdog-0.1.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on xamzar/socratic-watchdog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page