Skip to main content

🧠 Socratic Debug (socratic)

Stop copying stack traces. Start mastering your bugs.
An autonomous pedagogical debugger and mentor powered by LangGraph, PyQt6, and LangSmith.

CI PyPI version Python Version License: MIT


💡 Why Socratic?

When a runtime crash happens, most developers find themselves trapped in one of two extremes:

  1. The Intimidating Traceback: Staring at a terrifying wall of 50-line red terminal text, unsure which line actually caused the root flaw.
  2. The "Copier" Reflex: Blindly copying the error into an LLM chat, pasting the patch without understanding why it failed, only to trigger the exact same design mistake minutes later.

Socratic Debug changes the game.
Instead of dumping stack traces or spoon-feeding copy-paste patches, socratic intercepts uncaught runtime crashes and launches a dedicated desktop mentorship window. It analyzes the bug silently and guides you through a calibrated, interactive dialogue to help you discover, understand, and fix the root cause yourself.


✨ Features

  • 🖥️ Standalone Desktop Window: Launches an isolated, dark-themed GUI terminal window right at the center of your screen. No terminal pollution.
  • 🌍 Pure Native BiDi & Arabic Support: Flawlessly displays English and Arabic with full Right-to-Left (RTL) text shaping and formatting.
  • 🎯 Calibrated Socratic Mentorship: 3-tier adaptive hints (Observation ➔ Mechanism ➔ Idiomatic Prevention).
  • 🧠 Smart Evaluator: Distinguishes between partial observations (e.g., stating a variable's value) and true comprehension before unlocking the defensive code solution.
  • 🔌 Universal LLM Support: Plug into local models via Ollama (Gemma, Llama, Qwen) or cloud providers via OpenRouter / Google Gemini.
  • 📊 Built-in Observability: Native tracing with LangSmith to monitor latency, tokens, and node execution graphs.
  • 🌐 Cross-Platform: Runs seamlessly on Linux, macOS, and Windows.

🚀 Quick Start

Installation

The cleanest, recommended way to install socratic globally across your system without virtual environment conflicts:

# Recommended (isolated global CLI)
pipx install socratic-debug

# Or via standard pip
pip install socratic-debug

Alternatively, use the one-line install script:

# Linux & macOS
curl -sSL https://raw.githubusercontent.com/mohamedelawakey/socratic/main/install.sh | bash

# Windows (PowerShell)
irm https://raw.githubusercontent.com/mohamedelawakey/socratic/main/install.ps1 | iex

🛠️ Usage

You can use socratic in two distinct ways:

You don't need to add any code or imports to your script! Simply prefix your execution:

socratic run my_script.py
  • If your script runs successfully, it outputs normally.
  • If an unhandled exception occurs, the Socratic Mentor Window springs to life immediately!

Method 2: In-Process Runtime Hook

If you are building an application or library and want Socratic guidance baked directly into development runs:

import socratic
socratic.install()

# Your regular application code
number_1 = 10
number_2 = 0
print(number_1 / number_2)  # <-- ZeroDivisionError triggers Socratic window!

⚙️ Configuration (.socratic.yaml)

When you run socratic for the first time, it automatically creates a .socratic.yaml config file in your project or home directory:

# LLM Provider: "ollama" or "openrouter"
provider: "ollama"
provider_name: "gemma4:31b-cloud"
provider_link: "http://localhost:11434"

# API Key (for cloud providers like OpenRouter)
api_key: "your_api_key_here"

# Mentor Personality & Language ("Arabic" or "English")
socratic_language: "Arabic"
socratic_style: "friendly"

# Observability with LangSmith (Optional)
LANGSMITH_TRACING: "true"
LANGSMITH_API_KEY: "lsv2_pt_..."
LANGSMITH_PROJECT: "socratic-debug"

🤝 Contributing

We welcome contributions! Please review our CONTRIBUTING.md guidelines:

  • For large architectural changes or new features, please open a GitHub Discussion first.
  • For minor bug fixes, direct Pull Requests are warmly welcome.

Please note that this project adheres to the Contributor Covenant Code of Conduct.


📄 License

Distributed under the MIT License. See LICENSE for full details.

Metadata

Release files for socratic-debug 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for socratic-debug 0.0.1
File Size Uploaded Provenance Actions
socratic_debug-0.0.1.tar.gz 20.5 kB Without provenance Details for socratic_debug-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for socratic-debug 0.0.1
File Interpreter ABI Platform Actions
socratic_debug-0.0.1-py3-none-any.whl Python 3 none any Details for socratic_debug-0.0.1-py3-none-any.whl

Total release size: 50.1 kB

Release files / socratic_debug-0.0.1.tar.gz

Download URL socratic_debug-0.0.1.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2b641342da3adb72fdc345f88abbb10ee1eac80d5d34cb7e1823385ba2609f87
BLAKE2b-256 checksum
How to use checksums
828e6def6f3538ac27696438400eed1010c936ae72e8dca04222992eb0c9761a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / socratic_debug-0.0.1-py3-none-any.whl

Download URL socratic_debug-0.0.1-py3-none-any.whl
Size 29.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1104299ffdb324c35879bae7bb6c39d07f26ac6430101bf75eb99ce9ec34992
BLAKE2b-256 checksum
How to use checksums
2870de54b4f5947189b549fbd61ef03d2a031d78be0b6e9ce442dccc6a149a8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for socratic-debug 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page