Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:20:11 +08:00
commit 0e4afd6273
10 changed files with 639 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
{
"name": "pi-pathfinder",
"description": "PI Pathfinder - Finds the path through 229 plugins. Automatically picks the best plugin for your task, extracts its skills, and applies them. You don't pick plugins, PI does.",
"version": "1.0.0",
"author": {
"name": "Jeremy Longshore",
"email": "[email protected]"
},
"skills": [
"./skills"
]
}

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# pi-pathfinder
PI Pathfinder - Finds the path through 229 plugins. Automatically picks the best plugin for your task, extracts its skills, and applies them. You don't pick plugins, PI does.

69
plugin.lock.json Normal file
View File

@@ -0,0 +1,69 @@
{
"$schema": "internal://schemas/plugin.lock.v1.json",
"pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/examples/pi-pathfinder",
"normalized": {
"repo": null,
"ref": "refs/tags/v20251128.0",
"commit": "602ec546a189d794162fbb93a997d1e5589a5a0c",
"treeHash": "b9d8ee19223b50eb71c8ad04285d8cd245aa9aac47ecd752be63f01e1197396c",
"generatedAt": "2025-11-28T10:18:40.380621Z",
"toolVersion": "publish_plugins.py@0.2.0"
},
"origin": {
"remote": "git@github.com:zhongweili/42plugin-data.git",
"branch": "master",
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
},
"manifest": {
"name": "pi-pathfinder",
"description": "PI Pathfinder - Finds the path through 229 plugins. Automatically picks the best plugin for your task, extracts its skills, and applies them. You don't pick plugins, PI does.",
"version": "1.0.0"
},
"content": {
"files": [
{
"path": "README.md",
"sha256": "d5f1e0b5681f8c3f02a393ffa737b26e48dd188113e41373563e6081a34b31e2"
},
{
"path": ".claude-plugin/plugin.json",
"sha256": "6b33d524f7060d38ca1f0bc1b620ad107e7ffc58c212636b789ffd405e78b7ec"
},
{
"path": "skills/pi-pathfinder/SKILL.md",
"sha256": "00678c41b7dab77a627705c4598f8a8f6926eba5f67fca980d3649cd9ed6b8af"
},
{
"path": "skills/pi-pathfinder/references/README.md",
"sha256": "ef4063163f9a93e5e2d5de78077343b50f8d0973ab4edb1dc95054d5e208b4b9"
},
{
"path": "skills/pi-pathfinder/scripts/README.md",
"sha256": "32922e3c9a25a8727d19215b62600defcdadca3715e6ea4ad7a40067589c0898"
},
{
"path": "skills/pi-pathfinder/assets/plugin_selection_rules.yaml",
"sha256": "a961aefb71b7791b30dc1ca4c8f505e00df7877d2e3f4a83a22173430df927b0"
},
{
"path": "skills/pi-pathfinder/assets/example_plugin_analysis.json",
"sha256": "4f66090a1e8bc627bdb38c52e0181d958e03edd85e9cd469fba2d03e0d72d782"
},
{
"path": "skills/pi-pathfinder/assets/skill_adaptation_template.py",
"sha256": "d610c447442017398ad03f3cb52a597b41de96084c29a9260d8d94944c27dc1d"
},
{
"path": "skills/pi-pathfinder/assets/README.md",
"sha256": "28fb584a15b3a6703e4aaf0175307316ca2e74036f38823109657ec76ae01643"
}
],
"dirSha256": "b9d8ee19223b50eb71c8ad04285d8cd245aa9aac47ecd752be63f01e1197396c"
},
"security": {
"scannedAt": null,
"scannerVersion": null,
"flags": []
}
}

View File

