@purpleraven/hits 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/AGENTS.md +75 -75
  2. package/README.md +280 -243
  3. package/package.json +1 -1
package/AGENTS.md CHANGED
@@ -19,137 +19,137 @@ If pre-flight checks fail, fix the errors before proceeding.
19
19
 
20
20
  ## AI Session Handover Protocol
21
21
 
22
- 토큰 한계 등으로 AI 세션이 교체될 때, 프로젝트별 인수인계가 자동으로 동작합니다.
23
- 모든 데이터는 `~/.hits/data/`에 중앙 집중 저장되며, 프로젝트 경로로 격리됩니다.
22
+ When an AI session is replaced due to token limits, project-specific handover activates automatically.
23
+ All data is centrally stored at `~/.hits/data/` and isolated by project path.
24
24
 
25
- ### 세션 시작
25
+ ### On Session Start
26
26
 
27
27
  ```bash
28
- # HTTP API (HITS 서버 실행 중일 때)
28
+ # HTTP API (when HITS server is running)
29
29
  curl -s "http://localhost:8765/api/handover?project_path=$(pwd)" | python -m json.tool
30
30
 
31
- # 또는 MCP (HITS MCP 설정된 경우):
32
- # hits_get_handover → 이전 세션의 작업 내용, 결정 사항, 미완료 항목 조회
31
+ # Or via MCP tool (when HITS MCP is configured):
32
+ # hits_get_handover → Retrieve previous session's work, decisions, and unfinished items
33
33
  ```
34
34
 
35
- ### 세션 종료 (반드시 기록)
35
+ ### On Session End (MUST record)
36
36
 
37
37
  ```bash
38
38
  curl -X POST http://localhost:8765/api/work-log \
39
39
  -H "Content-Type: application/json" \
40
40
  -d '{
41
- "performed_by": "<AI_도구_이름>",
42
- "request_text": "<작업 요약>",
43
- "context": "<상세 내용, 결정 사항>",
41
+ "performed_by": "<AI_tool_name>",
42
+ "request_text": "<work summary>",
43
+ "context": "<details, decisions>",
44
44
  "source": "ai_session",
45
- "tags": ["<태그>"],
46
- "project_path": "<프로젝트_절대경로>",
45
+ "tags": ["<tag>"],
46
+ "project_path": "<project_absolute_path>",
47
47
  "result_data": {
48
- "files_modified": ["<수정한_파일>"],
49
- "commands_run": ["<실행한_명령>"]
48
+ "files_modified": ["<modified_file>"],
49
+ "commands_run": ["<executed_command>"]
50
50
  }
51
51
  }'
52
52
  ```
53
53
 
54
- ### performed_by 규칙
54
+ ### performed_by Values
55
55
 
56
- | AI 도구 | performed_by |
57
- |---------|----------------|
56
+ | AI Tool | performed_by Value |
57
+ |---------|-------------------|
58
58
  | OpenCode | `"opencode"` |
59
59
  | Claude Code | `"claude"` |
60
60
  | Cursor | `"cursor"` |
61
61
  | GitHub Copilot | `"copilot"` |
62
- | 사용자 직접 | `"manual"` 또는 사용자명 |
62
+ | Manual | `"manual"` or username |
63
63
 
64
- ### project_path 규칙
64
+ ### project_path Rules
65
65
 
66
- - **항상 절대경로 사용**: `"/home/user/source/my-project"` (O), `"./my-project"` (X)
67
- - **자동 감지**: CWD에서 `.git` 디렉토리가 있는 루트를 프로젝트 경로로 사용
68
- - **프로젝트별 격리**: 서로 다른 `project_path`는 완전히 독립된 인수인계 컨텍스트를 가짐
66
+ - **Always use absolute paths**: `"/home/user/source/my-project"` (O), `"./my-project"` (X)
67
+ - **Auto-detection**: Use the directory containing `.git` from CWD as the project path
68
+ - **Project isolation**: Different `project_path` values have completely independent handover contexts
69
69
 
70
- ### MCP 사용 (권장)
70
+ ### MCP Tools (Recommended)
71
71
 
72
- HITS MCP 서버가 설정된 경우, HTTP API 대신 직접 호출:
72
+ When the HITS MCP server is configured, use direct tool calls instead of HTTP API:
73
73
 
74
74
  ```
75
- hits_record_work → 작업 기록 (project_path 자동 감지)
76
- hits_get_handover → 인수인계 요약 조회
77
- hits_search_works → 이전 작업 검색
78
- hits_list_projects → 프로젝트 목록
79
- hits_get_recent → 최근 작업 조회
75
+ hits_record_work → Record work entry (auto-detects project_path)
76
+ hits_get_handover → Query handover summary
77
+ hits_search_works → Search past work
78
+ hits_list_projects → List projects
79
+ hits_get_recent → Get recent work
80
80
  ```
81
81
 
82
- ### 기록 시점
82
+ ### When to Record
83
83
 
