feat: 전체 PKM 스크립트 일괄 작성 — 분류/법령/메일/다이제스트/임베딩
- scripts/pkm_utils.py: 공통 유틸 (로거, dotenv, osascript 래퍼) - scripts/prompts/classify_document.txt: Ollama 분류 프롬프트 - applescript/auto_classify.scpt: Inbox → AI 분류 → DB 이동 - applescript/omnifocus_sync.scpt: Projects → OmniFocus 작업 생성 - scripts/law_monitor.py: 법령 변경 모니터링 + DEVONthink 임포트 - scripts/mailplus_archive.py: MailPlus IMAP → Archive DB - scripts/pkm_daily_digest.py: 일일 다이제스트 + OmniFocus 액션 - scripts/embed_to_chroma.py: GPU 서버 벡터 임베딩 → ChromaDB - launchd/*.plist: 3개 스케줄 (07:00, 07:00+18:00, 20:00) - docs/deploy.md: Mac mini 배포 가이드 - docs/devonagent-setup.md: 검색 세트 9종 설정 가이드 - tests/test_classify.py: 5종 문서 분류 테스트 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
96
docs/deploy.md
Normal file
96
docs/deploy.md
Normal file
@@ -0,0 +1,96 @@
|
||||
# Mac mini 배포 가이드
|
||||
|
||||
## 1. 초기 설치
|
||||
|
||||
```bash
|
||||
# Mac mini에서
|
||||
cd ~/Documents/code/
|
||||
git clone https://git.hyungi.net/hyungi/devonthink_home.git "DEVONThink_my server"
|
||||
cd "DEVONThink_my server"
|
||||
|
||||
# Python 가상환경
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## 2. 인증 정보 설정
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.config/pkm
|
||||
nano ~/.config/pkm/credentials.env
|
||||
chmod 600 ~/.config/pkm/credentials.env
|
||||
```
|
||||
|
||||
credentials.env.example을 참고하여 실제 값 입력.
|
||||
|
||||
## 3. launchd 스케줄 등록
|
||||
|
||||
```bash
|
||||
# 심볼릭 링크 생성
|
||||
ln -sf ~/Documents/code/DEVONThink_my\ server/launchd/net.hyungi.pkm.law-monitor.plist ~/Library/LaunchAgents/
|
||||
ln -sf ~/Documents/code/DEVONThink_my\ server/launchd/net.hyungi.pkm.mailplus.plist ~/Library/LaunchAgents/
|
||||
ln -sf ~/Documents/code/DEVONThink_my\ server/launchd/net.hyungi.pkm.daily-digest.plist ~/Library/LaunchAgents/
|
||||
|
||||
# 등록
|
||||
launchctl load ~/Library/LaunchAgents/net.hyungi.pkm.law-monitor.plist
|
||||
launchctl load ~/Library/LaunchAgents/net.hyungi.pkm.mailplus.plist
|
||||
launchctl load ~/Library/LaunchAgents/net.hyungi.pkm.daily-digest.plist
|
||||
|
||||
# 확인
|
||||
launchctl list | grep pkm
|
||||
```
|
||||
|
||||
## 4. 수동 테스트
|
||||
|
||||
```bash
|
||||
cd ~/Documents/code/DEVONThink_my\ server/
|
||||
source venv/bin/activate
|
||||
|
||||
# 각 스크립트 수동 실행
|
||||
python3 scripts/law_monitor.py
|
||||
python3 scripts/mailplus_archive.py
|
||||
python3 scripts/pkm_daily_digest.py
|
||||
```
|
||||
|
||||
## 5. DEVONthink Smart Rule 설정
|
||||
|
||||
1. DEVONthink → Preferences → Smart Rules
|
||||
2. 새 Rule: "AI Auto Classify"
|
||||
- Event: On Import
|
||||
- Database: Inbox
|
||||
- Condition: Tags is empty
|
||||
- Action: Execute Script → External → `applescript/auto_classify.scpt`
|
||||
3. 새 Rule: "OmniFocus Sync"
|
||||
- Event: On Import
|
||||
- Database: Projects
|
||||
- Action: Execute Script → External → `applescript/omnifocus_sync.scpt`
|
||||
|
||||
## 6. 업데이트
|
||||
|
||||
```bash
|
||||
cd ~/Documents/code/DEVONThink_my\ server/
|
||||
git pull
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## 7. 로그 확인
|
||||
|
||||
```bash
|
||||
# 스크립트 로그
|
||||
tail -f logs/law_monitor.log
|
||||
tail -f logs/mailplus.log
|
||||
tail -f logs/digest.log
|
||||
|
||||
# launchd 로그
|
||||
tail -f logs/law_monitor_launchd.log
|
||||
```
|
||||
|
||||
## 실행 스케줄
|
||||
|
||||
| 스크립트 | 시간 | 용도 |
|
||||
|---------|------|------|
|
||||
| law_monitor.py | 매일 07:00 | 법령 변경 모니터링 |
|
||||
| mailplus_archive.py | 매일 07:00, 18:00 | 이메일 수집 |
|
||||
| pkm_daily_digest.py | 매일 20:00 | 일일 다이제스트 |
|
||||
103
docs/devonagent-setup.md
Normal file
103
docs/devonagent-setup.md
Normal file
@@ -0,0 +1,103 @@
|
||||
# DEVONagent Pro — 검색 세트 설정 가이드
|
||||
|
||||
DEVONagent Pro에서 안전 분야 + 기술 분야 자동 검색 세트를 설정합니다.
|
||||
주간 합계 50~85건 수준으로 양을 조절합니다.
|
||||
|
||||
## 공통 설정
|
||||
|
||||
- **Schedule**: 각 세트별 지정 (매일/주간)
|
||||
- **Action**: Import to DEVONthink → Inbox DB
|
||||
- **Max Results per Run**: 각 세트별 지정
|
||||
- **Language**: 해당 언어
|
||||
|
||||
---
|
||||
|
||||
## 검색 세트 1: 국내 산업안전 뉴스 (매일)
|
||||
|
||||
- **키워드**: `산업안전 OR 중대재해 OR 위험성평가 OR 안전사고`
|
||||
- **사이트**: kosha.or.kr, moel.go.kr, safetynews.co.kr, dailysafety.com
|
||||
- **Max Results**: 5/일
|
||||
- **Schedule**: 매일 08:00
|
||||
|
||||
## 검색 세트 2: 국내 중대재해 뉴스 (매일)
|
||||
|
||||
- **키워드**: `중대재해 OR 산업재해 OR 작업장사고 -주식 -부동산`
|
||||
- **사이트**: 뉴스 전체
|
||||
- **Max Results**: 3/일
|
||||
- **Schedule**: 매일 08:30
|
||||
|
||||
## 검색 세트 3: KOSHA 가이드/지침 (주간)
|
||||
|
||||
- **키워드**: `site:kosha.or.kr 가이드 OR 지침 OR 기술자료`
|
||||
- **Max Results**: 5/주
|
||||
- **Schedule**: 매주 월요일 09:00
|
||||
|
||||
## 검색 세트 4: 국내 산업안전 학술/논문 (주간)
|
||||
|
||||
- **키워드**: `산업안전 OR 위험성평가 OR occupational safety site:kci.go.kr OR site:dbpia.co.kr`
|
||||
- **Max Results**: 3/주
|
||||
- **Schedule**: 매주 수요일 09:00
|
||||
|
||||
## 검색 세트 5: US OSHA / Safety+Health Magazine (주간)
|
||||
|
||||
- **키워드**: `occupational safety OR workplace hazard OR OSHA regulation`
|
||||
- **사이트**: osha.gov, safetyandhealthmagazine.com, ehstoday.com
|
||||
- **Max Results**: 5/주
|
||||
- **Language**: English
|
||||
- **Schedule**: 매주 화요일 09:00
|
||||
|
||||
## 검색 세트 6: JP 厚生労働省 / 安全衛生 (주간)
|
||||
|
||||
- **키워드**: `労働安全 OR 安全衛生 OR 労災`
|
||||
- **사이트**: mhlw.go.jp, jisha.or.jp
|
||||
- **Max Results**: 3/주
|
||||
- **Language**: Japanese
|
||||
- **Schedule**: 매주 목요일 09:00
|
||||
|
||||
## 검색 세트 7: EU-OSHA (월간)
|
||||
|
||||
- **키워드**: `occupational safety health EU regulation`
|
||||
- **사이트**: osha.europa.eu
|
||||
- **Max Results**: 5/월
|
||||
- **Language**: English
|
||||
- **Schedule**: 매월 1일 09:00
|
||||
|
||||
## 검색 세트 8: 기술 뉴스 — AI/서버/네트워크 (매일)
|
||||
|
||||
- **키워드**: `AI model release OR server infrastructure OR homelab OR self-hosted`
|
||||
- **사이트**: news.ycombinator.com, arstechnica.com, theregister.com
|
||||
- **Max Results**: 5/일
|
||||
- **Schedule**: 매일 12:00
|
||||
|
||||
## 검색 세트 9: 프로그래밍 기술 동향 (주간)
|
||||
|
||||
- **키워드**: `Python release OR Node.js update OR Docker best practice OR FastAPI`
|
||||
- **사이트**: dev.to, blog.python.org, nodejs.org
|
||||
- **Max Results**: 5/주
|
||||
- **Schedule**: 매주 금요일 12:00
|
||||
|
||||
---
|
||||
|
||||
## 주간 예상 건수
|
||||
|
||||
| 세트 | 빈도 | 건/주 |
|
||||
|------|------|-------|
|
||||
| 1. 국내 안전 뉴스 | 매일 5 | ~35 |
|
||||
| 2. 중대재해 뉴스 | 매일 3 | ~21 |
|
||||
| 3. KOSHA 가이드 | 주간 5 | 5 |
|
||||
| 4. 학술/논문 | 주간 3 | 3 |
|
||||
| 5. US OSHA | 주간 5 | 5 |
|
||||
| 6. JP 안전위생 | 주간 3 | 3 |
|
||||
| 7. EU-OSHA | 월간 5 | ~1 |
|
||||
| 8. 기술 뉴스 | 매일 5 | ~35 |
|
||||
| 9. 프로그래밍 | 주간 5 | 5 |
|
||||
| **합계** | | **~113** |
|
||||
|
||||
> 양이 너무 많으면 세트 1, 2, 8의 Max Results를 3으로 줄이면 주간 ~65건 수준으로 조절 가능.
|
||||
|
||||
## DEVONthink 전송 설정
|
||||
|
||||
1. DEVONagent → Preferences → DEVONthink
|
||||
2. Target Database: **Inbox**
|
||||
3. Auto-Tag: 검색 세트 이름으로 자동 태그 (`devonagent-검색세트명`)
|
||||
4. DEVONthink Smart Rule이 Inbox에서 자동 분류 처리
|
||||
Reference in New Issue
Block a user