Skip to content

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

feat: give every om command a Gemini CLI wrapper (#400)

Brenno Ferrari2cb2e0199944
diff --git a/.claude/commands/om-vault-upgrade.md b/.claude/commands/om-vault-upgrade.md
index 30ba3df..0b368a2 100644
--- a/.claude/commands/om-vault-upgrade.md
+++ b/.claude/commands/om-vault-upgrade.md
@@ -1,3 +1,7 @@
+---
+description: "Upgrade this vault to the latest template release through ShardMind, or import a source vault's content into this instance."
+---
+
# Vault Upgrade
Two jobs, picked by whether a source vault is given:
diff --git a/.claude/scripts/tests/gemini-commands.test.ts b/.claude/scripts/tests/gemini-commands.test.ts
new file mode 100644
index 0000000..d9d426c
--- /dev/null
+++ b/.claude/scripts/tests/gemini-commands.test.ts
@@ -0,0 +1,40 @@
+/**
+ * The om commands under Gemini CLI (#356). Gemini reads custom commands only
+ * as TOML from `.gemini/commands/`, so each `.claude/commands/om-*.md` gets a
+ * wrapper there whose prompt injects the command file with `@{…}`: the
+ * command's text is read live, with no copy to drift. The wrappers are
+ * generated (`.scripts/gemini-commands.ts`); this checks they match, one per
+ * command and none left over.
+ */
+
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import { existsSync, readFileSync } from "node:fs";
+import { join } from "node:path";
+
+import { WRAPPERS, commandDescription, expectedWrappers, geminiCommand, orphanedWrappers } from "../../../.scripts/gemini-commands.ts";
+
+test("every om command has its Gemini wrapper, as generated", () => {
+ const stale = [...expectedWrappers()]
+ .filter(([file, toml]) => !existsSync(join(WRAPPERS, file)) || readFileSync(join(WRAPPERS, file), "utf8") !== toml)
+ .map(([file]) => file);
+ assert.deepEqual(stale, [], "run: node --experimental-strip-types .scripts/gemini-commands.ts");
+});
+
+test("no wrapper outlives its command", () => {
+ assert.deepEqual(orphanedWrappers(expectedWrappers()), []);
+});
+
+test("a wrapper injects the command, passes the arguments, and maps $ARGUMENTS onto them", () => {
+ const toml = geminiCommand("om-dump", '---\ndescription: "Freeform capture."\n---\n\nUse $ARGUMENTS.\n');
+ assert.match(toml, /^description = "Freeform capture\."$/m);
+ assert.ok(toml.includes("@{.claude/commands/om-dump.md}"), "the command file is injected, not copied");
+ assert.ok(toml.includes("{{args}}"), "Gemini's arguments are passed");
+ assert.match(toml, /\$ARGUMENTS/, "and the wrapper says what $ARGUMENTS means here");
+});
+
+test("the description comes from frontmatter, else the first line of prose, escaped for TOML", () => {
+ assert.equal(commandDescription('---\ndescription: "Morning kickoff."\n---\n\nRun it.\n'), "Morning kickoff.");
+ assert.equal(commandDescription("# Wrap Up\n\nFull session review before ending.\n\n## Usage\n"), "Full session review before ending.");
+ assert.match(geminiCommand("om-x", '---\ndescription: "Say \\"hi\\" — now."\n---\n'), /^description = "Say \\"hi\\" — now\."$/m);
+});
diff --git a/.gemini/commands/om-capture-1on1.toml b/.gemini/commands/om-capture-1on1.toml
new file mode 100644
index 0000000..6f266c6
--- /dev/null
+++ b/.gemini/commands/om-capture-1on1.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-capture-1on1.md. Do not edit: run the script.
+description = "Take a meeting transcript, notes, or Gemini summary and create a structured vault note with key takeaways, quotes, action items, and DM context."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-capture-1on1.md}
+"""
diff --git a/.gemini/commands/om-correct.toml b/.gemini/commands/om-correct.toml
new file mode 100644
index 0000000..272b9da
--- /dev/null
+++ b/.gemini/commands/om-correct.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-correct.md. Do not edit: run the script.
+description = "Sweep a corrected fact through the vault — finds every note restating it, applies the correction at the single source, replaces restatements with links, and preserves notes that correctly record what was believed at the time."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-correct.md}
+"""
diff --git a/.gemini/commands/om-dump.toml b/.gemini/commands/om-dump.toml
new file mode 100644
index 0000000..a4f231e
--- /dev/null
+++ b/.gemini/commands/om-dump.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-dump.md. Do not edit: run the script.
+description = "Freeform capture mode. Dump anything — conversations, decisions, incidents, wins, thoughts — and I'll route it all to the right notes with proper templates, frontmatter, and wikilinks."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-dump.md}
+"""
diff --git a/.gemini/commands/om-humanize.toml b/.gemini/commands/om-humanize.toml
new file mode 100644
index 0000000..2fe8988
--- /dev/null
+++ b/.gemini/commands/om-humanize.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-humanize.md. Do not edit: run the script.
+description = "Voice-calibrated editing — makes Claude-drafted text sound like you wrote it, not like AI wrote it."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-humanize.md}
+"""
diff --git a/.gemini/commands/om-incident-capture.toml b/.gemini/commands/om-incident-capture.toml
new file mode 100644
index 0000000..7ec18bc
--- /dev/null
+++ b/.gemini/commands/om-incident-capture.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-incident-capture.md. Do not edit: run the script.
+description = "Capture an incident from Slack channels, DMs, and threads into structured vault notes. Produces a complete incident work note with timeline, people, analysis, and brag doc entry."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-incident-capture.md}
+"""
diff --git a/.gemini/commands/om-intake.toml b/.gemini/commands/om-intake.toml
new file mode 100644
index 0000000..f46ef22
--- /dev/null
+++ b/.gemini/commands/om-intake.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-intake.md. Do not edit: run the script.
+description = "Process all unread meeting notes in work/meetings/ — reads each file, classifies content, routes to the right vault notes, then clears the inbox."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-intake.md}
+"""
diff --git a/.gemini/commands/om-meeting.toml b/.gemini/commands/om-meeting.toml
new file mode 100644
index 0000000..f5ce53b
--- /dev/null
+++ b/.gemini/commands/om-meeting.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-meeting.md. Do not edit: run the script.
+description = "Prep for any meeting by topic — subject-forward briefing with open tasks, blockers, and brainstormed considerations the user may not have thought of yet."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-meeting.md}
+"""
diff --git a/.gemini/commands/om-peer-scan.toml b/.gemini/commands/om-peer-scan.toml
new file mode 100644
index 0000000..381e6c8
--- /dev/null
+++ b/.gemini/commands/om-peer-scan.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-peer-scan.md. Do not edit: run the script.
+description = "Deep scan a peer's GitHub PRs for performance review preparation. Produces a structured analysis saved to `perf/evidence/`."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-peer-scan.md}
+"""
diff --git a/.gemini/commands/om-prep-1on1.toml b/.gemini/commands/om-prep-1on1.toml
new file mode 100644
index 0000000..5203496
--- /dev/null
+++ b/.gemini/commands/om-prep-1on1.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-prep-1on1.md. Do not edit: run the script.
+description = "Prep for an upcoming 1:1 — load person context, surface open items, suggest agenda based on vault state."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-prep-1on1.md}
+"""
diff --git a/.gemini/commands/om-project-archive.toml b/.gemini/commands/om-project-archive.toml
new file mode 100644
index 0000000..809c473
--- /dev/null
+++ b/.gemini/commands/om-project-archive.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-project-archive.md. Do not edit: run the script.
+description = "Move a completed project from `work/active/` to `work/archive/YYYY/` and update all indexes."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-project-archive.md}
+"""
diff --git a/.gemini/commands/om-review-brief.toml b/.gemini/commands/om-review-brief.toml
new file mode 100644
index 0000000..7e215ca
--- /dev/null
+++ b/.gemini/commands/om-review-brief.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-review-brief.md. Do not edit: run the script.
+description = "Generate a performance review context transfer document from vault data. Supports manager version (PO-friendly) and peer version (project-focused)."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-review-brief.md}
+"""
diff --git a/.gemini/commands/om-review-peer.toml b/.gemini/commands/om-review-peer.toml
new file mode 100644
index 0000000..ce9a950
--- /dev/null
+++ b/.gemini/commands/om-review-peer.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-review-peer.md. Do not edit: run the script.
+description = "Write a peer review for a colleague on your company's review tool. Produces project feedback, principles, and performance summary — all within 1000-char limits, fact-checked against vault evidence."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-review-peer.md}
+"""
diff --git a/.gemini/commands/om-self-review.toml b/.gemini/commands/om-self-review.toml
new file mode 100644
index 0000000..50e25d2
--- /dev/null
+++ b/.gemini/commands/om-self-review.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-self-review.md. Do not edit: run the script.
+description = "Write your self-assessment for your company's review tool. Produces project impact descriptions, competency self-assessments (current level / next level), principles, and growth plan — all within character limits, fact-checked, strategically calibrated."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-self-review.md}
+"""
diff --git a/.gemini/commands/om-slack-scan.toml b/.gemini/commands/om-slack-scan.toml
new file mode 100644
index 0000000..9ff5e07
--- /dev/null
+++ b/.gemini/commands/om-slack-scan.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-slack-scan.md. Do not edit: run the script.
+description = "Deep scan Slack channels and DMs for evidence involving a specific person or project. Extracts every touchpoint with timestamps for review evidence or project documentation."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-slack-scan.md}
+"""
diff --git a/.gemini/commands/om-standup.toml b/.gemini/commands/om-standup.toml
new file mode 100644
index 0000000..61899cb
--- /dev/null
+++ b/.gemini/commands/om-standup.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-standup.md. Do not edit: run the script.
+description = "Morning kickoff. Load today's context, review yesterday, surface open tasks, and identify priorities."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-standup.md}
+"""
diff --git a/.gemini/commands/om-tidy.toml b/.gemini/commands/om-tidy.toml
new file mode 100644
index 0000000..2efd94b
--- /dev/null
+++ b/.gemini/commands/om-tidy.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-tidy.md. Do not edit: run the script.
+description = "Self-maintenance pass — acts on every hygiene flag: archives completed work, groups loose clusters, splits oversized notes, reports stale open loops, fixes links. Safe by construction: never deletes, never commits, zero content loss."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-tidy.md}
+"""
diff --git a/.gemini/commands/om-vault-audit.toml b/.gemini/commands/om-vault-audit.toml
new file mode 100644
index 0000000..0b1a4ea
--- /dev/null
+++ b/.gemini/commands/om-vault-audit.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-vault-audit.md. Do not edit: run the script.
+description = "Deep structural audit of the vault. Checks indexes, folder placement, frontmatter, links, Bases, and consistency. Fix what can be fixed, flag what needs user input."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-vault-audit.md}
+"""
diff --git a/.gemini/commands/om-vault-upgrade.toml b/.gemini/commands/om-vault-upgrade.toml
new file mode 100644
index 0000000..53109d3
--- /dev/null
+++ b/.gemini/commands/om-vault-upgrade.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-vault-upgrade.md. Do not edit: run the script.
+description = "Upgrade this vault to the latest template release through ShardMind, or import a source vault's content into this instance."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-vault-upgrade.md}
+"""
diff --git a/.gemini/commands/om-weekly.toml b/.gemini/commands/om-weekly.toml
new file mode 100644
index 0000000..abc85dd
--- /dev/null
+++ b/.gemini/commands/om-weekly.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-weekly.md. Do not edit: run the script.
+description = "Weekly synthesis — cross-session review of vault activity, North Star alignment, patterns, uncaptured wins, and forward priorities."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-weekly.md}
+"""
diff --git a/.gemini/commands/om-wrap-up.toml b/.gemini/commands/om-wrap-up.toml
new file mode 100644
index 0000000..07fad71
--- /dev/null
+++ b/.gemini/commands/om-wrap-up.toml
@@ -0,0 +1,7 @@
+# Generated by .scripts/gemini-commands.ts from .claude/commands/om-wrap-up.md. Do not edit: run the script.
+description = "Full session review before ending. Review context, ways of working, files modified, consistency, and suggest improvements."
+prompt = """
+Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}
+
+@{.claude/commands/om-wrap-up.md}
+"""
diff --git a/.scripts/gemini-commands.ts b/.scripts/gemini-commands.ts
new file mode 100644
index 0000000..10a2dd4
--- /dev/null
+++ b/.scripts/gemini-commands.ts
@@ -0,0 +1,73 @@
+#!/usr/bin/env node
+/**
+ * Write a Gemini CLI wrapper for each om command (#356).
+ *
+ * Gemini reads custom commands only as TOML, from `.gemini/commands/`, so the
+ * vault's `.claude/commands/om-*.md` don't exist there on their own. Each
+ * wrapper's prompt injects its command file with `@{…}`, which Gemini resolves
+ * from the workspace before it substitutes arguments, so the command text is
+ * read live from the `.md` and there is no copy to drift. Wrappers for
+ * commands that no longer exist are removed.
+ *
+ * node --experimental-strip-types .scripts/gemini-commands.ts
+ *
+ * tests/gemini-commands.test.ts fails when a wrapper is missing or stale.
+ */
+
+import { existsSync, mkdirSync, readdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
+import { dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
+import { isMainModule } from "../.claude/scripts/lib/main-guard.ts";
+import { parseFrontmatter } from "../.claude/scripts/lib/memory-recall.ts";
+
+const REPO = join(dirname(fileURLToPath(import.meta.url)), "..");
+const COMMANDS = join(REPO, ".claude", "commands");
+/** Where the wrappers live. */
+export const WRAPPERS = join(REPO, ".gemini", "commands");
+
+/** The command's description: its frontmatter `description`, else its first line of prose. */
+export function commandDescription(markdown: string): string {
+ const described = parseFrontmatter(markdown)["description"];
+ if (typeof described === "string" && described !== "") return described;
+ const body = markdown.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, "");
+ return body.split(/\r?\n/).map((l) => l.trim()).find((l) => l !== "" && !l.startsWith("#")) ?? "";
+}
+
+/** The Gemini TOML wrapper for the om command `name`, given its markdown. */
+export function geminiCommand(name: string, markdown: string): string {
+ return [
+ `# Generated by .scripts/gemini-commands.ts from .claude/commands/${name}.md. Do not edit: run the script.`,
+ `description = ${JSON.stringify(commandDescription(markdown))}`,
+ 'prompt = """',
+ `Run the vault command below. It is written for Claude Code: where it says $ARGUMENTS, use these arguments: {{args}}`,
+ "",
+ `@{.claude/commands/${name}.md}`,
+ '"""',
+ "",
+ ].join("\n");
+}
+
+/** Every wrapper there should be: file name → contents, one per om command. */
+export function expectedWrappers(): Map<string, string> {
+ const wrappers = new Map<string, string>();
+ for (const file of readdirSync(COMMANDS).filter((f) => /^om-.+\.md$/.test(f))) {
+ const name = file.replace(/\.md$/, "");
+ wrappers.set(`${name}.toml`, geminiCommand(name, readFileSync(join(COMMANDS, file), "utf8")));
+ }
+ return wrappers;
+}
+
+/** Wrapper files whose command is gone. */
+export function orphanedWrappers(expected: Map<string, string>): string[] {
+ return (existsSync(WRAPPERS) ? readdirSync(WRAPPERS) : []).filter((f) => /^om-.+\.toml$/.test(f) && !expected.has(f));
+}
+
+function main(): void {
+ const expected = expectedWrappers();
+ mkdirSync(WRAPPERS, { recursive: true });
+ for (const [file, toml] of expected) writeFileSync(join(WRAPPERS, file), toml);
+ for (const file of orphanedWrappers(expected)) unlinkSync(join(WRAPPERS, file));
+ console.log(`${expected.size} Gemini command wrappers in .gemini/commands/`);
+}
+
+if (isMainModule(import.meta.url)) main();
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 37bdd07..c2d9293 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -122,6 +122,7 @@ The release pipeline handles these automatically — **do not include in your PR
- [ ] A code change comes with a test that fails on `main` and passes with it
- [ ] Counts match everywhere (commands, agents) if you added/removed any
- [ ] New command/agent appears in ALL doc tables (README + Skills.md, and `.claude/rules/subagents.md` for an agent)
+- [ ] New, renamed or removed command: its Gemini wrapper is regenerated (`node --experimental-strip-types .scripts/gemini-commands.ts`)
- [ ] Translations flagged if you changed README.md (maintainer can handle these)
- [ ] Tests pass: `cd .claude/scripts && npm test`
- [ ] Any NEW guard, check, or config constraint has [demonstrated a red](#new-guards-must-demonstrate-a-red), recorded in the PR
diff --git a/README.md b/README.md
index cd81d76..1b6507d 100644
--- a/README.md
+++ b/README.md
@@ -270,7 +270,7 @@ Codex runs a project's hooks only once two kinds of trust are in place (observed
Until both are in place, Codex runs no hook, and the session gets no vault context.
-**Gemini CLI** — hook config at `.gemini/settings.json` maps Gemini's event names to the shared hook scripts, and its `context.fileName` setting points Gemini at `AGENTS.md`.
+**Gemini CLI** — hook config at `.gemini/settings.json` maps Gemini's event names to the shared hook scripts, and its `context.fileName` setting points Gemini at `AGENTS.md`. Gemini reads custom commands only as TOML, so `.gemini/commands/` holds a generated wrapper per command that injects the command's `.md` (`node --experimental-strip-types .scripts/gemini-commands.ts` regenerates them).
**Antigravity** and **Grok** — read `AGENTS.md` for vault conventions. Their hook, skill and command layers are tracked in [#322](https://github.com/breferrari/obsidian-mind/issues/322) and [#323](https://github.com/breferrari/obsidian-mind/issues/323).