84
- - 사용자와 작업 세션 종료
85
- - 주요 기능 구현 완료
86
- - 버그 수정 완료
87
- - 사용자가 명시적으로 종료 요청
88
- - **토큰 한계 경고 수신 시** (즉시 기록!)
84
+ - At the end of a long work session with the user
85
+ - After completing a major feature implementation
86
+ - After fixing a bug
87
+ - When the user explicitly requests to end the session
88
+ - **On token limit warning** (record immediately!)
89
89
 
90
- ### 데이터 저장소
90
+ ### Data Store
91
91
 
92
- | 위치 | 설명 |
93
- |------|------|
94
- | `~/.hits/data/work_logs/` | 작업 기록 (JSON) |
95
- | `~/.hits/data/trees/` | 지식 트리 |
96
- | `~/.hits/data/workflows/` | 워크플로우 |
97
- | `~/.hits/.auth/` | 인증 데이터 (권한 600/700) |
98
- | `HITS_DATA_PATH` 환경변수 | 저장소 경로 오버라이드 |
92
+ | Location | Description |
93
+ |----------|-------------|
94
+ | `~/.hits/data/work_logs/` | Work logs (JSON) |
95
+ | `~/.hits/data/trees/` | Knowledge trees |
96
+ | `~/.hits/data/workflows/` | Workflows |
97
+ | `~/.hits/.auth/` | Auth data (permissions 600/700) |
98
+ | `HITS_DATA_PATH` env var | Override storage path |
99
99
 
100
100
  ## API Endpoints
101
101
 
102
- ### 인증
102
+ ### Authentication
103
103
 
104
104
  | Method | Path | Description |
105
105
  |--------|------|-------------|
106
- | GET | `/api/auth/status` | 인증 상태 (초기화 여부, 로그인 여부) |
107
- | POST | `/api/auth/register` | 사용자 등록 ( 사용자 = admin) |
108
- | POST | `/api/auth/login` | 로그인 (HttpOnly 쿠키 설정) |
109
- | POST | `/api/auth/logout` | 로그아웃 |
110
- | POST | `/api/auth/refresh` | 액세스 토큰 갱신 |
111
- | GET | `/api/auth/me` | 현재 사용자 정보 |
112
- | PUT | `/api/auth/password` | 비밀번호 변경 |
106
+ | GET | `/api/auth/status` | Auth status (initialized, logged in) |
107
+ | POST | `/api/auth/register` | Register user (first user = admin) |
108
+ | POST | `/api/auth/login` | Login (sets HttpOnly cookies) |
109
+ | POST | `/api/auth/logout` | Logout |
110
+ | POST | `/api/auth/refresh` | Refresh access token |
111
+ | GET | `/api/auth/me` | Current user info |
112
+ | PUT | `/api/auth/password` | Change password |
113
113
 
114
- ### 작업 기록
114
+ ### Work Logs
115
115
 
116
116
  | Method | Path | Description |
117
117
  |--------|------|-------------|
118
- | GET | `/api/health` | 서버 상태 확인 |
119
- | POST | `/api/work-log` | 작업 기록 생성 |
120
- | GET | `/api/work-logs` | 작업 기록 목록 (`project_path` 필터 지원) |
121
- | GET | `/api/work-logs/search?q=키워드` | 작업 검색 (`project_path` 필터 지원) |
122
- | GET | `/api/work-log/{id}` | 단건 조회 |
123
- | PUT | `/api/work-log/{id}` | 수정 |
124
- | DELETE | `/api/work-log/{id}` | 삭제 |
118
+ | GET | `/api/health` | Server health check |
119
+ | POST | `/api/work-log` | Create work log |
120
+ | GET | `/api/work-logs` | List work logs (supports `project_path` filter) |
121
+ | GET | `/api/work-logs/search?q=keyword` | Search work logs (supports `project_path` filter) |
122
+ | GET | `/api/work-log/{id}` | Get single entry |
123
+ | PUT | `/api/work-log/{id}` | Update entry |
124
+ | DELETE | `/api/work-log/{id}` | Delete entry |
125
125
 
126
- ### 인수인계
126
+ ### Handover
127
127
 
128
128
  | Method | Path | Description |
129
129
  |--------|------|-------------|
130
- | GET | `/api/handover?project_path=...` | 프로젝트별 인수인계 요약 |
131
- | GET | `/api/handover/projects` | 프로젝트 목록 |
132
- | GET | `/api/handover/project-stats?project_path=...` | 프로젝트 통계 |
130
+ | GET | `/api/handover?project_path=...` | Project handover summary |
131
+ | GET | `/api/handover/projects` | List projects |
132
+ | GET | `/api/handover/project-stats?project_path=...` | Project stats |
133
133
 
134
- ### 지식 카테고리
134
+ ### Knowledge Categories
135
135
 
136
136
  | Method | Path | Description |
137
137
  |--------|------|-------------|
