Skip to content

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

feat: install via ShardMind — wizard setup, modules, safe upgrades (#70)

Brenno Ferrarif72760b7b9c9
diff --git a/.claude/scripts/tests/post-install-hook.test.ts b/.claude/scripts/tests/post-install-hook.test.ts
new file mode 100644
index 0000000..5be5401
--- /dev/null
+++ b/.claude/scripts/tests/post-install-hook.test.ts
@@ -0,0 +1,233 @@
+/**
+ * Unit tests for the v6 post-install hook (.shardmind/hooks/post-install.ts).
+ *
+ * Drives the named exports against synthetic vaults under a per-test temp
+ * directory. Covers Invariant 2's binding contract: with values at defaults
+ * the hook must leave `brain/North Star.md` byte-identical; with a non-empty
+ * `user_name` the hook personalizes the heading once and is idempotent on
+ * subsequent runs. The default-export path (which spawns `git`/`node`) isn't
+ * exercised here — those subprocesses get integration coverage through
+ * ShardMind's contract suite when it runs against this shard.
+ *
+ * Each test gets its own `os.tmpdir() + crypto.randomUUID()` directory to
+ * avoid the parallel-load flake pattern documented in the take-next skill.
+ * `beforeEach` / `afterEach` own the lifecycle so test bodies stay focused
+ * on assertions.
+ */
+
+import { test, describe, beforeEach, afterEach } from "node:test";
+import assert from "node:assert/strict";
+import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { randomUUID } from "node:crypto";
+
+import postInstall, {
+ ensureGitRepo,
+ personalizeNorthStar,
+} from "../../../.shardmind/hooks/post-install.ts";
+
+const NORTH_STAR_BASE = `---
+date:
+description: "Living document of goals, focus areas, and aspirations"
+tags:
+ - brain
+---
+
+# North Star
+
+Body content that must survive personalization byte-for-byte.
+
+## Current Focus
+
+-
+
+## Goals
+
+-
+`;
+
+async function makeTempDir(prefix: string): Promise<string> {
+ return mkdtemp(join(tmpdir(), `${prefix}-${randomUUID()}-`));
+}
+
+const isENOENT = (err: unknown): boolean =>
+ (err as NodeJS.ErrnoException).code === "ENOENT";
+
+describe("personalizeNorthStar", () => {
+ let vault: string;
+
+ beforeEach(async () => {
+ vault = await makeTempDir("post-install-hook");
+ await mkdir(join(vault, "brain"), { recursive: true });
+ await writeFile(join(vault, "brain", "North Star.md"), NORTH_STAR_BASE, "utf-8");
+ });
+
+ afterEach(async () => {
+ await rm(vault, { recursive: true, force: true });
+ });
+
+ test("personalizes the heading with the supplied name", async () => {
+ await personalizeNorthStar(vault, "Jane Engineer");
+ const after = await readFile(join(vault, "brain", "North Star.md"), "utf-8");
+ assert.match(after, /^# North Star — Jane Engineer$/m);
+ assert.equal(after.includes("# North Star\n"), false, "verbatim heading must be replaced");
+ });
+
+ test("preserves the rest of the file byte-for-byte", async () => {
+ await personalizeNorthStar(vault, "Jane Engineer");
+ const after = await readFile(join(vault, "brain", "North Star.md"), "utf-8");
+ // Replace the personalized line back to the verbatim form and the
+ // rest of the file must equal the input exactly. Pins that the hook
+ // doesn't drop frontmatter, body content, trailing newline, or
+ // otherwise reflow the file.
+ const restored = after.replace(/^# North Star — Jane Engineer$/m, "# North Star");
+ assert.equal(restored, NORTH_STAR_BASE);
+ });
+
+ test("is idempotent — second run produces byte-identical content", async () => {
+ await personalizeNorthStar(vault, "Jane Engineer");
+ const afterFirst = await readFile(join(vault, "brain", "North Star.md"), "utf-8");
+ await personalizeNorthStar(vault, "Jane Engineer");
+ const afterSecond = await readFile(join(vault, "brain", "North Star.md"), "utf-8");
+ assert.equal(afterSecond, afterFirst);
+ });
+
+ test("idempotent against a different name once personalized", async () => {
+ // Once personalized with name A, a later run with name B is a no-op.
+ // Subsequent installs with a changed `user_name` value would have to
+ // flow through `shardmind update`'s merge engine — the hook itself
+ // never re-personalizes a file that's already been personalized.
+ // Pins the anchor on `^# North Star$` (verbatim only).
+ await personalizeNorthStar(vault, "Jane Engineer");
+ const afterFirst = await readFile(join(vault, "brain", "North Star.md"), "utf-8");
+ await personalizeNorthStar(vault, "Different Person");
+ const afterSecond = await readFile(join(vault, "brain", "North Star.md"), "utf-8");
+ assert.equal(afterSecond, afterFirst);
+ assert.match(afterSecond, /^# North Star — Jane Engineer$/m);
+ });
+});
+
+describe("personalizeNorthStar — ENOENT tolerance", () => {
+ let vault: string;
+
+ beforeEach(async () => {
+ // brain/ exists but North Star.md doesn't — covers the case where
+ // `brain` deselection (impossible today since `removable: false`,
+ // but the guard costs nothing) or an upstream rename leaves the
+ // path absent.
+ vault = await makeTempDir("post-install-hook");
+ await mkdir(join(vault, "brain"), { recursive: true });
+ });
+
+ afterEach(async () => {
+ await rm(vault, { recursive: true, force: true });
+ });
+
+ test("missing North Star is a no-op (no throw, no side-effect)", async () => {
+ await personalizeNorthStar(vault, "Jane Engineer");
+ // Match the typed errno code rather than the message string —
+ // message format varies by Node version and OS, code is stable.
+ await assert.rejects(
+ readFile(join(vault, "brain", "North Star.md"), "utf-8"),
+ isENOENT,
+ );
+ });
+});
+
+describe("ensureGitRepo", () => {
+ let vault: string;
+
+ beforeEach(async () => {
+ vault = await makeTempDir("post-install-hook");
+ });
+
+ afterEach(async () => {
+ await rm(vault, { recursive: true, force: true });
+ });
+
+ test("skips when .git/ already exists", async () => {
+ await mkdir(join(vault, ".git"), { recursive: true });
+ // HEAD is one of the few files git always writes during init; if
+ // the hook's skip-branch fires correctly, our pre-existing empty
+ // .git/ stays empty.
+ await ensureGitRepo(vault);
+ await assert.rejects(
+ readFile(join(vault, ".git", "HEAD"), "utf-8"),
+ isENOENT,
+ "ensureGitRepo must not run `git init` when .git/ already exists",
+ );
+ });
+});
+
+describe("postInstall (default export) — Invariant 2 binding", () => {
+ // Drives the orchestration gate `if (!ctx.valuesAreDefaults)` in the
+ // default export, which the named-export tests can't reach. Pre-creates
+ // `.git/` to short-circuit `ensureGitRepo` (avoiding a real `git init`
+ // subprocess on each test) and pins `qmd_enabled: false` so
+ // `bootstrapQmd` is gated off — leaving the personalization branch as
+ // the only orchestration path the test exercises.
+ let vault: string;
+
+ beforeEach(async () => {
+ vault = await makeTempDir("post-install-hook");
+ await mkdir(join(vault, ".git"), { recursive: true });
+ await mkdir(join(vault, "brain"), { recursive: true });
+ await writeFile(join(vault, "brain", "North Star.md"), NORTH_STAR_BASE, "utf-8");
+ });
+
+ afterEach(async () => {
+ await rm(vault, { recursive: true, force: true });
+ });
+
+ function makeCtx(overrides: Partial<{
+ valuesAreDefaults: boolean;
+ userName: string;
+ qmdEnabled: boolean;
+ }>): {
+ vaultRoot: string;
+ values: Record<string, unknown>;
+ modules: Record<string, "included" | "excluded">;
+ shard: { name: string; version: string };
+ valuesAreDefaults: boolean;
+ newFiles: string[];
+ removedFiles: string[];
+ } {
+ return {
+ vaultRoot: vault,
+ values: {
+ user_name: overrides.userName ?? "",
+ org_name: "Independent",
+ vault_purpose: "engineering",
+ qmd_enabled: overrides.qmdEnabled ?? false,
+ },
+ modules: {},
+ shard: { name: "obsidian-mind", version: "6.0.0-beta.1" },
+ valuesAreDefaults: overrides.valuesAreDefaults ?? true,
+ newFiles: [],
+ removedFiles: [],
+ };
+ }
+
+ test("Invariant 2: leaves North Star byte-identical when valuesAreDefaults", async () => {
+ await postInstall(makeCtx({ valuesAreDefaults: true }));
+ const after = await readFile(join(vault, "brain", "North Star.md"), "utf-8");
+ assert.equal(after, NORTH_STAR_BASE);
+ });
+
+ test("personalizes North Star when valuesAreDefaults is false and user_name is set", async () => {
+ await postInstall(makeCtx({ valuesAreDefaults: false, userName: "Jane Engineer" }));
+ const after = await readFile(join(vault, "brain", "North Star.md"), "utf-8");
+ assert.match(after, /^# North Star — Jane Engineer$/m);
+ });
+
+ test("leaves North Star alone when valuesAreDefaults is false but user_name is empty", async () => {
+ // Empty user_name means the user took the wizard but didn't enter a
+ // name (some other value drove !valuesAreDefaults). Personalizing
+ // with the empty string would produce the eyesore `# North Star — `;
+ // the hook's secondary guard (userName.trim().length > 0) catches it.
+ await postInstall(makeCtx({ valuesAreDefaults: false, userName: "" }));
+ const after = await readFile(join(vault, "brain", "North Star.md"), "utf-8");
+ assert.equal(after, NORTH_STAR_BASE);
+ });
+});
diff --git a/.claude/scripts/tsconfig.json b/.claude/scripts/tsconfig.json
index b8a9d41..552025d 100644
--- a/.claude/scripts/tsconfig.json
+++ b/.claude/scripts/tsconfig.json
@@ -18,7 +18,8 @@
"include": [
"**/*.ts",
"../../.github/scripts/**/*.ts",
- "../../scripts/**/*.ts"
+ "../../scripts/**/*.ts",
+ "../../.shardmind/hooks/**/*.ts"
],
"exclude": ["node_modules"]
}
diff --git a/.obsidian/app.json b/.obsidian/app.json
index 957efe5..5c9c2fc 100644
--- a/.obsidian/app.json
+++ b/.obsidian/app.json
@@ -6,6 +6,11 @@
"README.ko.md",
"README.zh-CN.md",
"CHANGELOG.md",
- "CONTRIBUTING.md"
+ "CONTRIBUTING.md",
+ ".claude/",
+ ".claude-plugin/",
+ ".codex/",
+ ".gemini/",
+ ".shardmind/"
]
}
diff --git a/.shardmind/hooks/package.json b/.shardmind/hooks/package.json
new file mode 100644
index 0000000..92313dc
--- /dev/null
+++ b/.shardmind/hooks/package.json
@@ -0,0 +1,5 @@
+{
+ "private": true,
+ "type": "module",
+ "description": "ShardMind lifecycle hooks for obsidian-mind. Runtime has zero dependencies — executed by ShardMind's hook runner via the bundled tsx loader. The `type: module` field exists so TypeScript's verbatimModuleSyntax treats these .ts files as ESM during typecheck (run from `.claude/scripts/`), matching their runtime behavior."
+}
diff --git a/.shardmind/hooks/post-install.ts b/.shardmind/hooks/post-install.ts
new file mode 100644
index 0000000..4fdc225
--- /dev/null
+++ b/.shardmind/hooks/post-install.ts
@@ -0,0 +1,178 @@
+/**
+ * obsidian-mind post-install hook.
+ *
+ * Runs once after `shardmind install` writes the vault and its state. Non-fatal:
+ * throwing surfaces as a warning in the install summary, never rolls back the
+ * install. See ShardMind docs/ARCHITECTURE.md §9.3.
+ *
+ * Responsibilities (all idempotent, all skippable):
+ * 1. Initialize a git repo at the vault root if one doesn't already exist.
+ * Creates an *unmanaged* `.git/` directory — Invariant 2 doesn't apply
+ * (only managed-file edits are gated on `valuesAreDefaults`).
+ * 2. Personalize the managed `brain/North Star.md` with the user's name —
+ * gated on `!ctx.valuesAreDefaults` per Invariant 2 (with all values at
+ * defaults, the install must remain byte-equivalent to `git clone`).
+ * The engine re-hashes managed files after the hook exits, so state.json
+ * reflects the post-edit content (#75).
+ * 3. Bootstrap the QMD semantic index when `qmd_enabled === true`. Creates
+ * `.qmd/` (unmanaged), so this branch ignores `valuesAreDefaults` and
+ * runs unconditionally inside the `qmd_enabled` gate. Skips silently if
+ * the `qmd` binary isn't on PATH — the user gets a note in stdout
+ * telling them how to install it later. We never hard-fail on optional
+ * tooling.
+ *
+ * `personalizeNorthStar` and `ensureGitRepo` are exported by name so the
+ * test suite can drive them with synthetic vault layouts.
+ */
+
+import { spawn } from 'node:child_process';
+import { access, readFile, writeFile } from 'node:fs/promises';
+import { join } from 'node:path';
+
+// Vault-relative path to the QMD bootstrap script. Centralized so a future
+// rename is a one-line change. Lives at vault root under `scripts/`, not
+// `.claude/scripts/` — the README's QMD setup section invokes the same path
+// (`node --experimental-strip-types scripts/qmd-bootstrap.ts`), and changing
+// it would silently desync the manual setup path from the hook's automated
+// one.
+const QMD_BOOTSTRAP_RELATIVE = 'scripts/qmd-bootstrap.ts';
+
+// Local mirror of ShardMind's HookContext shape. Inlined (rather than imported
+// from `shardmind/runtime`) so obsidian-mind has no shardmind dependency —
+// the engine's hook runner spawns this file via tsx and the types are erased
+// at runtime. Kept in sync with `source/runtime/types.ts::HookContext` in
+// the shardmind repo. See ShardMind docs/SHARD-LAYOUT.md §Hooks, state, and
+// re-hash semantics.
+interface HookCtx {
+ vaultRoot: string;
+ values: Record<string, unknown>;
+ modules: Record<string, 'included' | 'excluded'>;
+ shard: { name: string; version: string };
+ previousVersion?: string;
+ valuesAreDefaults: boolean;
+ newFiles: string[];
+ removedFiles: string[];
+}
+
+export default async function postInstall(ctx: HookCtx): Promise<void> {
+ await ensureGitRepo(ctx.vaultRoot);
+
+ // Invariant 2: managed-file edits are gated on `!valuesAreDefaults`. With
+ // every value at its schema default, the install MUST stay byte-equivalent
+ // to `git clone` — so we leave North Star alone. When the user supplied a
+ // non-default name (or any other value), personalize the heading.
+ if (!ctx.valuesAreDefaults) {
+ const userName = typeof ctx.values['user_name'] === 'string' ? ctx.values['user_name'] : '';
+ if (userName.trim().length > 0) {
+ await personalizeNorthStar(ctx.vaultRoot, userName);
+ }
+ }
+
+ if (ctx.values['qmd_enabled'] === true) {
+ await bootstrapQmd(ctx.vaultRoot);
+ }
+}
+
+export async function ensureGitRepo(vaultRoot: string): Promise<void> {
+ try {
+ await access(join(vaultRoot, '.git'));
+ console.log('git: repository already present — skipping git init');
+ return;
+ } catch (err) {
+ // ENOENT — the expected case — falls through to `git init`. Any
+ // other code (EACCES on a permission-restricted .git/, EBUSY, …)
+ // means a `.git/` exists but we can't see it; running `git init`
+ // would either silently re-init an existing repo or fail with a
+ // less obvious follow-on error. Surface the original errno so the
+ // user knows why init didn't run.
+ if ((err as NodeJS.ErrnoException).code !== 'ENOENT') {
+ const code = (err as NodeJS.ErrnoException).code ?? 'UNKNOWN';
+ console.error(`git: cannot inspect ${join(vaultRoot, '.git')} (${code}) — skipping git init. Run \`git init\` manually if needed.`);
+ return;
+ }
+ }
+
+ const ok = await run('git', ['init', '--quiet'], vaultRoot);
+ if (ok) {
+ console.log('git: initialized repository at vault root');
+ } else {
+ console.error('git: init failed — install succeeded but the vault is not version-controlled. Run `git init` manually.');
+ }
+}
+
+/**
+ * Replace `# North Star` with `# North Star — <userName>` once. Idempotent:
+ * a heading already personalized (with this name or any other) is left
+ * alone — the regex anchors to the literal verbatim form. ENOENT-tolerant:
+ * if `brain/` was deselected (the `brain` module is `removable: false`,
+ * so this shouldn't happen in practice, but the guard costs nothing) or
+ * the file moved upstream, the hook exits cleanly.
+ */
+export async function personalizeNorthStar(vaultRoot: string, userName: string): Promise<void> {
+ const target = join(vaultRoot, 'brain', 'North Star.md');
+ let original: string;
+ try {
+ original = await readFile(target, 'utf-8');
+ } catch (err) {
+ if ((err as NodeJS.ErrnoException).code === 'ENOENT') {
+ console.log(`obsidian-mind: ${target} not present — skipping North Star personalization.`);
+ return;
+ }
+ throw err;
+ }
+
+ // Anchor to the verbatim heading. If the file has already been personalized
+ // (heading reads `# North Star — <something>`), `^# North Star$/m` won't
+ // match and the file is left untouched — making the hook idempotent.
+ if (!/^# North Star$/m.test(original)) {
+ return;
+ }
+
+ const personalized = original.replace(/^# North Star$/m, `# North Star — ${userName}`);
+ await writeFile(target, personalized, 'utf-8');
+ console.log(`obsidian-mind: personalized brain/North Star.md for ${userName}`);
+}
+
+async function bootstrapQmd(vaultRoot: string): Promise<void> {
+ const bootstrap = join(vaultRoot, QMD_BOOTSTRAP_RELATIVE);
+ try {
+ await access(bootstrap);
+ } catch {
+ console.error(`qmd: bootstrap script not found at ${bootstrap} — skipping`);
+ return;
+ }
+
+ const qmdAvailable = await which('qmd');
+ if (!qmdAvailable) {
+ console.log('qmd: `qmd` binary not found on PATH — skipping bootstrap.');
+ console.log(`qmd: install with \`npm install -g @tobilu/qmd\`, then run \`node --experimental-strip-types ${QMD_BOOTSTRAP_RELATIVE}\` from the vault root.`);
+ return;
+ }
+
+ console.log('qmd: bootstrapping semantic index (this may take a moment on first run)…');
+ const ok = await run('node', ['--experimental-strip-types', bootstrap], vaultRoot);
+ if (ok) {
+ console.log('qmd: index bootstrap complete.');
+ } else {
+ console.error(`qmd: bootstrap exited non-zero. The vault is installed; re-run manually with \`node --experimental-strip-types ${QMD_BOOTSTRAP_RELATIVE}\`.`);
+ }
+}
+
+function run(command: string, args: string[], cwd: string, opts: { quiet?: boolean } = {}): Promise<boolean> {
+ // `quiet` discards stdout + stderr — used by `which()` so a successful
+ // tool-availability probe doesn't print the resolved path into the hook
+ // log alongside the prefixed `qmd:` / `git:` messages. The user-visible
+ // subprocess paths (`git init`, `node qmd-bootstrap.ts`) keep `inherit`
+ // so their progress streams through to the install summary.
+ const out: 'ignore' | 'inherit' = opts.quiet ? 'ignore' : 'inherit';
+ return new Promise(resolve => {
+ const child = spawn(command, args, { cwd, stdio: ['ignore', out, out], shell: false });
+ child.on('error', () => resolve(false));
+ child.on('exit', code => resolve(code === 0));
+ });
+}
+
+async function which(binary: string): Promise<boolean> {
+ const cmd = process.platform === 'win32' ? 'where' : 'which';
+ return run(cmd, [binary], process.cwd(), { quiet: true });
+}
diff --git a/.shardmind/hooks/post-update.ts b/.shardmind/hooks/post-update.ts
new file mode 100644
index 0000000..48ce3e1
--- /dev/null
+++ b/.shardmind/hooks/post-update.ts
@@ -0,0 +1,55 @@
+/**
+ * obsidian-mind post-update hook.
+ *
+ * Runs after `shardmind update` finishes applying merge results and writes
+ * new state. Non-fatal — warnings in the summary, no rollback.
+ *
+ * For v6, update-time side effects are minimal:
+ *
+ * * Vault structure stays stable across patch / minor bumps. No managed
+ * file needs personalization on update — the post-install hook handled
+ * that once at install time, and the user's edits since then are owned
+ * by the user (and protected by the merge engine).
+ * * QMD's index is kept fresh by the PostToolUse `qmd-refresh.ts` hook
+ * during editing sessions, not at install/update time. A re-bootstrap
+ * here would clobber the user's existing index for no benefit.
+ *
+ * Invariant 3 (post-update hooks are additive-only by default — see
+ * ShardMind docs/SHARD-LAYOUT.md §Invariant 3): a hook that needs to write
+ * a managed file MUST restrict its writes to paths in `ctx.newFiles`. This
+ * hook writes nothing today, so the contract holds trivially. If a future
+ * migration ships a new managed file that the hook needs to seed, the
+ * write must be guarded on `ctx.newFiles.includes(path)`.
+ *
+ * If a future migration requires a re-bootstrap, branch on
+ * `ctx.previousVersion` here.
+ */
+
+// Local mirror of ShardMind's HookContext shape. See post-install.ts for the
+// rationale (no shardmind dep; types erased at runtime).
+interface HookCtx {
+ vaultRoot: string;
+ values: Record<string, unknown>;
+ modules: Record<string, 'included' | 'excluded'>;
+ shard: { name: string; version: string };
+ previousVersion?: string;
+ valuesAreDefaults: boolean;
+ newFiles: string[];
+ removedFiles: string[];
+}
+
+export default async function postUpdate(ctx: HookCtx): Promise<void> {
+ const prev = ctx.previousVersion ?? 'unknown';
+ console.log(`obsidian-mind: updated from ${prev} to ${ctx.shard.version}.`);
+
+ if (ctx.values['qmd_enabled'] === true) {
+ console.log('qmd: index stays fresh via the PostToolUse refresh hook during sessions — no action needed here.');
+ }
+
+ // Invariant 3: no managed-file writes from this hook today. If you add
+ // one, gate it on `ctx.newFiles.includes(<path>)` so the engine's
+ // additive-only contract is preserved. `ctx.removedFiles` is available
+ // for cleaning up external state (QMD collection refs, MCP registrations)
+ // that referenced now-removed paths — but obsidian-mind doesn't track
+ // any such external pointers from the engine side.
+}
diff --git a/.shardmind/shard-schema.yaml b/.shardmind/shard-schema.yaml
new file mode 100644
index 0000000..8e38e5c
--- /dev/null
+++ b/.shardmind/shard-schema.yaml
@@ -0,0 +1,276 @@
+# yaml-language-server: $schema=https://raw.githubusercontent.com/breferrari/shardmind/main/schemas/shard-schema.schema.json
+
+schema_version: 1
+
+# ---------------------------------------------------------------------------
+# Values — what goes inside files.
+# Four questions. One TUI screen. Done in 30 seconds.
+#
+# Every value declares a `default` (Invariant 1: defaults must produce a
+# vault byte-equivalent to `git clone`). `required: true` here pairs with
+# an empty default — the post-install hook personalizes North Star only
+# when ctx.valuesAreDefaults === false (Invariant 2), so an unset name
+# leaves managed files untouched.
+# ---------------------------------------------------------------------------
+
+values:
+ user_name:
+ type: string
+ required: true
+ message: "Your name"
+ placeholder: "Jane Engineer"
+ default: ""
+ group: setup
+
+ org_name:
+ type: string
+ message: "Organization (or 'Independent')"
+ default: "Independent"
+ group: setup
+
+ vault_purpose:
+ type: select
+ required: true
+ message: "How will you use this vault?"
+ hint: "Chooses the primary lens. You can edit this later in shard-values.yaml."
+ options:
+ - { value: engineering, label: "Engineering", description: "Projects, incidents, decisions, reviews" }
+ - { value: research, label: "Research", description: "Sources, findings, hypotheses, wiki" }
+ - { value: freelance, label: "Freelance", description: "Clients, projects, milestones" }
+ - { value: general, label: "General", description: "Flexible knowledge work" }
+ default: engineering
+ group: setup
+
+ qmd_enabled:
+ type: boolean
+ message: "Enable QMD semantic search?"
+ default: true
+ hint: "Requires: npm install -g @tobilu/qmd"
+ group: setup
+
+groups:
+ - id: setup
+ label: "Quick Setup"
+ description: "Four questions. Press Enter after each."
+
+# ---------------------------------------------------------------------------
+# Modules — what files exist.
+#
+# Eleven modules in three tiers:
+#
+# * 5 always-on modules (`removable: false`): the 4 content spines —
+# brain, work, reference, thinking — plus claude. Claude is the
+# canonical agent layer: every per-feature module gates files under
+# `.claude/{agents,commands}/` (e.g. `org.agents: ["people-profiler"]`
+# gates `.claude/agents/people-profiler.md`), and Codex + Gemini's
+# hook configs reference `${*_PROJECT_DIR:-.}/.claude/scripts/...`.
+# Deselecting Claude would orphan every cross-module gating reference
+# and break Codex/Gemini's hook resolution. Codex and Gemini are
+# additive integrations layered on top of the Claude infra.
+# * 4 removable content modules: org, perf, incidents, one_on_ones.
+# Deselected modules drop their paths AND their per-name commands /
+# agents under `.claude/{commands,agents}/`.
+# * 2 removable agent modules: codex, gemini. Deselect to omit
+# AGENTS.md / GEMINI.md and the matching dotfolder contents.
+# `.claude/scripts/` (shared hook implementations) stays always-on
+# by virtue of being claimed by no module.
+#
+# Bases (`bases/*.base`) are listed by exact path under their owning
+# module's `paths` — the engine's `mod.bases` field only matches
+# `.base.njk` (see ShardMind source/core/modules.ts §classifyModule),
+# and obsidian-mind's bases ship as plain `.base`.
+# ---------------------------------------------------------------------------
+
+modules:
+ brain:
+ label: "Operational memory — Memories, Decisions, Patterns, Gotchas, North Star, Skills"
+ paths: ["brain/"]
+ removable: false
+
+ work:
+ label: "Active projects, archive, meetings"
+ paths:
+ - "work/Index.md"
+ - "work/active/"
+ - "work/archive/"
+ - "work/meetings/"
+ - "bases/Work Dashboard.base"
+ commands: ["om-meeting", "om-intake", "om-project-archive"]
+ removable: false
+
+ reference:
+ label: "Codebase knowledge, architecture maps, runbooks"
+ paths: ["reference/"]
+ removable: false
+
+ thinking:
+ label: "Scratchpad for drafts and reasoning"
+ paths: ["thinking/"]
+ removable: false
+
+ org:
+ label: "People and teams — who you work with"
+ paths:
+ - "org/"
+ - "bases/People Directory.base"
+ agents: ["people-profiler"]
+ removable: true
+
+ perf:
+ label: "Performance — brag doc, competencies, reviews, PR evidence"
+ paths:
+ - "perf/"
+ - "bases/Competency Map.base"
+ - "bases/Review Evidence.base"
+ commands: ["om-peer-scan", "om-review-brief", "om-self-review", "om-review-peer", "om-slack-scan"]
+ agents: ["brag-spotter", "review-fact-checker", "review-prep"]
+ removable: true
+
+ incidents:
+ label: "Incident tracking — outages, RCAs, deep dives"
+ paths:
+ - "work/incidents/"
+ - "bases/Incidents.base"
+ commands: ["om-incident-capture"]
+ agents: ["slack-archaeologist"]
+ removable: true
+
+ one_on_ones:
+ label: "1:1 meeting notes"
+ paths:
+ - "work/1-1/"
+ - "bases/1-1 History.base"
+ commands: ["om-capture-1on1", "om-prep-1on1"]
+ removable: true
+
+ claude:
+ label: "Claude (Anthropic) agent — CLAUDE.md, .claude/agents, .claude/skills, .claude/commands, .claude-plugin"
+ paths:
+ - "CLAUDE.md"
+ - ".claude/agents/"
+ - ".claude/skills/"
+ - ".claude/commands/"
+ - ".claude/memory-template.md"
+ - ".claude/settings.json"
+ - ".claude/update-skills.ts"
+ - ".claude-plugin/"
+ agents: ["claude"]
+ # Always-on. Per-feature modules (org/perf/incidents/one_on_ones) gate
+ # files under `.claude/{agents,commands}/` via their `agents:` /
+ # `commands:` fields; Codex + Gemini hook configs reference
+ # `${*_PROJECT_DIR:-.}/.claude/scripts/...`. Deselecting Claude would
+ # orphan every cross-module gating reference and break the other two
+ # agents' hook resolution.
+ removable: false
+
+ codex:
+ label: "Codex (OpenAI) agent — AGENTS.md, .codex/"
+ paths:
+ - "AGENTS.md"
+ - ".codex/"
+ agents: ["codex"]
+ removable: true
+
+ gemini:
+ label: "Gemini (Google) agent — GEMINI.md, .gemini/"
+ paths:
+ - "GEMINI.md"
+ - ".gemini/"
+ agents: ["gemini"]
+ removable: true
+
+# ---------------------------------------------------------------------------
+# Signals — classification contract.
+#
+# This block is the spec / source-of-truth for which signals the vault
+# recognizes and where each one routes. Each signal lists a description
+# (what the hook is looking for) plus a `routes_to` field (where the
+# resulting capture should land). Module-gated signals are skipped when
+# their module is excluded.
+#
+# The runtime consumer is `.claude/scripts/classify-message.ts`. As of
+# obsidian-mind v5.1 the multilingual regex tables live in
+# `.claude/scripts/lib/signals.ts` and the classifier reads them
+# directly — not from this schema. Keep the two in sync when adding or
+# removing a signal: the schema entry (here) and the implementation
+# (`.claude/scripts/lib/signals.ts`) describe the same surface.
+# ---------------------------------------------------------------------------
+
+signals:
+ - id: DECISION
+ description: "A choice was made with reasoning"
+ routes_to: "work/active/ or work/Index.md Decisions Log; brain/Key Decisions.md if significant"
+ core: true
+
+ - id: WIN
+ description: "Achievement, praise, milestone, or delivery"
+ routes_to: "perf/Brag Doc.md with a link to the evidence note"
+ module: perf
+
+ - id: ARCHITECTURE
+ description: "System design, technical structure, decision record"
+ routes_to: "reference/ or work/active/<project>/decisions/"
+ core: true
+
+ - id: PROJECT_UPDATE
+ description: "Status update, delivery, roadmap shift on active work"
+ routes_to: "work/active/<project>/ note or work/Index.md"
+ core: true
+
+ - id: INCIDENT
+ description: "Outage, pager, severity event, postmortem material"
+ routes_to: "work/incidents/ — consider /om-incident-capture"
+ module: incidents
+
+ - id: PERSON_CONTEXT
+ description: "Information about someone you work with"
+ routes_to: "org/people/<person>.md"
+ module: org
+
+ - id: ONE_ON_ONE
+ description: "1:1 meeting content — takeaways, feedback, action items"
+ routes_to: "work/1-1/<Person> YYYY-MM-DD.md and org/people/<person>.md"
+ module: one_on_ones
+
+# ---------------------------------------------------------------------------
+# Frontmatter — per-note-type validation rules consumed by the PostToolUse
+# validate-write hook. Shorthand `key: [a, b]` expands to `key: { required: [...] }`.
+# `path_match` uses shell-glob (single-segment *, cross-segment **); omit to
+# infer note type from parent folder.
+# ---------------------------------------------------------------------------
+
+frontmatter:
+ global: [date, description, tags]
+
+ work-note:
+ required: [date, status, quarter]
+ path_match: "work/active/**.md"
+
+ incident:
+ required: [date, status, quarter, ticket, severity, role]
+ path_match: "work/incidents/**.md"
+
+ 1-1:
+ required: [date, quarter]
+ path_match: "work/1-1/*.md"
+
+ person:
+ required: [date, title]
+ path_match: "org/people/*.md"
+
+ team:
+ required: [date]
+ path_match: "org/teams/*.md"
+
+ brain-note:
+ required: [date, description]
+ path_match: "brain/*.md"
+
+# ---------------------------------------------------------------------------
+# Migrations — value migrations between shard versions.
+# v6.0.0 is the first shardmind-native release; no prior shard-values.yaml
+# exists to migrate. Users on obsidian-mind v5.x or earlier run
+# `/om-vault-upgrade` inside an installed v6 vault to migrate their content.
+# ---------------------------------------------------------------------------
+
+migrations: []
diff --git a/.shardmind/shard.yaml b/.shardmind/shard.yaml
new file mode 100644
index 0000000..245890c
--- /dev/null
+++ b/.shardmind/shard.yaml
@@ -0,0 +1,22 @@
+# yaml-language-server: $schema=https://raw.githubusercontent.com/breferrari/shardmind/main/schemas/shard.schema.json
+
+apiVersion: v1
+name: obsidian-mind
+namespace: breferrari
+version: 6.0.0-beta.1
+description: "AI-augmented Obsidian vault for multi-agent knowledge work"
+persona: "Engineers, researchers, freelancers — anyone using Claude Code, Codex, or Gemini CLI as a thinking partner"
+license: MIT
+homepage: https://github.com/breferrari/obsidian-mind
+
+requires:
+ obsidian: ">=1.12.0"
+ # `--experimental-strip-types` + ESM; required by `.claude/scripts/*.ts`
+ # which are executed natively by Node without a build step.
+ node: ">=22.6.0"
+
+hooks:
+ post-install: .shardmind/hooks/post-install.ts
+ post-update: .shardmind/hooks/post-update.ts
+ # 60 s to accommodate first-run qmd bootstrap (index creation + initial embed pass).
+ timeout_ms: 60000
diff --git a/.shardmindignore b/.shardmindignore
new file mode 100644
index 0000000..8bd01cf
--- /dev/null
+++ b/.shardmindignore
@@ -0,0 +1,20 @@
+# Files in this list are part of the GitHub repo, not the vault. ShardMind
+# excludes them from `shardmind install` so the installed vault carries
+# only what an Obsidian user needs. The repo still ships them so the GitHub
+# landing page, contribution flow, and translated READMEs work for visitors
+# who land on the repo directly.
+#
+# Glob semantics: gitignore-spec, minus negation (deferred to v0.2 per
+# breferrari/shardmind#87). See ShardMind docs/SHARD-LAYOUT.md
+# §File disposition for the three-tier model.
+
+# Repo-meta — meaningful on GitHub, noise in a vault.
+CONTRIBUTING.md
+README.*.md
+
+# Marketing media — not vault content. Patterns are explicit (not `*.png` /
+# `*.gif`) so a future `.png`/`.gif` attachment landing at vault root would
+# install correctly instead of being silently dropped. Update the list when
+# new marketing media ship.
+obsidian-mind-logo.*
+obsidian-mind-demo.*
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 8745d26..446990c 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -360,3 +360,21 @@ The design is hostile to these changes (on purpose):
Template versions are tracked in `vault-manifest.json` with fingerprints that let `/om-vault-upgrade` detect an older vault's version by presence or absence of specific files. The migrator uses the infrastructure/user-content split to decide what to overwrite versus preserve. `CHANGELOG.md` documents what changed in each version.
The long-term stability guarantee is narrow: the manifest keys (`qmd_index`, `infrastructure`, `user_content_roots`, `frontmatter_required`), the hook script names under `.claude/scripts/`, and the folder layout for user content. Everything else — including command names, subagent internals, and classification logic — is allowed to evolve between versions.
+
+## Install Paths
+
+Two ways to bring obsidian-mind into a new directory:
+
+**`git clone` — the original.** Clone the repo, open the folder in Obsidian, talk to the agent. Zero machinery beyond git. Every file ships verbatim; no install-time substitution. The hook scripts under `.claude/scripts/` only run when the agent triggers them. This path is the long-standing default and the one new contributors use to read the codebase.
+
+**`shardmind install` — v6.** [ShardMind](https://github.com/breferrari/shardmind) is a package manager for Obsidian vault templates that produces the same vault as `git clone` plus a `.shardmind/` sidecar. A wizard collects four values (`user_name`, `org_name`, `vault_purpose`, `qmd_enabled`), gates eleven modules (4 always-on content, 4 removable content, 3 agent — `claude` / `codex` / `gemini`), and runs a post-install hook (`.shardmind/hooks/post-install.ts`) that initializes git, optionally bootstraps QMD when enabled, and personalizes `brain/North Star.md` with the user's name. The shard contract is locked by three invariants:
+
+1. **Invariant 1 — clone-equivalence under defaults.** `shardmind install --defaults` produces a vault byte-equivalent to `git clone` modulo Tier 1 exclusions (`.git`, `.github`, ephemeral `.obsidian/workspace*.json`), the engine metadata under `.shardmind/`, and a vault-root `shard-values.yaml`.
+2. **Invariant 2 — hooks no-op on defaults.** The post-install hook respects `ctx.valuesAreDefaults` — managed-file edits (e.g., the North Star personalization) are gated on a non-default user value. With every value at its default, the install must remain byte-equivalent to clone.
+3. **Invariant 3 — post-update is additive-only.** The post-update hook restricts managed-file writes to `ctx.newFiles` (paths added by the new version), preventing clobbers of the merge engine's three-way resolution of user edits.
+
+The contract surface lives at `.shardmind/shard.yaml` (manifest), `.shardmind/shard-schema.yaml` (values + module declarations), `.shardmind/hooks/{post-install,post-update}.ts` (lifecycle), and `.shardmindignore` at repo root (excludes `CONTRIBUTING.md`, README translations, marketing media from the install). Spec: [ShardMind `docs/SHARD-LAYOUT.md`](https://github.com/breferrari/shardmind/blob/main/docs/SHARD-LAYOUT.md).
+
+**Additive principle.** `shardmind install` produces a strictly larger vault than `git clone` — never smaller, never different on shared paths under defaults. Deleting `.shardmind/` and `shard-values.yaml` from an installed vault leaves a working clone-equivalent vault. The same is true on the source side: deleting `.shardmind/` from this repo would produce a v5.1-shape working vault. ShardMind extends the clone experience; it doesn't replace it.
+
+`shardmind update` (v6+) three-way-merges your edits with upstream changes — the moat that `git pull` doesn't provide for templates with installed-time personalization. `/om-vault-upgrade` remains the path for migrating a v5.x clone or arbitrary vault into v6 in place; once installed, `shardmind update` (or `shardmind adopt` for retroactive adoption) takes over.
diff --git a/README.ja.md b/README.ja.md
index 9d4554e..eb9c090 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -39,6 +39,8 @@ AIコーディングエージェントは強力ですが、忘れてしまいま
明日マネージャーとの1on1があります — レビューブリーフは準備完了です。"
```
+`shardmind install` または `git clone` でインストール — どちらも同じボールトです。
+
---
## ⚡ 実際の動作
@@ -96,12 +98,29 @@ Decision: defer Redis migration. Win: Sarah praised the auth architecture.
## 🚀 クイックスタート
-1. このリポジトリをクローン(または**GitHubテンプレート**として使用)
-2. フォルダを**Obsidianボールト**として開く
-3. 設定 → 一般で**Obsidian CLI**を有効化(Obsidian 1.12以上が必要)
-4. ボールトディレクトリでエージェントを実行:**`claude`**、**`codex`**、または**`gemini`**
-5. **`brain/North Star.md`**に目標を記入 — これがすべてのセッションの基盤になります
-6. 仕事について話し始める
+### 📦 ShardMindでインストール(推奨)
+
+```bash
+npm install -g shardmind
+shardmind install breferrari/obsidian-mind
+```
+
+ウィザードがあなたの名前、組織、ボールトの目的、含めるエージェント、QMDを有効化するかどうかを収集します。post-installフックがあなたの回答に基づいて`brain/North Star.md`をパーソナライズします。その後:
+
+1. インストールされたフォルダを**Obsidianボールト**として開く
+2. 設定 → 一般で**Obsidian CLI**を有効化(Obsidian 1.12以上が必要)
+3. ボールトディレクトリでエージェントを実行:**`claude`**、**`codex`**、または**`gemini`**
+4. 仕事について話し始める
+
+[ShardMind](https://github.com/breferrari/shardmind)はObsidianボールトテンプレートのパッケージマネージャーです。インストール時に`.shardmind/`サイドカーが追加され、ウィザード、オプションのモジュール(不要なものはスキップ可能)、3-wayマージのアップグレードを実現します。すべての値がデフォルトの場合、インストール結果は`git clone`とバイト等価 — クローン体験はそのまま保たれます。インストール済みボールトから`.shardmind/`と`shard-values.yaml`を削除しても動作し続けます:ShardMindは追加機能であり、必須ではありません。
+
+### または直接クローン
+
+```bash
+git clone https://github.com/breferrari/obsidian-mind.git
+```
+
+または**GitHubテンプレート**として使用。ウィザードをスキップし、素のテンプレートを取得します。その後、上記の4ステップを実行し、加えて**`brain/North Star.md`**に目標を記入してください(ShardMindウィザードを使えば自動で行われます)。
### 🔍 推奨:QMDセマンティック検索
@@ -299,6 +318,7 @@ CLAUDE.md 運用マニュアル — エージェントが毎セッ
AGENTS.md マルチエージェントガイド — Codex、Cursor、Windsurf等
GEMINI.md マルチエージェントガイド — Gemini CLI
vault-manifest.json テンプレートメタデータ — バージョン、構造、スキーマ
+.shardmindignore `shardmind install` から除外されるファイル(CONTRIBUTING、翻訳、マーケティング素材)
CHANGELOG.md バージョン履歴
CONTRIBUTING.md テンプレート開発チェックリスト
README.md プロダクトドキュメント
@@ -343,8 +363,16 @@ templates/ YAMLフロントマター付きObsidianテンプレー
scripts/ フックスクリプト + charcount.tsユーティリティ
skills/ Obsidian + QMDスキル
settings.json 5つのフック設定
+
+.shardmind/ ShardMindサイドカー — `shardmind install`でインストールした場合のみ使用
+ shard.yaml マニフェスト(名前、バージョン、モジュール、フック)
+ shard-schema.yaml ウィザードの値 + モジュールゲーティング
+ hooks/ post-install(QMDブートストラップ + パーソナライズ)、post-update
```
+> [!NOTE]
+> `.shardmind/`は**追加機能であり、必須ではありません。** クローンして開くボールトはこれを読み込みません。`shardmind` CLIだけが読み込みます。削除してもボールトは動作し続けます。v6レイアウト契約は[shardmind/docs/SHARD-LAYOUT.md](https://github.com/breferrari/shardmind/blob/main/docs/SHARD-LAYOUT.md)を参照してください。
+
---
## 📝 テンプレート
@@ -431,9 +459,20 @@ git merge upstream/main
カスタマイズしたファイル(通常は`CLAUDE.md`、`brain/`ノート)のコンフリクトを解消してください。インフラファイル(`.claude/scripts/`、`.codex/`、`.gemini/`)はクリーンにマージされます。
-### 古いボールトからの移行
+### 既存のクローンをShardMindに取り込む(v5.x → v6)
+
+すでにobsidian-mindをクローンしていて、カスタマイズを失わずにウィザード、オプションのモジュール、3-wayマージのアップグレードが欲しい?`shardmind adopt`が既存のボールトを管理されたv6インストールへと整合させます — あなたの編集を1バイトも失わず、`.shardmind/`サイドカーと`shard-values.yaml`を追加するだけです:
+
+```bash
+npm install -g shardmind
+shardmind adopt breferrari/obsidian-mind
+```
+
+2-way diffのUIがローカルの変更箇所を案内し、ファイルごとに何を残すか確認した上で、エンジンのメタデータを書き込みます。結果:既存のコンテンツが無傷のままのv6管理ボールトが手に入り、以降は`shardmind update`が使えます。再クローン不要。
+
+### 古いボールトからの移行(またはその他のボールト)
-obsidian-mindの古いバージョン(または任意のObsidianボールト)をお使いですか?`/om-vault-upgrade`コマンドでコンテンツを最新テンプレートに移行できます:
+v5以前のobsidian-mindを使っている、または全く別のObsidianボールトから移行したい?`/om-vault-upgrade`コマンドがコンテンツを最新テンプレートに移行します:
```bash
# 1. 最新のobsidian-mindをクローン
diff --git a/README.ko.md b/README.ko.md
index 46dd495..ce40834 100644
--- a/README.ko.md
+++ b/README.ko.md
@@ -39,6 +39,8 @@ You: "start session"
with your manager is tomorrow — review brief is ready."
```
+`shardmind install` 또는 `git clone`으로 설치 — 어느 쪽이든 동일한 볼트입니다.
+
---
## ⚡ 실제 동작 예시
@@ -96,12 +98,29 @@ You: "wrap up"
## 🚀 빠른 시작
-1. 이 저장소를 클론하거나 **GitHub 템플릿**으로 사용하세요
-2. 폴더를 **Obsidian 볼트**로 엽니다
-3. 설정 → 일반에서 **Obsidian CLI**를 활성화합니다 (Obsidian 1.12+ 필요)
-4. 볼트 디렉토리에서 에이전트를 실행합니다: **`claude`**, **`codex`**, 또는 **`gemini`**
-5. **`brain/North Star.md`**에 목표를 작성합니다 — 이것이 모든 세션의 기준이 됩니다
-6. 업무에 대해 이야기를 시작하세요
+### 📦 ShardMind로 설치 (권장)
+
+```bash
+npm install -g shardmind
+shardmind install breferrari/obsidian-mind
+```
+
+마법사가 이름, 조직, 볼트 목적, 포함할 에이전트, QMD 활성화 여부를 수집합니다. post-install 훅이 답변에 따라 `brain/North Star.md`를 개인화합니다. 그런 다음:
+
+1. 설치된 폴더를 **Obsidian 볼트**로 엽니다
+2. 설정 → 일반에서 **Obsidian CLI**를 활성화합니다 (Obsidian 1.12+ 필요)
+3. 볼트 디렉토리에서 에이전트를 실행합니다: **`claude`**, **`codex`**, 또는 **`gemini`**
+4. 업무에 대해 이야기를 시작하세요
+
+[ShardMind](https://github.com/breferrari/shardmind)는 Obsidian 볼트 템플릿의 패키지 매니저입니다. 설치 시 `.shardmind/` 사이드카가 추가되어 마법사, 선택적 모듈 (사용하지 않는 것은 건너뛰기), 3-way 머지 업그레이드를 제공합니다. 모든 값이 기본값일 때 설치 결과는 `git clone`과 바이트 단위로 동일합니다 — 클론 경험이 그대로 보존됩니다. 설치된 볼트에서 `.shardmind/`와 `shard-values.yaml`을 삭제해도 계속 작동합니다: ShardMind는 추가 기능이며, 필수 요소가 아닙니다.
+
+### 또는 직접 클론
+
+```bash
+git clone https://github.com/breferrari/obsidian-mind.git
+```
+
+또는 **GitHub 템플릿**으로 사용하세요. 마법사를 건너뛰고 기본 템플릿을 받습니다. 그런 다음 위의 4단계를 진행하고, 추가로 **`brain/North Star.md`**에 목표를 작성하세요 (ShardMind 마법사를 사용하면 자동으로 처리됩니다).
### 🔍 권장: QMD 시맨틱 검색
@@ -299,6 +318,7 @@ CLAUDE.md 운영 매뉴얼 — 에이전트가 매 세션마다
AGENTS.md 멀티에이전트 가이드 — Codex, Cursor, Windsurf 등
GEMINI.md 멀티에이전트 가이드 — Gemini CLI
vault-manifest.json 템플릿 메타데이터 — 버전, 구조, 스키마
+.shardmindignore `shardmind install`에서 제외되는 파일 (CONTRIBUTING, 번역, 마케팅 미디어)
CHANGELOG.md 버전 히스토리
CONTRIBUTING.md 템플릿 개발 체크리스트
README.md 제품 문서
@@ -343,8 +363,16 @@ templates/ YAML 프론트매터가 포함된 Obsidian 템플릿
scripts/ 훅 스크립트 + charcount.ts 유틸리티
skills/ Obsidian + QMD 스킬
settings.json 5개 훅 설정
+
+.shardmind/ ShardMind 사이드카 — `shardmind install`로 설치한 경우에만 사용
+ shard.yaml 매니페스트 (이름, 버전, 모듈, 훅)
+ shard-schema.yaml 마법사 값 + 모듈 게이팅
+ hooks/ post-install (QMD 부트스트랩 + 개인화), post-update
```
+> [!NOTE]
+> `.shardmind/`는 **추가 기능이며, 필수 요소가 아닙니다.** 클론하여 열기만 하는 볼트는 이 파일을 읽지 않으며, `shardmind` CLI만 사용합니다. 삭제해도 볼트는 계속 작동합니다. v6 레이아웃 계약은 [shardmind/docs/SHARD-LAYOUT.md](https://github.com/breferrari/shardmind/blob/main/docs/SHARD-LAYOUT.md)를 참조하세요.
+
---
## 📝 템플릿
@@ -431,9 +459,20 @@ git merge upstream/main
커스터마이징한 파일(일반적으로 `CLAUDE.md`, `brain/` 노트)의 충돌을 해결하세요. 인프라 파일(`.claude/scripts/`, `.codex/`, `.gemini/`)은 깔끔하게 병합됩니다.
-### 이전 볼트에서 마이그레이션
+### 기존 클론을 ShardMind로 채택 (v5.x → v6)
+
+이미 obsidian-mind를 클론했고 커스터마이징을 잃지 않고 마법사, 선택적 모듈, 3-way 머지 업그레이드를 원하시나요? `shardmind adopt`가 기존 볼트를 관리되는 v6 설치로 조정해줍니다 — 편집한 모든 바이트를 유지하면서 `.shardmind/` 사이드카와 `shard-values.yaml`만 추가합니다:
+
+```bash
+npm install -g shardmind
+shardmind adopt breferrari/obsidian-mind
+```
+
+2-way diff UI가 로컬 변경 사항을 안내하고, 파일별로 무엇을 유지할지 묻고, 엔진 메타데이터를 작성합니다. 결과: 기존 콘텐츠가 그대로 유지된 v6 관리 볼트, 이후로는 `shardmind update`를 사용할 수 있습니다. 다시 클론할 필요 없음.
+
+### 이전 볼트에서 마이그레이션 (또는 다른 볼트)
-이전 버전의 obsidian-mind(또는 기존 Obsidian 볼트)를 사용 중이신가요? `/om-vault-upgrade` 명령어가 최신 템플릿으로 콘텐츠를 마이그레이션합니다:
+v5 이전 버전의 obsidian-mind를 사용 중이거나, 완전히 다른 Obsidian 볼트에서 마이그레이션하시나요? `/om-vault-upgrade` 명령어가 최신 템플릿으로 콘텐츠를 마이그레이션합니다:
```bash
# 1. 최신 obsidian-mind 클론
diff --git a/README.md b/README.md
index 9bf0429..2959719 100644
--- a/README.md
+++ b/README.md
@@ -38,6 +38,8 @@ Agent: "You're working on Project Alpha, blocked on the BE contract.
Works with **Claude Code** (full support), **Codex CLI**, and **Gemini CLI** — same hooks, same commands, same vault.
+Install via `shardmind install` or `git clone` — same vault either way.
+
---
## ⚡ See It In Action
@@ -95,12 +97,29 @@ You: "wrap up"
## 🚀 Quick Start
-1. Clone this repo (or use it as a **GitHub template**)
-2. Open the folder as an **Obsidian vault**
-3. Enable the **Obsidian CLI** in Settings → General (requires Obsidian 1.12+)
-4. Run your agent in the vault directory: **`claude`**, **`codex`**, or **`gemini`**
-5. Fill in **`brain/North Star.md`** with your goals — this grounds every session
-6. Start talking about work
+### 📦 Install via ShardMind (recommended)
+
+```bash
+npm install -g shardmind
+shardmind install breferrari/obsidian-mind
+```
+
+The wizard collects your name, organization, vault purpose, agents to include, and whether to enable QMD; the post-install hook personalizes `brain/North Star.md` with your answers. Then:
+
+1. 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`**
+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.
+
+### Or clone directly
+
+```bash
+git clone https://github.com/breferrari/obsidian-mind.git
+```
+
+Or use it as a **GitHub template**. Skip the wizard, get the bare template. Then run through the same 4 steps above, plus fill in **`brain/North Star.md`** with your goals (the ShardMind wizard does this for you).
### 🔍 Recommended: QMD Semantic Search
@@ -306,6 +325,7 @@ CLAUDE.md Operating manual — read by your agent 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
+.shardmindignore Files excluded from `shardmind install` (CONTRIBUTING, translations, marketing media)
CHANGELOG.md Version history
CONTRIBUTING.md Template development checklist
README.md Product documentation
@@ -350,8 +370,16 @@ templates/ Obsidian templates with YAML frontmatter
scripts/ Hook scripts + charcount.ts utility
skills/ Obsidian + QMD skills
settings.json 5 hooks configuration
+
+.shardmind/ ShardMind sidecar — only used if installed via `shardmind install`
+ shard.yaml Manifest (name, version, modules, hooks)
+ shard-schema.yaml Wizard values + module gating
+ hooks/ post-install (QMD bootstrap + personalization), post-update
```
+> [!NOTE]
+> `.shardmind/` is **additive, not load-bearing.** A clone-and-open vault never reads it; only the `shardmind` CLI does. Delete it and the vault keeps working. See the v6 layout contract in [shardmind/docs/SHARD-LAYOUT.md](https://github.com/breferrari/shardmind/blob/main/docs/SHARD-LAYOUT.md).
+
---
## 📝 Templates
@@ -438,9 +466,20 @@ git merge upstream/main
Resolve any conflicts in files you customized (typically `CLAUDE.md`, `brain/` notes). Infrastructure files (`.claude/scripts/`, `.codex/`, `.gemini/`) should merge cleanly.
-### Migrating from an older vault
+### Adopting an existing clone into ShardMind (v5.x → v6)
+
+Already cloned obsidian-mind and want the wizard, optional modules, and three-way-merge upgrades without losing your customizations? `shardmind adopt` reconciles your existing vault into a managed v6 install — keeping every byte of your edits and only adding the `.shardmind/` sidecar + `shard-values.yaml`:
+
+```bash
+npm install -g shardmind
+shardmind adopt breferrari/obsidian-mind
+```
+
+The 2-way diff UI walks you through any local changes, asks per-file what to keep, then writes the engine metadata. Result: a v6-managed vault with your existing content intact, ready for `shardmind update` from there forward. No re-cloning.
+
+### Migrating from an older vault (or any other vault)
-Using an older version of obsidian-mind (or any Obsidian vault)? The `/om-vault-upgrade` command migrates your content into the latest template:
+Using a pre-v5 obsidian-mind, or migrating from a totally different Obsidian vault? The `/om-vault-upgrade` command migrates your content into the latest template:
```bash
# 1. Clone the latest obsidian-mind
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 831b35f..5a77837 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -39,6 +39,8 @@ Agent: "你正在做 Project Alpha,被后端契约阻塞了。
1:1——Review 简报已经准备好了。"
```
+通过 `shardmind install` 或 `git clone` 安装 —— 两种方式得到相同的仓库。
+
---
## ⚡ 实际效果
@@ -96,12 +98,29 @@ Decision: defer Redis migration. Win: Sarah praised the auth architecture.
## 🚀 快速开始
-1. 克隆此仓库(或使用它作为 **GitHub 模板**)
-2. 将文件夹作为 **Obsidian 仓库** 打开
-3. 在 设置 → 通用 中启用 **Obsidian CLI**(需要 Obsidian 1.12+)
-4. 在仓库目录中运行你的 Agent:**`claude`**、**`codex`** 或 **`gemini`**
-5. 在 **`brain/North Star.md`** 中填写你的目标——这将为每次会话定下基调
-6. 开始谈论工作
+### 📦 通过 ShardMind 安装(推荐)
+
+```bash
+npm install -g shardmind
+shardmind install breferrari/obsidian-mind
+```
+
+向导会收集你的姓名、组织、仓库用途、要包含的 Agent,以及是否启用 QMD。post-install 钩子会根据你的答案个性化 `brain/North Star.md`。然后:
+
+1. 将已安装的文件夹作为 **Obsidian 仓库** 打开
+2. 在 设置 → 通用 中启用 **Obsidian CLI**(需要 Obsidian 1.12+)
+3. 在仓库目录中运行你的 Agent:**`claude`**、**`codex`** 或 **`gemini`**
+4. 开始谈论工作
+
+[ShardMind](https://github.com/breferrari/shardmind) 是 Obsidian 仓库模板的包管理器。安装时会添加 `.shardmind/` 旁挂目录,提供向导、可选模块(不需要的可以跳过)和三方合并升级。所有值采用默认值时,安装结果与 `git clone` 字节等价——克隆体验完全保留。从已安装的仓库中删除 `.shardmind/` 和 `shard-values.yaml`,仓库仍可正常工作:ShardMind 是附加功能,并非必需。
+
+### 或直接克隆
+
+```bash
+git clone https://github.com/breferrari/obsidian-mind.git
+```
+
+或将其作为 **GitHub 模板** 使用。跳过向导,获取裸模板。然后按上面的 4 个步骤操作,并在 **`brain/North Star.md`** 中填写你的目标(ShardMind 向导会自动完成此项)。
### 🔍 推荐:QMD 语义搜索
@@ -299,6 +318,7 @@ CLAUDE.md 操作手册——Agent 每次会话都会读取
AGENTS.md 多 Agent 指南——Codex、Cursor、Windsurf 等
GEMINI.md 多 Agent 指南——Gemini CLI
vault-manifest.json 模板元数据——版本、结构、schema
+.shardmindignore 从 `shardmind install` 中排除的文件(CONTRIBUTING、翻译、营销素材)
CHANGELOG.md 版本历史
CONTRIBUTING.md 模板开发清单
README.md 产品文档
@@ -343,8 +363,16 @@ templates/ 带有 YAML frontmatter 的 Obsidian 模板
scripts/ 钩子脚本 + charcount.ts 工具
skills/ Obsidian + QMD 技能
settings.json 5 个钩子配置
+
+.shardmind/ ShardMind 旁挂目录——仅在通过 `shardmind install` 安装时使用
+ shard.yaml 清单文件(名称、版本、模块、钩子)
+ shard-schema.yaml 向导值 + 模块门控
+ hooks/ post-install(QMD 引导 + 个性化)、post-update
```
+> [!NOTE]
+> `.shardmind/` 是**附加功能,并非必需。** 克隆并打开的仓库从不读取它;只有 `shardmind` CLI 使用它。删除它,仓库仍可正常工作。v6 布局契约见 [shardmind/docs/SHARD-LAYOUT.md](https://github.com/breferrari/shardmind/blob/main/docs/SHARD-LAYOUT.md)。
+
---
## 📝 模板
@@ -431,9 +459,20 @@ git merge upstream/main
解决你自定义过的文件的冲突(通常是 `CLAUDE.md`、`brain/` 笔记)。基础设施文件(`.claude/scripts/`、`.codex/`、`.gemini/`)应该可以干净合并。
-### 从旧仓库迁移
+### 将已有克隆收编到 ShardMind(v5.x → v6)
+
+已经克隆了 obsidian-mind,又想要向导、可选模块和三方合并升级,且不希望丢失自定义内容?`shardmind adopt` 会将你已有的仓库整合为受管的 v6 安装——保留你的每一字节编辑,仅添加 `.shardmind/` 旁挂目录和 `shard-values.yaml`:
+
+```bash
+npm install -g shardmind
+shardmind adopt breferrari/obsidian-mind
+```
+
+2-way diff UI 会引导你查看本地变更,按文件确认要保留的内容,然后写入引擎元数据。结果:你已有的内容完好保留的 v6 受管仓库,从此可以使用 `shardmind update`。无需重新克隆。
+
+### 从旧仓库(或任何其他仓库)迁移
-已经在使用旧版本的 obsidian-mind(或其他 Obsidian 仓库)?`/om-vault-upgrade` 命令可以将你的内容迁移到最新模板:
+使用 v5 之前的 obsidian-mind,或要从完全不同的 Obsidian 仓库迁移?`/om-vault-upgrade` 命令可以将你的内容迁移到最新模板:
```bash
# 1. 克隆最新版 obsidian-mind
diff --git a/vault-manifest.json b/vault-manifest.json
index fabcb8b..bb53d57 100644
--- a/vault-manifest.json
+++ b/vault-manifest.json
@@ -29,7 +29,9 @@
"obsidian-mind-demo.gif",
"brain/Skills.md",
"perf/competencies/README.md",
- "thinking/README.md"
+ "thinking/README.md",
+ ".shardmind/**",
+ ".shardmindignore"
],
"scaffold": {
"brain/North Star.md": "Personal goals — replace if source has real content",