Content
# Cunzhi
## Say Goodbye to AI Termination Worries, Empower AI to Last Longer
Cunzhi is an intelligent interaction tool based on the MCP (Model Context Protocol), providing pop-up interaction and global memory management features, making AI assistants more durable and intelligent.
## ✨ Features
- 🎯 **MCP Standard Compliance**: Fully compliant with the MCP 2024-11-05 protocol specification
- 🎨 **Beautiful Pop-up Interface**: A modern UI built with Vue 3 + Tailwind CSS
- 🔒 **Secure Markdown Rendering**: Supports code highlighting and secure content rendering
- 🖥️ **Native Application Experience**: A cross-platform desktop application based on Tauri
- ⚡ **Efficient Communication**: Uses inter-process communication for quick responses
- 🛠️ **Flexible Interaction**: Supports predefined options, multiple selections, and free text input
- 🧠 **Global Memory Management**: Smart storage and management of development specifications, user preferences, and best practices
- 📷 **Image Support**: Supports image uploads and Base64 processing
## 📸 Feature Demonstration
### Intelligent Pop-up Interface

_The modern pop-up interface of Cunzhi supports Markdown rendering, code highlighting, predefined options, and free text input._
## 🚀 Quick Installation
### Method 1: Using Installation Script (Recommended)
```bash
# Clone the repository
git clone https://github.com/imhuso/cunzhi.git
cd cunzhi
# Run the installation script
chmod +x install.sh
./install.sh
```
### Method 2: Download Precompiled Version
Download the precompiled version for your platform from the [Releases](https://github.com/imhuso/cunzhi/releases) page:
- **Linux**: `cunzhi-cli-v*-linux-x86_64.tar.gz`
- **macOS (Intel)**: `cunzhi-cli-v*-macos-x86_64.tar.gz`
- **macOS (Apple Silicon)**: `cunzhi-cli-v*-macos-aarch64.tar.gz`
- **Windows**: `cunzhi-cli-v*-windows-x86_64.zip`
**Installation Steps**:
1. Download the corresponding platform's compressed package and extract it.
2. Place the `Cunzhi` and `Wait` CLI tools in any directory.
3. Optionally add them to the PATH environment variable or call them using absolute paths.
**Deployment Example**:
```bash
# Linux/macOS - Global Installation
tar -xzf cunzhi-cli-v*-linux-x86_64.tar.gz
sudo cp Cunzhi Wait /usr/local/bin/
# Linux/macOS - User Directory
tar -xzf cunzhi-cli-v*-linux-x86_64.tar.gz
mkdir -p ~/.local/bin
cp Cunzhi Wait ~/.local/bin/
echo 'export PATH="$PATH:~/.local/bin"' >> ~/.bashrc
# Windows - Custom Directory
# Extract the zip file to C:\cunzhi
# Optionally: Add C:\cunzhi to the system PATH
```
## 📋 Deployment Configuration
### MCP Client Configuration
Add the following configuration to your MCP client configuration file:
```json
{
"mcpServers": {
"Cunzhi": {
"command": "Cunzhi"
}
}
}
```
**Note**: If `Cunzhi` is not in the PATH, please use the absolute path:
```json
{
"mcpServers": {
"Cunzhi": {
"command": "/path/to/Cunzhi"
}
}
}
```
### Tool Collaboration Mechanism
Cunzhi includes two CLI tools that have an intelligent collaboration mechanism:
- **Cunzhi**: MCP server that handles requests from AI clients
- **Wait**: Pop-up interface that provides user interaction
**Auto-discovery Logic**:
1. When the MCP server needs to display a pop-up, it will automatically look for the `Wait` tool.
2. Search order: Same directory → PATH environment variable → Error message
3. This means you can place both tools anywhere as long as they can be found.
## 🛠️ MCP Tools
### 1. zhi - Intelligent Interaction Tool
A pop-up interaction tool that supports various input methods and Markdown rendering.
**Main Parameters**:
- `message` (required): The message content displayed to the user
- `predefined_options` (optional): List of predefined options, supports multiple selections
- `is_markdown` (optional): Whether to enable Markdown format rendering
**Feature Highlights**:
- ✅ Predefined options with multiple selections + free text input
- ✅ Image uploads and Base64 processing
- ✅ Markdown rendering and code highlighting
- ✅ Modern dark theme UI
### 2. jiyi - Global Memory Management Tool
An intelligent memory management system that stores development specifications and preferences by project.
**Main Parameters**:
- `action` (required): Operation type ("remember" or "recall")
- `project_path` (required): Project path
- `content` (required when remembering): Content to remember
- `category` (optional): Memory category (rule/preference/pattern/context)
**Feature Highlights**:
- ✅ Automatically organizes memories by project
- ✅ Intelligent category management (specifications/preferences/patterns/context)
- ✅ Automatic recognition of Git repository root directory
- ✅ Compressed format output to save tokens
## 📋 Usage
### Start the MCP Server
```bash
Cunzhi
```
### Start the Pop-up Interface
```bash
Wait # Start the settings interface
Wait --mcp-request file # MCP pop-up mode
```
### Version Management
```bash
# Check current version
node scripts/version.js --current
# Release a new version
./scripts/release.sh
```
## 📁 Project Structure
```
cunzhi/
├── src/
│ ├── mcp/tools/
│ │ ├── memory/ # Memory management tool
│ │ └── interaction/ # Intelligent interaction tool
│ ├── assets/sounds/ # Audio resources
│ ├── main.rs # Tauri main application
│ └── bin/mcp_server.rs # MCP server
├── scripts/
│ ├── release.sh # Release script
│ ├── version.js # Version management
│ └── README.md # Script usage instructions
├── .github/workflows/
│ └── build.yml # Cross-platform build
├── install.sh # Installation script
├── Cargo.toml # Rust configuration
├── package.json # Node.js configuration
├── tauri.conf.json # Tauri configuration
└── version.json # Version configuration
```
## 🧪 Development
### Local Development
```bash
# Install dependencies
pnpm install
# Run frontend in development mode
pnpm dev
# Build and run the MCP server
cargo build --release
./target/release/Cunzhi
```
### Build Release Version
```bash
# Build frontend
pnpm build
# Build CLI tools
cargo build --release
# Run installation script
./install.sh
```
## 🔧 Troubleshooting
### Build Issues
If you encounter build errors, please check the following:
1. **Linux System Dependencies**:
```bash
# Ubuntu/Debian
sudo apt-get install pkg-config libgtk-3-dev libasound2-dev
# CentOS/RHEL
sudo yum install pkgconfig gtk3-devel alsa-lib-devel
```
2. **Windows Build**:
- Ensure that Visual Studio Build Tools are installed
- Use PowerShell or CMD to run the build commands
3. **macOS Build**:
- Ensure that Xcode Command Line Tools are installed
```bash
xcode-select --install
```
### Runtime Issues
- **Permission Issues**: Ensure that the CLI tools have execution permissions
- **Path Issues**: Ensure both tools are in the same directory or both in the PATH
- **Dependency Issues**: Check if the necessary runtime libraries are installed on the system
## 🤝 Contribution
Contributions are welcome! Please submit Issues and Pull Requests!
## 📄 License
MIT License