138
- | GET | `/api/knowledge/categories` | 카테고리 목록 |
139
- | POST | `/api/knowledge/category` | 카테고리 생성 |
140
- | PUT | `/api/knowledge/category/{name}` | 카테고리 수정 |
141
- | DELETE | `/api/knowledge/category/{name}` | 카테고리 삭제 |
142
- | POST | `/api/knowledge/category/{name}/nodes` | 노드 추가 |
143
- | PUT | `/api/knowledge/category/{name}/nodes/{idx}` | 노드 수정 |
144
- | DELETE | `/api/knowledge/category/{name}/nodes/{idx}` | 노드 삭제 |
138
+ | GET | `/api/knowledge/categories` | List categories |
139
+ | POST | `/api/knowledge/category` | Create category |
140
+ | PUT | `/api/knowledge/category/{name}` | Update category |
141
+ | DELETE | `/api/knowledge/category/{name}` | Delete category |
142
+ | POST | `/api/knowledge/category/{name}/nodes` | Add node |
143
+ | PUT | `/api/knowledge/category/{name}/nodes/{idx}` | Update node |
144
+ | DELETE | `/api/knowledge/category/{name}/nodes/{idx}` | Delete node |
145
145
 
146
- ### 지식 트리 (노드 기반)
146
+ ### Knowledge Tree (Node-based)
147
147
 
148
148
  | Method | Path | Description |
149
149
  |--------|------|-------------|
150
- | POST | `/api/node` | 지식 노드 생성 |
151
- | PUT | `/api/node/{id}` | 지식 노드 수정 |
152
- | DELETE | `/api/node/{id}` | 지식 노드 삭제 |
150
+ | POST | `/api/node` | Create knowledge node |
151
+ | PUT | `/api/node/{id}` | Update knowledge node |
152
+ | DELETE | `/api/node/{id}` | Delete knowledge node |
153
153
 
154
154
  ## Development Workflow
155
155
 
package/README.md CHANGED
@@ -1,336 +1,373 @@
1
- # HITS - Hybrid Intel Trace System
1
+ # hits
2
2
 
3
- > AI를 가장 적게 쓰면서, 전임자의 뇌를 가장 완벽하게 복제하는 시스템
3
+ > Replicate your predecessor's brain as perfectly as possible, using the least amount of AI.
4
4
 
5
- ## 개요
5
+ A secure web-based knowledge management system that preserves organizational context across AI tool sessions. When your Claude session hits the token limit and you switch to a new one — HITS ensures nothing is lost.
6
6
 
7
- HITS는 기업의 핵심 지식과 의사결정 맥락을 보존하기 위한 하이브리드 지식 관리 시스템입니다. AI 도구 간(Claude, OpenCode, Cursor 등) 세션 전환 시 프로젝트별 인수인계를 자동화합니다.
7
+ ## What Problem Does This Solve?
8
8
 
9
- ### 핵심 가치
9
+ You're working on a project with Claude Code. After a long session, you hit the token limit. A new session starts — but it has **no idea** what you did, what decisions were made, or what was left unfinished.
10
10
 
11
- - **토큰 최적화**: AI 비용 절감을 위한 시멘틱 압축과 온디맨드 분석
12
- - **맥락 보존**: Why-How-What 계층 구조로 의사결정 과정 저장
13
- - **실패 경험**: Negative Path로 실패한 접근법도 함께 기록
14
- - **보안 강화**: Argon2id 해싱, JWT HttpOnly 쿠키, CSP, Rate Limiting
15
- - **AI 세션 인수인계**: 토큰 한계로 AI 교체 시 프로젝트별 컨텍스트 자동 전달
16
- - **중앙 집중 저장**: `~/.hits/data/`에 모든 AI 도구의 작업 기록이 통합 저장
17
- - **프로젝트별 격리**: 프로젝트 경로 기반으로 완전히 독립된 컨텍스트 관리
11
+ **HITS fixes this:**
18
12
 
19
- ## 기술 스택
13
+ 1. **Record work** during each AI session (manually or via MCP tools)
14
+ 2. **Query handover** when a new session starts — it gets the full context
15
+ 3. **Knowledge trees** preserve the WHY/HOW/WHAT of every project
16
+ 4. **All AI tools share the same data** — Claude, OpenCode, Cursor, it doesn't matter
20
17
 
21
- | 영역 | 기술 |
22
- |------|------|
23
- | **백엔드** | Python 3.10+, FastAPI, Pydantic v2 |
24
- | **프론트엔드** | Svelte 5, Vite, TypeScript |
25
- | **인증** | Argon2id (비밀번호), JWT HS256 (HttpOnly 쿠키) |
26
- | **저장소** | 파일 기반 (`~/.hits/data/`), Redis (선택) |
27
- | **보안** | CSP, CORS, Rate Limiting, Secure Headers |
28
-
29
- ## 설치
30
-
31
- ### 요구사항
32
-
33
- - Python 3.10 이상
34
- - Node.js 18+ (프론트엔드 빌드용)
35
- - Redis (선택사항, 없으면 파일 저장소 사용)
36
-
37
- ### 빠른 시작
38
-
39
- ```bash
40
- cd hits
41
- ./run.sh # 자동 설치 + 서버 시작
42
18
  ```
