AI-powered development assistant with multi-model support, memory system, and autonomous coding pipeline
Project description
ZhuShou (助手) - AI-Powered Development Assistant
An AI-powered development assistant with multi-model LLM support, three-tier memory, tool execution, and an autonomous 7-stage coding pipeline.
Features
- Multi-provider LLM support - Ollama, OpenAI, Anthropic, DeepSeek, Gemini, LM Studio, vLLM
- Interactive REPL with streaming responses and slash commands
- 11 built-in tools - file read/write/edit, shell commands, glob, grep, search, git operations
- 7-stage autonomous coding pipeline - Requirements, Architecture, Tasks, Implementation, Testing, Debugging, Verification
- Three-tier memory system - persistent JSON KV store, JSONL conversation logs, ChromaDB vector search
- Context window management - automatic compaction when 80% of context budget is used
- Token tracking and cost estimation per provider/model
- Persona configuration via Markdown files
- Sibling tool discovery - integrates tools from Chou, GangDan, Huan, Liao, NuoYi, CopyTalker, LaPian
- .git directory protection - refuses to modify git internals
Requirements
- Python >= 3.10
- httpx (required)
- rich (required)
Installation
From PyPI
pip install zhushou
From Source
git clone https://github.com/cycleuser/ZhuShou.git
cd ZhuShou
pip install -e .
With Optional Dependencies
# Install with vector search support
pip install zhushou[vector]
# Install with specific LLM providers
pip install zhushou[openai]
pip install zhushou[anthropic]
pip install zhushou[gemini]
# Install everything
pip install zhushou[all]
Quick Start
After installation, the zhushou command is available:
# Launch interactive REPL
zhushou
# Single-turn chat
zhushou chat "Explain Python decorators"
# Run the 7-stage autonomous pipeline
zhushou pipeline "Build a Gomoku game" -o ./output
# List available models
zhushou models
# Show configuration
zhushou config
# Show version
zhushou -V
Usage
zhushou [options] [command]
Global Options
| Option | Short | Description |
|---|---|---|
--version |
-V |
Show version |
--verbose |
-v |
Verbose output |
--json |
Output results as JSON | |
--quiet |
-q |
Suppress non-essential output |
--output DIR |
-o |
Working / output directory |
--provider |
LLM provider (default: ollama) | |
--model |
-m |
Model name |
--api-key |
API key for cloud providers | |
--base-url |
Custom API endpoint URL |
Subcommands
| Command | Description |
|---|---|
chat |
Send a message to the assistant |
pipeline |
Run the 7-stage autonomous coding pipeline |
models |
List available models across providers |
config |
Show or edit configuration |
Interactive REPL Commands
| Command | Description |
|---|---|
/help |
Show available commands |
/quit or /exit |
Exit the REPL |
/clear |
Clear conversation history |
/stats |
Show token usage statistics |
LLM Providers
| Provider | Key | Notes |
|---|---|---|
| Ollama | ollama |
Local, free, default |
| OpenAI | openai |
Requires API key |
| Anthropic | anthropic |
Requires API key |
| DeepSeek | deepseek |
Requires API key |
| Gemini | gemini |
Requires API key |
| LM Studio | lmstudio |
Local, OpenAI-compatible |
| vLLM | vllm |
Local, OpenAI-compatible |
# Use with Ollama (default)
zhushou --provider ollama --model llama3
# Use with OpenAI
zhushou --provider openai --api-key sk-... --model gpt-4o
# Use with DeepSeek
zhushou --provider deepseek --api-key sk-...
# Use with a custom endpoint
zhushou --provider openai --base-url http://localhost:8080/v1
Autonomous Pipeline
The 7-stage pipeline generates a complete project from a text description:
- Requirements - Analyse the request and produce a specification
- Architecture - Design file structure and module layout
- Task Breakdown - Create ordered implementation tasks
- Implementation - Write code file by file
- Testing - Generate and run tests
- Debugging - Fix any failing tests (up to 5 retries)
- Verification - Final check and summary
zhushou pipeline "Build a REST API with Flask" -o ./my_api
Memory System
ZhuShou provides three tiers of persistent memory:
| Tier | Storage | Purpose |
|---|---|---|
| Persistent KV | ~/.zhushou/memory.json |
Facts, preferences, project metadata |
| Conversation Log | ~/.zhushou/logs/{date}.jsonl |
Full message history per day |
| Vector Search | ChromaDB (optional) | Semantic search over past conversations |
Persona Configuration
Customise the assistant's behaviour by creating a persona file:
# Project-local persona
mkdir -p .zhushou
cat > .zhushou/persona.md << 'EOF'
# Identity
You are a senior Python developer specialising in data science.
# Rules
- Always use type hints
- Prefer pandas over raw loops
# Tools
- Use python_exec for quick calculations
EOF
Search order: .zhushou/persona.md -> ~/.zhushou/persona.md -> built-in default.
Project Structure
ZhuShou/
├── zhushou/ # Main package
│ ├── llm/ # LLM provider abstraction
│ │ ├── base.py # BaseLLMClient ABC + dataclasses
│ │ ├── ollama_client.py # Ollama provider
│ │ ├── openai_client.py # OpenAI / DeepSeek / LM Studio
│ │ ├── anthropic_client.py # Anthropic
│ │ ├── gemini_client.py # Google Gemini
│ │ ├── factory.py # LLMClientFactory
│ │ └── model_registry.py # Context windows & pricing
│ ├── executor/ # Tool execution
│ │ ├── tool_executor.py # Sandboxed dispatcher
│ │ ├── builtin_tools.py # 11 built-in tools
│ │ └── sibling_tools.py # Sibling package discovery
│ ├── agent/ # Core agent loop
│ │ ├── loop.py # Interactive REPL + tool loop
│ │ ├── context.py # Context window management
│ │ └── conversation.py # Conversation buffer
│ ├── memory/ # Three-tier memory
│ │ ├── persistent.py # JSON KV store
│ │ ├── conversation_log.py # JSONL logger
│ │ └── vector_store.py # ChromaDB / numpy fallback
│ ├── pipeline/ # Autonomous pipeline
│ │ ├── stages.py # 7 stage definitions
│ │ └── orchestrator.py # Pipeline runner
│ ├── display/ # Rich console output
│ ├── persona/ # Persona loader
│ ├── tracking/ # Token usage tracker
│ ├── git/ # Git operations
│ ├── utils/ # Constants, python finder
│ ├── api.py # Unified Python API
│ ├── tools.py # OpenAI function-calling schemas
│ └── cli.py # CLI entry point
├── tests/ # pytest tests
├── old/ # Original prototype
├── pyproject.toml # Package configuration
├── README.md # This file
└── README_CN.md # Chinese documentation
Development
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run with verbose output
pytest -v
Python API
from zhushou import chat, run_pipeline, search_pypi
# Single-turn chat
result = chat("Explain list comprehensions", provider="ollama", model="llama3")
print(result.success) # True / False
print(result.data) # Assistant response text
# Run the autonomous pipeline
result = run_pipeline("Build a calculator app", output_dir="./calc")
print(result.data) # Pipeline stats
# Search PyPI
result = search_pypi("requests")
print(result.data) # List of package info dicts
Agent Integration (OpenAI Function Calling)
ZhuShou exposes OpenAI-compatible tools for LLM agents:
from zhushou.tools import TOOLS, dispatch
# Pass TOOLS to the OpenAI chat completion API
response = client.chat.completions.create(
model="gpt-4o",
messages=messages,
tools=TOOLS,
)
# Dispatch the tool call
result = dispatch(
tool_call.function.name,
tool_call.function.arguments,
)
CLI Help
License
MIT License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zhushou-0.1.0.tar.gz.
File metadata
- Download URL: zhushou-0.1.0.tar.gz
- Upload date:
- Size: 69.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
672c3b9657cd52feb82cf6499136f05e9b289cce17a8e839377eca7962d4e39c
|
|
| MD5 |
b5d10297de697dc7721e90c7243d920f
|
|
| BLAKE2b-256 |
038410693e5b042d9f43fcc945889bf0afe680b00d0b75349363045d95047c9e
|
File details
Details for the file zhushou-0.1.0-py3-none-any.whl.
File metadata
- Download URL: zhushou-0.1.0-py3-none-any.whl
- Upload date:
- Size: 76.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecc9b8dcb34d733b55e570306ac7bf4da7f7d8438730b573d31545ab72dc3371
|
|
| MD5 |
1ade2963438757592903bed50caa7fd6
|
|
| BLAKE2b-256 |
dd2dff5af55087af6ea3c3dcc3595e79c8b12801b25066fce6af9d473a006bfa
|