EP

ericwang915/pythonclaw

Developer tools
44ย stars ํ’ˆ์งˆ 40 ํŠธ๋ Œ๋“œ 40

๐Ÿ Personal AI agent in pure Python โ€” OpenClaw reimagined. Memory, RAG, skills marketplace, cron, voice. Telegram/Discord/WhatsApp/Web. Works with DeepSeek, Claude, Gemini, Kimi, GLM, Ollama.

๊ฐœ์š”

A personal AI agent you own โ€” in pure Python. pip install and talk to it from your terminal, a web dashboard, or Telegram / Discord / WhatsApp. It remembers what matters, learns new skills on demand, and runs tasks on a schedule. The Python reimagining of OpenClaw โ€” no Node.js, no Rust, no C extensions. Just Python. Quick Start ยท Local with Ollama ยท Docker ยท Providers ยท Skills ยท Config ยท Library - ๐Ÿ โ€” one pip install, no Node/Rust/C toolchain. Import it as a library, not just a CLI. - ๐Ÿ”Œ โ€” DeepSeek, Claude, Gemini, Kimi, GLMโ€ฆ or : no API key, nothing leaves your machine. - ๐Ÿ“ก โ€” the same brain answers from your CLI, a browser dashboard, and group chats, each with isolated memory. - ๐Ÿงฉ โ€” pulls from a 13K-skill marketplace, and can write and install a brand-new skill at runtime when none fits. Prefer to stay fully offline?

README

PythonClaw

A personal AI agent you own โ€” in pure Python. pip install and talk to it from your terminal, a web dashboard, or Telegram / Discord / WhatsApp.It remembers what matters, learns new skills on demand, and runs tasks on a schedule.

The Python reimagining of OpenClaw โ€” no Node.js, no Rust, no C extensions. Just Python.

Quickย Start ยท Localย withย Ollama ยท Docker ยท Providers ยท Skills ยท Config ยท Library


Why PythonClaw

  • ๐Ÿ Pure Python, zero build step โ€” one pip install, no Node/Rust/C toolchain. Import it as a library, not just a CLI.
  • ๐Ÿ”Œ Any model, or none โ€” DeepSeek, Claude, Gemini, Kimi, GLMโ€ฆ or 100% local with Ollama: no API key, nothing leaves your machine.
  • ๐Ÿ“ก One agent, everywhere โ€” the same brain answers from your CLI, a browser dashboard, and group chats, each with isolated memory.
  • ๐Ÿงฉ It grows itself โ€” pulls from a 13K-skill marketplace, and can write and install a brand-new skill at runtime when none fits.

Quick Start

pip install pythonclaw

pythonclaw onboard    # pick a provider, paste an API key (or choose Ollama โ€” no key)
pythonclaw start      # daemon + web dashboard at http://localhost:7788
pythonclaw chat       # or just chat in the terminal

Prefer to stay fully offline? One line, no key:

LLM_PROVIDER=ollama pythonclaw chat      # needs a local Ollama running

Whatโ€™s inside

Feature Details
๐Ÿง  Provider-agnostic DeepSeek, Grok, Claude, Gemini, Kimi, GLM, Ollama (100% local) โ€” or any OpenAI-compatible API
๐Ÿ› ๏ธ Self-extending skills Three-tier progressive loading (metadata โ†’ instructions โ†’ resources) + a 13K-skill ClawHub marketplace, and the agent can author its own
๐Ÿ’พ Persistent memory Plain-Markdown long-term memory with daily logs and semantic recall โ€” grep-able, backup-able, no database
๐Ÿ” Hybrid RAG BM25 + dense embeddings + RRF fusion + LLM re-ranking over your own docs
๐ŸŒ Web dashboard Browser UI for chat, config, skill catalog, identity editing, and marketplace
๐ŸŽ™๏ธ Voice input Speech-to-text via Deepgram, or fully local with Whisper (stt.provider: "whisper")
โฐ Cron jobs Schedule tasks in config, or let the agent schedule its own and message you
๐Ÿ“ก Multi-channel CLI, Web, Telegram, Discord, WhatsApp โ€” one agent behind every front-end

CLI Reference