43
-
44
- #### 개발 모드
45
-
46
- ```bash
47
- ./run.sh --dev # Vite HMR + FastAPI 백엔드
19
+ [OpenCode session ends] [Claude session starts]
20
+ │ │
21
+ Record work: Query handover:
22
+ "Added JWT auth, → Previous: Added JWT auth
23
+ chose Argon2id over → Decisions: Argon2id > bcrypt
24
+ bcrypt, still need to → Pending: rate limiting
25
+ add rate limiting" → Files: auth/manager.py, ...
48
26
  ```
49
27
 
50
- #### 수동 설치
28
+ ## Quick Start
51
29
 
52
- ```bash
53
- # Python 환경
54
- python3 -m venv venv
55
- source venv/bin/activate
56
- pip install -r requirements.txt
57
-
58
- # 프론트엔드 빌드
59
- cd hits_web
60
- npm install
61
- npm run build
62
- cd ..
30
+ ### One Command — That's It
63
31
 
64
- # 서버 실행
65
- python -m hits_core.main --port 8765
32
+ ```bash
33
+ npx hits
66
34
  ```
67
35
 
68
- ## 보안
36
+ That single command will:
69
37
 
70
- ### 인증 시스템
38
+ 1. **Detect Python 3.10+** on your system
39
+ 2. **Create a virtual environment** automatically
40
+ 3. **Install Python dependencies** (FastAPI, Argon2id, etc.)
41
+ 4. **Start the Python backend** (FastAPI on port 8765)
42
+ 5. **Start the web server** (Express on port 8765)
43
+ 6. Open **http://127.0.0.1:8765** in your browser
71
44
 
72
- | 기능 | 구현 |
73
- |------|------|
74
- | **비밀번호 해싱** | Argon2id (memory=64MB, iterations=3, parallelism=1) |
75
- | **비밀번호 최소 길이** | 8자 |
76
- | **JWT 토큰** | HttpOnly + Secure + SameSite=Lax 쿠키 |
77
- | **액세스 토큰** | 15분 만료 |
78
- | **리프레시 토큰** | 7일 만료, `/api/auth/refresh` 경로에서만 전송 |
79
- | **첫 사용자** | 자동으로 admin 역할 부여 |
80
- | **이후 사용자** | admin만 생성 가능 |
45
+ ### First Time Setup
81
46
 
82
- ### 보안 헤더
47
+ On first visit, you'll create an admin account:
83
48
 
84
49
  ```
85
- Content-Security-Policy: default-src 'self'; script-src 'self'; ...
86
- X-Content-Type-Options: nosniff
87
- X-Frame-Options: DENY
88
- Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
89
- Referrer-Policy: strict-origin-when-cross-origin
90
- Permissions-Policy: camera=(), microphone=(), geolocation=()
50
+ ┌──────────────────────────────────────┐
51
+ │ 🌳 HITS │
52
+ │ Hybrid Intel Trace System │
53
+ │ │
54
+ │ ┌────────────────────────────────┐ │
55
+ │ │ Username: [____________] │ │
56
+ │ │ Password: [____________] │ │
57
+ │ │ │ │
58
+ │ │ [ Create Account ] │ │
59
+ │ │ │ │
60
+ │ │ First account = admin role │ │
61
+ │ └────────────────────────────────┘ │
62
+ └──────────────────────────────────────┘
91
63
  ```
92
64
 
93
- ### Rate Limiting
65
+ ### Custom Port
94
66
 
95
- - 로그인 엔드포인트: 10회/분 (IP 기준)
96
- - 429 Too Many Requests 응답으로 제한
67
+ ```bash
68
+ npx hits --port 9000
69
+ # or
70
+ HITS_PORT=9000 npx hits
71
+ ```
97
72
 
98
- ### 데이터 보호
73
+ ## Requirements
99
74
 
100
- | 항목 | 권한 | 설명 |
101
- |------|------|------|
102
- | `~/.hits/.auth/users.json` | 600 | 사용자 데이터 (소유자만) |
103
- | `~/.hits/.pepper` | 600 | HMAC 페퍼 (소유자만) |
104
- | `~/.hits/.jwt_secret` | 600 | JWT 서명 키 (소유자만) |
105
- | `~/.hits/.auth/` | 700 | 인증 디렉토리 (소유자만) |
75
+ | Requirement | Version | Why |
76
+ |-------------|---------|-----|
77
+ | **Node.js** | 18 | Runs the web server and manages the Python process |
78
+ | **Python** | 3.10 | Runs the FastAPI backend (auto-installed into venv) |
106
79
 
107
- ## UI
80
+ That's it. No database required — HITS uses file-based storage at `~/.hits/data/`.
108
81
 
109
- ### 화면 구성
82
+ ## What You Get
83
+
84
+ ### Web UI
110
85
 
111
86
  ```
112
87
  ┌─────────────┬───────────────────────────────────┐
113
- 사이드바헤더 ( + 사용자 메뉴)
88
+ SidebarHeader (tabs + user menu 🌐 lang)
114
89
  │ ├───────────────────────────────────┤
115
- │ 📂 프로젝트 │ │
116
- │ ────────── │ 메인 컨텐츠 영역
90
+ │ 📂 Projects│ │
91
+ │ ────────── │ Main content area
117
92
  │ /project-a │ │
