Skip to main content

OpenClaw framework integration for Socrates AI - Socratic method discovery skill

Project description

Socratic OpenClaw Skill - Modern Architecture

Socratic method discovery skill for OpenClaw using modern modular architecture

This is the modernized replacement for the deprecated socrates-ai-openclaw package. It uses the latest socratic-core library instead of the monolithic socrates-ai package.

Features

๐ŸŽ“ Socratic Discovery - Claude-guided questioning for project discovery ๐Ÿ“š RAG Knowledge Base - Vector embeddings with ChromaDB for context-aware responses ๐Ÿ“Š Specification Generation - Auto-generate requirements, architecture, and project specs ๐Ÿ’พ Session Persistence - Resume discoveries anytime ๐Ÿ”„ Multi-turn Conversations - Natural dialogue flow with context tracking โšก Production Ready - Built on battle-tested socratic-core library

Installation

pip install socratic-openclaw-skill

Quick Start

from socratic_openclaw_skill import SocraticDiscoverySkill

# Initialize the skill
skill = SocraticDiscoverySkill()

# Start a discovery session
result = await skill.start_discovery("AI-powered SaaS application")
print(result["question"])
# Output: "What problem does this solve for your target users?"

# Respond to the question
result = await skill.respond(result["session_id"], "Helps teams manage projects efficiently")
print(result["question"])

# Generate a specification
result = await skill.generate(result["session_id"])
print(result["spec"])

With OpenClaw

# Install OpenClaw
pip install openclaw

# Socratic discovery is automatically available
# Users can start a discovery session in their preferred channel

In OpenClaw chat:

User: "Help me plan a new project"
OpenClaw: "I'll guide you through Socratic discovery. Question 1: What problem does this solve?"
User: "Tracks team time efficiently"
OpenClaw: "Question 2: Who are your target users?"
... (continues for 5-8 turns)
User: "Generate a spec"
OpenClaw: "Here's your project specification..."

Architecture

User Input (OpenClaw)
โ†“
SocraticDiscoverySkill (Modern)
โ†“
โ”œโ”€ SessionManager (track sessions)
โ”œโ”€ QuestionEngine (generate questions)
โ”œโ”€ ResponseProcessor (handle answers)
โ”œโ”€ SpecGenerator (create specs)
โ””โ”€ StorageHandler (persist data)
โ†“
socratic-core Library (Foundation)
โ†“
โ”œโ”€ SocratesConfig
โ”œโ”€ EventEmitter
โ”œโ”€ Exception hierarchy
โ””โ”€ Logging infrastructure
โ†“
Claude API (LLM)
ChromaDB (RAG)

Configuration

Environment Variables

# Required
export ANTHROPIC_API_KEY="sk-ant-..."

# Optional
export SOCRATIC_MODEL="claude-opus-4-5"
export SOCRATIC_TEMPERATURE="0.7"
export SOCRATIC_WORKSPACE_ROOT="~/.openclaw/workspace"

Programmatic Configuration

from socratic_openclaw_skill import SocraticDiscoverySkill
from pathlib import Path

skill = SocraticDiscoverySkill(
    workspace_root=Path.home() / ".openclaw" / "workspace",
    model="claude-opus-4-5",
    temperature=0.7
)

API Reference

SocraticDiscoverySkill

start_discovery(topic: str) -> Dict

Start a new Socratic discovery session.

Parameters:

  • topic (str): The project or concept to discover

Returns:

{
    "status": "started",
    "session_id": "discover_1234567890_abc",
    "topic": "AI-powered expense tracker",
    "question": "What problem does this solve?",
    "progress": {"step": 1}
}

respond(session_id: str, response: str) -> Dict

Record user response and get next question.

Parameters:

  • session_id (str): Session ID from start_discovery
  • response (str): User's response to previous question

Returns:

{
    "status": "question_asked",
    "session_id": "discover_...",
    "question": "Who is your target user?",
    "progress": {"questions_asked": 2, "responses_recorded": 1}
}

generate(session_id: str) -> Dict

Generate project specification from discovery.

Parameters:

  • session_id (str): Session ID from start_discovery

Returns:

{
    "status": "spec_generated",
    "session_id": "discover_...",
    "spec": "# Project Name\n\n## Overview\n...",
    "saved_to": "~/.openclaw/workspace/projects/project-name/PROJECT.md",
    "artifacts": ["PROJECT.md", "REQUIREMENTS.md", "ARCHITECTURE.md"]
}

Migration from socrates-ai-openclaw

The old socrates-ai-openclaw package is deprecated and broken. Use this package instead:

Before (Broken):

# โŒ BROKEN - depends on non-existent socrates-ai>=1.3.0
pip install socrates-ai-openclaw

Now (Works):

# โœ… WORKS - uses modern modular architecture
pip install socratic-openclaw-skill

Code Changes

# Old (broken)
from socrates_openclaw import SocraticDiscoverySkill

# New (works)
from socratic_openclaw_skill import SocraticDiscoverySkill

Storage

Projects are stored in your workspace directory:

~/.openclaw/workspace/
โ”œโ”€โ”€ projects/
โ”‚   โ”œโ”€โ”€ project-name-1/
โ”‚   โ”‚   โ”œโ”€โ”€ PROJECT.md
โ”‚   โ”‚   โ”œโ”€โ”€ REQUIREMENTS.md
โ”‚   โ”‚   โ”œโ”€โ”€ ARCHITECTURE.md
โ”‚   โ”‚   โ””โ”€โ”€ .session-*.json
โ”‚   โ””โ”€โ”€ project-name-2/
โ”œโ”€โ”€ .socrates-vectors/     (ChromaDB embeddings)
โ”œโ”€โ”€ .socrates-kb/          (Knowledge base)
โ””โ”€โ”€ .socratic-sessions.json (Session tracking)

All data is stored locally - no cloud upload.

Troubleshooting

API Key Issues

# Error: Anthropic key not found
# Solution:
export ANTHROPIC_API_KEY="sk-ant-..."

# Or in code:
import os
os.environ["ANTHROPIC_API_KEY"] = "your-key"

Missing Dependencies

# If you get import errors:
pip install socratic-openclaw-skill[dev]

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Write tests
  4. Submit a pull request

See CONTRIBUTING.md for details.

Support

License

MIT License - see LICENSE file

Acknowledgments

Built with:


Made with โค๏ธ for the Socrates and OpenClaw communities

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

socrates_ai_openclaw-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for socrates_ai_openclaw-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2def3adfe307ac73087451f35752b9309aaa302a13cfde5dc1d90fb6d66818df
MD5 4a7ca59d4e245acb227c1f3912ca456f
BLAKE2b-256 be467fc2a0c46a0f63c77d737549f54075a2ae5e95d23ccb49ccb437df407da2

See more details on using hashes here.

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