LLM-Enhanced Molecular Visualization Platform for Drug Discovery
PymolCode fuses LLM agent capabilities with PyMOL's molecular visualization to create an intelligent platform for structure-based drug discovery.
- π€ Conversational Molecular Visualization - Natural language control of PyMOL
- π§ Persistent Memory System - Agent learns from mistakes and remembers preferences across sessions
- β‘ Hephaestus Orchestrator - Autonomous deep work with two-stage review (spec + quality)
- π OAuth Authentication - Secure login for OpenAI, Google, GitHub Copilot, Anthropic
- π Ultrawork Command - One-command agentic workflow execution
- π¬ Automated Drug Discovery Workflows - Agent-driven structure-based design
- π» Dual Interface - CLI and PyMOL GUI plugin
- π§ Extensible Skill System - Drug discovery-specific agent skills with Oh-My-OpenCode integration
- π MCP Integration - Model Context Protocol for standardized tool interoperability
- π‘οΈ Safety Controls - Policy-guarded actions for scientific reproducibility
- π REST API - Remote control via port 9124
- π¦ 10 PyMOLWiki Scripts - Integrated utility scripts from the community
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PymolCode β
ββββββββββββββββββ¬ββββββββββββββββββ¬ββββββββββββββββββββββββββ€
β CLI Bridge β GUI Client β Python SDK β
β (Headless) β (PyMOL Plugin) β (Scripting API) β
ββββββββββββββββββ΄ββββββββββββββββββ΄ββββββββββββββββββββββββββ€
β Application Core β
β Session β Agent β Skills β Bridge β Memory β Auth β Hephaestus β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β MCP Hub β Molecular Bridge β
β MCP Server β MCP Client β PyMOL Adapter β Services β
βββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββ€
β External Tools (MCP Servers) β
β Docking β Databases β Screening β Analysis β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Python 3.11+
- PyMOL 2.5+ (Open-source or Incentive)
- Open-source:
pip install pymol-open-sourceor build from source - Incentive PyMOL: Download from SchrΓΆdinger
- Open-source:
- UV package manager (recommended) - Install UV
# Clone the repository
git clone https://github.com/chenDeepin/pymolcode.git
cd pymolcode
# Create virtual environment
uv venv
source .venv/bin/activate # or `.venv\Scripts\activate` on Windows
# Install dependencies
uv pip install -e ".[all]"
# Install PyMOL (required for GUI mode)
pip install pymol-open-source
# (Optional) Verify installation
pymolcode --versionFor OAuth-based authentication with LLM providers, set these environment variables:
# OpenAI (ChatGPT Plus/Pro device code flow)
export OPENAI_CLIENT_ID="your-client-id"
# Google Gemini (OAuth device code flow)
export GOOGLE_CLIENT_ID="your-client-id"
export GOOGLE_CLIENT_SECRET="your-client-secret"
# GitHub Copilot (device code flow)
export GITHUB_COPILOT_CLIENT_ID="your-client-id"Note: OAuth is optional. You can also use API keys directly with
pymolcode auth login <provider>.
Security: Never commit client IDs or secrets to version control. For GitHub upload, all OAuth client IDs are read from environment variables.
PymolCode works standalone. For remote AI control via Telegram/Discord, see OpenClaw Extension.
# Login with OAuth (recommended)
pymolcode auth login openai # Device code flow for ChatGPT Plus/Pro
pymolcode auth login google # OAuth for Gemini
pymolcode auth login github-copilot # GitHub Copilot
pymolcode auth login anthropic # API key for Claude
# List stored credentials
pymolcode auth list
# Remove credentials
pymolcode auth logout openai# One-command workflow execution
pymolcode ultrawork "analyze TEAD1 binding pocket and dock 10 ligands"# Launch PyMOL with pymolcode panel
pymolcode# Run bridge server (JSON-RPC over stdio)
pymolcode --headless
# or
pymolcode-bridge# Build TypeScript client
cd node
npm install
npm run build
# Use the client programmatically
# See node/src/bridge-client.tsCore skill frameworks for drug discovery workflows. These provide the API structure for agent orchestration:
| Skill | Status | Description |
|---|---|---|
structure_analysis |
Framework | Basic structure queries (extensible for composition/secondary structure) |
binding_site_analysis |
Framework | Placeholder for binding site characterization |
ligand_comparison |
Framework | Alignment framework (requires PyMOL command integration) |
trajectory_analysis |
Planned | Requires MDAnalysis or MDTraj integration |
π‘ These skills provide the orchestration layer. Full implementations planned for future releases.
The skills/ directory contains reference implementations from external projects for extended capabilities:
| Category | Description |
|---|---|
01-scientific/ |
Cheminformatics, structural biology, genomics |
02-research/ |
Drug discovery research (target search, trends) |
03-ai-ml/ |
Machine learning and AI model training |
Note: Reference skills are educational materials from OpenCode, Orchestra Research, and Trail of Bits. See skills/SOURCES.md for attribution.
# ~/.pymolcode/config.json
{
"llm": {
"provider": "anthropic",
"model": "claude-opus-4-6",
"auth_type": "oauth"
},
"auth": {
"providers": {
"anthropic": {"type": "oauth", "refresh_on_expiry": true},
"openai": {"type": "oauth"},
"google": {"type": "oauth"}
}
},
"agents": {
"hephaestus": {
"model": "claude-opus-4-6",
"parallel_limit": 5
}
},
"skills": {
"discovery_sources": [
"local://~/.pymolcode/skills",
"omo://code-yeongyu/oh-my-opencode"
]
}
}Hephaestus is the discipline orchestrator for autonomous deep work:
- Planning: Decomposes goals into concrete implementation steps
- Delegation: Dispatches tasks to category-specific specialists
- Review Gates: Two-stage review (spec compliance + code quality)
- Completion Enforcement: Drives all tasks to completion
Preferred Models:
- Claude Opus 4.6 / 4.5
- GPT-5.3 / 5.2 Codex
- GLM-5 (Zhipu AI)
- Kimi K2.5
PymolCode includes a persistent memory system that allows the LLM agent to learn from mistakes and remember preferences across sessions.
memory/
βββ memory.yaml # General preferences and accumulated knowledge
βββ lessons.yaml # Lessons learned from mistakes (prevents repetition)
βββ now.yaml # Active tasks and priorities (P0-P3)
βββ YYYY-MM-DD.yaml # Daily session notes
~/.pymolcode/
βββ auth.json # OAuth tokens (0o600 permissions)
βββ artifacts/
β βββ pdb/ # Downloaded PDB structures (cached)
β βββ screenshots/ # Default screenshot location
β βββ scripts/ # Generated scripts
βββ sessions/ # Saved session states
βββ plugins/ # Installed plugins
βββ skills/ # User-installed skills
pymolcode/
βββ python/ # Main Python package
β βββ cli.py # CLI entry point
β βββ agent/ # LLM agent orchestration
β βββ auth/ # OAuth authentication
β βββ bridge/ # JSON-RPC bridge server
β βββ pymol/ # PyMOL integration
β βββ session/ # Session management
β βββ skill/ # Skill registry & bridge
β βββ workflow/ # Ultrawork command
β βββ validation/ # Hash validation
β βββ memory/ # Persistent memory system
β βββ plugins/ # Plugin loader
βββ node/ # TypeScript bridge client
βββ launcher/ # Bridge orchestrator
βββ docs/ # Documentation
βββ memory/ # YAML memory files
βββ skills/ # Reference skills (10 categories)
βββ tests/ # Test suites
| Document | Description |
|---|---|
| API Reference | Python SDK and JSON-RPC API |
| PyMOL Plugin | GUI integration guide |
| Skills Guide | Creating custom skills |
| MCP Integration | External tool integration |
| Memory System | Persistent agent memory |
| Headless Rendering | Running without display |
| SOUL.md | Agent identity & behavioral guidelines |
| AGENTS.md | AI agent context |
See CONTRIBUTING.md for development guidelines.
MIT License - see LICENSE for details.
- CHENRAN JIANG - Creator & Lead Developer
- PyMOL - Molecular visualization foundation
- OpenCode - LLM agent patterns
- oh-my-opencode - Hephaestus orchestrator patterns
- MCP - Tool integration protocol
- pymol-mcp - MCP integration reference
- ChatMOL - LLM interface patterns
If you use PymolCode in your research, please cite:
@software{pymolcode2026,
title = {PymolCode: LLM-Enhanced Molecular Visualization Platform},
author = {Jiang, Chenran},
year = {2026},
url = {https://github.com/chenDeepin/pymolcode}
}Built with β€οΈ for the drug discovery community