118
- │ /project-b │ 📋 지식 트리 | 📝 타임라인 | 🔄 인수인계
93
+ │ /project-b │ 📋 Knowledge | 📝 Timeline | 🔄 Handover
119
94
  │ /project-c │ │
120
95
  │ │ │
121
96
  └─────────────┴───────────────────────────────────┘
122
97
  ```
123
98
 
124
- ### 주요 기능
99
+ **Knowledge Tree** — Organize project knowledge as Why-How-What nodes:
125
100
 
126
- - **지식 트리**: 카테고리별 Why-How-What 노드 관리 (CRUD)
127
- - **타임라인**: 프로젝트별 작업 기록, 날짜별 그룹핑, 검색
128
- - **인수인계**: 프로젝트 선택 자동 생성된 인수인계 요약
129
- - **프로젝트 전환**: 사이드바에서 프로젝트 선택으로 즉시 전환
130
- - **사용자 관리**: 비밀번호 변경, 로그아웃
101
+ ```
102
+ 📁 Authentication
103
+ ├── WHY "Need secure user auth for web UI"
104
+ ├── HOW "Argon2id hashing + JWT HttpOnly cookies"
105
+ └── WHAT "POST /api/auth/login Set-Cookie"
106
+ └── ❌ Negative Path: "Tried bcrypt first — too fast, GPU-vulnerable"
107
+ ```
131
108
 
132
- ## AI 세션 인수인계
109
+ **Timeline** Chronological work log, grouped by date, filterable by project
133
110
 
134
- ### 작동 방식
111
+ **Handover** Auto-generated summary of a project's context, ready to paste into a new AI session
135
112
 
136
- ```
137
- [OpenCode 세션] [Claude 세션]
138
- │ │
139
- 작업 수행 세션 시작
140
- │ │
141
- 작업 기록 ──────────────────────→ 인수인계 조회
142
- POST /api/work-log GET /api/handover
143
- project_path: /my-project project_path: /my-project
144
- │ │
145
- └──→ ~/.hits/data/ ←──┘ │
146
- (중앙 집중) 이전 컨텍스트 파악
147
-
148
- 작업 이어서 수행
149
- ```
113
+ **i18n** — Korean/English toggle (🌐 button in header)
150
114
 
151
- ### MCP 설정
115
+ ### MCP Tools for AI Assistants
152
116
 
153
- OpenCode 또는 Claude의 MCP 설정에 추가:
117
+ HITS includes an MCP server so your AI can read and write handover data directly:
118
+
119
+ #### Register with OpenCode (`~/.config/opencode/opencode.json`)
154
120
 
155
121
  ```json