Command Description
pythonclaw onboard Interactive setup wizard โ€” choose LLM provider, enter API key
pythonclaw start Start the agent as a background daemon
pythonclaw start -f Start in foreground (no daemonize)
pythonclaw start --channels telegram discord whatsapp Start with messaging channels
pythonclaw stop Stop the running daemon
pythonclaw status Show daemon status (PID, uptime, port)
pythonclaw chat Interactive CLI chat (foreground REPL)
pythonclaw skill search Search skills on ClawHub
pythonclaw skill browse Browse top-rated skills
pythonclaw skill install Install a community skill
pythonclaw skill info View skill details

First Run

$ pythonclaw start

  โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
  โ•‘       PythonClaw โ€” Setup Wizard      โ•‘
  โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

  Choose your LLM provider:

    1. DeepSeek
    2. Grok (xAI)
    3. Claude (Anthropic)
    4. Gemini (Google)
    5. Kimi (Moonshot)
    6. GLM (Zhipu / ChatGLM)
    7. Ollama (100% local โ€” no API key)

  Enter number (1-7): 1
  โ†’ DeepSeek

  API Key: ********
  โ†’ Key set (sk-****)

  Validating... โœ” Valid!
  โœ” Setup complete!

[PythonClaw] Daemon started (PID 12345).
[PythonClaw] Dashboard: http://localhost:7788

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         PythonClaw                            โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ CLI      โ”‚ Daemon     โ”‚ Sessions  โ”‚      Core                โ”‚
โ”‚          โ”‚            โ”‚           โ”‚                          โ”‚
โ”‚ onboard  โ”‚ start /    โ”‚ Store(MD) โ”‚ Agent                    โ”‚
โ”‚ chat     โ”‚ stop /     โ”‚ Manager   โ”‚ โ”œโ”€ Memory (Markdown)     โ”‚
โ”‚ skill โ€ฆ  โ”‚ status     โ”‚ Locks +   โ”‚ โ”œโ”€ RAG (Hybrid)          โ”‚
โ”‚          โ”‚            โ”‚ Semaphore โ”‚ โ”œโ”€ Skills (3-tier)        โ”‚
โ”‚ Web UI โ—„โ”€โ”ค Channels   โ”‚           โ”‚ โ”œโ”€ Compaction            โ”‚
โ”‚ Voice In โ”‚ Telegram   โ”‚ Per-group โ”‚ โ”œโ”€ Soul + Persona        โ”‚
โ”‚          โ”‚ Discord    โ”‚ Isolation โ”‚ โ”œโ”€ Group Context          โ”‚
โ”‚          โ”‚ WhatsApp   โ”‚           โ”‚ โ””โ”€ Tool Execution        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚               LLM Provider Abstraction Layer                 โ”‚
โ”‚ DeepSeek โ”‚ Grok โ”‚ Claude โ”‚ Gemini โ”‚ Kimi โ”‚ GLM โ”‚ Ollama โ”‚ โ€ฆ  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚              ClawHub Marketplace (clawhub.com)               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Web Dashboard

Start with pythonclaw start and open http://localhost:7788.

  • Dashboard โ€” agent status, soul/persona preview, tool list
  • Chat โ€” real-time chat with voice input (Deepgram)
  • Skill Catalog โ€” browse installed skills by category
  • Marketplace โ€” search and install skills from ClawHub
  • Configuration โ€” edit LLM provider, API keys, and settings in-browser

Configuration

All configuration lives in pythonclaw.json (auto-created by pythonclaw onboard). See pythonclaw.example.json for the full template.

{
  "llm": {
    "provider": "grok",
    "grok": { "apiKey": "xai-...", "model": "grok-3" }
  },
  "tavily":   { "apiKey": "" },
  "deepgram": { "apiKey": "" },
  "web":      { "host": "127.0.0.1", "port": 7788 },
  "channels": {
    "telegram": { "token": "" },
    "discord":  { "token": "" },
    "whatsapp": { "phoneNumberId": "", "token": "", "verifyToken": "pythonclaw_verify" }
  },
  "isolation":   { "perGroup": false },
  "concurrency": { "maxAgents": 4 }
}

Environment variables (e.g. DEEPSEEK_API_KEY, TAVILY_API_KEY, LLM_PROVIDER) override JSON values.

Security: the dashboard has full agent access, so web.host defaults to 127.0.0.1 (loopback only). Expose it deliberately โ€” set web.host to 0.0.0.0 (or PYTHONCLAW_WEB_HOST=0.0.0.0 in containers) only behind your own auth/tunnel.


