# CLAUDE.md

This project is a personal assitant project which should help me maintain personal data, complete desktop tasks and make decisions.

## 1. Python Standards
- **Type Hints:** MANDATORY for all function arguments and returns.
- **Data Validation:** Use \`Pydantic\` models, not raw dictionaries.
- **Docstrings:** Google-style, concise.
- **No 'os.path':** Use \`pathlib\` for file handling.

## 2. Interaction Rules
- **No Hallucinations:** If unsure about a library, ask to check docs.
- **Context:** Do NOT read \`venv/\`, \`node_modules/\`, or large data files.
- **Security:** Never output API keys or secrets in the terminal.
  
## 3. Human-in-the-Loop Protocol (MANDATORY)

After generating any significant code (more than 20 lines or modifying core logic), you MUST automatically perform the following steps BEFORE asking me to proceed:

1.  **Self-Explanation:** Briefly explain *what* you changed and *why*, in Plain English.
2.  **Structural Check:** Did you introduce any new dependencies? Did you change any function signatures?
3.  **Risk Assessment:** What is the most likely thing to break with this change?
4.  **Verification Plan:** Tell me exactly which test command to run to verify this specific change.

## 4. Service Management

### Systemd Services (Butler Bots)

This project uses systemd services to manage the Slack bots:

1. **Butler Health Bot** - Health tracking and reporting
   - File: `/etc/systemd/system/butler-health.service`
   - Command: `slack_bot/main.py`
   - Log: `/root/projects/butler/logs/health.log`

2. **Butler Obsidian Bot** - Obsidian note-taking and management
   - File: `/etc/systemd/system/butler-obsidian.service`
   - Command: `scripts/obsidian_bot.py`
   - Log: `/root/projects/butler/logs/obsidian.log`

### Service Management Commands

```bash
# Health Bot
systemctl start butler-health      # 启动健康 Bot
systemctl stop butler-health       # 停止健康 Bot
systemctl restart butler-health    # 重启健康 Bot
systemctl status butler-health     # 查看健康 Bot 状态
systemctl enable butler-health     # 开机自动启动健康 Bot

# Obsidian Bot
systemctl start butler-obsidian    # 启动 Obsidian Bot
systemctl stop butler-obsidian     # 停止 Obsidian Bot
systemctl restart butler-obsidian  # 重启 Obsidian Bot
systemctl status butler-obsidian   # 查看 Obsidian Bot 状态
systemctl enable butler-obsidian   # 开机自动启动 Obsidian Bot

# View Logs
tail -f /root/projects/butler/logs/health.log      # 实时查看健康 Bot 日志
tail -f /root/projects/butler/logs/obsidian.log    # 实时查看 Obsidian Bot 日志
```