156
122
  {
157
- "hits": {
158
- "type": "local",
159
- "command": ["python", "-m", "hits_core.mcp.server"],
160
- "cwd": "/path/to/hits"
123
+ "mcp": {
124
+ "hits": {
125
+ "type": "local",
126
+ "command": ["python", "-m", "hits_core.mcp.server"],
127
+ "cwd": "/path/to/hits"
128
+ }
161
129
  }
162
130
  }
163
131
  ```
164
132
 
165
- MCP 툴:
166
- - `hits_record_work`: 작업 기록
167
- - `hits_get_handover`: 인수인계 요약
168
- - `hits_search_works`: 작업 검색
169
- - `hits_list_projects`: 프로젝트 목록
170
- - `hits_get_recent`: 최근 작업
133
+ #### Register with Claude Code
171
134
 
172
- ## API 엔드포인트
135
+ ```bash
136
+ claude mcp add hits \
137
+ -e HITS_DATA_PATH="$HOME/.hits/data" \
138
+ -- python -m hits_core.mcp.server
139
+ ```
173
140
 
174
- ### 인증
141
+ #### 5 MCP Tools
175
142
 
176
- | Method | Path | Description |
177
- |--------|------|-------------|
178
- | GET | `/api/auth/status` | 인증 상태 확인 |
179
- | POST | `/api/auth/register` | 사용자 등록 |
180
- | POST | `/api/auth/login` | 로그인 (HttpOnly 쿠키 설정) |
181
- | POST | `/api/auth/logout` | 로그아웃 |
182
- | POST | `/api/auth/refresh` | 액세스 토큰 갱신 |
183
- | GET | `/api/auth/me` | 현재 사용자 정보 |
184
- | PUT | `/api/auth/password` | 비밀번호 변경 |
143
+ | Tool | What It Does |
144
+ |------|-------------|
145
+ | `hits_record_work` | Record a work entry (auto-detects project path from CWD) |
146
+ | `hits_get_handover` | Get handover summary for the current project |
147
+ | `hits_search_works` | Search past work by keyword |
148
+ | `hits_list_projects` | List all projects with recorded work |
149
+ | `hits_get_recent` | Get the most recent work entries |
185
150
 
186
- ### 작업 기록
151
+ #### Example AI Workflow
187
152
 
188
- | Method | Path | Description |
189
- |--------|------|-------------|
190
- | POST | `/api/work-log` | 작업 기록 생성 |
191
- | GET | `/api/work-logs` | 작업 목록 (`project_path` 필터) |
192
- | GET | `/api/work-logs/search?q=...` | 작업 검색 |
193
- | GET | `/api/work-log/{id}` | 단건 조회 |
194
- | PUT | `/api/work-log/{id}` | 수정 |
195
- | DELETE | `/api/work-log/{id}` | 삭제 |
153
+ ```
154
+ User: "Continue working on the auth system"
196
155
 
197
- ### 인수인계
156
+ AI (auto-calls hits_get_handover):
157
+ → Previous session added Argon2id password hashing
158
+ → Decisions: Argon2id (not bcrypt), JWT HS256, HttpOnly cookies
159
+ → Pending: Rate limiting, password change endpoint
198
160
 
199
- | Method | Path | Description |
200
- |--------|------|-------------|
201
- | GET | `/api/handover?project_path=...` | 프로젝트별 인수인계 요약 |
202
- | GET | `/api/handover/projects` | 프로젝트 목록 |
203
- | GET | `/api/handover/project-stats?project_path=...` | 프로젝트 통계 |
161
+ AI: "I see the auth system uses Argon2id + JWT. Let me add rate limiting..."
204
162
 
205
- ### 지식 카테고리
163
+ (later)
206
164
 
207
- | Method | Path | Description |
208
- |--------|------|-------------|
209
- | GET | `/api/knowledge/categories` | 카테고리 목록 |
210
- | POST | `/api/knowledge/category` | 카테고리 생성 |
211
- | PUT | `/api/knowledge/category/{name}` | 카테고리 수정 |
212
- | DELETE | `/api/knowledge/category/{name}` | 카테고리 삭제 |
213
- | POST | `/api/knowledge/category/{name}/nodes` | 노드 추가 |
214
- | PUT | `/api/knowledge/category/{name}/nodes/{idx}` | 노드 수정 |
215
- | DELETE | `/api/knowledge/category/{name}/nodes/{idx}` | 노드 삭제 |
165
+ AI (auto-calls hits_record_work):
166
+ → Recorded: "Added rate limiting (10 req/min on login endpoint)"
167
+ ```
168
+
169
+ ### REST API
170
+
171
+ All features are also accessible via HTTP API:
172
+
173
+ ```bash
174
+ # Health check
175
+ curl http://localhost:8765/api/health
176
+
177
+ # Record work
178
+ curl -X POST http://localhost:8765/api/work-log \
179
+ -H "Content-Type: application/json" \
180
+ -b cookies.txt \
181
+ -d '{
182
+ "performed_by": "claude",
183
+ "request_text": "Added rate limiting to login endpoint",
184
+ "context": "10 req/min per IP, 429 response on limit",
185
+ "project_path": "/home/user/my-project",
186
+ "tags": ["security", "api"]
187
+ }'
188
+
189
+ # Get handover summary
190
+ curl "http://localhost:8765/api/handover?project_path=/home/user/my-project" \
191
+ -b cookies.txt
192
+
193
+ # Search past work
194
+ curl "http://localhost:8765/api/work-logs/search?q=auth" \
195
+ -b cookies.txt
196
+ ```
197
+
198
+ ## Security
216
199
 
217
- ### performed_by 규칙
200
+ HITS is built with security as a first-class concern:
218
201
 
219
- | AI 도구 | |
220
- |---------|-----|
221
- | OpenCode | `opencode` |
222
- | Claude Code | `claude` |
223
- | Cursor | `cursor` |
224
- | 사용자 직접 | `manual` |
202
+ | Feature | Implementation |
203
+ |---------|---------------|
204
+ | **Password Hashing** | Argon2id (64MB memory, 3 iterations, parallelism=1) |
205
+ | **JWT Tokens** | HttpOnly + Secure + SameSite=Lax cookies |
206
+ | **Access Token** | 15-minute expiry |
207
+ | **Refresh Token** | 7-day expiry, restricted to `/api/auth/refresh` path |
208
+ | **Brute Force Protection** | 10 login attempts/minute per IP |
209
+ | **Security Headers** | CSP, X-Frame-Options: DENY, HSTS preload, nosniff |
210
+ | **Data Protection** | Auth files stored with `chmod 600` (owner-only) |
211
+ | **First User Policy** | First registered user becomes admin; subsequent users need admin approval |
225
212
 
226
- ## 아키텍처
213
+ ## How It Works Under the Hood
227
214
 
228
215
  ```
