Skip to content

A self-organizing Obsidian vault that gives AI coding agents persistent memory.

feat: add multi-agent support for Codex CLI and Gemini CLI

Brenno Ferrari1907e638e680
diff --git a/.claude/scripts/classify-message.py b/.claude/scripts/classify-message.py
index bf1f9da..e672548 100755
--- a/.claude/scripts/classify-message.py
+++ b/.claude/scripts/classify-message.py
@@ -188,7 +188,7 @@ def main():
hints = "\n".join(f"- {s}" for s in signals)
output = {
"hookSpecificOutput": {
- "hookEventName": "UserPromptSubmit",
+ "hookEventName": input_data.get("hook_event_name", "UserPromptSubmit"),
"additionalContext": (
"Content classification hints (act on these if the user's message contains relevant info):\n"
+ hints
diff --git a/.claude/scripts/session-start.sh b/.claude/scripts/session-start.sh
index 1247e0a..444e262 100755
--- a/.claude/scripts/session-start.sh
+++ b/.claude/scripts/session-start.sh
@@ -1,6 +1,6 @@
#!/bin/bash
set -eo pipefail
-cd "$CLAUDE_PROJECT_DIR"
+cd "${CLAUDE_PROJECT_DIR:-${CODEX_PROJECT_DIR:-${GEMINI_PROJECT_DIR:-$(pwd)}}}"
# Persist vault path for the session
if [ -n "${CLAUDE_ENV_FILE:-}" ]; then
diff --git a/.claude/scripts/validate-write.py b/.claude/scripts/validate-write.py
index 79f4020..d47aeaf 100755
--- a/.claude/scripts/validate-write.py
+++ b/.claude/scripts/validate-write.py
@@ -26,7 +26,7 @@ def main():
normalized = file_path.replace("\\", "/")
# Skip dotfiles, templates, thinking, and root template files (not vault notes)
basename = os.path.basename(normalized)
- root_files = {"README.md", "CHANGELOG.md", "CONTRIBUTING.md", "CLAUDE.md"}
+ root_files = {"README.md", "CHANGELOG.md", "CONTRIBUTING.md", "CLAUDE.md", "AGENTS.md", "GEMINI.md"}
if basename in root_files:
sys.exit(0)
# Also skip translated READMEs (README.ja.md, README.zh-CN.md, etc.)
@@ -65,7 +65,7 @@ def main():
hint_list = "\n".join(f" - {w}" for w in warnings)
output = {
"hookSpecificOutput": {
- "hookEventName": "PostToolUse",
+ "hookEventName": input_data.get("hook_event_name", "PostToolUse"),
"additionalContext": f"Vault hygiene warnings for `{basename}`:\n{hint_list}\nFix these before moving on."
}
}
diff --git a/.codex/hooks.json b/.codex/hooks.json
new file mode 100644
index 0000000..e240509
--- /dev/null
+++ b/.codex/hooks.json
@@ -0,0 +1,50 @@
+{
+ "hooks": {
+ "SessionStart": [
+ {
+ "matcher": "startup|resume",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "bash .claude/scripts/session-start.sh",
+ "timeout": 30
+ }
+ ]
+ }
+ ],
+ "UserPromptSubmit": [
+ {
+ "hooks": [
+ {
+ "type": "command",
+ "command": "bash .claude/scripts/find-python.sh .claude/scripts/classify-message.py",
+ "timeout": 15
+ }
+ ]
+ }
+ ],
+ "PostToolUse": [
+ {
+ "matcher": "Write|Edit",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "bash .claude/scripts/find-python.sh .claude/scripts/validate-write.py",
+ "timeout": 15
+ }
+ ]
+ }
+ ],
+ "Stop": [
+ {
+ "hooks": [
+ {
+ "type": "command",
+ "command": "bash -c 'echo \"Session end checklist:\n- Archive completed projects?\n- Update indexes?\n- New notes linked? (orphans are bugs)\"'",
+ "timeout": 5
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/.gemini/settings.json b/.gemini/settings.json
new file mode 100644
index 0000000..bfe3211
--- /dev/null
+++ b/.gemini/settings.json
@@ -0,0 +1,61 @@
+{
+ "hooks": {
+ "SessionStart": [
+ {
+ "matcher": "startup|resume",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "bash .claude/scripts/session-start.sh",
+ "timeout": 30
+ }
+ ]
+ }
+ ],
+ "BeforeAgent": [
+ {
+ "hooks": [
+ {
+ "type": "command",
+ "command": "bash .claude/scripts/find-python.sh .claude/scripts/classify-message.py",
+ "timeout": 15
+ }
+ ]
+ }
+ ],
+ "AfterTool": [
+ {
+ "matcher": "Write|Edit",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "bash .claude/scripts/find-python.sh .claude/scripts/validate-write.py",
+ "timeout": 15
+ }
+ ]
+ }
+ ],
+ "PreCompress": [
+ {
+ "hooks": [
+ {
+ "type": "command",
+ "command": "bash .claude/scripts/pre-compact.sh",
+ "timeout": 30
+ }
+ ]
+ }
+ ],
+ "SessionEnd": [
+ {
+ "hooks": [
+ {
+ "type": "command",
+ "command": "bash -c 'echo \"Session end checklist:\n- Archive completed projects?\n- Update indexes?\n- New notes linked? (orphans are bugs)\"'",
+ "timeout": 5
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 0000000..eec2e6a
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,46 @@
+# Obsidian Mind
+
+This vault is built for [Claude Code](https://claude.ai/code) with a full operating manual in `CLAUDE.md`.
+
+**Read `CLAUDE.md` for all vault conventions** — structure, note types, linking rules, frontmatter schemas, indexes, and workflows. Most of the content is agent-agnostic.
+
+## Hooks
+
+The hook scripts in `.claude/scripts/` are agent-agnostic Python and shell — no Claude SDK dependencies. Hook configs are provided for three agents:
+
+| Agent | Config | Status |
+|-------|--------|--------|
+| Claude Code | `.claude/settings.json` | Full support |
+| Codex CLI | `.codex/hooks.json` | Shared hook scripts |
+| Gemini CLI | `.gemini/settings.json` | Shared hook scripts |
+
+| Script | Purpose | Claude / Codex event | Gemini event |
+|--------|---------|---------------------|--------------|
+| `session-start.sh` | Inject vault context at startup | SessionStart | SessionStart |
+| `classify-message.py` | Classify messages, inject routing hints | UserPromptSubmit | BeforeAgent |
+| `validate-write.py` | Validate frontmatter and wikilinks | PostToolUse | AfterTool |
+| `pre-compact.sh` | Back up transcript before compaction | PreCompact | PreCompress |
+
+## Commands
+
+18 slash commands in `.claude/commands/` — agent-agnostic markdown with YAML frontmatter. Invoke as `/om-standup`, `/om-dump`, etc. in any agent that supports custom commands or skills.
+
+## What's agent-specific
+
+Subagents (`.claude/agents/`) and the memory system (`~/.claude/`) are Claude Code-only. Skip those sections in `CLAUDE.md`.
+
+## Setup
+
+**Codex CLI**: Reads `AGENTS.md` natively. For direct access to `CLAUDE.md`, add to `~/.codex/config.toml`:
+```toml
+project_doc_fallback_filenames = ["CLAUDE.md"]
+```
+
+**Gemini CLI**: Reads `GEMINI.md` natively. For direct access to `CLAUDE.md`, add to `~/.gemini/settings.json`:
+```json
+{ "context": { "fileName": ["GEMINI.md", "CLAUDE.md"] } }
+```
+
+**Other agents** (Cursor, Windsurf, Copilot): Read `AGENTS.md` for vault conventions. Hook support varies by agent.
+
+For more information, see the [README](README.md).
diff --git a/CLAUDE.md b/CLAUDE.md
index f69d9f0..e901a6f 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -150,7 +150,7 @@ Use `thinking/` for drafts, reasoning, and analysis before writing final notes.
- Claude operational context -- `brain/`
- Codebase knowledge -- `reference/`
- Drafts -- `thinking/`
- - Vault root: `Home.md`, `CLAUDE.md`, `vault-manifest.json`, `CHANGELOG.md`, `CONTRIBUTING.md`, `README.md`, `LICENSE`, `.gitignore`. No user notes at root.
+ - Vault root: `Home.md`, `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, `vault-manifest.json`, `CHANGELOG.md`, `CONTRIBUTING.md`, `README.md`, `LICENSE`, `.gitignore`. No user notes at root.
4. **Name files descriptively.** Use the note title as filename.
### Note Types
diff --git a/GEMINI.md b/GEMINI.md
new file mode 100644
index 0000000..eec2e6a
--- /dev/null
+++ b/GEMINI.md
@@ -0,0 +1,46 @@
+# Obsidian Mind
+
+This vault is built for [Claude Code](https://claude.ai/code) with a full operating manual in `CLAUDE.md`.
+
+**Read `CLAUDE.md` for all vault conventions** — structure, note types, linking rules, frontmatter schemas, indexes, and workflows. Most of the content is agent-agnostic.
+
+## Hooks
+
+The hook scripts in `.claude/scripts/` are agent-agnostic Python and shell — no Claude SDK dependencies. Hook configs are provided for three agents:
+
+| Agent | Config | Status |
+|-------|--------|--------|
+| Claude Code | `.claude/settings.json` | Full support |
+| Codex CLI | `.codex/hooks.json` | Shared hook scripts |
+| Gemini CLI | `.gemini/settings.json` | Shared hook scripts |
+
+| Script | Purpose | Claude / Codex event | Gemini event |
+|--------|---------|---------------------|--------------|
+| `session-start.sh` | Inject vault context at startup | SessionStart | SessionStart |
+| `classify-message.py` | Classify messages, inject routing hints | UserPromptSubmit | BeforeAgent |
+| `validate-write.py` | Validate frontmatter and wikilinks | PostToolUse | AfterTool |
+| `pre-compact.sh` | Back up transcript before compaction | PreCompact | PreCompress |
+
+## Commands
+
+18 slash commands in `.claude/commands/` — agent-agnostic markdown with YAML frontmatter. Invoke as `/om-standup`, `/om-dump`, etc. in any agent that supports custom commands or skills.
+
+## What's agent-specific
+
+Subagents (`.claude/agents/`) and the memory system (`~/.claude/`) are Claude Code-only. Skip those sections in `CLAUDE.md`.
+
+## Setup
+
+**Codex CLI**: Reads `AGENTS.md` natively. For direct access to `CLAUDE.md`, add to `~/.codex/config.toml`:
+```toml
+project_doc_fallback_filenames = ["CLAUDE.md"]
+```
+
+**Gemini CLI**: Reads `GEMINI.md` natively. For direct access to `CLAUDE.md`, add to `~/.gemini/settings.json`:
+```json
+{ "context": { "fileName": ["GEMINI.md", "CLAUDE.md"] } }
+```
+
+**Other agents** (Cursor, Windsurf, Copilot): Read `AGENTS.md` for vault conventions. Hook support varies by agent.
+
+For more information, see the [README](README.md).
diff --git a/README.ja.md b/README.ja.md
index 37cb3bf..2351eaa 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -157,6 +157,21 @@ obsidian-mindはボールト全体をコンテキストに読み込み**ませ
SessionStartは**軽量なコンテキスト**を読み込みます — 主要ファイルからの短い抜粋、ファイル名、git概要のみで、ノート全体は読み込みません。ClaudeはQMDで意味検索してからファイルを読むため、関連する情報のみを取得します。分類フックはメッセージごとに軽量なPython呼び出し1回です。検証フックはMarkdown書き込み時のみ発火し、除外パスはスキップします。
+### 他のエージェントでの利用
+
+obsidian-mindはClaude Code、Codex CLI、Gemini CLIで動作します。`CLAUDE.md`のボールト規約、`.claude/scripts/`のフックスクリプト、`.claude/commands/`の18コマンドはすべてエージェント非依存です — 純粋なMarkdown、Python、シェルでSDK依存はありません。
+
+**Claude Code** — フルサポート。フック、コマンド、サブエージェント、メモリシステムがすべてそのまま動作します。
+
+**Codex CLI** — `AGENTS.md`をネイティブに読み込みます。`.codex/hooks.json`のフック設定がClaude Codeと同じフックスクリプトを接続 — セッションコンテキスト、メッセージ分類、書き込み検証が自動的に動作します。
+
+**Gemini CLI** — `GEMINI.md`をネイティブに読み込みます。`.gemini/settings.json`のフック設定がGeminiのイベント名を共有フックスクリプトにマッピングします。
+
+**その他のエージェント**(Cursor、Windsurf、GitHub Copilot、JetBrains AI)— `AGENTS.md`でボールト規約を読み取ります。フックサポートはエージェントにより異なります。
+
+> [!NOTE]
+> サブエージェント(`.claude/agents/`)とメモリシステムはClaude Code専用です。フックとコマンドはClaude Code、Codex CLI、Gemini CLIで共有スクリプトを使用して動作します。
+
---
## 📅 日常ワークフロー
@@ -260,6 +275,8 @@ SessionStartは**軽量なコンテキスト**を読み込みます — 主要
```
Home.md ボールトのエントリーポイント — 埋め込みBaseビュー、クイックリンク
CLAUDE.md 運用マニュアル — Claudeが毎セッション読み込み
+AGENTS.md マルチエージェントガイド — Codex、Cursor、Windsurf等
+GEMINI.md マルチエージェントガイド — Gemini CLI
vault-manifest.json テンプレートメタデータ — バージョン、構造、スキーマ
CHANGELOG.md バージョン履歴
CONTRIBUTING.md テンプレート開発チェックリスト
diff --git a/README.ko.md b/README.ko.md
index 9c8c57f..4217872 100644
--- a/README.ko.md
+++ b/README.ko.md
@@ -157,6 +157,21 @@ obsidian-mind는 전체 볼트를 컨텍스트에 로드하지 **않습니다**.
SessionStart는 **가벼운 컨텍스트**를 로드합니다 — 주요 파일의 짧은 발췌, 파일명, git 요약만 로드하며 전체 노트 내용은 읽지 않습니다. Claude는 QMD를 통해 의미 기반 검색 후 파일을 읽으므로 관련 정보만 가져옵니다. 분류 훅은 메시지당 가벼운 Python 호출 1회입니다. 검증 훅은 마크다운 쓰기 시에만 실행되며 제외된 경로는 건너뜁니다.
+### 다른 에이전트와 사용하기
+
+obsidian-mind는 Claude Code, Codex CLI, Gemini CLI에서 작동합니다. `CLAUDE.md`의 볼트 규약, `.claude/scripts/`의 훅 스크립트, `.claude/commands/`의 18개 커맨드는 모두 에이전트 비의존적입니다 — 순수 Markdown, Python, 셸이며 SDK 의존성이 없습니다.
+
+**Claude Code** — 완전 지원. 훅, 커맨드, 서브에이전트, 메모리 시스템이 모두 기본으로 작동합니다.
+
+**Codex CLI** — `AGENTS.md`를 네이티브로 읽습니다. `.codex/hooks.json`의 훅 설정이 Claude Code와 동일한 훅 스크립트를 연결합니다 — 세션 컨텍스트, 메시지 분류, 쓰기 검증이 자동으로 작동합니다.
+
+**Gemini CLI** — `GEMINI.md`를 네이티브로 읽습니다. `.gemini/settings.json`의 훅 설정이 Gemini의 이벤트 이름을 공유 훅 스크립트에 매핑합니다.
+
+**기타 에이전트** (Cursor, Windsurf, GitHub Copilot, JetBrains AI) — `AGENTS.md`로 볼트 규약을 읽습니다. 훅 지원은 에이전트마다 다릅니다.
+
+> [!NOTE]
+> 서브에이전트(`.claude/agents/`)와 메모리 시스템은 Claude Code 전용입니다. 훅과 커맨드는 Claude Code, Codex CLI, Gemini CLI에서 공유 스크립트를 사용하여 작동합니다.
+
---
## 📅 일일 워크플로우
@@ -260,6 +275,8 @@ SessionStart는 **가벼운 컨텍스트**를 로드합니다 — 주요 파일
```
Home.md 볼트 진입점 — 임베드된 Base 뷰, 바로가기 링크
CLAUDE.md 운영 매뉴얼 — Claude가 매 세션마다 읽음
+AGENTS.md 멀티에이전트 가이드 — Codex, Cursor, Windsurf 등
+GEMINI.md 멀티에이전트 가이드 — Gemini CLI
vault-manifest.json 템플릿 메타데이터 — 버전, 구조, 스키마
CHANGELOG.md 버전 히스토리
CONTRIBUTING.md 템플릿 개발 체크리스트
diff --git a/README.md b/README.md
index 4887b72..af2e3c1 100644
--- a/README.md
+++ b/README.md
@@ -154,6 +154,21 @@ obsidian-mind does **not** dump your entire vault into context. It uses tiered l
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.
+### Using with Other Agents
+
+obsidian-mind works with Claude Code, Codex CLI, and Gemini CLI. The vault conventions in `CLAUDE.md`, the hook scripts in `.claude/scripts/`, and the 18 commands in `.claude/commands/` are all agent-agnostic — pure Markdown, Python, and shell with no SDK dependencies.
+
+**Claude Code** — full support. Hooks, commands, subagents, and the memory system all work out of the box.
+
+**Codex CLI** — reads `AGENTS.md` natively. Hook config at `.codex/hooks.json` wires the same hook scripts Claude Code uses — session context, message classification, and write validation work automatically.
+
+**Gemini CLI** — reads `GEMINI.md` natively. Hook config at `.gemini/settings.json` maps Gemini's event names to the shared hook scripts.
+
+**Other agents** (Cursor, Windsurf, GitHub Copilot, JetBrains AI) — read `AGENTS.md` for vault conventions. Hook support varies by agent.
+
+> [!NOTE]
+> Subagents (`.claude/agents/`) and the memory system are Claude Code-specific. Hooks and commands work across Claude Code, Codex CLI, and Gemini CLI using shared scripts.
+
---
## 📅 Daily Workflow
@@ -257,6 +272,8 @@ The `bases/` folder contains database views that query your notes' frontmatter p
```
Home.md Vault entry point — embedded Base views, quick links
CLAUDE.md Operating manual — Claude reads this every session
+AGENTS.md Multi-agent guide — Codex, Cursor, Windsurf, etc.
+GEMINI.md Multi-agent guide — Gemini CLI
vault-manifest.json Template metadata — version, structure, schemas
CHANGELOG.md Version history
CONTRIBUTING.md Template development checklist
diff --git a/README.zh-CN.md b/README.zh-CN.md
index ef31ad9..fa93de9 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -157,6 +157,21 @@ obsidian-mind **不会**将整个 vault 加载到上下文中。它使用分层
SessionStart 加载**轻量级上下文** — 关键文件的简短摘要、文件名和 git 摘要,而非完整笔记内容。Claude 通过 QMD 进行语义搜索后再读取文件,因此只获取相关内容。分类钩子每条消息仅执行一次轻量级 Python 调用。验证钩子仅在 markdown 写入时触发,跳过排除的路径。
+### 与其他 Agent 配合使用
+
+obsidian-mind 支持 Claude Code、Codex CLI 和 Gemini CLI。`CLAUDE.md` 中的 vault 规约、`.claude/scripts/` 中的钩子脚本、`.claude/commands/` 中的 18 个命令都是 Agent 无关的 — 纯 Markdown、Python 和 Shell,无 SDK 依赖。
+
+**Claude Code** — 完整支持。钩子、命令、子代理和记忆系统全部开箱即用。
+
+**Codex CLI** — 原生读取 `AGENTS.md`。`.codex/hooks.json` 中的钩子配置连接了与 Claude Code 相同的钩子脚本 — 会话上下文、消息分类和写入验证自动工作。
+
+**Gemini CLI** — 原生读取 `GEMINI.md`。`.gemini/settings.json` 中的钩子配置将 Gemini 的事件名称映射到共享钩子脚本。
+
+**其他 Agent**(Cursor、Windsurf、GitHub Copilot、JetBrains AI)— 通过 `AGENTS.md` 读取 vault 规约。钩子支持因 Agent 而异。
+
+> [!NOTE]
+> 子代理(`.claude/agents/`)和记忆系统是 Claude Code 专属功能。钩子和命令通过共享脚本在 Claude Code、Codex CLI 和 Gemini CLI 上运行。
+
---
## 📅 日常工作流
@@ -260,6 +275,8 @@ SessionStart 加载**轻量级上下文** — 关键文件的简短摘要、文
```
Home.md 仓库入口——嵌入的 Base 视图、快捷链接
CLAUDE.md 操作手册——Claude 每次会话都会读取
+AGENTS.md 多 Agent 指南——Codex、Cursor、Windsurf 等
+GEMINI.md 多 Agent 指南——Gemini CLI
vault-manifest.json 模板元数据——版本、结构、schema
CHANGELOG.md 版本历史
CONTRIBUTING.md 模板开发清单