A self-organizing Obsidian vault that gives AI coding agents persistent memory.
TypeScript ai-agentsclaude-codecodex-cligemini-cliknowledge-managementobsidianobsidian-vaultpersistent-memorysecond-braintemplate
fix: correct hook docs and add token efficiency section (#33)
Brenno Ferrari2ed13eb10776
diff --git a/CLAUDE.md b/CLAUDE.mdindex 16c1265..f69d9f0 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -324,8 +324,8 @@ Five lifecycle hooks in `.claude/settings.json`:| Hook | When | What ||------|------|------|| SessionStart | On startup/resume | QMD re-index, inject North Star, active work, recent changes, tasks, file listing |-| UserPromptSubmit | Every message | Classifies content (decision, incident, win, 1:1, architecture, person) and injects routing hints |-| PostToolUse | After writing `.md` | Validates frontmatter, checks for wikilinks, verifies folder placement |+| UserPromptSubmit | Every message | Classifies content (decision, incident, win, 1:1, architecture, person, project update) and injects routing hints |+| PostToolUse | After writing `.md` | Validates frontmatter, checks for wikilinks || PreCompact | Before context compaction | Backs up session transcript to `thinking/session-logs/` || Stop | End of every session | Lightweight checklist reminder: archive, update indexes, check orphans. For thorough review, use `/om-wrap-up` instead. |diff --git a/README.ja.md b/README.ja.mdindex dff7793..37cb3bf 100644--- a/README.ja.md+++ b/README.ja.md@@ -135,14 +135,28 @@ qmd update && qmd embed| フック | タイミング | 内容 ||------|------|------|| 🚀 SessionStart | 起動/再開時 | QMD再インデックス、North Star・アクティブプロジェクト・最近の変更・タスク・ファイル一覧を注入 |-| 💬 UserPromptSubmit | 全メッセージ | コンテンツを分類(意思決定、インシデント、実績、1on1、アーキテクチャ、人物)してルーティングヒントを注入 |-| ✍️ PostToolUse | `.md`書き込み後 | フロントマターの検証、ウィキリンクの確認、フォルダ配置の検証 |+| 💬 UserPromptSubmit | 全メッセージ | コンテンツを分類(意思決定、インシデント、実績、1on1、アーキテクチャ、人物、プロジェクト更新)してルーティングヒントを注入 |+| ✍️ PostToolUse | `.md`書き込み後 | フロントマターの検証、ウィキリンクの確認 || 💾 PreCompact | コンテキスト圧縮前 | セッション記録を`thinking/session-logs/`にバックアップ || 🏁 Stop | セッション終了時 | チェックリスト:完了プロジェクトのアーカイブ、インデックス更新、孤立ノートの確認 |> [!TIP]> ただ話すだけ。フックがルーティングを処理します。+### トークン効率++obsidian-mindはボールト全体をコンテキストに読み込み**ません**。階層型ローディングでトークンコストを抑えます:++| 階層 | 内容 | タイミング | コスト |+|------|------|------------|--------|+| **常時** | `CLAUDE.md` + SessionStartコンテキスト(North Star抜粋、git概要、タスク、ボールトファイル一覧) | セッション開始時 | ~2Kトークン |+| **オンデマンド** | QMDセマンティック検索結果 | Claudeが特定のコンテキストを必要とした時 | 対象のみ |+| **トリガー** | 分類ルーティングヒント | 毎メッセージ | ~100トークン |+| **トリガー** | PostToolUse検証 | `.md`書き込み後 | ~200トークン |+| **まれ** | ファイル全体の読み込み | 明示的に必要な場合のみ | 可変 |++SessionStartは**軽量なコンテキスト**を読み込みます — 主要ファイルからの短い抜粋、ファイル名、git概要のみで、ノート全体は読み込みません。ClaudeはQMDで意味検索してからファイルを読むため、関連する情報のみを取得します。分類フックはメッセージごとに軽量なPython呼び出し1回です。検証フックはMarkdown書き込み時のみ発火し、除外パスはスキップします。+---## 📅 日常ワークフローdiff --git a/README.ko.md b/README.ko.mdindex 057f8a8..9c8c57f 100644--- a/README.ko.md+++ b/README.ko.md@@ -135,14 +135,28 @@ qmd update && qmd embed| 훅 | 시점 | 동작 ||------|------|------|| 🚀 SessionStart | 시작/재개 시 | QMD 재인덱싱, North Star·활성 작업·최근 변경사항·작업·파일 목록 주입 |-| 💬 UserPromptSubmit | 매 메시지마다 | 콘텐츠 분류(의사결정, 인시던트, 성과, 1:1, 아키텍처, 인물) 및 라우팅 힌트 주입 |-| ✍️ PostToolUse | `.md` 작성 후 | 프론트매터 유효성 검사, 위키링크 확인, 폴더 배치 검증 |+| 💬 UserPromptSubmit | 매 메시지마다 | 콘텐츠 분류(의사결정, 인시던트, 성과, 1:1, 아키텍처, 인물, 프로젝트 업데이트) 및 라우팅 힌트 주입 |+| ✍️ PostToolUse | `.md` 작성 후 | 프론트매터 유효성 검사, 위키링크 확인 || 💾 PreCompact | 컨텍스트 압축 전 | 세션 트랜스크립트를 `thinking/session-logs/`에 백업 || 🏁 Stop | 세션 종료 시 | 체크리스트: 완료된 프로젝트 아카이브, 인덱스 업데이트, 고아 노트 확인 |> [!TIP]> 그냥 이야기하세요. 훅이 라우팅을 처리합니다.+### 토큰 효율성++obsidian-mind는 전체 볼트를 컨텍스트에 로드하지 **않습니다**. 계층형 로딩으로 토큰 비용을 최소화합니다:++| 계층 | 내용 | 시점 | 비용 |+|------|------|------|------|+| **항상** | `CLAUDE.md` + SessionStart 컨텍스트 (North Star 발췌, git 요약, 작업, 볼트 파일 목록) | 세션 시작 시 | ~2K 토큰 |+| **온디맨드** | QMD 시맨틱 검색 결과 | Claude가 특정 컨텍스트 필요 시 | 대상만 |+| **트리거** | 분류 라우팅 힌트 | 매 메시지 | ~100 토큰 |+| **트리거** | PostToolUse 검증 | `.md` 작성 후 | ~200 토큰 |+| **드물게** | 전체 파일 읽기 | 명시적으로 필요한 경우만 | 가변 |++SessionStart는 **가벼운 컨텍스트**를 로드합니다 — 주요 파일의 짧은 발췌, 파일명, git 요약만 로드하며 전체 노트 내용은 읽지 않습니다. Claude는 QMD를 통해 의미 기반 검색 후 파일을 읽으므로 관련 정보만 가져옵니다. 분류 훅은 메시지당 가벼운 Python 호출 1회입니다. 검증 훅은 마크다운 쓰기 시에만 실행되며 제외된 경로는 건너뜁니다.+---## 📅 일일 워크플로우diff --git a/README.md b/README.mdindex 6aa6c50..4887b72 100644--- a/README.md+++ b/README.md@@ -132,14 +132,28 @@ Five lifecycle hooks handle routing automatically:| Hook | When | What ||------|------|------|| 🚀 SessionStart | On startup/resume | QMD re-index, inject North Star, active work, recent changes, tasks, file listing |-| 💬 UserPromptSubmit | Every message | Classifies content (decision, incident, win, 1:1, architecture, person) and injects routing hints |-| ✍️ PostToolUse | After writing `.md` | Validates frontmatter, checks for wikilinks, verifies folder placement |+| 💬 UserPromptSubmit | Every message | Classifies content (decision, incident, win, 1:1, architecture, person, project update) and injects routing hints |+| ✍️ PostToolUse | After writing `.md` | Validates frontmatter, checks for wikilinks || 💾 PreCompact | Before context compaction | Backs up session transcript to `thinking/session-logs/` || 🏁 Stop | End of session | Checklist: archive completed projects, update indexes, check orphans |> [!TIP]> You just talk. The hooks handle the routing.+### Token Efficiency++obsidian-mind does **not** dump your entire vault into context. It uses tiered loading to keep token costs low:++| Tier | What | When | Cost |+|------|------|------|------|+| **Always** | `CLAUDE.md` + SessionStart context (North Star excerpt, git summary, tasks, vault file listing) | Session start | ~2K tokens |+| **On-demand** | QMD semantic search results | When Claude needs specific context | Targeted |+| **Triggered** | Classification routing hints | Every message | ~100 tokens |+| **Triggered** | PostToolUse validation | After `.md` writes | ~200 tokens |+| **Rare** | Full file reads | Only when explicitly needed | Variable |++SessionStart loads **lightweight context** — small excerpts from key files, filenames, and git summary — not full note contents. Claude queries by meaning via QMD before reading files, so it pulls only what's relevant. The classification hook is one lightweight Python call per message. The validation hook only fires on markdown writes and skips excluded paths.+---## 📅 Daily Workflowdiff --git a/README.zh-CN.md b/README.zh-CN.mdindex 2e787a1..ef31ad9 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -135,14 +135,28 @@ qmd update && qmd embed| 钩子 | 触发时机 | 功能 ||------|---------|------|| 🚀 SessionStart | 启动/恢复时 | QMD 重新索引,注入北极星目标、活跃工作、最近变更、任务、文件列表 |-| 💬 UserPromptSubmit | 每条消息 | 对内容分类(决策、事件、成就、1:1、架构、人员)并注入路由提示 |-| ✍️ PostToolUse | 写入 `.md` 后 | 验证 frontmatter、检查 wikilinks、验证文件夹位置 |+| 💬 UserPromptSubmit | 每条消息 | 对内容分类(决策、事件、成就、1:1、架构、人员、项目更新)并注入路由提示 |+| ✍️ PostToolUse | 写入 `.md` 后 | 验证 frontmatter、检查 wikilinks || 💾 PreCompact | 上下文压缩前 | 将会话记录备份到 `thinking/session-logs/` || 🏁 Stop | 会话结束时 | 检查清单:归档已完成项目、更新索引、检查孤立笔记 |> [!TIP]> 你只需要正常对话。钩子会处理路由。+### Token 效率++obsidian-mind **不会**将整个 vault 加载到上下文中。它使用分层加载来控制 token 成本:++| 层级 | 内容 | 时机 | 成本 |+|------|------|------|------|+| **始终** | `CLAUDE.md` + SessionStart 上下文(北极星摘要、git 摘要、任务、vault 文件列表) | 会话启动时 | ~2K tokens |+| **按需** | QMD 语义搜索结果 | Claude 需要特定上下文时 | 精准定向 |+| **触发** | 分类路由提示 | 每条消息 | ~100 tokens |+| **触发** | PostToolUse 验证 | `.md` 写入后 | ~200 tokens |+| **罕见** | 完整文件读取 | 仅在明确需要时 | 可变 |++SessionStart 加载**轻量级上下文** — 关键文件的简短摘要、文件名和 git 摘要,而非完整笔记内容。Claude 通过 QMD 进行语义搜索后再读取文件,因此只获取相关内容。分类钩子每条消息仅执行一次轻量级 Python 调用。验证钩子仅在 markdown 写入时触发,跳过排除的路径。+---## 📅 日常工作流diff --git a/brain/Skills.md b/brain/Skills.mdindex b2bd5e4..1b79ba7 100644--- a/brain/Skills.md+++ b/brain/Skills.md@@ -102,7 +102,7 @@ Subagents run in isolated context windows via `.claude/agents/`. They don't poll|------|------|------|| SessionStart | On startup/resume | QMD re-index, inject North Star, active work, recent changes, tasks, file listing || UserPromptSubmit | Every message | Classify content (decision, incident, 1:1, win, architecture, person, project update) and inject routing hints |-| PreToolUse (Write/Edit) | Before file writes | Validate frontmatter, check for wikilinks, verify folder placement |+| PostToolUse | After writing `.md` | Validates frontmatter, checks for wikilinks || PreCompact | Before context compaction | Back up session transcript to `thinking/session-logs/` || Stop | End of session | Checklist: archive, update indexes, check orphans |