@@ -0,0 +1,221 @@
---
name: skill-adapter
description: |
Analyzes existing plugins to extract their capabilities, then adapts and applies those skills to the current task. Acts as a universal skill chameleon that learns from other plugins. Activates when you request "skill adapter" functionality.
allowed-tools: Read, Grep, Glob, Bash
version: 1.0.0
---
# Skill Adapter - Universal Plugin Capability Extractor
## Purpose
Analyzes plugins in the claude-code-plugins marketplace to understand their capabilities, extracts the core patterns and approaches, then adapts those skills to solve the current user's task. Acts as a "skill chameleon" that can adopt any plugin's capabilities.
## How It Works
### 1. Task Analysis
When user presents a task:
- Identify the core capability needed (e.g., "analyze code quality", "generate documentation", "automate deployment")
- Determine the domain (security, devops, testing, etc.)
- Extract key requirements and constraints
### 2. Plugin Discovery
Search existing plugins for relevant capabilities:
```bash
# Find plugins in relevant category
ls plugins/community/ plugins/packages/ plugins/examples/
# Search for keywords in plugin descriptions
grep -r "keyword" --include="plugin.json" plugins/
# Find similar commands/agents
grep -r "capability-name" --include="*.md" plugins/
```
### 3. Capability Extraction
For each relevant plugin found, analyze:
**Commands (commands/*.md):**
- Read the markdown content
- Extract the approach/methodology
- Identify input/output patterns
- Note any scripts or tools used
**Agents (agents/*.md):**
- Understand the agent's role
- Extract problem-solving approach
- Note decision-making patterns
- Identify expertise areas
**Skills (skills/*/SKILL.md):**
- Read the skill instructions
- Extract core capability
- Note trigger conditions
- Understand tool usage patterns
**Scripts (scripts/*.sh, *.py):**
- Analyze script logic
- Extract reusable patterns
- Identify best practices
- Note error handling approaches
### 4. Pattern Synthesis
Combine learned patterns:
- Merge multiple approaches if beneficial
- Adapt to current context and constraints
- Simplify or enhance based on user needs
- Ensure compatibility with current environment
### 5. Skill Application
Apply the adapted skill:
- Use the learned approach
- Follow the extracted patterns
- Apply best practices discovered
- Adapt syntax/tools to current context
## Example Workflows
### Example 1: Learning Code Analysis from Security Plugins
**User task:** "Analyze this codebase for issues"
**Process:**
1. Search for security and code-analysis plugins
2. Find: `owasp-top-10-scanner`, `code-quality-enforcer`, `security-audit-agent`
3. Extract patterns:
- OWASP scanner checks for: SQL injection, XSS, CSRF, auth issues
- Quality enforcer looks at: complexity, duplication, standards
- Audit agent examines: dependencies, secrets, permissions
4. Synthesize approach:
- Run multi-layer analysis
- Check security patterns first
- Then code quality metrics
- Then dependency issues
5. Apply to user's codebase with adapted checks
### Example 2: Adopting Documentation Skills
**User task:** "Generate API documentation"
**Process:**
1. Find documentation plugins
2. Discover: `api-documenter`, `openapi-generator`, `readme-builder`
3. Extract approaches:
- API documenter: parses code, generates OpenAPI spec
- OpenAPI generator: creates interactive docs
- README builder: structures documentation hierarchically
4. Synthesize:
- Parse code for endpoints
- Generate OpenAPI/Swagger spec
- Create interactive documentation
- Build comprehensive README
5. Apply combined approach to user's API
### Example 3: Learning Automation from DevOps Plugins
**User task:** "Automate deployment process"
**Process:**
1. Search DevOps category
2. Find: `deployment-automation`, `ci-cd-pipeline`, `docker-compose-generator`
3. Extract patterns:
- Deployment automation: build → test → deploy → verify
- CI/CD pipeline: trigger conditions, parallel jobs, rollback
- Docker compose: service orchestration, environment management
4. Synthesize deployment workflow
5. Apply to user's specific tech stack
## Reasoning Process
### When to Use Skill Adapter
Trigger when:
- User needs capability that might exist in marketplace
- Task could benefit from existing plugin patterns
- User asks: "Is there a plugin for this?"
- Similar problems have been solved before
- Multiple approaches could be combined
### Plugin Selection Criteria
Choose plugins based on:
1. **Relevance**: Matches task domain/requirements
2. **Quality**: Well-documented, clear approach
3. **Simplicity**: Not overly complex for the task
4. **Recency**: Updated plugins preferred
5. **Popularity**: Featured or well-maintained plugins
### Adaptation Strategy
When adapting skills:
- **Keep**: Core logic and proven patterns
- **Adapt**: Syntax, tool names, specific commands
- **Enhance**: Add error handling, user feedback
- **Simplify**: Remove unnecessary complexity
- **Contextualize**: Adjust to user's environment
## Limitations and Boundaries
### What Skill Adapter CAN Do:
✅ Read and analyze plugin source code
✅ Extract patterns and approaches
✅ Adapt methodologies to new contexts
✅ Combine multiple plugin capabilities
✅ Apply learned skills with reasoning
### What Skill Adapter CANNOT Do:
❌ Execute compiled code (MCP servers)
❌ Access external APIs without credentials
❌ Modify original plugins
❌ Guarantee exact plugin behavior replication
❌ Use plugins that require specific environment setup
## Success Criteria
Skill adaptation is successful when:
1. User's task is completed effectively
2. Approach borrowed makes logical sense
3. Adapted skill is properly contextualized
4. User understands where the approach came from
5. Result quality matches or exceeds original plugin
## Transparency
Always inform user:
- Which plugins were analyzed
- What patterns were extracted
- How the skill was adapted
- Why this approach was chosen
- Any limitations of the adaptation
## Example Usage
```
User: "I need to validate JSON schemas in my project"
Skill Adapter Process:
1. Searches plugins for JSON validation
2. Finds: schema-validator, json-lint-enforcer
3. Extracts: ajv library usage, error formatting patterns
4. Adapts: Uses available tools (jq, node, python)
5. Applies: Validates user's schemas with detailed errors
6. Reports: "I adapted the schema-validator approach using jq
for validation and added custom error formatting"
```
## Meta-Learning
Skill Adapter improves by:
- Tracking which plugins solve which tasks best
- Learning which patterns are most reusable
- Noting which adaptations work well
- Building a mental model of the marketplace
- Understanding plugin ecosystem relationships
---
**In essence:** Skill Adapter is a meta-skill that makes the entire plugin marketplace available as a learning resource, extracting and applying capabilities on-demand to solve user tasks efficiently.

View File

@@ -0,0 +1,7 @@
# Assets
Bundled resources for pi-pathfinder skill
- [ ] example_plugin_analysis.json: Example JSON output from the plugin_analyzer.py script, showcasing the structure and content of the plugin analysis.
- [ ] skill_adaptation_template.py: Template for adapting skills from one plugin to another, including placeholders for input parameters, output variables, and adaptation logic.
- [ ] plugin_selection_rules.yaml: YAML file containing rules for selecting the best plugin for a given task, based on keywords, capabilities, and user preferences.

View File

@@ -0,0 +1,82 @@
{
"_comment": "Example JSON output for plugin analysis by PI Pathfinder",
"query": "Summarize the key findings from the latest IPCC report on climate change and suggest potential mitigation strategies.",
"selected_plugin": {
"name": "Research Assistant",
"description": "A powerful research tool for accessing and summarizing information from various online sources.",
"capabilities": [
"Web scraping",
"Document summarization",
"Academic paper retrieval",
"Fact checking",
"Trend analysis"
],
"reasoning": "This plugin is best suited for the task because it can access the IPCC report online, summarize its findings, and identify relevant mitigation strategies from reputable sources.",
"confidence_score": 0.95
},
"extracted_skills": [
{
"skill_name": "Document Summarization",
"skill_description": "Condenses large documents into concise summaries highlighting key information.",
"parameters": {
"document_url": "URL of the IPCC report",
"summary_length": "medium",
"focus_areas": ["key findings", "mitigation strategies"]
},
"implementation_details": "Utilizes advanced NLP techniques to identify and extract the most important information, including sentence scoring and topic modeling.",
"success_probability": 0.9
},
{
"skill_name": "Web Scraping",
"skill_description": "Extracts data from web pages, including text, tables, and images.",
"parameters": {
"url": "URL of the IPCC report website",
"elements_to_extract": ["text", "tables"]
},
"implementation_details": "Uses a robust web scraping library to handle various website structures and anti-scraping measures.",
"success_probability": 0.98
}
],
"execution_plan": [
{
"step": 1,
"action": "Use Web Scraping to extract the text content from the IPCC report webpage.",
"plugin_skill": "Web Scraping",
"expected_outcome": "Successful extraction of the IPCC report text."
},
{
"step": 2,
"action": "Use Document Summarization to generate a summary of the extracted text, focusing on key findings and mitigation strategies.",
"plugin_skill": "Document Summarization",
"expected_outcome": "A concise summary of the IPCC report's key findings and mitigation strategies."
},
{
"step": 3,
"action": "Return the generated summary to the user.",
"plugin_skill": null,
"expected_outcome": "User receives a helpful summary of the IPCC report."
}
],
"alternative_plugins": [
{
"name": "Web Search",
"description": "Performs web searches and retrieves relevant snippets.",
"suitability_score": 0.7,
"reason": "Useful for finding general information, but less effective for in-depth document analysis."
},
{
"name": "Document Reader",
"description": "Reads and analyzes local documents.",
"suitability_score": 0.3,
"reason": "Not applicable as the IPCC report is likely online."
}
],
"overall_assessment": {
"success_likelihood": 0.9,
"potential_issues": [
"Website may have anti-scraping measures.",
"Summarization may miss subtle nuances in the report."
],
"recommendations": "Review the generated summary for accuracy and consult the original report for a complete understanding."
}
}

View File

@@ -0,0 +1,90 @@
# plugin_selection_rules.yaml
# Configuration file for PI Pathfinder plugin selection logic.
# Global settings for plugin selection behavior.
global:
# Default preference for prioritizing plugins: "speed", "accuracy", "cost"
default_priority: "accuracy"
# Maximum number of plugins to consider for a given task.
max_plugins_considered: 10
# Minimum relevance score for a plugin to be considered. (0.0 - 1.0)
minimum_relevance_score: 0.2
# Enable/Disable verbose logging for debugging.
verbose_logging: false
# Rules for selecting plugins based on keywords and task descriptions.
keyword_rules:
# Define keywords and their associated plugin preferences.
# The higher the weight, the more preferred the plugin is for that keyword.
- keywords: ["image", "generate", "picture", "visual"]
plugin_preferences:
"DALL-E": 0.9 # Example: Prefer DALL-E for image generation
"Stable Diffusion": 0.8
"REPLACE_ME_IMAGE_PLUGIN": 0.5
- keywords: ["translate", "language", "multilingual"]
plugin_preferences:
"Google Translate": 0.95
"DeepL Translator": 0.9
"REPLACE_ME_TRANSLATION_PLUGIN": 0.6
- keywords: ["code", "programming", "algorithm", "debug"]
plugin_preferences:
"Code Interpreter": 0.9
"GitHub Copilot": 0.85
"REPLACE_ME_CODE_PLUGIN": 0.7
- keywords: ["data analysis", "statistics", "spreadsheet"]
plugin_preferences:
"Wolfram Alpha": 0.9
"Excel Online": 0.8
"REPLACE_ME_DATA_PLUGIN": 0.6
# Rules for selecting plugins based on their stated capabilities.
capability_rules:
# Define capability patterns and their associated plugin preferences.
# These rules are based on the plugin's description and advertised skills.
- capability_pattern: "Generates realistic images from text prompts."
plugin_preferences:
"DALL-E": 1.0
"Stable Diffusion": 0.9
- capability_pattern: "Translates text between multiple languages."
plugin_preferences:
"Google Translate": 1.0
"DeepL Translator": 0.95
- capability_pattern: "Executes code and analyzes data."
plugin_preferences:
"Code Interpreter": 1.0
"Wolfram Alpha": 0.8
# Rules for handling user preferences.
user_preferences:
# Default user preferences (can be overridden by user-specific settings).
defaults:
priority: "accuracy" # Default priority: "speed", "accuracy", "cost"
preferred_plugins: [] # List of plugins the user prefers (e.g., ["DALL-E", "Google Translate"])
excluded_plugins: [] # List of plugins the user wants to avoid (e.g., ["Expensive Plugin"])
# Example: User-specific preferences (loaded from a user profile, for example).
user_id_123:
priority: "speed"
preferred_plugins: ["Google Translate"]
excluded_plugins: ["REPLACE_ME_EXPENSIVE_PLUGIN"]
# Fallback plugin to use if no other plugin matches the criteria.
fallback_plugin: "Web Search"
# Advanced configuration (for expert users only).
advanced:
# Weighting factors for combining different rule types.
keyword_weight: 0.6
capability_weight: 0.4
user_preference_weight: 0.2
# Threshold for considering a plugin "suitable" after applying all rules.
suitability_threshold: 0.7
# Plugin specific configurations (example).
plugin_configurations:
"DALL-E":
api_key: "REPLACE_ME_DALL_E_API_KEY"
image_size: "1024x1024"
"Google Translate":
target_language: "en" # Default target language

View File

@@ -0,0 +1,141 @@
#!/usr/bin/env python3
"""
Template for adapting skills from one plugin to another.
This module provides a template for adapting skills from a source plugin
to a target plugin. It includes placeholders for input parameters,
output variables, and adaptation logic.
"""
import logging
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def adapt_skill(source_plugin_skills, target_plugin_requirements, user_query):
"""
Adapt skills from the source plugin to meet the target plugin's requirements.
Args:
source_plugin_skills (dict): A dictionary representing the skills
provided by the source plugin.
target_plugin_requirements (dict): A dictionary representing the
requirements of the target plugin.
user_query (str): The original user query.
Returns:
dict: A dictionary containing the adapted input parameters for the
target plugin. Returns None if adaptation is not possible.
Raises:
TypeError: If input types are incorrect.
ValueError: If input values are invalid.
Exception: For any other unexpected error during adaptation.
"""
try:
if not isinstance(source_plugin_skills, dict):
raise TypeError("source_plugin_skills must be a dictionary.")
if not isinstance(target_plugin_requirements, dict):
raise TypeError("target_plugin_requirements must be a dictionary.")
if not isinstance(user_query, str):
raise TypeError("user_query must be a string.")
# Example adaptation logic (replace with your actual adaptation)
adapted_input = {}
# Check if the target plugin requires a 'text' input and adapt from user query
if "text" in target_plugin_requirements:
adapted_input["text"] = user_query
# Check if the source plugin can provide a 'summary' and the target plugin requires it
if "summary" in target_plugin_requirements and "summarize" in source_plugin_skills:
# Assuming source_plugin_skills["summarize"] is a function that returns a summary
# This is a placeholder, replace with actual logic using the source plugin's skills
try:
# Placeholder: Replace with actual call to source plugin's skill
# summary = source_plugin_skills["summarize"](user_query)
summary = "This is a placeholder summary." # Simulate a summary
adapted_input["summary"] = summary
except Exception as e:
logging.error(f"Error summarizing using source plugin: {e}")
return None # Adaptation failed
# Check if adaptation logic was successful
if not adapted_input:
logging.warning("No adaptation logic applied. Adaptation may not be effective.")
return adapted_input
except TypeError as e:
logging.error(f"Type error during skill adaptation: {e}")
raise
except ValueError as e:
logging.error(f"Value error during skill adaptation: {e}")
raise
except Exception as e:
logging.exception("Unexpected error during skill adaptation.")
raise
def post_process_output(target_plugin_output):
"""
Post-processes the output from the target plugin.
Args:
target_plugin_output (any): The raw output from the target plugin.
Returns:
str: A human-readable string representing the processed output.
Raises:
TypeError: If input type is incorrect.
Exception: For any other error during post-processing.
"""
try:
if target_plugin_output is None:
return "No output from target plugin."
# Simple example: Convert to string
processed_output = str(target_plugin_output)
return processed_output
except TypeError as e:
logging.error(f"Type error during output post-processing: {e}")
raise
except Exception as e:
logging.exception("Unexpected error during output post-processing.")
raise
if __name__ == "__main__":
# Example Usage
source_plugin_skills = {
"summarize": lambda x: f"Summary of: {x}" # Placeholder summarize function
}
target_plugin_requirements = {
"text": "string",
"summary": "string"
}
user_query = "This is a long document that needs to be summarized."
try:
adapted_input = adapt_skill(source_plugin_skills, target_plugin_requirements, user_query)
if adapted_input:
print("Adapted Input:", adapted_input)
# Simulate target plugin output
target_plugin_output = f"Target plugin processed: {adapted_input}"
processed_output = post_process_output(target_plugin_output)
print("Processed Output:", processed_output)
else:
print("Skill adaptation failed.")
except Exception as e:
print(f"An error occurred: {e}")

View File

@@ -0,0 +1,7 @@
# References
Bundled resources for pi-pathfinder skill
- [ ] plugin_analysis_schema.md: Defines the schema for the plugin analysis output, including fields for name, description, capabilities, and examples.
- [ ] skill_adaptation_strategies.md: Details various strategies for adapting skills from one plugin to another, such as parameter mapping, input transformation, and output aggregation.
- [ ] plugin_selection_criteria.md: Outlines the criteria used to select the best plugin for a given task, including relevance, reliability, and performance.

View File

@@ -0,0 +1,7 @@
# Scripts
Bundled resources for pi-pathfinder skill
- [ ] plugin_analyzer.py: Analyzes a given plugin directory, extracts skill descriptions, and returns a structured summary.
- [ ] skill_adapter.py: Adapts the extracted skills from other plugins to the current task based on the user's request.
- [ ] plugin_search.py: Searches the installed plugins for relevant keywords and returns a list of potential plugins to use.