sync-context
Synchronize CLAUDE.md to GEMINI.md and check for context drift
What this skill does
# Sync Context Command
Check and synchronize context between CLAUDE.md (source of truth) and GEMINI.md.
## Usage
```text
/google-ecosystem:sync-context [options]
```
## Arguments
- `--status` - Show sync status without making changes
- `--init` - Initialize GEMINI.md with @import pattern
- `--force` - Force regenerate GEMINI.md from template
## Examples
- `/google-ecosystem:sync-context` - Check sync status
- `/google-ecosystem:sync-context --status` - Show detailed sync report
- `/google-ecosystem:sync-context --init` - Create GEMINI.md if missing
- `/google-ecosystem:sync-context --force` - Regenerate GEMINI.md
## Sync Strategy
This command implements the **@import pattern**:
```markdown
# GEMINI.md
@CLAUDE.md
## Gemini-Specific Overrides
{overrides}
```
With this pattern, GEMINI.md automatically stays in sync because it imports CLAUDE.md directly via Gemini's memport system.
## Execution
### Step 1: Parse Arguments
```bash
mode="status" # default
case "$1" in
--status) mode="status" ;;
--init) mode="init" ;;
--force) mode="force" ;;
esac
```
### Step 2: Check Prerequisites
```bash
# Check CLAUDE.md exists
if [ ! -f "CLAUDE.md" ]; then
echo "ERROR: CLAUDE.md not found"
echo "Create CLAUDE.md first - it's the source of truth"
exit 1
fi
```
### Step 3: Determine Sync State
```bash
# Create sync state directory
mkdir -p .claude/temp
# Get current CLAUDE.md hash
claude_hash=$(md5sum CLAUDE.md | cut -d' ' -f1)
# Read stored state
if [ -f ".claude/temp/sync-state.json" ]; then
stored_hash=$(cat .claude/temp/sync-state.json | jq -r '.claude_hash // ""')
last_sync=$(cat .claude/temp/sync-state.json | jq -r '.last_sync // "never"')
else
stored_hash=""
last_sync="never"
fi
# Check if GEMINI.md exists
gemini_exists="no"
gemini_uses_import="no"
if [ -f "GEMINI.md" ]; then
gemini_exists="yes"
if head -5 GEMINI.md | grep -q "^@CLAUDE.md"; then
gemini_uses_import="yes"
fi
fi
```
### Step 4: Execute Based on Mode
#### Status Mode
```bash
if [ "$mode" = "status" ]; then
echo "## Context Sync Status"
echo ""
echo "| File | Status |"
echo "|------|--------|"
echo "| CLAUDE.md | EXISTS |"
echo "| GEMINI.md | $gemini_exists |"
echo "| Uses @import | $gemini_uses_import |"
echo ""
echo "**CLAUDE.md Hash:** $claude_hash"
echo "**Stored Hash:** ${stored_hash:-none}"
echo "**Last Sync:** $last_sync"
echo ""
if [ "$claude_hash" = "$stored_hash" ]; then
echo "**Status:** IN SYNC"
else
echo "**Status:** CLAUDE.md has changed since last sync"
fi
if [ "$gemini_uses_import" = "yes" ]; then
echo ""
echo "**Note:** GEMINI.md uses @import pattern - automatically in sync"
fi
fi
```
#### Init Mode
```bash
if [ "$mode" = "init" ]; then
if [ "$gemini_exists" = "yes" ]; then
echo "GEMINI.md already exists. Use --force to regenerate."
exit 1
fi
cat > GEMINI.md << 'GEMINI_EOF'
# GEMINI.md
@CLAUDE.md
## Gemini-Specific Overrides
You are Gemini CLI. Your unique capabilities include:
- **Large context window** (Flash) / Very large (Pro)
- **Interactive PTY shell** - vim, git rebase -i, htop, psql
- **Checkpointing** - Git-based snapshots with instant rollback
- **Policy engine** - TOML-based tool execution control
- **Native Google Cloud authentication**
### When to Leverage Your Strengths
Use your large context for:
- Full codebase exploration and architecture analysis
- Bulk file processing and pattern detection
- Large log file analysis
Use your interactive shell for:
- vim, nano, emacs editing sessions
- git rebase -i, git add -p
- Database CLIs (psql, mysql, redis-cli)
- System monitors (htop, top)
Use checkpointing for:
- Risky refactoring operations
- Experimental changes
- Database migrations
### Model Selection
- **Flash** (gemini-2.5-flash): Bulk analysis, simple tasks, cost-effective
- **Pro** (gemini-2.5-pro): Complex reasoning, quality-critical, very large contexts
GEMINI_EOF
# Update sync state
echo "{\"claude_hash\": \"$claude_hash\", \"last_sync\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" > .claude/temp/sync-state.json
echo "GEMINI.md created with @import to CLAUDE.md"
echo "Sync state initialized"
fi
```
#### Force Mode
```bash
if [ "$mode" = "force" ]; then
# Backup existing
if [ -f "GEMINI.md" ]; then
cp GEMINI.md "GEMINI.md.backup.$(date +%Y%m%d%H%M%S)"
echo "Backed up existing GEMINI.md"
fi
# Same as init
cat > GEMINI.md << 'GEMINI_EOF'
# GEMINI.md
@CLAUDE.md
## Gemini-Specific Overrides
You are Gemini CLI. Your unique capabilities include:
- **Large context window** (Flash) / Very large (Pro)
- **Interactive PTY shell** - vim, git rebase -i, htop, psql
- **Checkpointing** - Git-based snapshots with instant rollback
- **Policy engine** - TOML-based tool execution control
- **Native Google Cloud authentication**
### When to Leverage Your Strengths
Use your large context for:
- Full codebase exploration and architecture analysis
- Bulk file processing and pattern detection
- Large log file analysis
Use your interactive shell for:
- vim, nano, emacs editing sessions
- git rebase -i, git add -p
- Database CLIs (psql, mysql, redis-cli)
- System monitors (htop, top)
Use checkpointing for:
- Risky refactoring operations
- Experimental changes
- Database migrations
### Model Selection
- **Flash** (gemini-2.5-flash): Bulk analysis, simple tasks, cost-effective
- **Pro** (gemini-2.5-pro): Complex reasoning, quality-critical, very large contexts
GEMINI_EOF
# Update sync state
echo "{\"claude_hash\": \"$claude_hash\", \"last_sync\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" > .claude/temp/sync-state.json
echo "GEMINI.md regenerated with @import to CLAUDE.md"
echo "Sync state updated"
fi
```
## Output Examples
### Status Check
```text
## Context Sync Status
| File | Status |
| --- | --- |
| CLAUDE.md | EXISTS |
| GEMINI.md | yes |
| Uses @import | yes |
**CLAUDE.md Hash:** a1b2c3d4e5f6
**Stored Hash:** a1b2c3d4e5f6
**Last Sync:** 2025-11-30T12:00:00Z
**Status:** IN SYNC
**Note:** GEMINI.md uses @import pattern - automatically in sync
```
### Init Success
```text
GEMINI.md created with @import to CLAUDE.md
Sync state initialized
```
## Notes
- CLAUDE.md is always the source of truth
- GEMINI.md should use @import pattern for automatic sync
- Sync state stored in `.claude/temp/sync-state.json`
- Backups created automatically with --force
- The @import pattern means GEMINI.md is always in sync with CLAUDE.md
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.