# task-11.1: task-timer 이벤트 + orchestrator 이벤트 전환

- **팀**: dev1-team (헤르메스)
- **소요 시간**: 1분 35초
- **상태**: 완료

## 작업 내용

### 1단계: task-timer.py 수정
`/home/jay/workspace/memory/task-timer.py`의 `end_task()` 메서드에 이벤트 파일 생성 기능 추가:

- `_write_event_file()` 메서드 신규 추가
- `end` 명령 실행 시 `/home/jay/workspace/memory/events/` 디렉토리에 `<task_id>.done` 파일 자동 생성
- 파일 내용: JSON 형식 (`task_id`, `team_id`, `end_time`, `duration_seconds`)
- events 디렉토리 없으면 자동 생성 (`mkdir(parents=True, exist_ok=True)`)

### 2단계: orchestrator.py 수정
`/home/jay/workspace/orchestrator.py`를 이벤트 기반으로 전환:

- **EventWatcher 클래스 신규 추가**: events/ 디렉토리의 .done 파일을 감시
  - watchdog 라이브러리 사용 가능 시: inotify 기반 즉시 감지
  - watchdog 없으면: 5초 간격 폴링 fallback
- **handle_done_event() 메서드 추가**: .done 파일 수신 → 작업 완료 처리 → .processed로 rename
- **run() 메서드 재구성**: EventWatcher를 시작하고, 메인 루프에서는 누락 이벤트 보완용 폴링도 병행
- **POLL_INTERVAL**: 20초 → 5초로 변경 (fallback용)
- **EVENTS_DIR 상수 추가**: `/home/jay/workspace/memory/events`

## 테스트 결과
- 테스트 작업(test-event-001) start → end 실행 시 `test-event-001.done` 파일 정상 생성 확인
- JSON 내용 정확성 확인 (`task_id`, `team_id`, `end_time`, `duration_seconds`)
- orchestrator.py 구문 검사 통과

## 수정된 파일
- `/home/jay/workspace/memory/task-timer.py` — `_write_event_file()` 메서드 추가, `end_task()`에서 호출
- `/home/jay/workspace/orchestrator.py` — EventWatcher 클래스 추가, run() 이벤트 기반 전환
