Build a command that gathers its own context intermediate
You keep running the same command, pasting its output back in, and then asking the question.
-
Custom commands can run shell with
!{...}and splice the output straight into the prompt. The command collects its own evidence before the model sees it..gemini/commands/pr/review.tomldescription = "Review the current branch against main." prompt = """ Review this diff like an owner. Prioritize correctness and regressions over style. Cite every finding as file:line. Diff: !{git diff main...HEAD} Recent commits: !{git log --oneline main..HEAD} """
-
Directory nesting becomes namespacing, so this one is invoked as
/pr:review. Project commands live in.gemini/commands/, personal ones in~/.gemini/commands/./pr:review
This inverts the usual loop. Instead of you fetching context and pasting it in, the command is the fetch — so it can't be run against stale output, and everyone who types /pr:review gets the same evidence.