Xu123-Bob/Baize
Tentang
Makhluk mitologi Tiongkok kuno yang kini bereinkarnasi sebagai asisten VibeCoding kelas enterprise.
AI dan pembelajaran mesinYang dapat Anda lakukan
- Multiple backends: DeepSeek, any OpenAI-compatible API (GLM / Qwen / Kimi / OpenAI), and local Ollama with one-click switching.
- Zero-config startup: Generates config files on first run; users only need to enter the key once.
- Multilingual interaction: Chinese / English / Japanese / Korean / Spanish / French / German / Russian / Arabic. Say English or /lang ja, and the AI thinks and replies in that language.
- Complete toolchain: bash execution, file read/write/edit, glob/grep search, web search and fetch, background tasks, task and todo management.
Pertumbuhan bintang terukur
- dalam 24 jam
- 0
- dalam 7 hari
- -1
- dalam 15 hari
- -35
- dalam 1 bulan
- -5
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliA security assistant for VibeCoding, inspired by a Chinese mythical beast.
An open-source Coding Agent with strong privacy protection and multilingual interaction. It supports multiple backends (DeepSeek / OpenAI-compatible / Zhipu / Tongyi / Kimi / local Ollama) and provides tool calling, skill loading, subagent delegation, context compression, secure sandboxing, and more.
The desktop product is now available on the Microsoft Store.
On-device Privacy Protection
- Bidirectional reversible privacy protection: Sensitive information is replaced with placeholders before being sent to the LLM, and restored automatically after the response. This is transparent to users: history, tool parameters, and final answers remain in original form, while the LLM only sees random unguessable placeholders such as
«PZ_PHONE_a3f8b2c1d4e5f6a7». - Full redaction on disk: Session files, compressed transcripts, and audit logs are automatically redacted before writing (enabled by default). Plaintext PII never appears on disk.
- Injection resistance: Placeholders use 64-bit cryptographic random tokens and cannot be enumerated, forged, or replayed. Old placeholders become invalid immediately after switching sessions.
- Multiple ways to enable privacy protection: Use natural language in the command line, or use the more precise
/privacycommand. - Local agent: No remote database. Runs fully locally and does not collect user information.
Features
- Multiple backends: DeepSeek, any OpenAI-compatible API (GLM / Qwen / Kimi / OpenAI), and local Ollama with one-click switching.
- Zero-config startup: Generates config files on first run; users only need to enter the key once.
- Privacy redaction: Automatically identifies and redacts 30+ types of sensitive information before sending to the LLM (phone numbers, emails, ID cards, passports, bank cards, international numbers, API keys, JWTs, database connection strings, MAC addresses, etc.), then restores after response. The same redaction applies on disk, leaving no plaintext on disk. Supports standard / strict modes, switchable via natural language or
/privacy. - Multilingual interaction: Chinese / English / Japanese / Korean / Spanish / French / German / Russian / Arabic. Say
Englishor/lang ja, and the AI thinks and replies in that language. - Complete toolchain: bash execution, file read/write/edit, glob/grep search, web search and fetch, background tasks, task and todo management.
- Skills system: Load domain knowledge (SKILL.md) on demand so the AI is more professional in specific scenarios.
- Subagents: Delegate complex tasks to subagents with independent contexts to avoid polluting the main session.
- Hooks: Python or Shell hooks support pre/post tool interception, audit logs, auto-formatting, and test gating.
- MCP protocol: Connect external tool servers (GitHub, Filesystem, etc.) via Model Context Protocol.
- Context compression: Two-level compression (tool result truncation + LLM summary), supporting very long conversations.
- Secure sandbox: Command whitelist, path escape detection, dangerous command blocking, sensitive file protection, script injection interception.
- Black-gold themed terminal: Adaptive CJK width, syntax highlighting, diff coloring, thinking folding.
- Desktop version available: Baize Agent desktop is available on the Microsoft Store for direct download.
Product Introduction
Static website: https://baize-agent-website.pages.dev/
Installation, Configuration and Extension Guide
Installation, Configuration and Extension Guide
Interactive interface display
Multilingual Interaction (Terminal)
Baize supports nine languages: 中文, English, 日本語, 한국어, Español, Français, deutsch, русский, العربية.
There are two ways to switch:
Method 1: Just speak (automatic detection)
Baize automatically detects the input language and switches:
>>> 降旨:Hello, help me write a Python script
[系统] 已检测到输入语言为 English,白泽已切换为 English 交互。
(白泽用英文回复)
>>> 降旨:日本語で答えてください
[系统] 已检测到输入语言为 日本語,白泽已切换为 日本語 交互。
(白泽用日文回复)
Method 2: Manual command
>>> 降旨:/lang # 查看当前语言和可用列表
[系统] 当前语言:中文 (zh)
[系统] 可用语言:
zh 中文 ←
en English
ja 日本語
ko 한국어
es Español
fr Français
>>> 降旨:/lang English # 用语言名切换
>>> 降旨:/lang ja # 用语言代码切换
>>> 降旨:/lang 西班牙语 # 中文名也可以
Supports language name / language code / Chinese name / native name. For example, to switch to English, any of English, en, 英语, 英文 works.
Security Design (Core)
Baize enables the following security mechanisms by default:
- Command whitelist: Only common commands such as ls, cat, grep, git, python3 are allowed.
- Path escape detection: All file operations are restricted to the current working directory and /tmp.
- Dangerous command blocking: Blocks patterns such as rm -rf /, fork bombs, curl | sh, git push --force.
- Sensitive file protection: Forbids modification of .env, .ssh/, id_rsa, *.pem, etc.
- Script injection interception: Detects bypasses such as python -c "os.system(...)".
- Process resource limits: Limits CPU, memory, and process count on Linux/macOS.
- Privacy redaction (bidirectional reversible): PII is replaced with random placeholders outbound and restored inbound; disk writes are independently redacted.
- Placeholder injection resistance: 64-bit cryptographic random token + input-side neutralization + session isolation.
- Audit log redaction:
hook_audit_logis redacted before writing + truncated + write refused on failure. If you need to relax restrictions in trusted projects, modify ALLOWED_COMMANDS and FORBIDDEN_PATH_PATTERNS in Baize.py.
Privacy Redaction (Core)
Baize includes bidirectional reversible + on-disk redaction privacy protection covering the full path from input to disk:
- Outbound: Before sending to the LLM, PII is replaced with unguessable placeholders.
- Inbound: Placeholders in LLM responses are restored to original text.
- On disk: Session files, compressed transcripts, and audit logs are independently redacted before writing; no plaintext remains on disk. Disabled by default; enable when needed.
Two Ways to Enable
Method 1: Natural language
>>>降旨:开启隐私脱敏
[系统] 隐私脱敏已开启(标准模式)。
>>>降旨:开启严格脱敏
[系统] 隐私脱敏已开启(严格模式)。
>>>降旨:关闭隐私保护
[系统] 隐私脱敏已关闭。
Method 2: Slash commands
/privacy onenable standard mode/privacy strictenable strict mode/privacy offdisable/privacy statusview status, session ID, rule count, LRU/TTL stats/privacy ruleslist all rules (including enabled status)/privacy rule-off <name>disable a rule/privacy rule-on <name>re-enable a rule/privacy test <text>test redaction effect/privacy clearclear placeholder mappings and rotate session ID
Two Modes
Standard: Mainland China mobile numbers, ID card numbers, bank card numbers (Luhn check), emails, IPv4/IPv6, OpenAI/Anthropic/GitHub/AWS API keys, Bearer Token, private key blocks, password fields, URL credentials.
Strict: All standard rules + Chinese names, QQ numbers, WeChat IDs, mainland China license plates.
How It Works
用户输入(含真实 PII)→ messages 存原文
↓ sanitize_messages()
发给 LLM 的是 [[PHONE_1]]、[[EMAIL_1]]
↓ LLM 响应
返回的占位符 → restore_message()
Restored to original text → disk write / display / tool execution.
- Privacy redaction (bidirectional reversible): PII replaced with random placeholders outbound and restored inbound; disk writes independently redacted.
- Placeholder injection resistance: 64-bit cryptographic random token + input-side neutralization + session isolation.
- Audit log redaction:
hook_audit_logredacted before writing + truncated + write refused on failure.
Smart Tool Parameter Classification
Redacted (plain text parameters, not used for actual execution):
todo,ask_user_question,task_create,task_update
Not redacted (paths/commands/URLs are actually used):
run_read/run_write/run_edit/run_glob/run_grep(paths used for IO)run_bash/background_run(commands are executed)run_webfetch/web_search(URLs are actually sent to the network)set_workspace(path used forchdir)load_skills(skill names are enumerated)agent(subagent context is independently redacted)mcp_*(unknown semantics, conservative handling)
All content is redacted when written to disk (because disk content is not re-executed; security first).
On-disk Redaction
Enabled by default, independent of in-memory redaction. Even if /privacy off (no in-memory redaction), disk writes still use at least standard rules.
Key features:
- On-disk redaction uses an independent, one-time mapping table — placeholders on disk cannot be restored because the mapping table is discarded.
- If on-disk redaction fails, plaintext writing is refused (no downgrade, no silent skip).
- If old session files contain plaintext, they are automatically redacted and rewritten on first save.
How to disable (not recommended): set PERSIST_REDACT_ENABLED = False in Baize.py.
Examples
>>>降旨:/privacy test 我的手机号 13812345678,邮箱 [email protected]
原文:我的手机号 13812345678,邮箱 [email protected]
脱敏:我的手机号 [[PHONE_1]],邮箱 [[EMAIL_1]]
还原:我的手机号 13812345678,邮箱 [email protected]
>>>降旨:/privacy status
[隐私脱敏]
当前模式 : 标准模式 (standard)
会话 ID : 7d2f5e91
启用规则数 : 34 / 41
活跃占位符 : 2
映射容量 : 2 / 2000
TTL : 86400 秒
LRU 淘汰 : 0
TTL 淘汰 : 0
脱敏调用次数: 3
还原调用次数: 3
>>>降旨:/privacy rules
[隐私脱敏规则清单] 共 41 条
【标准+严格】
[✓] phone_cn 中国大陆手机号 (standard,strict)
[✓] id_card_cn 中国大陆身份证号 (standard,strict)
[✓] jwt JWT Token (standard,strict)
...
【仅严格】
[✓] name_cn 中文姓名 (strict)
[✓] address_cn 中文详细地址 (strict)
...
用法:
/privacy rule-off <name> 禁用某条规则
/privacy rule-on <name> 重新启用
Test Examples
❓ FAQ
Q: What if I don't know how to use the terminal? A: Download the desktop version from the Microsoft Store. Search for Baize Agent and install it.
Q: Where should I put the API key? A:
~/.baize/.env, not the.envin the project root.Q: Do I need to reinstall after changing backends? A: No. Just change
active_providerin~/.baize/config.toml.Q: Does local Ollama need an API key? A: No. Set
active_provider = "ollama"and leaveenv_keyempty.Q: How do I switch the working directory? A: In the conversation, say "switch to /path/to/project"; Baize will call the
set_workspacetool.Q: What happens when context is too long? A: Baize automatically performs two-level compression: first truncate old tool results, then ask the LLM to generate a summary. You can also run
/compactmanually.Q: Will it accidentally delete my files? A: The default command whitelist blocks dangerous operations such as
rm -rf /; before writing files, a diff is shown and confirmation is requested.Q: How do I connect Baize to SPSS? A: 1. Install
pip install -r requirements-data.txt; 2. SetSPSS_INSTALL_PATHto the SPSS installation directory; 3. Enable the spss server inMCP/mcp_config.json. See the "Data Access (SPSS / SQL)" section.Q: What should I do if
SPSS batch: NOT FOUNDappears? A: This means the SPSS engine was not found. Check whetherSPSS_INSTALL_PATHcorrectly points to the directory containingstats.exe; if you only process.savfiles, you can ignore this warning (it falls back to file mode).Q: What extra software is needed to connect to SQL databases? A: Install
atengk-mcp-server-rdbmsat the Python layer (pip installdoes this automatically). SQL Server users also need Microsoft ODBC Driver 18 at the system level, which cannot be installed via pip.Q: Will Baize accidentally delete my database data? A: No. SQL MCP allows only SELECT by default and blocks all write operations at the AST level. It is still strongly recommended to create a read-only database account for Baize as a second safeguard.
Q: Will data in SPSS analysis results leak to the LLM? A: If privacy redaction is enabled (
/privacy on), tool results are automatically redacted for phone numbers, emails, ID cards, and other PII before being sent to the LLM. However, it is recommended to also use a read-only database account + data sampling (query only necessary fields) to reduce risk.Q: Why does Baize become slower and use more tokens after adding SPSS/SQL? A: Because tool definitions exposed by MCP servers are sent to the LLM in every conversation round. SPSS has 60+ tools, adding about 6000–12000 tokens of fixed overhead. If your common workflows do not involve SPSS, set its
enabledtofalseand turn it on when needed.
🤝 Contributing
Issues and PRs are welcome. Please read CONTRIBUTOR.md before submitting a PR.
Thank you for every Contributor to Submit PR
- GitHub Contributor: @wangyipeng0724
License
MIT License
Acknowledgements
- This project is hosted on AtomGit in China: https://atomgit.com/Com_Xu/Baize
- Thanks to AtomGit for including this project in the G-star incubation program.
- Thanks to PR contributors, Douyin followers, and students who follow me.
- Inspired by excellent AI Coding tools such as Claude Code and Codex.
- Built on DeepSeek, OpenAI SDK, and MCP.
- Thanks to all developers walking the Vibe Coding road together.
☕ Sponsorship
If Baize is useful to you, sponsorship is welcome. Independent development takes a lot of time. Sponsorship will not change the product update schedule. Thank you for your support!
Contact Me
- If you are interested in Baize or want to participate in open-source cooperation, you can contact me via the following methods.
- Currently, I am open to job opportunities. If my abilities match your needs, I hope to work with you.
Scan the WeChat QR code and note Baize open-source cooperation or corporate recruitment
Scan the Douyin QR code to follow
Jelajahi proyek terkait
Memuat…
