AgentSkillsCN

find-repo

在所有设备上查找同一仓库的克隆版本。

SKILL.md
--- frontmatter
name: find-repo
description: Find clones of a repository across all machines
version: 1.0
parameters:
  - name: repo_name
    type: string
    description: Repository name or slug to search for
    optional: true
agent: memory-manager

Find Repository

This skill finds all clones of a repository across all machines and environments.

Instructions for Agent

1. Identify Target Repository

  • If repo_name parameter not provided:
    • Use current repository: git rev-parse --show-toplevel
    • Extract repo name from path
  • If repo_name provided:
    • Normalize to repo slug (basename)

2. Call Python Script

Execute the query_memory.py script:

bash
cd "${CLAUDE_PLUGIN_ROOT}"

# Detect Python command (python3 on Linux, python on Windows)
PYTHON_CMD=$(command -v python3 || command -v python)

# Try to use venv if available, create if needed, skip if venv creation fails
if [ -d "venv" ]; then
  # Activate venv (cross-platform)
  if [ -f "venv/bin/activate" ]; then
    source venv/bin/activate
  elif [ -f "venv/Scripts/activate" ]; then
    source venv/Scripts/activate
  fi
elif $PYTHON_CMD -m venv venv 2>/dev/null; then
  echo "Setting up Python environment (first time)..."
  if [ -f "venv/bin/activate" ]; then
    source venv/bin/activate
  elif [ -f "venv/Scripts/activate" ]; then
    source venv/Scripts/activate
  fi
  pip install -r requirements.txt
else
  echo "Note: Using system Python (venv creation not available)"
fi
# Use python3 on Linux/WSL, python on Windows
$PYTHON_CMD scripts/query_memory.py find-repo \
  --config-repo "$YW_CONFIG_REPO_PATH" \
  --repo-name {repo_name}

3. Parse Results

Expected JSON output:

json
{
  "repository": "dynamics-solutions",
  "description": "Dynamics solution packages...",
  "clones": [
    {
      "machine": "work-main",
      "os": "windows",
      "path": "C:\\Users\\twatana\\repos\\dynamics-solutions",
      "last_accessed": "2026-01-31T14:30:00Z"
    },
    {
      "machine": "work-devbox",
      "os": "wsl",
      "path": "/home/twatana/repos/dynamics-solutions",
      "last_accessed": "2026-01-15T10:00:00Z"
    }
  ],
  "tags": ["azure-devops", "dynamics"],
  "found": true
}

4. Format and Display

Present results in a user-friendly format:

code
Repository: dynamics-solutions
Description: Dynamics solution packages...

Found 2 clones:

1. work-main (Windows)
   Path: C:\Users\twatana\repos\dynamics-solutions
   Last accessed: Jan 31, 2026

2. work-devbox (WSL)
   Path: /home/twatana/repos/dynamics-solutions
   Last accessed: Jan 15, 2026

Tags: azure-devops, dynamics

If found: false:

code
Repository '{repo_name}' not found in memory system.

This repository has not been tracked yet. Use /describe-repo to add it.

Example Usage

User: "Hey where else do I have clones of this repository?"

Agent:

  1. Identifies current repository
  2. Calls query_memory.py find-repo
  3. Formats and displays clone locations across machines