A self-organizing Obsidian vault that gives AI coding agents persistent memory.
TypeScript ai-agentsclaude-codecodex-cligemini-cliknowledge-managementobsidianobsidian-vaultpersistent-memorysecond-braintemplate
docs: point Codex users at the trust gates from Quick Start, and mark per-hook approval as inferred (#365)
Brenno Ferrari15662b1e5a29
diff --git a/.claude/rules/hooks-per-agent.md b/.claude/rules/hooks-per-agent.mdindex 24cc7a6..8342eb5 100644--- a/.claude/rules/hooks-per-agent.md+++ b/.claude/rules/hooks-per-agent.md@@ -18,4 +18,6 @@ The hook scripts in `.claude/scripts/` are agent-agnostic TypeScript and shell,| `pre-compact.ts` | Back up transcript before compaction | PreCompact | — | PreCompress || `stop-checklist.ts` | Wrap-up checklist and vault-hygiene drift findings (Claude Code and Codex: per response, deduped; Gemini: once, at shutdown) | Stop | Stop | SessionEnd |+Codex runs these hooks only once the vault folder is trusted and each hook approved (observed with Codex CLI 0.160.0 as of 2026-10-13, #345; the setup is in README's "Using with Other Agents").+Grok, once the vault is trusted, loads the project `.claude/settings.json` hooks (observed for #321); how each event behaves under Grok is not verified (TBC), and its own layer is #323.diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex 211b9a4..e05424c 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -203,7 +203,7 @@ sequenceDiagramA few specific design choices are worth calling out:-- **`SessionStart` injects, it does not load.** It builds a briefing (filename listing, North Star excerpt, git summary, open tasks aggregated from `work/active/` and the vault root) and hands it to the agent. Full note contents never flow through this hook. Its size is bounded by `eager_layer_budget_bytes`, held under Claude Code's 10,000-character hook output cap, and reported by the meter on the last line of every injection, so the cost is visible rather than assumed. When the template's Claude Code mod delivers the same briefing as an instruction file instead, the hook stands down and the briefing is bounded by `eager_layer_instruction_budget_bytes`, since instruction files are not under the hook cap (#264). The same backstop holds there, in bytes: sections that never degrade are cut at the budget plus the meter's room, and the meter says "truncated to fit the instruction budget". On the hook path the briefing goes out as one JSON object, `{"hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":…}}`, for every agent (#340). Gemini parses a hook's stdout as JSON and takes context only from that field (per its hooks reference as of 2026-10-13, not observed), and Claude Code accepts the same shape, capping the `additionalContext` string rather than the raw stdout. Codex takes context from it the same way (observed with Codex CLI 0.160.0 as of 2026-10-13, #345). Whether Grok does is unverified (TBC). So the budget and the backstop measure the JSON-encoded text (escaping counts), keeping the whole stdout under the cap for an agent whose cap is undocumented. The mod's `deliver` run stays plain text, since it becomes an instruction file. The open-tasks scan is filesystem-only so the hook never spawns the Obsidian CLI — that subprocess flashes the Electron app on macOS when no instance is running (#83).+- **`SessionStart` injects, it does not load.** It builds a briefing (filename listing, North Star excerpt, git summary, open tasks aggregated from `work/active/` and the vault root) and hands it to the agent. Full note contents never flow through this hook. Its size is bounded by `eager_layer_budget_bytes`, held under Claude Code's 10,000-character hook output cap, and reported by the meter on the last line of every injection, so the cost is visible rather than assumed. When the template's Claude Code mod delivers the same briefing as an instruction file instead, the hook stands down and the briefing is bounded by `eager_layer_instruction_budget_bytes`, since instruction files are not under the hook cap (#264). The same backstop holds there, in bytes: sections that never degrade are cut at the budget plus the meter's room, and the meter says "truncated to fit the instruction budget". On the hook path the briefing goes out as one JSON object, `{"hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":…}}`, for every agent (#340). Gemini parses a hook's stdout as JSON and takes context only from that field (per its hooks reference as of 2026-10-13, not observed), and Claude Code accepts the same shape, capping the `additionalContext` string rather than the raw stdout. Codex takes context from its `additionalContext` too (observed with Codex CLI 0.160.0 as of 2026-10-13, #345). Whether Grok does is unverified (TBC). So the budget and the backstop measure the JSON-encoded text (escaping counts), keeping the whole stdout under the cap for an agent whose cap is undocumented. The mod's `deliver` run stays plain text, since it becomes an instruction file. The open-tasks scan is filesystem-only so the hook never spawns the Obsidian CLI — that subprocess flashes the Electron app on macOS when no instance is running (#83).- **`UserPromptSubmit` classifies, it does not route.** It tags the prompt with hints like `ARCHITECTURE discussion` or `DECISION`; the agent decides where to file. Keeping the hook opinion-free means the routing logic lives in `AGENTS.md`, which is editable per-user without touching scripts.- **QMD refresh is shared, debounced, and detached.** Three hook entries fire the same refresh helper — `PostToolUse` (after `.md` writes), `PreCompact` (before transcript backup; writes tend to cluster before compaction), and `Stop` (after a response) — sharing one sentinel file so a burst of events produces at most one worker per debounce window. The actual indexing runs in `.claude/scripts/qmd-refresh-run.ts` as a detached, stdio-silent worker (`qmd update` → `qmd embed` → tail-chase `qmd update`), so the parent hook returns in milliseconds and nothing flows to the agent's context.- **`VAULT_QMD_REFRESH=off` switches the detached refresh off** (exactly `off`, as wiki-mind's copy reads it): no `qmd-refresh-run.ts` worker, and no detached `qmd update` or bootstrap from `SessionStart`. The debounce decision and its sentinel stamps still run. The test suite sets it in every test process and every hook a test runs. The test runner also stops and fails on any surviving worker whose command line names the run's temp folder, which every trailing worker's does; an immediate-path worker carries no path, so for those the switch is the guard (#337).diff --git a/README.ja.md b/README.ja.mdindex 9c491b8..d9add3a 100644--- a/README.ja.md+++ b/README.ja.md@@ -110,7 +110,7 @@ shardmind install github:breferrari/obsidian-mind1. インストールされたフォルダを**Obsidianボールト**として開く2. 設定 → 一般で**Obsidian CLI**を有効化(Obsidian 1.12以上が必要)-3. ボールトディレクトリでエージェントを実行:**`claude`**、**`codex`**、または**`gemini`**+3. ボールトディレクトリでエージェントを実行:**`claude`**、**`codex`**、または**`gemini`**。Codex はフォルダーが信頼され、各フックが承認されるまでボールトのフックを実行しません:[他のエージェントでの利用](#-他のエージェントでの利用)を参照。4. 仕事について話し始める[ShardMind](https://github.com/breferrari/shardmind)はObsidianボールトテンプレートのパッケージマネージャーです。インストール時に`.shardmind/`サイドカーが追加され、ウィザード、オプションのモジュール(不要なものはスキップ可能)、3-wayマージのアップグレードを実現します。すべての値がデフォルトの場合、インストール結果は`git clone`とバイト等価 — クローン体験はそのまま保たれます。インストール済みボールトから`.shardmind/`と`shard-values.yaml`を削除しても動作し続けます:ShardMindは追加機能であり、必須ではありません。@@ -247,7 +247,7 @@ obsidian-mindはClaude Code、Codex CLI、Gemini CLIで動作します。`CLAUDECodex がプロジェクトのフックを実行するには、2 つの信頼が必要です(Codex CLI 0.160.0 で確認、2026-10-13 時点、[#345](https://github.com/breferrari/obsidian-mind/issues/345))。- **ボールトのフォルダーが信頼されていること。** Codex は `~/.codex/config.toml` の `[projects.'<path>']` に記録します。Windows ではキーが `\\?\` 付きのパスになります(例: `[projects.'\\?\C:\path\to\vault']`)。-- **各フックが承認されていること。** 対話型の `codex` セッションで承認します。Codex は各承認を `[hooks.state]` の `trusted_hash` として保存します。+- **各フックが承認されていること。** Codex は各承認を `[hooks.state]` の `trusted_hash` として保存します。対話型の `codex` セッションで承認するとこれが書き込まれるはずです(推測:#345 の確認では、1 回の非対話実行用のフラグ `--dangerously-bypass-hook-trust` で代用しました)。両方が揃うまで Codex はフックを一切実行せず、セッションにボールトのコンテキストは届きません。diff --git a/README.ko.md b/README.ko.mdindex ded6ccc..42f82d7 100644--- a/README.ko.md+++ b/README.ko.md@@ -110,7 +110,7 @@ shardmind install github:breferrari/obsidian-mind1. 설치된 폴더를 **Obsidian 볼트**로 엽니다2. 설정 → 일반에서 **Obsidian CLI**를 활성화합니다 (Obsidian 1.12+ 필요)-3. 볼트 디렉토리에서 에이전트를 실행합니다: **`claude`**, **`codex`**, 또는 **`gemini`**+3. 볼트 디렉토리에서 에이전트를 실행합니다: **`claude`**, **`codex`**, 또는 **`gemini`**. Codex는 폴더가 신뢰되고 각 훅이 승인되기 전까지 볼트의 훅을 실행하지 않습니다: [다른 에이전트와 사용하기](#-다른-에이전트와-사용하기) 참고.4. 업무에 대해 이야기를 시작하세요[ShardMind](https://github.com/breferrari/shardmind)는 Obsidian 볼트 템플릿의 패키지 매니저입니다. 설치 시 `.shardmind/` 사이드카가 추가되어 마법사, 선택적 모듈 (사용하지 않는 것은 건너뛰기), 3-way 머지 업그레이드를 제공합니다. 모든 값이 기본값일 때 설치 결과는 `git clone`과 바이트 단위로 동일합니다 — 클론 경험이 그대로 보존됩니다. 설치된 볼트에서 `.shardmind/`와 `shard-values.yaml`을 삭제해도 계속 작동합니다: ShardMind는 추가 기능이며, 필수 요소가 아닙니다.@@ -247,7 +247,7 @@ obsidian-mind는 Claude Code, Codex CLI, Gemini CLI에서 작동합니다. `CLAUCodex가 프로젝트의 훅을 실행하려면 두 가지 신뢰가 필요합니다(Codex CLI 0.160.0으로 확인, 2026-10-13 기준, [#345](https://github.com/breferrari/obsidian-mind/issues/345)).- **볼트 폴더가 신뢰되어 있어야 합니다.** Codex는 이를 `~/.codex/config.toml`의 `[projects.'<path>']`에 기록합니다. Windows에서는 키가 `\\?\` 접두사가 붙은 경로입니다(예: `[projects.'\\?\C:\path\to\vault']`).-- **각 훅이 승인되어 있어야 합니다.** 대화형 `codex` 세션에서 승인하세요. Codex는 각 승인을 `[hooks.state]` 아래 `trusted_hash`로 저장합니다.+- **각 훅이 승인되어 있어야 합니다.** Codex는 각 승인을 `[hooks.state]` 아래 `trusted_hash`로 저장합니다. 대화형 `codex` 세션에서 승인하면 이것이 기록될 것으로 예상됩니다(추정: #345의 확인에서는 한 번의 비대화형 실행용 플래그 `--dangerously-bypass-hook-trust`로 대신했습니다).둘 다 갖춰지기 전에는 Codex가 어떤 훅도 실행하지 않으며, 세션에 볼트 컨텍스트가 전달되지 않습니다.diff --git a/README.md b/README.mdindex d7c9a84..d769606 100644--- a/README.md+++ b/README.md@@ -109,7 +109,7 @@ shardmind install github:breferrari/obsidian-mind1. Open the installed folder as an **Obsidian vault**2. Enable the **Obsidian CLI** in Settings → General (requires Obsidian 1.12+)-3. Run your agent in the vault directory: **`claude`**, **`codex`**, or **`gemini`**+3. Run your agent in the vault directory: **`claude`**, **`codex`**, or **`gemini`**. Codex runs the vault's hooks only once the folder is trusted and each hook approved: see [Using with Other Agents](#-using-with-other-agents).4. Start talking about work[ShardMind](https://github.com/breferrari/shardmind) is the package manager for Obsidian vault templates. The install adds a `.shardmind/` sidecar that powers the wizard, optional modules (skip what you don't use), and three-way-merge upgrades. With every value at its default the install is byte-equivalent to `git clone` — clone-UX is preserved exactly. Delete `.shardmind/` and `shard-values.yaml` from the installed vault and it keeps working: ShardMind is additive, not load-bearing.@@ -264,7 +264,7 @@ Observed with scratch vaults as of 2026-10-06 (Claude Code 2.1.291, Codex CLI 0.Codex runs a project's hooks only once two kinds of trust are in place (observed with Codex CLI 0.160.0 as of 2026-10-13, [#345](https://github.com/breferrari/obsidian-mind/issues/345)):- **The vault folder is trusted.** Codex records this in `~/.codex/config.toml` under `[projects.'<path>']`. On Windows the key is the `\\?\`-prefixed path, e.g. `[projects.'\\?\C:\path\to\vault']`.-- **Each hook is approved.** Approve them in an interactive `codex` session. Codex stores each approval as a `trusted_hash` under `[hooks.state]`.+- **Each hook is approved.** Codex stores each approval as a `trusted_hash` under `[hooks.state]`. Approving them in an interactive `codex` session is expected to write these (inferred: the #345 check stood in for them with `--dangerously-bypass-hook-trust`, a flag for one non-interactive run).Until both are in place, Codex runs no hook, and the session gets no vault context.diff --git a/README.zh-CN.md b/README.zh-CN.mdindex f3c6868..51da5a9 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -110,7 +110,7 @@ shardmind install github:breferrari/obsidian-mind1. 将已安装的文件夹作为 **Obsidian 仓库** 打开2. 在 设置 → 通用 中启用 **Obsidian CLI**(需要 Obsidian 1.12+)-3. 在仓库目录中运行你的 Agent:**`claude`**、**`codex`** 或 **`gemini`**+3. 在仓库目录中运行你的 Agent:**`claude`**、**`codex`** 或 **`gemini`**。Codex 只有在文件夹被信任、且每个钩子都被批准后才会运行 vault 的钩子:见[与其他 Agent 配合使用](#-与其他-agent-配合使用)。4. 开始谈论工作[ShardMind](https://github.com/breferrari/shardmind) 是 Obsidian 仓库模板的包管理器。安装时会添加 `.shardmind/` 旁挂目录,提供向导、可选模块(不需要的可以跳过)和三方合并升级。所有值采用默认值时,安装结果与 `git clone` 字节等价——克隆体验完全保留。从已安装的仓库中删除 `.shardmind/` 和 `shard-values.yaml`,仓库仍可正常工作:ShardMind 是附加功能,并非必需。@@ -247,7 +247,7 @@ obsidian-mind 支持 Claude Code、Codex CLI 和 Gemini CLI。`CLAUDE.md` 中的Codex 只有在两种信任都具备时才会运行项目的钩子(使用 Codex CLI 0.160.0 观察,截至 2026-10-13,[#345](https://github.com/breferrari/obsidian-mind/issues/345)):- **vault 文件夹已被信任。** Codex 将其记录在 `~/.codex/config.toml` 的 `[projects.'<path>']` 下。在 Windows 上,键是带 `\\?\` 前缀的路径,例如 `[projects.'\\?\C:\path\to\vault']`。-- **每个钩子已被批准。** 在交互式 `codex` 会话中批准。Codex 将每次批准作为 `trusted_hash` 存储在 `[hooks.state]` 下。+- **每个钩子已被批准。** Codex 将每次批准作为 `trusted_hash` 存储在 `[hooks.state]` 下。在交互式 `codex` 会话中批准预计会写入这些条目(推断:#345 的检查用仅适用于单次非交互运行的标志 `--dangerously-bypass-hook-trust` 代替了它们)。两者都具备之前,Codex 不会运行任何钩子,会话也得不到 vault 上下文。