SelfLayer - AI-powered terminal web browser for content analysis and research
Project description
SelfLayer ๐๐ง
AI-Powered Terminal Web Browser for Content Analysis and Research
SelfLayer is a modern, intelligent terminal-based web browser that combines web scraping, AI-powered content analysis, and beautiful terminal formatting to provide an efficient research and content exploration experience directly from your command line.
โจ Features
๐ Smart Web Search & Analysis
- Unified Search & Analysis:
/findcommand searches and analyzes multiple results automatically - Step-by-step Analysis: Traditional
/search+/openworkflow for detailed control - DuckDuckGo Integration: Privacy-focused web search
- Configurable Depth: Analyze 1-10 search results at once
๐ง AI-Powered Content Analysis
- Google Gemini Integration: State-of-the-art AI analysis using Pydantic AI
- Structured Output: WebCards with summaries, key facts, dates, and links
- Confidence Scoring: AI provides confidence ratings for each analysis
- Streaming Support: Real-time analysis progress updates
๐จ Beautiful Terminal Interface
- Rich Formatting: Colorful, responsive terminal UI using Rich library
- ASCII Art Branding: Eye-catching SelfLayer logo
- Progress Indicators: Visual feedback for all operations
- Error Handling: Graceful error display and recovery
โก Performance & Usability
- Async Operations: Non-blocking web requests and AI processing
- Smart Caching: Search result and analysis caching
- Command Aliases: Short commands (
/f,/s,/k, etc.) for power users - Persistent Config: API keys saved locally for seamless usage
๐ Installation
From PyPI (Recommended)
pip install selflayer
From Source
git clone https://github.com/antonvice/selflayer.git
cd selflayer
pip install -e .
๐ง Setup
-
Get a Google Gemini API Key
- Visit Google AI Studio
- Create a free API key
- Copy the key for the next step
-
Configure SelfLayer
selflayer # On first run, set your API key: /key YOUR_API_KEY_HERE
Your API key will be securely saved to ~/.selflayer/api_key.txt for future sessions.
๐ Usage
SelfLayer provides two interfaces:
selflayer: Interactive Terminal User Interface (TUI) with commands like/find,/search,/keysl: Command Line Interface (CLI) for direct command execution with arguments
Launch SelfLayer
Interactive TUI (Recommended)
selflayer
Command Line Interface
# For direct command execution
sl search "your query" --max-results 3
sl analyze https://example.com
Basic Commands
๐ Find & Analyze (Recommended)
# Search and analyze top 5 results automatically
/find python machine learning tutorials
# Analyze specific number of results (1-10)
/find quantum computing 3
# Short alias
/f artificial intelligence trends 2024
๐ Traditional Search
# Search only (no analysis)
/search web scraping python
/s data science tools
# Then analyze specific results
/open 1 # Analyze first result
/o 3 # Analyze third result
๐ Direct URL Analysis
# Analyze any webpage directly
/url https://docs.python.org/3/tutorial/
/u https://github.com/trending
โ๏ธ Configuration
# Set API key
/key YOUR_NEW_API_KEY
/k YOUR_NEW_API_KEY
# Clear API key
/key clear
# Check status
/status
# Clear screen
/clear
/c
# Get help
/help
/h
# Quit
/quit
/q
Command Aliases
| Full Command | Alias | Description |
|---|---|---|
/find |
/f |
Search and analyze multiple results |
/search |
/s |
Search only (no analysis) |
/open |
/o |
Analyze search result by number |
/url |
/u |
Analyze URL directly |
/key |
/k |
Set/clear API key |
/clear |
/c |
Clear screen |
/help |
/h |
Show help |
/quit |
/q |
Exit SelfLayer |
๐ฏ Use Cases
๐ Research & Learning
- Quickly analyze multiple sources on a topic
- Get structured summaries of complex articles
- Extract key facts and dates from content
- Discover related links and resources
๐ผ Professional Analysis
- Market research and trend analysis
- Competitive intelligence gathering
- Technical documentation review
- News and industry monitoring
๐ฌ Academic Work
- Literature review and source analysis
- Fact-checking and verification
- Research paper preparation
- Educational content exploration
๐๏ธ Architecture
SelfLayer is built with modern Python practices:
- Pydantic AI: Structured AI outputs with Google Gemini
- Rich: Beautiful terminal formatting and progress indicators
- httpx: Modern async HTTP client for web requests
- BeautifulSoup: HTML parsing and content extraction
- ddgs: Privacy-focused DuckDuckGo search
Project Structure
selflayer/
โโโ __init__.py # Package initialization and exceptions
โโโ __main__.py # Entry point and logging setup
โโโ ai.py # Pydantic AI integration with Gemini
โโโ config.py # Configuration management
โโโ models.py # Pydantic data models
โโโ search.py # DuckDuckGo search functionality
โโโ tui.py # Rich-powered terminal interface
โโโ web.py # Web scraping and content extraction
๐ค Contributing
We welcome contributions! Here's how to get started:
-
Fork the Repository
git clone https://github.com/antonvice/selflayer.git cd selflayer
-
Set Up Development Environment
pip install -e ".[dev]"
-
Run Tests
pytest mypy selflayer/ ruff check selflayer/
-
Submit Pull Request
Development Tools
- Testing: pytest, pytest-asyncio, pytest-cov
- Type Checking: mypy
- Linting: ruff
- Formatting: ruff format
๐ License
MIT License - see LICENSE file for details.
๐จโ๐ป Author
Anton Vice - CTO, SelfLayer ๐ง anton@selflayer.com ๐ GitHub ๐ LinkedIn
๐ Acknowledgments
- Pydantic AI for structured AI outputs
- Rich for beautiful terminal formatting
- DuckDuckGo for privacy-focused search
- Google Gemini for powerful AI analysis
๐ Changelog
v0.1.0 (2024-09-14)
- ๐ Initial release
- โจ Unified
/findcommand for search + analysis - ๐ง Google Gemini AI integration
- ๐จ Rich terminal interface
- โก Async operations and caching
- ๐ง Command aliases and persistent config
Made with โค๏ธ for researchers, developers, and curious minds everywhere.
SelfLayer - Because the web deserves intelligent exploration.
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 selflayer-0.2.1.tar.gz.
File metadata
- Download URL: selflayer-0.2.1.tar.gz
- Upload date:
- Size: 38.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c896ee4d12343c52feed5ee1117de65f5ab7653dec7b33c0117bc082cf0c56bb
|
|
| MD5 |
f4a80191c1a33c1800d63fcd639ae7e9
|
|
| BLAKE2b-256 |
4900e72a0ef436a009a3ab4062734a2a9b18b8277ece14b2164e38b7203aef11
|
File details
Details for the file selflayer-0.2.1-py3-none-any.whl.
File metadata
- Download URL: selflayer-0.2.1-py3-none-any.whl
- Upload date:
- Size: 34.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
752e34d6df6a9b043f4b21f2cd391e2972f9bfc195122059dafc5d907d31fca4
|
|
| MD5 |
022cba7825ba40e4ab744ed46c990de7
|
|
| BLAKE2b-256 |
9930c1c8e1453f5310a6cf389683612ab423e1adc5c673bf8f03d039eeac52a8
|