Personal automation task collection using macOS launchd for scheduling daily tasks: daily reports, email organization, desktop cleanup, and tech news aggregation with multi-platform sync.
> Personal automation task collection using macOS launchd for scheduled execution of daily tasks with multi-platform synchronization.
A Python-based automation system that runs four scheduled tasks daily:
```
zhimeng-agent/
├── tasks/
│ ├── config.py # Unified configuration
│ ├── sync_utils.py # Multi-platform sync utilities
│ ├── daily_report/ # Daily report generator (0:00)
│ ├── email_organizer/ # Email organizer (2:00)
│ ├── desktop_organizer/ # Desktop organizer (4:00)
│ ├── tech_news/ # Tech news aggregator (7:00)
│ └── launchd/ # macOS launchd configurations
├── logs/ # Execution logs
└── .env # Environment variables
```
**Purpose**: Generate structured daily work reports from code commits and AI sessions
**Data Sources**:
**Implementation Steps**:
1. Scan configured Git repositories for commits within the last 24 hours
2. Extract commit messages, authors, and timestamps
3. Parse Claude Code session directories for interaction logs
4. Generate structured Markdown report with sections: Code Commits, AI Sessions, Statistics
5. Sync to platforms: Git, Notion, Feishu, Obsidian
**Output Format**:
```markdown
```
**Manual Execution**:
```bash
poetry run python -m tasks.daily_report.main --dry-run # Preview only
poetry run python -m tasks.daily_report.main # Generate and sync
```
**Purpose**: Automatically archive notification emails using himalaya CLI
**Prerequisites**:
1. Install himalaya: `brew install himalaya`
2. Configure Gmail App Password
3. Create `~/.himalaya-config/himalaya/config.toml`
**Archive Rules** (prioritized):
**Implementation Steps**:
1. Connect to Gmail via himalaya CLI
2. Fetch unread emails from inbox
3. Apply rule-based classification (sender domain, subject patterns)
4. Move matched emails to Archive label
5. Generate statistics report by sender category
6. Sync summary to Obsidian
**Manual Execution**:
```bash
poetry run python -m tasks.email_organizer.main --dry-run # Analysis only
poetry run python -m tasks.email_organizer.main # Execute archiving
```
**Purpose**: Clean up desktop and downloads folders by file type
**Organization Rules**:
| File Type | Target Directory |
|-----------|------------------|
| Images (.png, .jpg, .gif, .svg) | ~/Pictures/Desktop-Archive/ |
| Documents (.pdf, .doc, .md, .txt) | ~/Documents/Desktop-Archive/ |
| Archives (.zip, .tar, .gz, .rar) | ~/Downloads/Archives/ |
| Code (.py, .js, .java, .cpp, .go) | ~/Documents/Code-Archive/ |
| Other | ~/Documents/Desktop-Other/ |
**Safety Features**:
**Implementation Steps**:
1. Scan ~/Desktop and ~/Downloads
2. Identify files older than 7 days
3. Classify by extension using rule mapping
4. Create target directories if they don't exist
5. Move files to appropriate archive folders
6. Clean up files older than 30 days in download archives
7. Generate summary report with file counts and moved sizes
8. Sync log to Obsidian
**Manual Execution**:
```bash
poetry run python -m tasks.desktop_organizer.main --dry-run # Preview only
poetry run python -m tasks.desktop_organizer.main # Execute cleanup
```
**Purpose**: Generate daily tech briefing from Hacker News and GitHub Trending
**Data Sources**:
**Output Format**:
```markdown
1. [Article Title](url) (320 points, 45 comments)
> Repository description
```
**Implementation Steps**:
1. Fetch Hacker News top stories via official API
2. Scrape GitHub Trending page for top repositories
3. Extract metadata: points, comments, stars, languages, descriptions
4. Generate formatted Markdown report
5. Sync to Obsidian (News/ folder) and Feishu
**Manual Execution**:
```bash
poetry run python -m tasks.tech_news.main --dry-run # Generate only
poetry run python -m tasks.tech_news.main --hn-count 20 # Custom counts
poetry run python -m tasks.tech_news.main # Generate and sync
```
```bash
FEISHU_APP_ID=your_app_id
FEISHU_APP_SECRET=your_app_secret
OPENAI_API_KEY=your_api_key
NOTION_TOKEN=your_token
```
```python
@dataclass
class TaskConfig:
# Schedule times (hour of day, 24-hour format)
DAILY_REPORT_HOUR: int = 0
EMAIL_ORGANIZE_HOUR: int = 2
DESKTOP_ORGANIZE_HOUR: int = 4
TECH_NEWS_HOUR: int = 7
# Path configuration
IDEAS_ROOT: Path = Path("/Users/username/workspace/ideas")
OBSIDIAN_VAULT: Path = Path("/Users/username/Documents/Obsidian Vault")
# Feishu recipient
FEISHU_RECIPIENT_OPEN_ID: str = "ou_xxxx"
```
```bash
cd /path/to/zhimeng-agent/tasks/launchd
./install.sh install
```
This creates and loads four launchd plist files:
```bash
./install.sh status
```
Shows loaded status for all four tasks.
```bash
./install.sh run daily-report
./install.sh run tech-news
```
```bash
./install.sh uninstall
```
Unloads and removes all launchd plist files.
```bash
tail -f logs/daily-report.log
tail -f logs/tech-news.log
tail -f logs/daily-report.error.log
tail -f logs/email-organizer.error.log
```
```bash
launchctl list | grep zhimeng
launchctl start com.zhimeng.tech-news
log show --predicate 'subsystem == "com.apple.launchd"' --last 1h | grep zhimeng
```
```bash
poetry env info --path
poetry run python -c "from tasks.config import config; print(config)"
```
```bash
chmod +x tasks/launchd/install.sh
ls -la $(poetry env info --path)/bin/python
```
1. **Create task module**:
```bash
mkdir -p tasks/new_task
touch tasks/new_task/__init__.py
touch tasks/new_task/main.py
```
2. **Implement main logic** (`tasks/new_task/main.py`):
```python
from tasks.config import config
from tasks.sync_utils import create_syncer
class NewTaskRunner:
def run(self):
# Task logic
content = self.generate_content()
# Sync to platforms
syncer = create_syncer()
syncer.sync_content(
title="new-task-report",
content=content,
targets=["obsidian", "feishu"],
)
def main():
runner = NewTaskRunner()
runner.run()
if __name__ == "__main__":
main()
```
3. **Create launchd plist** (`tasks/launchd/com.zhimeng.new-task.plist`):
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "...">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.zhimeng.new-task</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/virtualenv/bin/python</string>
<string>-m</string>
<string>tasks.new_task.main</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>8</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
<key>WorkingDirectory</key>
<string>/path/to/zhimeng-agent</string>
<key>StandardOutPath</key>
<string>/path/to/zhimeng-agent/logs/new-task.log</string>
<key>StandardErrorPath</key>
<string>/path/to/zhimeng-agent/logs/new-task.error.log</string>
</dict>
</plist>
```
4. **Update install script** to include new task in `install.sh`
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/zhimeng-agent-personal-automation-tasks/raw