Gemini CLI¶
Part 1: General Configuration & Tools¶
This section covers universal configurations, extensions, and the skills ecosystem applicable to any Gemini CLI environment.
1. Extensions Configuration¶
GitHub MCP Extension¶
To resolve authentication errors (e.g., Authorization header is badly formatted), you must configure a Personal Access Token (PAT).
- Generate Token: Navigate to GitHub Settings -> Developer Settings -> Personal access tokens (classic). Generate a token with
repo,read:org, andread:packagesscopes. -
Configure Environment: Gemini CLI expects the token in the
.gemini/.envfile.Windows (PowerShell):
New-Item -ItemType Directory -Force ~/.gemini; "GITHUB_MCP_PAT=ghp_your_token_here" | Out-File -Encoding utf8 -Append ~/.gemini/.env
Linux / macOS:
Note: Replace ghp_your_token_here with your actual token.
- Restart: Restart the CLI to load the new configuration. 1
Context7 Extension (Documentation RAG)¶
The context7 extension provides real-time access to up-to-date documentation and code examples for thousands of libraries (e.g., PyTorch, FastAPI, React).
- Benefits:
- Accuracy: Prevents model hallucinations of API details by fetching ground-truth documentation.
- Up-to-date: Access latest versions of libraries that might be newer than the model's training data.
- Core Tools:
resolve-library-id: Search for a library and get its unique ID (e.g.,/pytorch/docs).query-docs: Query the documentation for specific tasks or examples. 2
2. Skills Ecosystem¶
Claude Ecosystem Compatibility¶
Gemini CLI is largely compatible with the Claude skill ecosystem. You can leverage high-quality skills developed for Claude Code and Claude.ai.
Key Resources: - anthropics/skills: Official Anthropic skills for doc processing (PDF, PPTX, XLSX, etc.) and code testing. The gold standard for skill definitions. - alirezarezvani/claude-skills: Practical skills for Atlassian MCP (Jira/Confluence), Agile management, and frontend component generation. - VoltAgent/awesome-agent-skills: A curated collection of 300+ skills from major providers (Vercel, Stripe, Cloudflare, Hugging Face), compatible with Claude Code, Cursor, and Gemini CLI. - GitHub - K-Dense-AI/claude-scientific-skills: A set of ready to use scientific skills for Claude - Claude Code Plugins & Agent Skills - Community Registry with CLI
Recommended Dev Skills¶
These are general-purpose development skills useful in any workspace.
Modern Python Skill Useful for modern Python development standards.
gemini skills install https://github.com/trailofbits/skills.git --path plugins/modern-python/skills/modern-python --scope workspace
Git Commit Skill Automates structured git commit messages.
gemini skills install https://github.com/fvadicamo/dev-agent-skills.git --path skills/git-commit --scope workspace
Advanced: Porting & Installing Complex Skill Sets (Claude to Gemini)¶
When migrating complex skill collections (e.g., scientific tools) from Claude to Gemini, follow this recursive discovery and installation workflow.
Core Principles:
1. Consult Docs: Use @cli_help to check Gemini CLI syntax when adapting Claude code.
2. Recursive Discovery: Use the GitHub MCP server to explore repository trees and identify missing dependent skills.
3. Manual Installation: Construct gemini skills install commands for specific sub-paths.
Example Scenario:
Goal: Install scientific skills from K-Dense-AI/claude-scientific-skills and fix dependencies.
Prompt Template:
"@99_system/agents/gemini/skills/ I have installed
scientific-schematicsandgenerate-image. Please check for missing dependencies. 1. Use GitHub MCP to recursively list files inhttps://github.com/K-Dense-AI/claude-scientific-skills/tree/main. 2. If skills are missing, manually execute:run_shell_command(command="gemini skills install https://github.com/K-Dense-AI/claude-scientific-skills.git --path scientific-skills/<skill_name> --scope workspace")3. Continuously correct Claude-specific syntax to Gemini syntax during installation. 4. Note:.geminiis symlinked to99_system\agents\gemini\skills, so standard paths apply."
Key Command Pattern:
Part 2: Obsidian Integration SOP¶
This section details the specific configuration for integrating Gemini CLI with the Obsidian vault, managing the 99_system structure, and mobile deployment.
3
1. Architecture & Philosophy¶
Philosophy: Keep the context file (GEMINI.md) in the root for stability, and move configuration (.gemini) folder into a visible system directory (99_system) while maintaining CLI functionality via symbolic links.
- Target Structure:
./GEMINI.md->99_system/context/GEMINI.md(Conceptually, though physically kept in root for sync safety)./.gemini->99_system/agents/gemini(Symlinked)
Context File (Memory)¶
Action: Keep GEMINI.md in the Vault Root.
- Path: ./GEMINI.md
- Reasoning: This is the primary instruction file. Keeping it as a physical file in the root ensures maximum compatibility with Obsidian Sync, Git, and cross-platform usage without symlink risks.
2. Agent Configuration (Symlinks)¶
Action: Move the hidden .gemini folder to 99_system and symlink it.
Reasoning: Obsidian cannot display dot-folders. Moving it makes it visible/editable in Obsidian.
Windows (PowerShell Administrator)¶
# 1. Create the visible agent directory
New-Item -ItemType Directory -Force -Path "99_system\agents"
# 2. Move the hidden .gemini folder to the visible location
# (Ensure you are not inside the folder when moving)
Move-Item -Path ".\.gemini" -Destination ".\99_system\agents\gemini"
# 3. Create the Symbolic Link (The CLI looks for .gemini in root)
New-Item -ItemType SymbolicLink -Path ".\.gemini" -Value ".\99_system\agents\gemini"
Linux / Dual-Boot Repair Script¶
Since Windows symlinks don't work in Linux, use this script (fix_agent_config.sh) to fix the .gemini link when switching OS.
#!/bin/bash
echo "Linking Agent Configuration…"
# 1. Remove the broken Windows link
rm -rf .gemini
# 2. Create Linux link for the config folder
ln -s 99_system/agents/gemini .gemini
echo "Done. Skills are now editable in Obsidian."
3. Skills Configuration Strategy¶
45 We adopt a Hybrid Strategy for managing agent capabilities.
A. Global Skills (Public/Generic Tools)¶
Use Case: Generic utilities (Web Search, Markdown formatting) installed at the User level (~/.gemini/skills).
# Obsidian Markdown formatting
gemini skills install https://github.com/kepano/obsidian-skills.git --path skills/obsidian-markdown --scope user
# Obsidian Native CLI Bridge
gemini skills install https://github.com/kepano/obsidian-skills.git --path skills/obsidian-cli --scope user
# PDF Processing (Anthropic Official)
# Capabilities: Extract text/tables, merge/split, OCR, fill forms, encrypt/decrypt.
gemini skills install https://github.com/anthropics/skills.git --path skills/pdf --scope user
B. Workspace Skills (Private/Project Logic)¶
Use Case: Logic specific to this vault (SOPs, Scripts).
Location: 99_system/agents/gemini/skills/ (via symlink).
- Create Directory:
99_system/agents/gemini/skills/<skill_name>/ - Create Definition:
SKILL.mdinside that folder.
Skill Template:
---
name: my-custom-skill
description: A short description of what this skill does (visible in /skills list).
version: 1.0.0
---
# Skill System Prompt
[Write the detailed instructions, formatting rules, or persona definition here.]
Verification¶
4. Advanced Usage & Personalization¶
A. Memory Management¶
Gemini CLI offers two distinct ways to manage context:
- Simple Facts (
save_memory): "Remember that I prefer dark mode." - Context Management (
context-managerskill): Managing life phases inGEMINI.md.
Context Manager Skill Example:
---
name: context-manager
description: Manage user context in GEMINI.md by splitting memory into 'Core Identity' (long-term) and 'Current Phase' (short-term).
version: 1.0.0
---
## Context Manager Protocol
You are the custodian of the user's personal context file (`GEMINI.md`). Your goal is to maintain a high-fidelity, up-to-date model of the user by categorizing information into two distinct layers: **Core Identity** (Static) and **Current Phase** (Dynamic).
### Operational Rules
... [See full protocol in previous versions]
B. Custom Commands¶
Encapsulate complex prompts in 99_system/agents/gemini/commands/.
Example: The Private Secretary (\daily)
File: 99_system/agents/gemini/commands/daily.toml
description = "Acts as a private secretary to organize the daily note."
prompt = """
Activate skills: 'obsidian-markdown', 'obsidian-tasks', 'obsidian-cli'.
Role: Private Secretary managing LifeOS (Vault 1).
Context:
- Today is: {{date}}
- Template: @99_system/templates/daily notes.md
- User Input: {{args}}
Task:
1. **Resolve Date**: Determine the correct filename for today.
2. **Check/Create**: Check for daily note; create from template if missing.
3. **Analyze Input**: Parse user input for Physiological, Psychological, Wisdom, and Tasks.
4. **Update File**: Insert info into sections without deleting existing content.
5. **Report**: Summarize updates.
"""
Usage: \daily "Woke up at 8am, feel good. Plan to study Gemini CLI."
5. Obsidian Native CLI Integration¶
Native CLI Support
Obsidian now provides a native Command Line Interface (CLI). Official Documentation.
Setup Steps¶
- Open Obsidian Settings → General.
- Toggle Enable Command line interface.
- Follow the prompt to register Obsidian CLI.
6. Mobile Deployment (Android/Termux)¶
This guide details the Termux + Gemini CLI + Obsidian deployment on Android. Core Philosophy: Single-direction sync (Obsidian -> Termux) for configuration, running directly in the Vault.
Phase 1: Network & Base Installation¶
- Install Termux: Download from F-Droid.
-
Fix Repositories:
-
Install Dependencies:
Phase 2: Terminal Environment (Zsh + P10k)¶
- Install Nerd Font:
mkdir -p ~/.termux
wget https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.tar.xz
tar -xf JetBrainsMono.tar.xz
mv JetBrainsMonoNerdFont-Regular.ttf ~/.termux/font.ttf
rm JetBrainsMono*
termux-reload-settings
- Install Oh My Zsh & Plugins:
pkg install zsh -y
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
-
Configure
.zshrc:
Phase 3: Install Gemini Agent¶
Phase 4: Connect Obsidian (The Core Logic)¶
- Grant Storage Permission:
termux-setup-storage - Link Vault:
ln -s ~/storage/shared/Documents/Vault ~/Vault - Inject Startup Script (
chat): Add to.zshrc:
# Gemini Launcher: One-way Sync (Obsidian -> Termux)
function chat() {
local VAULT_PATH="$HOME/Vault"
# Check for Vault
if [ ! -d "$VAULT_PATH" ]; then
echo "❌ Error: Vault not found at $VAULT_PATH"
return 1
fi
# Enter Vault (Gemini uses current dir for context)
cd "$VAULT_PATH" || return
echo "🔄 Syncing configuration (Obsidian -> Termux)..."
# Force Copy Config (99_system -> .gemini)
if [ -d "99_system/agents/gemini" ]; then
cp -rf 99_system/agents/gemini ./.gemini
else
echo "⚠️ Warning: Config source not found in 99_system/agents/gemini"
fi
echo "🚀 Starting Gemini CLI..."
gemini
echo "✅ Session ended."
}
- Apply:
source ~/.zshrc
Usage¶
- Termux: Type
chat.