Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
📝 (docs): update documentation and examples for consistency and clarity
cyhhao3be55b5fd71d
diff --git a/.env.example b/.env.exampleindex 43fddddfb..3e97cac9e 100644--- a/.env.example+++ b/.env.example@@ -2,15 +2,6 @@# Options: slack,telegramIM_PLATFORM=slack-# ============== Telegram Configuration ==============-TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here--# Optional: Whitelist of allowed chat IDs (comma-separated)-# Examples:-# null or omit: Accept all chats-# [123456789,987654321]: Only accept messages from these chat IDs-TELEGRAM_TARGET_CHAT_ID=[]-# ============== Slack Configuration ==============# Required for SlackSLACK_BOT_TOKEN=xoxb-your-slack-bot-token@@ -31,9 +22,18 @@ SLACK_TARGET_CHANNEL=[]# If true, bot only responds when @mentioned in channels. Default: falseSLACK_REQUIRE_MENTION=false+# ============== Telegram Configuration ==============+TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here++# Optional: Whitelist of allowed chat IDs (comma-separated)+# Examples:+# null or omit: Accept all chats+# [123456789,987654321]: Only accept messages from these chat IDs+TELEGRAM_TARGET_CHAT_ID=[]+# Claude ConfigurationCLAUDE_PERMISSION_MODE=bypassPermissions-CLAUDE_CWD=./_tmp+CLAUDE_DEFAULT_CWD=./_tmp# Optional: Custom system promptCLAUDE_SYSTEM_PROMPT=diff --git a/CLAUDE.md b/CLAUDE.mdindex a3641b707..73a0e3649 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -57,8 +57,8 @@ IM_PLATFORM=slack python main.pyThe system uses an abstract factory pattern with platform-agnostic interfaces:-1. **BaseIMClient** (`modules/base_im_client.py`): Abstract base class defining the IM interface-2. **IMFactory** (`modules/im_factory.py`): Creates appropriate platform clients+1. **BaseIMClient** (`modules/im/base.py`): Abstract base class defining the IM interface+2. **IMFactory** (`modules/im/factory.py`): Creates appropriate platform clients3. **Controller** (`core/controller.py`): Platform-agnostic business logic coordinator### Key Components@@ -70,8 +70,8 @@ The system uses an abstract factory pattern with platform-agnostic interfaces:### Platform Implementations-- **TelegramBot** (`modules/telegram_bot.py`): Telegram-specific implementation with inline keyboards-- **SlackBot** (`modules/slack_bot.py`): Slack-specific implementation with thread support and Socket Mode+- **TelegramBot** (`modules/im/telegram.py`): Telegram-specific implementation with inline keyboards+- **SlackBot** (`modules/im/slack.py`): Slack-specific implementation with thread support and Socket Mode### Message Flow@@ -113,7 +113,7 @@ Telegram supports traditional slash commands:- `IM_PLATFORM`: Must be "telegram" or "slack"- Platform-specific tokens (see `.env.example`)-- `CLAUDE_CWD`: Working directory for Claude Code execution+- `CLAUDE_DEFAULT_CWD`: Working directory for Claude Code execution### Platform Switching@@ -128,9 +128,9 @@ To extend support to new platforms (Discord, Teams, etc.):3. Create platform config class inheriting from `BaseIMConfig`4. Add platform to `IMFactory.create_client()`5. Update `AppConfig.from_env()` validation-6. Add environment variables to `.env.example`+6. Add environment variables to `.env` template-Reference `modules/slack_bot.py` for a complete implementation example.+Reference `modules/im/slack.py` for a complete implementation example.## Thread and Session Managementdiff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.mdnew file mode 100644index 000000000..0f670c32d--- /dev/null+++ b/CODE_OF_CONDUCT.md@@ -0,0 +1,9 @@+# Contributor Covenant Code of Conduct++This project adopts the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/) Code of Conduct.++- Our Pledge: Provide a harassment-free experience for everyone.+- Our Standards: Be respectful and constructive; harassment and doxxing are unacceptable.+- Enforcement: Report incidents via issues or maintainer email (add contact).++For the full text, see the link above.diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdnew file mode 100644index 000000000..6b803a311--- /dev/null+++ b/CONTRIBUTING.md@@ -0,0 +1,26 @@+# Contributing++Thanks for your interest in contributing!++## Getting Started++- Fork the repo and create a feature branch+- Create and activate a virtualenv+- Install deps: `pip install -r requirements.txt`+- Copy `.env.example` to `.env` and fill values++## Development++- Run locally: `python main.py`+- Lint before PR (add your linter if used)+- Write clear commit messages++## Pull Requests++- One logical change per PR+- Include description, screenshots/logs if UX/behavior changes+- Update docs/README if config or behavior changes++## Code of Conduct++By participating, you agree to the CODE_OF_CONDUCT.mddiff --git a/LICENSE b/LICENSEnew file mode 100644index 000000000..261c3c5bd--- /dev/null+++ b/LICENSE@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2025 The Claude Proxy Authors++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/README.md b/README.mdindex 46187914f..9f47d2ad5 100644--- a/README.md+++ b/README.md@@ -5,21 +5,25 @@ A modular system for controlling Claude Code through multiple instant messaging## Quick Start1. Install dependencies:+```bashpip install -r requirements.txt```2. Create `.env` file from template:+```bashcp .env.example .env# Edit .env with your platform choice and credentials```3. Choose your platform:+- Set `IM_PLATFORM=telegram` for Telegram- Set `IM_PLATFORM=slack` for Slack4. Run the bot:+```bash./start.sh# or@@ -31,6 +35,7 @@ python main.py### Platform SelectionSet `IM_PLATFORM` in your `.env` file:+- `telegram` - Use Telegram Bot- `slack` - Use Slack Bot@@ -56,43 +61,22 @@ For detailed Slack setup instructions, see [docs/SLACK_SETUP.md](docs/SLACK_SETU### Claude Configuration-- `CLAUDE_CWD`: Working directory for Claude Code (default: `./_tmp`)-- `CLAUDE_PERMISSION_MODE`: Permission mode (default: `bypassPermissions`)-- `CLAUDE_CONTINUE_CONVERSATION`: Continue conversations (default: `true`)-- `CLAUDE_SYSTEM_PROMPT`: Custom system prompt (optional)+- `CLAUDE_DEFAULT_CWD` (required): Working directory for Claude Code (e.g. `./_tmp`)+- `CLAUDE_PERMISSION_MODE` (required): Permission mode, e.g. `bypassPermissions`+- `CLAUDE_SYSTEM_PROMPT` (optional): Custom system prompt-### Application Configuration+Claude Code SDK credentials (set via environment, if required by your setup):-- `LOG_LEVEL`: Logging level (default: `INFO`)+- `ANTHROPIC_API_KEY` (or other keys required by `claude-code-sdk`)-## Architecture+### Application Configuration-```-claude-code-bot/-├── config/-│ └── settings.py # Configuration management-├── modules/-│ ├── __init__.py-│ ├── base_im_client.py # Abstract base class for IM platforms-│ ├── base_im_config.py # Base configuration class-│ ├── telegram_bot.py # Telegram implementation-│ ├── slack_bot.py # Slack implementation-│ ├── im_factory.py # Factory for creating IM clients-│ ├── claude_client.py # Claude Code SDK wrapper-│ ├── session_manager.py # Session and message queue management-│ └── settings_manager.py # User settings management-├── core/-│ ├── __init__.py-│ └── controller.py # Platform-agnostic controller-├── docs/-│ └── SLACK_SETUP.md # Slack setup documentation-├── main.py # Application entry point-└── requirements.txt # Dependencies-```+- `LOG_LEVEL`: Logging level (default: `INFO`)## Features### Core Features+1. **Multi-Platform Support**: Works with Telegram and Slack2. **Automatic Execution**: Messages are processed automatically in order3. **Message Queue**: User messages are queued and executed sequentially@@ -105,12 +89,14 @@ claude-code-bot/### Platform-Specific Features#### Telegram+- Direct message and group chat support- Inline keyboard for settings- Message threading via reply-to- Markdown formatting support#### Slack+- **Thread Support**: Each conversation is organized in its own thread- **Socket Mode**: No need for public webhooks- **Channel & DM Support**: Works in both channels and direct messages@@ -119,6 +105,7 @@ claude-code-bot/## CommandsAll platforms support the same commands:+- `/start` - Shows welcome message and IDs- `/status` - Display queue and execution status- `/clear` - Clear message queue@@ -131,11 +118,13 @@ All platforms support the same commands:## Usage### Telegram+1. Start a chat with your bot2. Send messages directly - they'll be queued and processed automatically3. Use commands with `/` prefix### Slack+1. **In Channels**: Mention the bot (`@bot-name your message`)2. **In DMs**: Send messages directly3. Commands work with `/` prefix@@ -145,10 +134,23 @@ All platforms support the same commands:The architecture supports easy addition of new IM platforms:-1. Create a new class inheriting from `BaseIMClient`+1. Create a new class inheriting from `BaseIMClient`2. Implement all abstract methods3. Add configuration class inheriting from `BaseIMConfig`4. Update `IMFactory` to support the new platform5. Add platform-specific environment variables-See `modules/slack_bot.py` for a complete implementation example.\ No newline at end of file+See `modules/im/slack.py` for a complete implementation example.++## License++This project is licensed under the MIT License. See `LICENSE` for details.++## Contributing++Please see `CONTRIBUTING.md`. By participating you agree to the `CODE_OF_CONDUCT.md`.++## Security++- Do not commit secrets. Use `.env` based on `.env.example`.+- The underlying `claude-code-sdk` may require credentials such as `ANTHROPIC_API_KEY` in your environment.diff --git a/SECURITY.md b/SECURITY.mdnew file mode 100644index 000000000..703c6d11a--- /dev/null+++ b/SECURITY.md@@ -0,0 +1,9 @@+# Security Policy++## Reporting a Vulnerability+- Please open a private issue or email the maintainer (add contact) with details.+- Do not disclose publicly until we confirm a fix or mitigation.++## Secrets+- Never commit secrets. Use environment variables (`.env` is git-ignored).+- Tokens required: Telegram/Slack tokens, and the Claude/Anthropic credentials used by `claude-code-sdk` (e.g., `ANTHROPIC_API_KEY`).diff --git a/config/settings.py b/config/settings.pyindex 39829e75a..b583fdf51 100644--- a/config/settings.py+++ b/config/settings.py@@ -73,9 +73,9 @@ class ClaudeConfig:if not permission_mode:raise ValueError("CLAUDE_PERMISSION_MODE environment variable is required")- cwd = os.getenv("CLAUDE_CWD")+ cwd = os.getenv("CLAUDE_DEFAULT_CWD")if not cwd:- raise ValueError("CLAUDE_CWD environment variable is required")+ raise ValueError("CLAUDE_DEFAULT_CWD environment variable is required")return cls(permission_mode=permission_mode,diff --git a/main.py b/main.pyindex ecafcd403..40854d469 100644--- a/main.py+++ b/main.py@@ -19,12 +19,20 @@ def setup_logging(level: str = "INFO"):# For development, you can use this more detailed format:# log_format = '%(asctime)s - %(name)s - %(levelname)s - [%(pathname)s:%(lineno)d] - %(funcName)s() - %(message)s'+ # Ensure logs directory exists+ logs_dir = 'logs'+ try:+ os.makedirs(logs_dir, exist_ok=True)+ except Exception:+ # Fallback to current directory if logs dir cannot be created+ logs_dir = '.'+logging.basicConfig(level=getattr(logging, level.upper()),format=log_format,handlers=[logging.StreamHandler(sys.stdout),- logging.FileHandler('claude_proxy.log')+ logging.FileHandler(f'{logs_dir}/claude_proxy.log')])diff --git a/start.sh b/start.shindex 642ad901e..aa847f924 100755--- a/start.sh+++ b/start.sh@@ -65,13 +65,13 @@ cd "$SCRIPT_DIR"# Load environment variables from .env file if it existsif [ -f .env ]; then- export $(cat .env | grep -v '^#' | xargs)+ # shellcheck disable=SC2046+ export $(grep -v '^#' .env | xargs)elseecho "ERROR: .env file not found!"- echo "Please create a .env file with required environment variables:"- echo " TELEGRAM_BOT_TOKEN=your_bot_token"- echo " TELEGRAM_TARGET_CHAT_ID=your_chat_id (optional)"- echo " CLAUDE_CWD=./_tmp (optional, default: ./_tmp)"+ echo "Please create a .env file with required environment variables."+ echo "You can start from the template:"+ echo " cp .env.example .env && edit .env"exit 1fidiff --git a/status.sh b/status.shindex 76df74486..b8a171da9 100755--- a/status.sh+++ b/status.sh@@ -5,7 +5,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"PID_FILE="$SCRIPT_DIR/.bot.pid"LOG_DIR="$SCRIPT_DIR/logs"-echo "Telegram Bot Status"+echo "Claude Proxy Status"echo "==================="if [ -f "$PID_FILE" ]; thendiff --git a/stop.sh b/stop.shindex 830a18e51..c0334ed67 100755--- a/stop.sh+++ b/stop.sh@@ -4,7 +4,7 @@SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"PID_FILE="$SCRIPT_DIR/.bot.pid"-echo "Stopping Telegram Bot..."+echo "Stopping Claude Proxy..."if [ -f "$PID_FILE" ]; thenPID=$(cat "$PID_FILE")