Intelligently selects and bundles documentation for optimal AI assistant context
Project description
🎯 Smart Context Selector
Intelligently selects and bundles documentation for optimal AI assistant context. Originally built for n8n workflows, but extensible to any documentation set.
🌟 Features
- Intelligent Analysis: Analyzes your prompts to detect required services and concepts
- Smart Selection: Uses relevance scoring to select the most important documentation
- Context Optimization: Stays within AI context limits (85-95% usage)
- Multiple Configs: Built-in configurations for different platforms
- CLI & Python API: Use from command line or import as a library
🚀 Quick Start
Installation
pip install smart-context-selector
Command Line Usage
# Basic usage with built-in n8n config
smart-context --prompt "build a slack bot with AI" --config n8n
# Custom bundle name
smart-context --prompt "create API integration" --name my_integration
# List available configurations
smart-context --list-configs
# Use custom configuration file
smart-context --prompt "build react app" --config-file my_docs.json
Python API Usage
from smart_context_selector import SmartContextSelector
# Initialize with built-in config
selector = SmartContextSelector(config_name="n8n")
# Or with custom config
selector = SmartContextSelector(config_file="my_config.json")
# Create context bundle
bundle_path = selector.create_context_bundle(
prompt="Create an AI chatbot that monitors Slack",
bundle_name="slack_ai_bot"
)
print(f"Bundle created at: {bundle_path}")
📁 Configuration
Built-in Configurations
- n8n: Complete n8n workflow automation documentation
- More configurations coming soon!
Custom Configuration Format
Create a JSON file with this structure:
{
"name": "my_platform",
"description": "My Platform Documentation",
"docs_dir": "path/to/docs",
"knowledge_base": {
"keyword": ["folder1", "folder2"],
"api": ["integrations", "reference"],
"database": ["data", "storage"]
},
"file_patterns": {
"core_always": ["getting-started", "basics"],
"api_specific": ["auth", "endpoints"],
"advanced": ["deployment", "scaling"]
}
}
🎯 How It Works
- Prompt Analysis: Analyzes your prompt to identify key concepts and services
- Relevance Scoring: Scores documentation files based on detected concepts
- Smart Selection: Selects the most relevant files within context limits
- Bundle Creation: Creates an optimized documentation bundle
- Ready for AI: Upload the bundle to your AI assistant for optimal context
📊 Example Output
🔍 Analyzing prompt: Create an AI chatbot that monitors Slack...
📊 Analysis Results:
🎯 Workflow Type: ai_focused
🔧 Detected Services: ai, slack, chatbot, webhook
📁 Required Folders: ai_langchain, nodes_integrations, workflows
📈 Complexity Score: 4
📋 Selected 85 files for optimal AI context
✅ Created bundle: slack_ai_bot
📁 Location: smart_context_bundles/slack_ai_bot
📄 Files: 85
🛠️ CLI Options
smart-context [OPTIONS]
Options:
--prompt, -p TEXT Prompt describing what you want to build [required]
--config, -c TEXT Built-in configuration to use (default: n8n)
--config-file TEXT Path to custom configuration JSON file
--name, -n TEXT Custom bundle name
--docs-dir TEXT Override documentation directory from config
--max-files INTEGER Maximum number of files to include (default: 120)
--push Push bundle to GitHub after creation
--list-configs List available built-in configurations
--version Show version
--help Show this message and exit
🧪 Development
Setup Development Environment
git clone https://github.com/yourusername/smart-context-selector.git
cd smart-context-selector
pip install -e .
Running Tests
python -m pytest tests/
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
📝 License
MIT License - see LICENSE file for details.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📞 Support
- Issues: GitHub Issues
- Documentation: Full Documentation
🙏 Acknowledgments
Originally developed for n8n workflow automation documentation bundling.
Made with ❤️ for the AI development community
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smart_context_selector-1.0.0.tar.gz.
File metadata
- Download URL: smart_context_selector-1.0.0.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fbbf0cbf6e7a8e3cca752920a0c4e6673e0cc9dcd2815ff02ad8e06540c3367
|
|
| MD5 |
f7842361d4f0df032e6949656ac2e177
|
|
| BLAKE2b-256 |
27e4023d937b03fc1d0b84fd722a538d7aa63d612c00c8d08981d3f0c823f33a
|
File details
Details for the file smart_context_selector-1.0.0-py3-none-any.whl.
File metadata
- Download URL: smart_context_selector-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c59eae08784ca034af04585d5b5a20af8699d48f2cc485760d1567e1b21310ee
|
|
| MD5 |
66fc34acd49312fe682999136c4b66aa
|
|
| BLAKE2b-256 |
efbbb0203bf7948d03e6262937c2e50191079b5960b809c3eba5556b0a1fb1ad
|