229
- ┌──────────────────────────────────────────────────────────┐
230
- hits_web (Svelte 5 + Vite) │
231
- │ Material Dark 테마 · TypeScript │
232
- ┌──────────┬──────────┬──────────────────────────┐ │
233
- Sidebar │ Knowledge│ HandoverPanel │ │
234
- Projects │ Tree 인수인계 요약 뷰 │ │
235
- │ │ Filter │ Timeline │ │ │
236
- └──────────┴──────────┴──────────────────────────┘ │
237
- ↕ API Client (fetch + HttpOnly cookies)
238
- ├──────────────────────────────────────────────────────────┤
239
- │ hits_core (Apache 2.0)
240
- ┌──────────┬──────────┬──────────┬──────────┐ │
241
- Models │ Storage │ AI │ Auth │ │
242
- │ │ Tree │ Redis │ Compress │ Argon2id │ │
243
- │ │ Node │ File │ SLM/LLM │ JWT │ │
244
- │ │ WorkLog │(~/.hits) │ Filter │ Middleware│ │
245
- │ └──────────┴──────────┴──────────┴──────────┘ │
246
- │ ┌──────────┬──────────┬──────────┐ │
247
- │ │ API │ Collector│ MCP │ │
248
- │ │ FastAPI │ Git/Shell│ Server │ │
249
- │ │ + Static │ AI Sess. │ 5 Tools │ │
250
- │ │ Serve │ │ │ │
251
- │ └──────────┴──────────┴──────────┘ │
252
- │ ┌──────────────────────────────┐ │
253
- │ │ Service Layer │ │
254
- │ │ TreeService HandoverService│ │
255
- │ │ KnowledgeService │ │
256
- │ └──────────────────────────────┘ │
257
- └──────────────────────────────────────────────────────────┘
216
+ npx hits
217
+
218
+ ├── 1. findPython() → Detect Python 3.10+ on system
219
+ ├── 2. setupPython() → Create venv, install deps
220
+ ├── 3. startBackend() → Spawn FastAPI process (port 8765)
221
+ └── 4. startExpress() Serve frontend + proxy /api → FastAPI
222
+
223
+ Browser Express (8765) FastAPI (8765 internal)
224
+
225
+ ├── GET / ───→ static (Svelte SPA) │
226
+ ├── GET /some/route ───→ SPA fallback
227
+ └── GET /api/* ───→ proxy ──────────────→ FastAPI routes
228
+ POST /api/* ───→ proxy ──────────────→ FastAPI routes
258
229
  ```
259
230
 
260
- ## 지식 트리 구조
231
+ All data is stored centrally:
232
+
233
+ ```
234
+ ~/.hits/
235
+ ├── data/ ← All project data
236
+ │ ├── work_logs/ ← AI session work logs (JSON)
237
+ │ ├── trees/ ← Knowledge trees
238
+ │ └── workflows/ ← Workflows
239
+ ├── .auth/ ← User accounts (chmod 700)
240
+ │ └── users.json ← User data (chmod 600)
241
+ ├── .pepper ← HMAC pepper (chmod 600)
242
+ └── .jwt_secret ← JWT signing key (chmod 600)
243
+
244
+ Override with HITS_DATA_PATH environment variable
245
+ ```
261
246
 
262
- ### Why-How-What 계층
247
+ ## CLI Options
263
248
 
264
249
  ```
265
- ├── WHY (의도/목적)
266
- │ ├── "왜 이 시스템을 만들었나?"
267
- │ └── "비즈니스 목표가 무엇인가?"
268
-
269
- ├── HOW (논리/방법)
270
- │ ├── "어떻게 구현했나?"
271
- │ └── "어떤 의사결정을 내렸나?"
272
-
273
- └── WHAT (실행/작업)
274
- ├── "구체적으로 무엇을 하나?"
275
- └── "실행 가능한 액션"
250
+ npx hits [options]
251
+
252
+ Options:
253
+ -p, --port <port> Server port (default: 8765)
254
+ -d, --dev Development mode (verbose logging)
255
+ -s, --setup Install dependencies only, don't start
256
+ -h, --help Show help
257
+
258
+ Environment:
259
+ HITS_PORT Server port override
260
+ HITS_PYTHON Path to python executable (default: auto-detect)
261
+ HITS_DATA_PATH Data storage path (default: ~/.hits/data)
276
262
  ```
277
263
 
278
- ## 개발
264
+ ## API Reference
265
+
266
+ ### Authentication
267
+
268
+ | Method | Path | Description |
269
+ |--------|------|-------------|
270
+ | GET | `/api/auth/status` | Check if auth is initialized, current login status |
271
+ | POST | `/api/auth/register` | Register user (first user = admin) |
272
+ | POST | `/api/auth/login` | Login — sets HttpOnly cookies |
273
+ | POST | `/api/auth/logout` | Logout — clears cookies |
274
+ | POST | `/api/auth/refresh` | Refresh access token |
275
+ | GET | `/api/auth/me` | Get current user info |
276
+ | PUT | `/api/auth/password` | Change password |
277
+
278
+ ### Work Logs
279
+
280
+ | Method | Path | Description |
281
+ |--------|------|-------------|
282
+ | POST | `/api/work-log` | Create work log |
283
+ | GET | `/api/work-logs` | List logs (filter by `project_path`) |
284
+ | GET | `/api/work-logs/search?q=...` | Search logs by keyword |
285
+ | GET | `/api/work-log/{id}` | Get single entry |
286
+ | PUT | `/api/work-log/{id}` | Update entry |
287
+ | DELETE | `/api/work-log/{id}` | Delete entry |
288
+
289
+ ### Handover
279
290
 
280
- ### 개발 모드
291
+ | Method | Path | Description |
292
+ |--------|------|-------------|
293
+ | GET | `/api/handover?project_path=...` | Get project handover summary |
294
+ | GET | `/api/handover/projects` | List all projects |
295
+ | GET | `/api/handover/project-stats?project_path=...` | Get project statistics |
281
296
 
297
+ ### Knowledge
298
+
299
+ | Method | Path | Description |
300
+ |--------|------|-------------|
301
+ | GET | `/api/knowledge/categories` | List categories |
302
+ | POST | `/api/knowledge/category` | Create category |
303
+ | PUT | `/api/knowledge/category/{name}` | Update category |
304
+ | DELETE | `/api/knowledge/category/{name}` | Delete category |
305
+ | POST | `/api/knowledge/category/{name}/nodes` | Add node to category |
306
+ | PUT | `/api/knowledge/category/{name}/nodes/{idx}` | Update node |
307
+ | DELETE | `/api/knowledge/category/{name}/nodes/{idx}` | Delete node |
308
+
309
+ ## Troubleshooting
310
+
311
+ ### "Python 3.10+ not found"
312
+
313
+ Install Python 3.10 or later:
282
314
  ```bash
283
- ./run.sh --dev # Vite HMR + FastAPI
315
+ # Ubuntu/Debian
316
+ sudo apt install python3.12
317
+
318
+ # macOS
319
+ brew install python@3.12
320
+
321
+ # Or set manually:
322
+ export HITS_PYTHON=/usr/bin/python3.12
284
323
  ```
285
324
 
286
- ### 테스트
325
+ ### "Frontend not built"
287
326
 
327
+ This shouldn't happen with the npm package (frontend is pre-built). If it does:
288
328
  ```bash
289
- ./run.sh --test # pytest 실행
329
+ npx hits --setup
290
330
  ```
291
331
 
292
- ### 프론트엔드 개발
332
+ ### "ModuleNotFoundError: No module named 'hits_core'"
293
333
 
334
+ Python dependencies failed to install. Try:
294
335
  ```bash
295
- cd hits_web
296
- npm install # 의존성 설치
297
- npm run dev # Vite 개발 서버 (http://localhost:5173)
298
- npm run build # 프로덕션 빌드
336
+ npx hits --setup
299
337
  ```
300
338
 
301
- ## 라이선스
339
+ ### Redis Connection Failed
302
340
 
303
- | 패키지 | 라이선스 | 상업적 사용 |
304
- |--------|---------|-------------|
305
- | `hits_core` | Apache 2.0 | ✅ 자유로움 |
306
- | `hits_web` | Apache 2.0 | ✅ 자유로움 |
341
+ Not a problem HITS automatically uses file-based storage. Redis is optional.
307
342
 
308
- ## 문제 해결
343
+ ## Development
309
344
 
310
- ### Node.js가 없습니다
345
+ If you're working on HITS itself:
311
346
 
312
347
  ```bash
313
- # Ubuntu/Debian
314
- curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
315
- sudo apt install -y nodejs
316
- ```
348
+ git clone https://github.com/lhjnano/hits.git
349
+ cd hits
317
350
 
318
- ### Redis 연결 실패
351
+ # Backend setup
352
+ python3 -m venv venv
353
+ source venv/bin/activate
354
+ pip install -r requirements.txt
319
355
 
320
- Redis 없이도 HITS는 정상 작동합니다. 파일 기반 저장소를 자동으로 사용합니다.
356
+ # Frontend build
357
+ cd hits_web && npm install && npm run build && cd ..
321
358
 
322
- ### 데이터가 어디에 저장되나요?
359
+ # Development mode (Vite HMR + FastAPI)
360
+ ./run.sh --dev
323
361
 
362
+ # Run tests
363
+ ./run.sh --test
324
364
  ```
325
- ~/.hits/
326
- ├── data/ ← 모든 데이터의 기본 위치
327
- │ ├── work_logs/ ← AI 세션 작업 기록
328
- │ ├── trees/ ← 지식 트리
329
- │ └── workflows/ ← 워크플로우
330
- ├── .auth/ ← 인증 데이터
331
- │ └── users.json ← 사용자 정보 (권한 600)
332
- ├── .pepper ← HMAC 페퍼 (권한 600)
333
- └── .jwt_secret ← JWT 서명 키 (권한 600)
334
-
335
- HITS_DATA_PATH 환경변수로 경로 변경 가능
336
- ```
365
+
366
+ ## License
367
+
368
+ Apache 2.0 free for commercial use.
369
+
370
+ ## Links
371
+
372
+ - **GitHub**: [https://github.com/lhjnano/hits](https://github.com/lhjnano/hits)
373
+ - **Issues**: [https://github.com/lhjnano/hits/issues](https://github.com/lhjnano/hits/issues)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleraven/hits",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "HITS - Hybrid Intel Trace System. AI session handover with secure web UI.",
5
5
  "keywords": [
6
6
  "knowledge-management",