Supported LLM Providers

Provider llm.provider Default Model API key
DeepSeek deepseek deepseek-chat DEEPSEEK_API_KEY
Grok (xAI) grok grok-3 GROK_API_KEY
Claude (Anthropic) claude claude-sonnet-4-20250514 ANTHROPIC_API_KEY (or claude setup-token)
Gemini (Google) gemini gemini-2.0-flash GEMINI_API_KEY
Kimi (Moonshot) kimi moonshot-v1-128k KIMI_API_KEY
GLM (Zhipu) glm glm-4-flash GLM_API_KEY
Ollama (local) ๐Ÿ†• ollama llama3.1 none โ€” 100% local
Any OpenAI-compatible ๐Ÿ†• custom gpt-4o-mini OPENAI_API_KEY

custom works with OpenAI, OpenRouter, LM Studio, vLLM, llama.cpp server โ€” anything speaking the chat-completions protocol (set llm.custom.baseUrl).

Run 100% local with Ollama

No API key, no cloud, your data never leaves the machine:

ollama pull llama3.1        # or qwen3, mistral, โ€ฆ
pip install pythonclaw

LLM_PROVIDER=ollama pythonclaw chat        # CLI
LLM_PROVIDER=ollama pythonclaw start       # daemon + web dashboard

Pick a different model with OLLAMA_MODEL=qwen3, or point at a remote Ollama with OLLAMA_BASE_URL=http://gpu-box:11434/v1.

Troubleshooting: โ€œtimeoutโ€ errors after binding your API key

Not every error containing the word timeout is an API/network timeout. A common case: a script the agent generated (or a downloaded skill) calls subprocess.Popen(cmd, timeout=N) โ€” Popen has no timeout parameter, so Python raises TypeError: Popen.__init__() got an unexpected keyword argument 'timeout'. Your API key and connection are fine; the script just needs subprocess.run(cmd, timeout=N) instead. PythonClaw now detects this and attaches a hint to the tool output so the agent fixes the script on the next round.

If you hit a real network timeout (request hangs ~300 s, error mentions your provider host), check llm..baseUrl โ€” a missing /v1 suffix is the most common cause โ€” and verify the endpoint answers curl $BASEURL/models.


Docker

docker run -p 7788:7788 \
  -e LLM_PROVIDER=deepseek -e DEEPSEEK_API_KEY=sk-... \
  -v pythonclaw-data:/root/.pythonclaw \
  $(docker build -q .)

Or with compose (edit the environment block / use a .env file):

git clone https://github.com/ericwang915/PythonClaw.git && cd PythonClaw
docker compose up -d

Fully local stack: run Ollama on the host and set LLM_PROVIDER=ollama โ€” the compose file already routes host.docker.internal for you.


Skills

Three-Tier Progressive Loading

Level Loaded When Content
L1 โ€” Metadata Always (startup) name + description from YAML frontmatter
L2 โ€” Instructions Agent activates skill Full SKILL.md body
L3 โ€” Resources As needed Bundled scripts, schemas, data files
---
name: code_runner
description: Execute Python code safely in an isolated subprocess.
---
# Code Runner

## Instructions
Run `python {skill_path}/run_code.py "expression"`

ClawHub Marketplace

Browse and install 13,000+ community skills from ClawHub โ€” free, no API key required:

pythonclaw skill search "database backup"
pythonclaw skill install 

Also accessible from the web dashboard Marketplace tab.


Memory & RAG

Markdown Memory

~/.pythonclaw/context/memory/
โ”œโ”€โ”€ MEMORY.md           # Curated long-term memory
โ””โ”€โ”€ 2026-02-23.md       # Daily append-only log

When per-group isolation is enabled ("isolation": { "perGroup": true } in config), each session (Telegram chat, Discord channel, etc.) gets its own memory/, persona/, and soul/ under ~/.pythonclaw/context/groups//, while global memories remain accessible via read-through fallback.

TOOLS.md โ€” Local Notes

~/.pythonclaw/context/tools/
โ””โ”€โ”€ TOOLS.md              # Your environment-specific cheat sheet

