hypomnema 1.2.0 → 1.2.1
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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.ko.md +72 -26
- package/README.md +53 -7
- package/hooks/hypo-cwd-change.mjs +8 -4
- package/hooks/hypo-first-prompt.mjs +39 -7
- package/hooks/hypo-personal-check.mjs +3 -1
- package/hooks/hypo-session-start.mjs +9 -5
- package/hooks/hypo-shared.mjs +25 -1
- package/package.json +1 -1
- package/scripts/resume.mjs +5 -1
- package/templates/hot.md +1 -1
- package/templates/hypo-config.md +1 -1
package/README.ko.md
CHANGED
|
@@ -15,13 +15,21 @@
|
|
|
15
15
|
|
|
16
16
|
**Claude Code를 위한 LLM 네이티브 개인 위키. 복리로 성장하는 지식.**
|
|
17
17
|
|
|
18
|
-
_Claude
|
|
18
|
+
_Claude에게 기록을 맡기세요 — 그리고 그 기록이 실제로 쌓이는지 측정하세요._
|
|
19
19
|
|
|
20
20
|
[빠른 시작](#빠른-시작) • [다른 시스템과의 비교](#다른-시스템과의-비교) • [설계 결정](#설계-결정) • [기능](#기능) • [아키텍처](docs/ARCHITECTURE.md) • [기여](docs/CONTRIBUTING.md)
|
|
21
21
|
|
|
22
|
-
> Andrej Karpathy의 "LLM 네이티브 위키" 스케치에서 영감을 받아, 10개월간의
|
|
22
|
+
> Andrej Karpathy의 "LLM 네이티브 위키" 스케치에서 영감을 받아, 10개월간의 AI 워크플로우 실험과 v1.2.0 공개 전 한 달의 Hypomnema 직접 굴리기(dogfood)로 다듬어진 도구입니다. 캡처 → 합성 → 검색 → 세션 재개로 이어지는 전체 라이프사이클을 Claude Code 명령어와 라이프사이클 훅으로 제공합니다.
|
|
23
23
|
|
|
24
|
-
>
|
|
24
|
+
> **아래에서 자주 쓰이는 용어 간단 정리.** *프런트매터(frontmatter)* = 마크다운 파일 맨 위의 YAML 블록. *위키링크(wikilink)* = `[[페이지-슬러그]]` 형태의 교차 참조. *ADR* = "Architecture Decision Record" — 어떤 설계 결정을 *왜* 했는지 짧게 적은 마크다운 페이지. *projection*(투영) = 한 방향 자동 파생(`pages/feedback/*.md` → `MEMORY.md` / `<learned_behaviors>`). *훅(hook)* = Claude Code가 라이프사이클 이벤트에서 자동으로 실행하는 스크립트. *hot.md* / *session-state.md* = "방금 무엇을 했는지"와 "다음에 무엇을 할지"를 담는 프로젝트별 캐시 파일 — 멈춘 프로젝트를 한 번에 이어 받을 수 있게 합니다. 전체 용어 풀이는 [용어 사전](#용어-사전) 참조.
|
|
25
|
+
|
|
26
|
+
> **현재 자동화 범위와 다음 목표.** v1.2.0(현재)은 트리거 모델을 솔직하게 정리합니다. 위키 작업(자료 정리·검색·세션 마무리)은 여전히 사용자가 `/hypo:*` 명령어를 직접 입력해 시작합니다. 다만 **v1.1.0**부터 위키가 한 세션에서 얼마나 활용됐는지를 측정하는 *관측성 지표(observability score)* 가 들어갔고, **v1.2.0**은 그 위에 사용자가 시키지 않아도 자동으로 동작하는 영역 4개를 추가했습니다:
|
|
27
|
+
> - **`feedback` 페이지를 단일 원천(source of truth)으로**(ADR 0031) — `pages/feedback/`에 한 번만 적으면, 위키가 `MEMORY.md`와 `~/.claude/CLAUDE.md`의 `<learned_behaviors>` 블록을 자동으로 갱신합니다.
|
|
28
|
+
> - **확장 파일 동봉 동기화**(ADR 0024) — 위키 안의 `~/hypomnema/extensions/{agents,commands,hooks,skills}/`에 둔 파일을 자동으로 `~/.claude/`에 반영합니다. `--codex` 옵션을 추가하면 `hooks`·`commands`는 `~/.codex/`에도 반영되지만, `agents`와 `skills`는 Claude 전용이라 의도적으로 건너뜁니다.
|
|
29
|
+
> - **프로젝트 자동 생성**(ADR 0023) — 작업 디렉터리를 git 저장소(`package.json`·`Cargo.toml` 등의 프로젝트 표식이 있는 곳)로 옮겼을 때 대응하는 위키 프로젝트가 없으면, 새로 만들지 물어봅니다.
|
|
30
|
+
> - **세션 종료 자동 정리와 `/clear` 복구**(ADR 0022) — 의미 있는 세션이 끝날 때 "마무리 메모를 짧게 남길까요?"가 자동으로 뜨고, 마무리하지 않은 채 `/clear`를 입력해도 다음 세션 시작 시 이어서 정리할 수 있습니다.
|
|
31
|
+
>
|
|
32
|
+
> 스키마(`SCHEMA.md`)는 2.0으로 올라갑니다. `feedback` 페이지 타입에 9개의 필수 항목이 추가되며, `hypomnema upgrade --apply`를 실행하면 위키 루트에 `MIGRATION-v2.0.md`가 생성되어 단계별 보강 체크리스트를 제공합니다. 사용자가 직접 편집한 `SCHEMA.md`는 upgrade가 **덮어쓰지 않습니다** — 안내만 표시하고, 실제 반영은 사용자가 수동으로 결정합니다(이 정책을 코드에서는 *Option C*로 부릅니다).
|
|
25
33
|
|
|
26
34
|
---
|
|
27
35
|
|
|
@@ -70,9 +78,9 @@ hypomnema
|
|
|
70
78
|
|
|
71
79
|
## Hypomnema가 필요한 이유
|
|
72
80
|
|
|
73
|
-
개인 지식 도구는 보통
|
|
81
|
+
개인 지식 도구는 보통 다섯 가지 부류에 속하고, 각각 다른 지점에서 무너집니다:
|
|
74
82
|
|
|
75
|
-
| |
|
|
83
|
+
| | 어디서 막히는가 | 왜 지식이 쌓이지 않는가 |
|
|
76
84
|
|---|---|---|
|
|
77
85
|
| **노트 볼트** (마크다운 기반, 로컬 우선) | 수동 캡처, 수동 링크, 수동 재독 | 노트가 독립적으로 머무름. 합성 없음 |
|
|
78
86
|
| **클라우드 지식 플랫폼** (페이지·DB 하이브리드) | 캡처는 빠르나 검색이 느림 | 키워드 기반 검색. LLM이 직접 접근 못 함 |
|
|
@@ -107,16 +115,45 @@ Hypomnema ───► 합성 · 마크다운 · git · 훅 · 로컬
|
|
|
107
115
|
| **포맷** | 평문 마크다운 + frontmatter | 마크다운 | 독자 포맷 | 벡터 스토어 | 독자 포맷 | HTML |
|
|
108
116
|
| **백엔드** | 로컬 파일 + git | 로컬 파일 | SaaS | 서비스 / DB | SaaS | 서비스 |
|
|
109
117
|
| **행동 튜닝** | `/hypo:feedback` → 영구 규칙 | 없음 | 없음 | 없음 | 일부 | 없음 |
|
|
110
|
-
| **자율 동작(auto-behavior)** |
|
|
118
|
+
| **자율 동작(auto-behavior)** | 명시적 `/hypo:*` 호출 + **v1.1 관측성 점수** + **v1.2 피드백 단일 원천 자동 반영 / 확장 파일 동봉 동기화 / 프로젝트 자동 생성 / 세션 종료 시 최소 마무리 자동 제안**; v2 목표는 완전 자율 동작 | 없음 | 없음 | 없음 | 블랙박스 | 없음 |
|
|
111
119
|
| **셋업 비용** | 명령 1개 | 설치 1번 | 가입 | 파이프라인 구축 | 가입 | 레포 연결 |
|
|
112
120
|
| **락인** | 0 (마크다운 + git) | 낮음 | 높음 | 중간 | 높음 | 중간 |
|
|
113
121
|
|
|
114
|
-
### 이
|
|
122
|
+
### 이 선택이 가져다주는 것
|
|
115
123
|
|
|
116
|
-
- **저장이
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
124
|
+
- **저장이 아니라 합성.** 끝까지 읽지도 못한 글들의 무덤이 쌓이지 않습니다. `/hypo:ingest`는 매번 구조화된 페이지를 만들고, 같은 주제의 다음 인제스트는 새 페이지가 아닌 *기존 페이지의 갱신*으로 들어갑니다.
|
|
125
|
+
- **밀도가 복리로 자란다.** 소스 100개짜리 위키가 단절된 페이지 100개로 끝나면 의미가 없습니다. 실사용 3개월 시점이면 페이지 수는 소스 증가보다 천천히 늘고, 교차 링크는 오히려 더 빠르게 늘어납니다.
|
|
126
|
+
- **맥락 전환이 0이다.** 어차피 Claude Code 안에서 일하는 중입니다. 위키는 슬래시 명령 한 줄로 닿습니다 — 새 탭도, 다른 앱도, 추가 로그인도 없습니다.
|
|
127
|
+
- **저장 형식이 오래 살아남는다.** 평문 마크다운 + git 조합은 20년 뒤에도 읽힙니다. 오프라인에서도 `grep`이 됩니다. 언제든 다른 도구로 옮길 수 있고, 아직 세상에 없는 미래의 AI 도우미도 별도 변환 없이 그대로 읽을 수 있습니다.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 용어 사전
|
|
132
|
+
|
|
133
|
+
Hypomnema가 본문에서 반복적으로 쓰는 용어를 한 표로 모았습니다. 본문을 훑어볼 때 이 표를 옆 탭에 열어 두시면 됩니다.
|
|
134
|
+
|
|
135
|
+
| 용어 | Hypomnema에서의 의미 |
|
|
136
|
+
|---|---|
|
|
137
|
+
| **프런트매터(frontmatter)** | 마크다운 페이지 맨 위의 YAML 블록 — `title`, `type`, `tags` 같은 항목이 들어갑니다 |
|
|
138
|
+
| **위키링크(wikilink)** | `[[페이지-슬러그]]` 형태의 페이지 간 교차 참조 — `lint` 시 유효성이 확인됩니다 |
|
|
139
|
+
| **ADR** | "Architecture Decision Record" — 자명하지 않은 설계 결정을 *왜* 했는지 짧게 기록하는 마크다운 페이지 |
|
|
140
|
+
| **스키마(schema)** | `SCHEMA.md`에 정의된 타입 분류 + 필수 항목 규칙 — 페이지가 유효한지의 기준 |
|
|
141
|
+
| **lint** | 읽기 전용 검증기(`hypomnema lint`) — 프런트매터·위키링크·스키마를 한꺼번에 점검 |
|
|
142
|
+
| **projection(투영)** | 한 방향 자동 파생 — `pages/feedback/*.md` → `MEMORY.md`와 CLAUDE.md `<learned_behaviors>` |
|
|
143
|
+
| **단일 원천(source of truth, SoT)** | 사용자가 편집하는 단 하나의 파일 — 단방향 반영(projection)은 그로부터만 파생되며, 역방향은 허용되지 않습니다 |
|
|
144
|
+
| **훅(hook)** | Claude Code가 라이프사이클 이벤트(`SessionStart`, `Stop` 등)에 자동으로 실행하는 스크립트 |
|
|
145
|
+
| **라이프사이클 이벤트** | Claude Code가 플러그인에 알리는 시점 — 세션 시작/프롬프트 제출/도구 사용/`compact` 요청/세션 종료 등 |
|
|
146
|
+
| **`hot.md`** | 프로젝트별 캐시 — "방금 무엇을 했는지"(직전 세션의 핵심) |
|
|
147
|
+
| **`session-state.md`** | 프로젝트별 캐시 — "다음에 무엇을 할지"(다음 세션 시작 시 주입되는 이어받기 데이터) |
|
|
148
|
+
| **`.hypoignore`** | 모든 콘텐츠 주입 훅과 `ingest`에서 제외할 경로(글롭 패턴) |
|
|
149
|
+
| **관측성 지표(observability score)** | 세션별 측정값(ingest·query·session-close·citation 비율) — 위키가 실제로 활용됐는지를 보여줍니다 |
|
|
150
|
+
| **manifest** | 설치 스크립트가 작성하는 작은 JSON — 어떤 파일을 어떤 SHA로 설치했는지 정확히 기록 |
|
|
151
|
+
| **`additionalContext`** | Claude Code 훅이 프롬프트에 컨텍스트를 끼워 넣는 필드 — 콘텐츠 주입 훅의 출력 위치 |
|
|
152
|
+
| **바이트 동일(byte-equal)** | `--apply` 전후가 비트 단위로 같은 파일 — "건드리지 않았다"는 가장 강한 보장 |
|
|
153
|
+
| **BM25** | 고전적인 전문(全文) 랭킹 알고리즘 — `/hypo:query`의 MISS 내성 검색을 담당 |
|
|
154
|
+
| **Option C** | `hypomnema upgrade --apply`가 사용자의 `SCHEMA.md`를 절대 덮어쓰지 않는 정책 — 마이그레이션 보고서만 작성하고, 적용은 사용자가 수동으로 |
|
|
155
|
+
|
|
156
|
+
본문에서 마주친 용어가 이 표에 빠져 있다면 문서 버그입니다. 이슈를 남겨 주세요.
|
|
120
157
|
|
|
121
158
|
---
|
|
122
159
|
|
|
@@ -132,7 +169,7 @@ RAG는 *낯선* 코퍼스에 강합니다 — 100만 페이지 법률 아카이
|
|
|
132
169
|
- 사용자는 단편이 아니라 **관점**을 원합니다.
|
|
133
170
|
- 청크 수는 캡처에 비례해 선형 증가합니다 — 지식이 늘지 않아도.
|
|
134
171
|
|
|
135
|
-
Hypomnema는 청크가 아니라 페이지를 지식 단위로 다룹니다. 새 소스는 페이지에
|
|
172
|
+
Hypomnema는 청크가 아니라 페이지를 지식 단위로 다룹니다. 새 소스는 관련 페이지에 반영됩니다 — 기존 페이지가 있으면 갱신하고, 없으면 새 페이지로 만듭니다. 결과물은 위키 문서처럼 읽힙니다 — 정확히 위키 문서이기 때문입니다.
|
|
136
173
|
|
|
137
174
|
### 2. 왜 독자 포맷이 아니라 **마크다운 + git**인가
|
|
138
175
|
|
|
@@ -166,7 +203,7 @@ Hypomnema는 청크가 아니라 페이지를 지식 단위로 다룹니다. 새
|
|
|
166
203
|
|
|
167
204
|
### 7. 왜 privacy mode 플래그가 아니라 **`.hypoignore`** 인가
|
|
168
205
|
|
|
169
|
-
v1.0에서는 `personal / shared / public` 3-mode를 만들었습니다. 현실과 부딪히자마자 무너졌습니다 — 모든 privacy 결정은 결국 *경로 단위* 질문이었고, 그 질문은 단일 파일(`.hypoignore`)이 네이티브로 처리합니다. v1.1은 mode 개념을 통째로 삭제했습니다.
|
|
206
|
+
v1.0에서는 `personal / shared / public` 3-mode를 만들었습니다. 현실과 부딪히자마자 무너졌습니다 — 모든 privacy 결정은 결국 *경로 단위* 질문이었고, 그 질문은 단일 파일(`.hypoignore`)이 네이티브로 처리합니다. v1.1은 mode 개념을 통째로 삭제했습니다. 한 파일이 모든 결정을 담는 단일 원천 구조입니다.
|
|
170
207
|
|
|
171
208
|
---
|
|
172
209
|
|
|
@@ -180,14 +217,14 @@ v1.0에서는 `personal / shared / public` 3-mode를 만들었습니다. 현실
|
|
|
180
217
|
|---|---|---|
|
|
181
218
|
| `/hypo:ingest` | 원본을 `sources/`에 보관하고 Claude가 `pages/`에 구조화된 페이지를 합성. 셸 헬퍼(`scripts/ingest.mjs`)는 read-only — 아직 ingest되지 않은 소스를 *목록만* 출력 | 보관할 가치가 있는 글을 읽었을 때 |
|
|
182
219
|
| `/hypo:query` | BM25 검색 + LLM 합성 + `[[wikilink]]` 인용 | 자기 노트에 근거한 답변이 필요할 때 |
|
|
183
|
-
| `/hypo:crystallize` |
|
|
184
|
-
| `/hypo:resume` | 활성 프로젝트의 가장 최근 세션
|
|
185
|
-
| `/hypo:feedback` | AI 행동 교정
|
|
186
|
-
| `/hypo:verify` | `verify_by`
|
|
220
|
+
| `/hypo:crystallize` | 세션 마무리 체크리스트(1~6단계) 실행. 요청 시 초안 합성(7~11단계)까지 수행 | 단순하지 않은 세션을 마칠 때 |
|
|
221
|
+
| `/hypo:resume` | 활성 프로젝트의 가장 최근 세션 상태를 불러오기 | 잠시 미뤄둔 프로젝트로 돌아올 때 |
|
|
222
|
+
| `/hypo:feedback` | AI 행동 교정 사항을 기록. 영구 규칙으로 승격 후보가 됨 | Claude가 잘못한 순간 — 또는 반대로 정확히 잘한 순간 |
|
|
223
|
+
| `/hypo:verify` | `verify_by` 프런트매터가 붙은 페이지를 점검 | 시간이 지나 옛 정보가 됐을 가능성이 있을 때 |
|
|
187
224
|
| `/hypo:lint` | frontmatter, 위키링크, 스키마 검증 | 커밋 전, CI에서 |
|
|
188
225
|
| `/hypo:graph` | 위키링크 의존성 그래프 생성 | 구조적 성장을 보고 싶을 때 |
|
|
189
226
|
|
|
190
|
-
### 라이프사이클 훅 (
|
|
227
|
+
### 라이프사이클 훅 (14개)
|
|
191
228
|
|
|
192
229
|
| 훅 | 이벤트 | 역할 |
|
|
193
230
|
|---|---|---|
|
|
@@ -201,9 +238,17 @@ v1.0에서는 `personal / shared / public` 3-mode를 만들었습니다. 현실
|
|
|
201
238
|
| `hypo-auto-commit.mjs` | `Stop` | 자동 commit + pull + push |
|
|
202
239
|
| `hypo-hot-rebuild.mjs` | `Stop` | `hot.md` 재생성 |
|
|
203
240
|
| `hypo-personal-check.mjs` | `PreCompact` | lint 실패 / session-close 미완 시 compact 차단 |
|
|
241
|
+
| `hypo-session-end.mjs` | `SessionEnd` | SessionEnd 마커 기록 — 다음 SessionStart가 `source=clear` 복구를 감지하기 위함 (ADR 0022) |
|
|
242
|
+
| `hypo-session-record.mjs` | `Stop` | observability 점수 + auto-resume 신호용 세션 메타데이터 기록 |
|
|
243
|
+
| `hypo-auto-minimal-crystallize.mjs` | `Stop` | 단순하지 않은 세션이 끝났을 때 `/hypo:crystallize --apply-session-close --minimal`을 자동 제안 (사용자가 동의하면 실행, ADR 0022 Layer 3) |
|
|
244
|
+
| `hypo-web-fetch-ingest.mjs` | `PostToolUse(WebFetch/WebSearch)` | WebFetch/WebSearch 완료 후 `additionalContext`에 `/hypo:ingest` 권유 안내 주입 (privacy 보호: WebFetch URL의 query/hash/userinfo 제거) |
|
|
204
245
|
|
|
205
246
|
모든 훅은 위키 루트를 `HYPO_DIR` 환경변수 → `hypo-config.md` 스캔 → `~/hypomnema` 기본값 순으로 해결하며, `hypo-shared.mjs`(`hooks.json`의 `shared` 필드로 선언)를 공유합니다.
|
|
206
247
|
|
|
248
|
+
이와 별도로 `SessionStart` 훅은 npm 레지스트리와 Claude Code 플러그인 마켓플레이스를 백그라운드에서 확인합니다(세션 시작을 막지 않습니다). 새 버전이 게시되어 있으면 다음 세션 시작 시 "Update available!" 안내가 한 줄 표시됩니다. `HYPO_NO_UPDATE_CHECK=1`, `NO_UPDATE_NOTIFIER=1`을 지정하거나 `CI=true` 환경에서 실행하면 점검을 건너뜁니다.
|
|
249
|
+
|
|
250
|
+
위 네 가지 레인 외의 v1.2 세부 수정 — 오래된 `design-history.md`를 잡는 `W8` lint, 프로젝트 간 누출을 막는 `project:*` 정확 일치 필터(PR #59), 코드 주석 정리 1단계(PR #58) — 는 [`CHANGELOG.md`](CHANGELOG.md)를 참고하세요.
|
|
251
|
+
|
|
207
252
|
### 셋업 & 유지보수
|
|
208
253
|
|
|
209
254
|
| 명령어 | 목적 |
|
|
@@ -213,17 +258,18 @@ v1.0에서는 `personal / shared / public` 3-mode를 만들었습니다. 현실
|
|
|
213
258
|
| `/hypo:upgrade` | 훅/설정을 최신 버전으로 마이그레이션 |
|
|
214
259
|
| `/hypo:uninstall` | 훅 및 등록 정보 제거 |
|
|
215
260
|
| `/hypo:stats` | 위키 통계 |
|
|
261
|
+
| `/hypo:audit` | observability 감사 (세션별 메트릭, 주간 보고서) |
|
|
216
262
|
|
|
217
263
|
### Claude Agent Skills
|
|
218
264
|
|
|
219
|
-
합성이 핵심인 명령어(`ingest`, `query`, `crystallize`, `lint`, `verify`, `graph`)는 `skills/<name>/SKILL.md`로도 등록되어
|
|
265
|
+
합성이 핵심인 명령어(`ingest`, `query`, `crystallize`, `lint`, `verify`, `graph`)는 `skills/<name>/SKILL.md`로도 등록되어 있습니다. 대화 내용이 해당 스킬의 설명(`description`)과 맞아떨어지면 **Claude Agent Skills** 메커니즘이 슬래시 명령 입력 없이도 자동으로 호출합니다.
|
|
220
266
|
|
|
221
267
|
---
|
|
222
268
|
|
|
223
269
|
## 시나리오
|
|
224
270
|
|
|
225
271
|
**A — 새 기술 학습.**
|
|
226
|
-
Kubernetes 문서와 블로그 글을 읽는
|
|
272
|
+
Kubernetes 문서와 블로그 글을 읽는 중입니다. 각 URL을 `/hypo:ingest`에 넘깁니다. 세 번째 글쯤 되면 Claude가 새 페이지를 만드는 대신 기존 `kubernetes-networking.md`를 갱신하기 시작합니다. 일주일 뒤 `/hypo:query "pod CIDR 할당은 어떻게 동작하나요?"`를 실행하면, 본인이 직접 정리해 둔 노트를 인용한 합성 답변이 돌아옵니다.
|
|
227
273
|
|
|
228
274
|
**B — 엔지니어링 결정 추적.**
|
|
229
275
|
중요한 변경 사항을 머지하기 전에 설계 문서나 PR 설명을 `/hypo:ingest`로 처리합니다. Claude가 컨텍스트, 트레이드오프, 결정 사항이 담긴 ADR 스타일 페이지를 작성합니다. 이후 `[[wikilink]]` 참조가 관련 프롬프트에 근거를 직접 주입합니다.
|
|
@@ -232,7 +278,7 @@ Kubernetes 문서와 블로그 글을 읽는 중. 각 URL을 `/hypo:ingest`에
|
|
|
232
278
|
몇 주에 걸쳐 한 주제의 논문들을 읽습니다. 각 `/hypo:ingest`가 논문을 합성하고 기존 페이지와 교차 연결합니다. 언제든 `/hypo:query`로 자신의 노트에 근거한 문헌 리뷰 스타일 요약을 받을 수 있습니다.
|
|
233
279
|
|
|
234
280
|
**D — AI 행동 튜닝.**
|
|
235
|
-
Claude가
|
|
281
|
+
Claude가 잘못한 순간 — 또는 반대로 정확히 잘한 순간 — `/hypo:feedback`을 실행합니다. 교정 내용이 `pages/feedback/`에 저장되고 다음 세션 시작 시 자동으로 주입되므로, 같은 실수가 다시 반복되지 않습니다. 한 번의 대화 안에서만 효력이 있는 게 아니라, 세션이 바뀌어도 그대로 유지된다는 뜻입니다.
|
|
236
282
|
|
|
237
283
|
**E — 일시 중단된 프로젝트 재개.**
|
|
238
284
|
3주 동안 손 놓았던 프로젝트로 돌아옵니다. 다음 세션 시작 시 `hypo-session-start.mjs`가 `projects/<name>/session-state.md`를 읽고 "다음 작업"과 최근 결정 사항을 컨텍스트에 주입합니다. 첫 프롬프트를 입력하기 전에 이미 업무 파악이 끝나 있습니다.
|
|
@@ -296,17 +342,17 @@ Claude가 잘못하거나 정확히 맞았을 때마다 `/hypo:feedback`을 실
|
|
|
296
342
|
|
|
297
343
|
위키 루트에 `hypo-config.md`를 두면 환경변수 없이도 기기 간 이식이 가능합니다.
|
|
298
344
|
|
|
299
|
-
`.hypoignore`는 훅이 무시할 경로를 정의합니다 (기본: `*.pdf`, `*.zip`, `*.pem`, `*.env` 등). 직접 편집하면 됩니다 — privacy mode 플래그는 없습니다.
|
|
345
|
+
`.hypoignore`는 훅이 무시할 경로를 정의합니다 (기본: `*.pdf`, `*.zip`, `*.pem`, `*.env` 등). 직접 편집하면 됩니다 — privacy mode 플래그는 없습니다. 파일 하나가 모든 결정을 담는 단일 원천 구조입니다.
|
|
300
346
|
|
|
301
|
-
>
|
|
347
|
+
> **모델 사업자에게 전송되는 범위 안내.** Hypomnema 훅은 위키 본문을 Claude Code의 추가 컨텍스트(`additionalContext`)에 실어 보내며, 이 내용은 프롬프트의 일부로 Claude 모델 사업자에게 전송됩니다. 따라서 `.hypoignore`에 등록된 경로는 모든 주입 훅(`hypo-file-watch`, `hypo-session-start`, `hypo-cwd-change`, `hypo-lookup`)과 `ingest`에서 제외되지만, 등록되지 *않은* 파일은 전송 대상이 됩니다. (`hypo-auto-stage`/`hypo-auto-commit`은 git 스테이징용 훅이라 컨텍스트를 주입하지는 않지만, 스테이징 판단에도 동일하게 `.hypoignore`를 참고합니다.) 비밀 정보는 위키에 두지 마시고, `HYPO_DIR` 아래에 민감한 내용을 저장하기 전에 `.hypoignore` 패턴을 먼저 점검하시기 바랍니다.
|
|
302
348
|
|
|
303
|
-
> **git sync 범위.** Hypomnema는 `~/hypomnema/` 위키 자체만 git sync합니다.
|
|
349
|
+
> **git sync 범위.** Hypomnema는 `~/hypomnema/` 위키 자체만 git sync합니다. 단, `init` / `upgrade`는 `~/.claude/` 내부의 관리 대상 영역 — Hypomnema 자체 hook(`~/.claude/hooks/`), 슬래시 커맨드(`~/.claude/commands/hypo/`), `settings.json` 등록 — 을 설치·SHA 추적하며, v1.2.0 **extensions companion sync**(ADR 0024)에 의해 위키의 `~/hypomnema/extensions/`에 둔 `agents/`·`commands/`·`hooks/`·`skills/`도 자동 미러링합니다(`--codex` 옵션 시 `hooks`·`commands` 부분 집합만 `~/.codex/`로). 이 관리 대상 영역 *바깥*의 `~/.claude/` 콘텐츠는 의도적으로 Hypomnema가 **관리하지 않습니다** — 위키를 거치지 않는 기타 agent/skill, 머신 고유 `settings.local.json` 등 일반적인 Claude Code 설정 기기 간 동기화는 [chezmoi](https://www.chezmoi.io/) 같은 별도 dotfiles 매니저 사용을 권장합니다.
|
|
304
350
|
|
|
305
351
|
### `/hypo:*` 커맨드는 어디서 오는가?
|
|
306
352
|
|
|
307
353
|
| 설치 경로 | 슬래시 커맨드 위치 |
|
|
308
354
|
|---|---|
|
|
309
|
-
| 플러그인 (Path A) | Claude Code 플러그인 캐시; `/plugin update`로 갱신 |
|
|
355
|
+
| 플러그인 (Path A) | Claude Code 플러그인 캐시; `/plugin marketplace update hypomnema` 후 `/reload-plugins`로 갱신 |
|
|
310
356
|
| npm CLI (Path B) | `~/.claude/commands/hypo/`; `hypomnema upgrade --apply`로 갱신, 파일별 SHA 추적. 사용자 수정본까지 덮어쓰려면 `--force-commands`(원본은 `.bak`으로 보존) |
|
|
311
357
|
|
|
312
358
|
---
|
|
@@ -322,7 +368,7 @@ Claude가 잘못하거나 정확히 맞았을 때마다 `/hypo:feedback`을 실
|
|
|
322
368
|
|
|
323
369
|
## 상태
|
|
324
370
|
|
|
325
|
-
- **테스트:** `npm test` 참조 —
|
|
371
|
+
- **테스트:** `npm test` 참조 — 레인이 ship될 때마다 카운트가 변하므로 러너가 단일 원천입니다
|
|
326
372
|
- **CI:** 7개 독립 job (test matrix, lint, init/upgrade snapshots, replay, hypo-absent, uninstall-smoke)
|
|
327
373
|
- **릴리스:** `v*` 태그 push 시 `npm publish --provenance` 자동 실행
|
|
328
374
|
|
package/README.md
CHANGED
|
@@ -19,9 +19,17 @@ _Make Claude take notes — and measure whether it actually does._
|
|
|
19
19
|
|
|
20
20
|
[Quick Start](#quick-start) • [How It Compares](#how-it-compares) • [Design Decisions](#design-decisions) • [Features](#features) • [Architecture](docs/ARCHITECTURE.md) • [Contributing](docs/CONTRIBUTING.md)
|
|
21
21
|
|
|
22
|
-
> Inspired by Andrej Karpathy's "LLM-native wiki" sketch and shaped by ten months of personal
|
|
22
|
+
> Inspired by Andrej Karpathy's "LLM-native wiki" sketch and shaped by ten months of personal AI-workflow experiments plus one month of Hypomnema dogfooding before the v1.2.0 public release, Hypomnema ships the full lifecycle — capture, synthesis, retrieval, session-resume — as Claude Code commands and lifecycle hooks.
|
|
23
23
|
|
|
24
|
-
> **
|
|
24
|
+
> **Quick decoder for terms used below.** *frontmatter* = the YAML block at the top of a markdown file; *wikilink* = a `[[page-slug]]` cross-reference; *ADR* = "Architecture Decision Record", a short markdown page that records *why* a design choice was made; *projection* = a one-way derive (`pages/feedback/*.md` → `MEMORY.md` / `<learned_behaviors>`); *hook* = a script that Claude Code runs automatically on lifecycle events; *hot.md* / *session-state.md* = the per-project cache files that hold "what just happened" and "what's next" so a paused project resumes in one read. Full glossary lives under [Term decoder](#term-decoder).
|
|
25
|
+
|
|
26
|
+
> **Current state vs. v2 vision.** v1.2.0 (today) is honest about its trigger model: most wiki behavior — ingest, query, session-close — still fires on **explicit `/hypo:*` commands**, but the auto-behavior surface is growing. The v2 thesis is *fully autonomous* — Claude reading, writing, and synthesizing the wiki without being asked. **v1.1.0** shipped the **observability score** that measures how often the wiki is actually used per session (ingest / query / session-close / citation rates). **v1.2.0** adds four load-bearing autonomous lanes on top:
|
|
27
|
+
> - **feedback-as-SoT with one-way projections** — `pages/feedback/` becomes the single source-of-truth (SoT) for behavior corrections; the wiki one-way derives `MEMORY.md` and the `<learned_behaviors>` block inside `~/.claude/CLAUDE.md`, so you edit one place and the projections refresh on their own (ADR 0031 — full design rationale lives in `projects/hypomnema/decisions/0031-*.md` inside your wiki).
|
|
28
|
+
> - **extensions companion sync** — anything you drop under `~/hypomnema/extensions/{agents,commands,hooks,skills}/` is mirrored into `~/.claude/` automatically; the optional `--codex` flag additionally mirrors `hooks` and `commands` into `~/.codex/` (agents/skills are Claude-only and skipped on the Codex target by design) (ADR 0024).
|
|
29
|
+
> - **auto-project creation on cwd match** — when you `cd` into a git repo with a project marker (`package.json`, `Cargo.toml`, etc.) and no matching wiki project exists, Hypomnema offers to scaffold one for you (ADR 0023).
|
|
30
|
+
> - **Stop-chain auto-minimal-crystallize + `/clear` recovery** — non-trivial sessions get an automatic "save a minimal session-close note?" prompt; `/clear` after a forgotten close is detected and recovered cleanly (ADR 0022).
|
|
31
|
+
>
|
|
32
|
+
> The schema (`SCHEMA.md`) bumps to 2.0 — the `feedback` page type now requires 9 mandatory frontmatter fields. `hypomnema upgrade --apply` writes `MIGRATION-v2.0.md` into the wiki root with a step-by-step backfill checklist. Your own `SCHEMA.md` is **never overwritten** by upgrade — we call this policy *Option C*: the upgrade only tells you what changed, and you apply the diff yourself.
|
|
25
33
|
|
|
26
34
|
---
|
|
27
35
|
|
|
@@ -70,7 +78,7 @@ Hooks handle the rest — auto-staging, auto-commit/push, session-state injectio
|
|
|
70
78
|
|
|
71
79
|
## Why Hypomnema
|
|
72
80
|
|
|
73
|
-
Personal knowledge tools fall into
|
|
81
|
+
Personal knowledge tools fall into five buckets, and each one breaks at a different place:
|
|
74
82
|
|
|
75
83
|
| | Pain | Why it doesn't compound |
|
|
76
84
|
|---|---|---|
|
|
@@ -107,7 +115,7 @@ Hypomnema ───► synthesis · markdown · git · hooks · local
|
|
|
107
115
|
| **Format** | Plain markdown + frontmatter | Markdown | Proprietary | Vector store | Proprietary | HTML |
|
|
108
116
|
| **Backend** | Local file + git | Local file | SaaS | Service / DB | SaaS | Service |
|
|
109
117
|
| **Behavior tuning** | `/hypo:feedback` → permanent rules | None | None | None | Sometimes | None |
|
|
110
|
-
| **Auto-behavior** | Explicit `/hypo:*` triggers
|
|
118
|
+
| **Auto-behavior** | Explicit `/hypo:*` triggers + **v1.1 observability score** + **v1.2 feedback-as-SoT projection / extensions companion sync / auto-project / Stop-chain auto-minimal-crystallize**; v2 target = fully autonomous | None | None | None | Black box | None |
|
|
111
119
|
| **Setup cost** | One command | One install | Sign-up | Pipeline build | Sign-up | Repo connect |
|
|
112
120
|
| **Lock-in** | Zero (markdown + git) | Low | High | Medium | High | Medium |
|
|
113
121
|
|
|
@@ -120,6 +128,35 @@ Hypomnema ───► synthesis · markdown · git · hooks · local
|
|
|
120
128
|
|
|
121
129
|
---
|
|
122
130
|
|
|
131
|
+
## Term decoder
|
|
132
|
+
|
|
133
|
+
Hypomnema borrows vocabulary from a few worlds. These are the recurring terms used in the rest of the README — keep this table open in another tab while you skim.
|
|
134
|
+
|
|
135
|
+
| Term | Meaning in Hypomnema |
|
|
136
|
+
|---|---|
|
|
137
|
+
| **frontmatter** | The YAML block at the top of a markdown page — `title`, `type`, `tags`, etc. |
|
|
138
|
+
| **wikilink** | A `[[page-slug]]` cross-reference between pages; resolved at lint time |
|
|
139
|
+
| **ADR** | "Architecture Decision Record" — a short markdown page recording *why* a non-obvious design choice was made |
|
|
140
|
+
| **schema** | The type taxonomy + required-field rules in `SCHEMA.md` — what makes a page valid |
|
|
141
|
+
| **lint** | A read-only validator (`hypomnema lint`) that checks frontmatter, wikilinks, and schema |
|
|
142
|
+
| **projection** | A one-way automatic derivation — `pages/feedback/*.md` → `MEMORY.md` and CLAUDE.md `<learned_behaviors>` |
|
|
143
|
+
| **SoT** ("source of truth") | The single file you edit; projections derive from it, never the other way around |
|
|
144
|
+
| **hook** | A script Claude Code runs automatically on a lifecycle event (e.g. `SessionStart`, `Stop`) |
|
|
145
|
+
| **lifecycle event** | A point Claude Code surfaces to plugins: session opens, prompt submitted, tool used, compact requested, session ends, etc. |
|
|
146
|
+
| **`hot.md`** | Per-project cache: "what just happened" (most recent session highlights) |
|
|
147
|
+
| **`session-state.md`** | Per-project cache: "what's next" (the resume payload for the next session) |
|
|
148
|
+
| **`.hypoignore`** | Glob patterns that exclude paths from every content-injection hook and from `ingest` |
|
|
149
|
+
| **observability score** | A per-session metric (ingest / query / session-close / citation rates) that measures whether the wiki is actually being used |
|
|
150
|
+
| **manifest** | A small JSON the install scripts write to track exactly which files were installed and at what SHA |
|
|
151
|
+
| **`additionalContext`** | The Claude Code hook field that injects extra context into the prompt — what content-injection hooks emit into |
|
|
152
|
+
| **byte-equal** | A file that comes out of `--apply` bit-for-bit identical to before — the strongest "we did not touch this" guarantee |
|
|
153
|
+
| **BM25** | A classic full-text ranking algorithm; powers the `/hypo:query` MISS-resistant lookup |
|
|
154
|
+
| **Option C** | The policy that `hypomnema upgrade --apply` never overwrites your `SCHEMA.md` — it only writes a migration report you apply by hand |
|
|
155
|
+
|
|
156
|
+
If a term you hit later in the README is missing here, that is a documentation bug — please open an issue.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
123
160
|
## Design Decisions
|
|
124
161
|
|
|
125
162
|
Why each choice looks the way it does:
|
|
@@ -187,7 +224,7 @@ Eight commands cover the full capture → retrieval → consolidation cycle.
|
|
|
187
224
|
| `/hypo:lint` | Validates frontmatter, wikilinks, schema | Before commits, in CI |
|
|
188
225
|
| `/hypo:graph` | Generates a wikilink dependency graph | When you want to see structural growth |
|
|
189
226
|
|
|
190
|
-
### Lifecycle hooks (
|
|
227
|
+
### Lifecycle hooks (14)
|
|
191
228
|
|
|
192
229
|
| Hook | Event | Role |
|
|
193
230
|
|---|---|---|
|
|
@@ -201,9 +238,17 @@ Eight commands cover the full capture → retrieval → consolidation cycle.
|
|
|
201
238
|
| `hypo-auto-commit.mjs` | `Stop` | Auto commit + pull + push |
|
|
202
239
|
| `hypo-hot-rebuild.mjs` | `Stop` | Rebuild `hot.md` |
|
|
203
240
|
| `hypo-personal-check.mjs` | `PreCompact` | Block compact on lint failures or unfinished session-close |
|
|
241
|
+
| `hypo-session-end.mjs` | `SessionEnd` | Write a SessionEnd marker so SessionStart can detect `source=clear` recovery (ADR 0022) |
|
|
242
|
+
| `hypo-session-record.mjs` | `Stop` | Record session metadata for the observability score and auto-resume signaling |
|
|
243
|
+
| `hypo-auto-minimal-crystallize.mjs` | `Stop` | Offer (and on consent run) `/hypo:crystallize --apply-session-close --minimal` after non-trivial sessions (ADR 0022 Layer 3) |
|
|
244
|
+
| `hypo-web-fetch-ingest.mjs` | `PostToolUse(WebFetch/WebSearch)` | Inject a `/hypo:ingest` nudge into `additionalContext` after a URL resolution (privacy-aware: redacts query/hash/userinfo) |
|
|
204
245
|
|
|
205
246
|
All hooks resolve the wiki root via `HYPO_DIR` env → `hypo-config.md` scan → `~/hypomnema` default, and share `hypo-shared.mjs` (declared via `hooks.json`'s `shared` field).
|
|
206
247
|
|
|
248
|
+
Additionally, the `SessionStart` hook performs a non-blocking background check against npm and the Claude Code plugin marketplace and prints an "Update available!" banner the next time a newer Hypomnema version has been published. Opt out with `HYPO_NO_UPDATE_CHECK=1`, `NO_UPDATE_NOTIFIER=1`, or by running under `CI=true`.
|
|
249
|
+
|
|
250
|
+
For fix-level v1.2 detail beyond the lanes above — `W8` stale `design-history.md` lint, exact-match `project:*` filter for cross-project feedback projection (PR #59), and the comment-hygiene Phase 1 cleanup (PR #58) — see [`CHANGELOG.md`](CHANGELOG.md).
|
|
251
|
+
|
|
207
252
|
### Setup & maintenance
|
|
208
253
|
|
|
209
254
|
| Command | Purpose |
|
|
@@ -213,6 +258,7 @@ All hooks resolve the wiki root via `HYPO_DIR` env → `hypo-config.md` scan →
|
|
|
213
258
|
| `/hypo:upgrade` | Migrate hooks/config to the latest version |
|
|
214
259
|
| `/hypo:uninstall` | Remove hooks and registrations |
|
|
215
260
|
| `/hypo:stats` | Wiki statistics |
|
|
261
|
+
| `/hypo:audit` | Observability audit (per-session metrics, weekly report) |
|
|
216
262
|
|
|
217
263
|
### Claude Agent Skills
|
|
218
264
|
|
|
@@ -300,13 +346,13 @@ Place a `hypo-config.md` at the wiki root to make it portable across machines wi
|
|
|
300
346
|
|
|
301
347
|
> **Provider transmission disclaimer.** Hypomnema hooks emit wiki content into Claude Code's `additionalContext`, which is transmitted to the Claude model provider as part of the prompt. `.hypoignore` is enforced at every content-injection hook (`hypo-file-watch`, `hypo-session-start`, `hypo-cwd-change`, `hypo-lookup`) and at `ingest`, but any file *not* matched by `.hypoignore` is fair game for transmission. (`hypo-auto-stage` and `hypo-auto-commit` are git-staging hooks, not injection points, and also honor `.hypoignore` for their staging decisions.) Keep secrets out of the wiki, and review `.hypoignore` patterns before storing anything sensitive under `HYPO_DIR`.
|
|
302
348
|
|
|
303
|
-
> **Scope of git sync.** Hypomnema git-syncs only the `~/hypomnema/` wiki itself.
|
|
349
|
+
> **Scope of git sync.** Hypomnema git-syncs only the `~/hypomnema/` wiki itself. `init` / `upgrade` actively install and SHA-track a defined surface inside `~/.claude/` — Hypomnema's own hooks (`~/.claude/hooks/`), slash commands (`~/.claude/commands/hypo/`), and `settings.json` registrations — plus, via v1.2.0 **extensions companion sync** (ADR 0024), any `agents/` · `commands/` · `hooks/` · `skills/` you ship inside `~/hypomnema/extensions/` (and with `--codex`, the `hooks` + `commands` subset into `~/.codex/`). Anything *outside* that defined surface in `~/.claude/` is intentionally **not** managed by Hypomnema — for general cross-machine sync of Claude Code configuration (other agents/skills not staged via the wiki, machine-specific `settings.local.json`, etc.), the recommended pattern is still a separate dotfiles manager such as [chezmoi](https://www.chezmoi.io/).
|
|
304
350
|
|
|
305
351
|
### Where do `/hypo:*` commands live?
|
|
306
352
|
|
|
307
353
|
| Install path | Slash commands served from |
|
|
308
354
|
|---|---|
|
|
309
|
-
| Plugin (Path A) | Claude Code's plugin cache; updated via `/plugin update` |
|
|
355
|
+
| Plugin (Path A) | Claude Code's plugin cache; updated via `/plugin marketplace update hypomnema` then `/reload-plugins` |
|
|
310
356
|
| npm CLI (Path B) | `~/.claude/commands/hypo/`; updated via `hypomnema upgrade --apply` with per-file SHA tracking. Pass `--force-commands` to overwrite hand-edits (creates `.bak`). |
|
|
311
357
|
|
|
312
358
|
---
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
shouldSuggestProjectCreation,
|
|
19
19
|
buildProjectSuggestionLine,
|
|
20
20
|
recordSuggestionCooldown,
|
|
21
|
+
sanitizeProjForPrompt,
|
|
21
22
|
} from './hypo-shared.mjs';
|
|
22
23
|
|
|
23
24
|
const PROJECTS_DIR = join(HYPO_DIR, 'projects');
|
|
@@ -124,10 +125,13 @@ process.stdin.on('end', () => {
|
|
|
124
125
|
}
|
|
125
126
|
console.log(
|
|
126
127
|
JSON.stringify(
|
|
127
|
-
buildOutput(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
buildOutput(
|
|
129
|
+
`[WIKI: cwd changed → project=${sanitizeProjForPrompt(newHit.proj)}]\n\n${content}`,
|
|
130
|
+
{
|
|
131
|
+
continue: true,
|
|
132
|
+
suppressOutput: true,
|
|
133
|
+
},
|
|
134
|
+
),
|
|
131
135
|
),
|
|
132
136
|
);
|
|
133
137
|
return;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { readFileSync, unlinkSync, existsSync } from 'fs';
|
|
18
|
-
import { buildOutput, sessionMarkerPath } from './hypo-shared.mjs';
|
|
18
|
+
import { buildOutput, sessionMarkerPath, sanitizeProjForPrompt } from './hypo-shared.mjs';
|
|
19
19
|
|
|
20
20
|
const MARKER_TTL = 10 * 60 * 1000; // 10 min
|
|
21
21
|
|
|
@@ -52,16 +52,48 @@ process.stdin.on('end', () => {
|
|
|
52
52
|
// fix #13: a cwd-change re-trigger says "Resuming"; a fresh session start
|
|
53
53
|
// (default source) says "Previously working on".
|
|
54
54
|
const verb = marker.source === 'cwd-change' ? 'Resuming' : 'Previously working on';
|
|
55
|
+
// marker.proj originates from a wiki directory name read by findProjectFiles;
|
|
56
|
+
// sanitize via the shared helper so a hand-crafted project name cannot close
|
|
57
|
+
// the wrapper tag, smuggle newlines/control chars, or inject conflicting
|
|
58
|
+
// directives into the resume contract (codex v2 review 2026-05-26).
|
|
59
|
+
const projSafe = sanitizeProjForPrompt(marker.proj);
|
|
60
|
+
// When there is no snapshot, the [HOT] / [SESSION STATE] context has nothing
|
|
61
|
+
// for the model to fill the placeholders with. Provide a concrete fallback
|
|
62
|
+
// line so the model doesn't leak literal `[one-line summary]` text on a
|
|
63
|
+
// first-ever session (codex v2 review 2026-05-26).
|
|
64
|
+
const exampleLine = hasSnapshot
|
|
65
|
+
? `${verb} ${projSafe}: [one-line summary]. Continue with [next task]?`
|
|
66
|
+
: `${verb} ${projSafe}: no prior snapshot yet — first session. What would you like to start with?`;
|
|
67
|
+
const fillNote = hasSnapshot
|
|
68
|
+
? `Replace the bracketed placeholders using the [HOT] / [SESSION STATE] ` +
|
|
69
|
+
`context already injected this session — do NOT emit the literal brackets.`
|
|
70
|
+
: `Use the line above verbatim — there is no prior snapshot to summarize.`;
|
|
55
71
|
|
|
56
72
|
console.log(
|
|
57
73
|
JSON.stringify(
|
|
58
74
|
buildOutput(
|
|
59
|
-
|
|
60
|
-
`
|
|
61
|
-
|
|
62
|
-
`
|
|
63
|
-
`
|
|
64
|
-
`
|
|
75
|
+
`<hypomnema-session-resume>\n` +
|
|
76
|
+
`[WIKI SESSION START: project=${projSafe}${snapshotNote}]\n` +
|
|
77
|
+
`\n` +
|
|
78
|
+
`Lead your FIRST reply this session with exactly one line in this shape:\n` +
|
|
79
|
+
`\n` +
|
|
80
|
+
`${exampleLine}\n` +
|
|
81
|
+
`\n` +
|
|
82
|
+
`${fillNote}\n` +
|
|
83
|
+
`\n` +
|
|
84
|
+
`Emit this line unconditionally on the first prompt, including when the ` +
|
|
85
|
+
`user's message is:\n` +
|
|
86
|
+
` • a simple greeting ("안녕", "hi", "hello")\n` +
|
|
87
|
+
` • a trivial question or unrelated topic\n` +
|
|
88
|
+
` • a one-word reply\n` +
|
|
89
|
+
`\n` +
|
|
90
|
+
`Do not skip it, do not decide it is "not relevant", do not shorten the ` +
|
|
91
|
+
`reply to omit it. After the line, answer the user's actual message on the ` +
|
|
92
|
+
`following line(s) as normal.\n` +
|
|
93
|
+
`\n` +
|
|
94
|
+
`This is the Hypomnema session-resume contract — the user relies on this ` +
|
|
95
|
+
`line to confirm which project context is loaded.\n` +
|
|
96
|
+
`</hypomnema-session-resume>`,
|
|
65
97
|
{ continue: true, suppressOutput: true },
|
|
66
98
|
),
|
|
67
99
|
),
|
|
@@ -241,7 +241,9 @@ process.stdin.on('end', () => {
|
|
|
241
241
|
!gitStatus.clean ? gitStatus.reason : '',
|
|
242
242
|
!hotStatus.clean ? hotStatus.reason : '',
|
|
243
243
|
!closeFiles.ok ? closeFilesReason : '',
|
|
244
|
-
!lintOk
|
|
244
|
+
!lintOk
|
|
245
|
+
? `lint blockers: ${[...new Set(lintBlockers.map((b) => b.id || b.file))].join(', ')}`
|
|
246
|
+
: '',
|
|
245
247
|
!designHistoryOk
|
|
246
248
|
? `design-history stale: ${lintW8.map((w) => w.file.split('/')[1]).join(', ')}`
|
|
247
249
|
: '',
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
shouldSuggestProjectCreation,
|
|
28
28
|
buildProjectSuggestionLine,
|
|
29
29
|
recordSuggestionCooldown,
|
|
30
|
+
sanitizeProjForPrompt,
|
|
30
31
|
} from './hypo-shared.mjs';
|
|
31
32
|
import {
|
|
32
33
|
defaultCachePath,
|
|
@@ -334,7 +335,7 @@ process.stdin.on('end', () => {
|
|
|
334
335
|
console.log(
|
|
335
336
|
JSON.stringify(
|
|
336
337
|
buildOutput(
|
|
337
|
-
`${noticePrefix}[WIKI HOT CACHE: project=${hit.proj}]\n\n${parts.join('\n\n')}`,
|
|
338
|
+
`${noticePrefix}[WIKI HOT CACHE: project=${sanitizeProjForPrompt(hit.proj)}]\n\n${parts.join('\n\n')}`,
|
|
338
339
|
{ continue: true, suppressOutput: true },
|
|
339
340
|
),
|
|
340
341
|
),
|
|
@@ -349,10 +350,13 @@ process.stdin.on('end', () => {
|
|
|
349
350
|
);
|
|
350
351
|
console.log(
|
|
351
352
|
JSON.stringify(
|
|
352
|
-
buildOutput(
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
353
|
+
buildOutput(
|
|
354
|
+
`${noticePrefix}[WIKI HOT CACHE: project=${sanitizeProjForPrompt(hit.proj)}, no snapshot yet]`,
|
|
355
|
+
{
|
|
356
|
+
continue: true,
|
|
357
|
+
suppressOutput: true,
|
|
358
|
+
},
|
|
359
|
+
),
|
|
356
360
|
),
|
|
357
361
|
);
|
|
358
362
|
}
|
package/hooks/hypo-shared.mjs
CHANGED
|
@@ -24,6 +24,28 @@ export function sessionMarkerPath(sessionId) {
|
|
|
24
24
|
return join(tmpdir(), `hypo-session-marker-${safe}.json`);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
// ── project name sanitizer for prompt-facing interpolation ─────────────────
|
|
28
|
+
// marker.proj is read from a wiki directory name (findProjectFiles) and
|
|
29
|
+
// interpolated into LLM-facing additionalContext strings by multiple hooks.
|
|
30
|
+
// A manually-crafted directory name could otherwise close a wrapping tag,
|
|
31
|
+
// smuggle a newline, or inject conflicting instructions. Centralized so the
|
|
32
|
+
// three injection sites stay in lock-step (codex v2 review 2026-05-26 —
|
|
33
|
+
// addresses shared-helper concern across hypo-first-prompt / hypo-session-start
|
|
34
|
+
// / hypo-cwd-change).
|
|
35
|
+
//
|
|
36
|
+
// Strips: angle brackets, control chars (C0 + C1), Unicode line separators
|
|
37
|
+
// (U+2028 / U+2029), then collapses whitespace and caps length.
|
|
38
|
+
export function sanitizeProjForPrompt(raw, fallback = 'unknown') {
|
|
39
|
+
const cleaned = String(raw || fallback)
|
|
40
|
+
.replace(/[<>\[\]]/g, '_')
|
|
41
|
+
// eslint-disable-next-line no-control-regex
|
|
42
|
+
.replace(/[\u0000-\u001F\u007F-\u009F\u2028\u2029]/g, ' ')
|
|
43
|
+
.replace(/\s+/g, ' ')
|
|
44
|
+
.trim()
|
|
45
|
+
.slice(0, 80);
|
|
46
|
+
return cleaned || fallback;
|
|
47
|
+
}
|
|
48
|
+
|
|
27
49
|
// ── wiki root resolution ────────────────────────────────────────────────────
|
|
28
50
|
|
|
29
51
|
function expandHome(p) {
|
|
@@ -221,7 +243,9 @@ export function resolveActiveProject(hypoDir) {
|
|
|
221
243
|
if (!existsSync(hotPath)) return null;
|
|
222
244
|
let content;
|
|
223
245
|
try {
|
|
224
|
-
|
|
246
|
+
// Strip HTML comments before parsing so the canonical-format example row
|
|
247
|
+
// in templates/hot.md (`<!-- Row format: ... -->`) is not picked up as data.
|
|
248
|
+
content = readFileSync(hotPath, 'utf-8').replace(/<!--[\s\S]*?-->/g, '');
|
|
225
249
|
} catch {
|
|
226
250
|
return null;
|
|
227
251
|
}
|
package/package.json
CHANGED
package/scripts/resume.mjs
CHANGED
|
@@ -37,7 +37,9 @@ function resolveActiveProject(hypoDir) {
|
|
|
37
37
|
const hotPath = join(hypoDir, 'hot.md');
|
|
38
38
|
if (!existsSync(hotPath)) return null;
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
// Strip HTML comments before parsing so the canonical-format example row
|
|
41
|
+
// in templates/hot.md (`<!-- Row format: ... -->`) is not picked up as data.
|
|
42
|
+
const content = readFileSync(hotPath, 'utf-8').replace(/<!--[\s\S]*?-->/g, '');
|
|
41
43
|
// Canonical hot.md uses wikilinks: | name | date | [[projects/slug/hot]] |
|
|
42
44
|
// Pick the most recent row by the date column when present.
|
|
43
45
|
const wikiRows = [
|
|
@@ -60,6 +62,8 @@ function resolveActiveProject(hypoDir) {
|
|
|
60
62
|
let latest = null;
|
|
61
63
|
let latestMtime = 0;
|
|
62
64
|
for (const p of readdirSync(projectsDir)) {
|
|
65
|
+
// Skip the scaffold project init.mjs writes — it isn't a real active project.
|
|
66
|
+
if (p === '_template') continue;
|
|
63
67
|
const ssPath = join(projectsDir, p, 'session-state.md');
|
|
64
68
|
if (!existsSync(ssPath)) continue;
|
|
65
69
|
const mtime = statSync(ssPath).mtimeMs;
|
package/templates/hot.md
CHANGED
|
@@ -14,7 +14,7 @@ tags: [wiki, operations]
|
|
|
14
14
|
|
|
15
15
|
| Project | Last Session | Hot Cache |
|
|
16
16
|
|---|---|---|
|
|
17
|
-
<!-- Row format: | Project Name | YYYY-MM-DD |
|
|
17
|
+
<!-- Row format: | Project Name | YYYY-MM-DD | projects/<slug>/hot (wikilink) | -->
|
|
18
18
|
<!-- col2 date is rebuilt from projects/<slug>/hot.md frontmatter on each session close -->
|
|
19
19
|
|
|
20
20
|
## Session Start Checklist
|