Skills define how tools work. TOOLS.md stores your specifics โ€” SSH hosts, device nicknames, project paths, preferred defaults, API endpoints. Keeping them apart means you can update skills without losing your notes, and share skills without leaking your infrastructure. Editable from the web dashboard.

Hybrid RAG Pipeline

Query โ†’ BM25 (sparse) + Embeddings (dense) โ†’ RRF Fusion โ†’ LLM Re-ranker โ†’ Top-K

Use as a Library

from pythonclaw import Agent
from pythonclaw.core.llm.openai_compatible import OpenAICompatibleProvider

provider = OpenAICompatibleProvider(
    api_key="sk-...",
    base_url="https://api.deepseek.com/v1",
    model_name="deepseek-chat",
)

agent = Agent(provider=provider)
print(agent.chat("What is the capital of France?"))

Project Structure

PythonClaw/
โ”œโ”€โ”€ pythonclaw/
โ”‚   โ”œโ”€โ”€ main.py                # CLI entry (onboard/start/stop/status/chat/skill)
โ”‚   โ”œโ”€โ”€ onboard.py             # Interactive setup wizard
โ”‚   โ”œโ”€โ”€ daemon.py              # PID-based daemon lifecycle
โ”‚   โ”œโ”€โ”€ server.py              # Multi-channel daemon server
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ agent.py           # Core reasoning loop
โ”‚   โ”‚   โ”œโ”€โ”€ tools.py           # Tool schemas and execution
โ”‚   โ”‚   โ”œโ”€โ”€ skill_loader.py    # Three-tier skill system
โ”‚   โ”‚   โ”œโ”€โ”€ skillhub.py        # ClawHub marketplace client
โ”‚   โ”‚   โ”œโ”€โ”€ persistent_agent.py
โ”‚   โ”‚   โ”œโ”€โ”€ compaction.py      # Context compaction
โ”‚   โ”‚   โ”œโ”€โ”€ llm/               # Provider adapters
โ”‚   โ”‚   โ”œโ”€โ”€ memory/            # Markdown memory
โ”‚   โ”‚   โ”œโ”€โ”€ knowledge/         # Knowledge-base RAG
โ”‚   โ”‚   โ””โ”€โ”€ retrieval/         # BM25 + dense + fusion + reranker
โ”‚   โ”œโ”€โ”€ channels/              # Telegram, Discord, WhatsApp
โ”‚   โ”œโ”€โ”€ scheduler/             # Cron jobs, heartbeat
โ”‚   โ”œโ”€โ”€ web/                   # FastAPI dashboard + static assets
โ”‚   โ””โ”€โ”€ templates/             # Built-in skill templates
โ”œโ”€โ”€ context/                   # Runtime data (gitignored)
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ pythonclaw.example.json    # Configuration template
โ””โ”€โ”€ LICENSE

Development

git clone https://github.com/ericwang915/PythonClaw.git
cd PythonClaw
python -m venv .venv && source .venv/bin/activate
pip install -e .
pytest tests/ -v

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.


Comparison with OpenClaw

Feature OpenClaw PythonClaw
Language TypeScript / Node.js Python
Install npm i -g openclaw pip install pythonclaw
CLI openclaw start/stop pythonclaw start/stop/status
Dashboard Web UI Web UI (localhost:7788)
Memory Markdown Markdown (long-term + daily)
Skills Plugin system Three-tier + ClawHub marketplace
Channels Discord, Telegram, WhatsApp CLI, Web, Telegram, Discord, WhatsApp
Voice โ€” Deepgram STT + local Whisper
LLM Providers OpenAI, Anthropic, Gemini DeepSeek, Grok, Claude, Gemini, Kimi, GLM + any OpenAI-compatible
Run fully local โ€” Yes โ€” Ollama, no API key
Deploy npm pip ยท Docker ยท docker-compose
Daemon Background process PID-managed (start/stop/status)

License

MIT


If PythonClaw helps you, consider giving it a โญ

View this README on GitHub

์ถ”์ฒœ ๋„๊ตฌ

๋‹ค๋ฅธ ํ‚ค์›Œ๋“œ๋ฅผ ์ž…๋ ฅํ•˜๊ฑฐ๋‚˜ ํ•„ํ„ฐ๋ฅผ ์ œ๊ฑฐํ•ด ๋ณด์„ธ์š”.

์„ค์น˜

npx skillfish add ericwang915/pythonclaw