A Local RAG (Retrieval-Augmented Generation) CLI for System File Analysis.
SysChat is a command-line utility that allows users to have natural language conversations about their file system. Unlike standard system tools (ls, stat, cat), SysChat combines file metadata extraction with a local LLM to provide context-aware answers about a file's purpose, history, and contents.
It features a System-Safe Architecture that prevents context overflow and safely handles binary files.
- Local RAG Implementation: Dynamically injects file metadata and content into the LLM context window.
- Dual-Mode "Brain":
- Local Mode: Runs entirely offline using Ollama (Llama 3, Mistral, DarkIdol).
- Cloud Mode: Seamlessly switches to OpenAI/Gemini APIs if an API Key is detected.
- Safety Guardrails:
- Binary Protection: Automatically detects and skips non-text files (images, binaries) to prevent encoding errors.
- Context Window Protection: Implements a "Safe Reader" that caps reads at 10KB to prevent token limit crashes.
- Universal Compatibility: Works on Windows, Linux, and macOS.
SysChat operates in three distinct layers:
- The Harvester (
analyzer.py): Usespathlibandosto extract low-level stats (permissions, timestamps, MIME types). - The Safety Valve: A middleware layer that checks file signatures and size before attempting a read operation.
- The Brain (
brain.py): A model-agnostic connector that formats the prompt into a structured conversation (System vs. User roles) and dispatches it to the active LLM.
- Python 3.8+
- Ollama (For local mode)
-
Clone the repository:
git clone [https://github.com/yourusername/syschat-cli.git](https://github.com/yourusername/syschat-cli.git) cd syschat-cli -
Create a Virtual Environment:
python -m venv .venv # Windows: .\.venv\Scripts\activate # Mac/Linux: source .venv/bin/activate
-
Install Dependencies:
pip install -r requirements.txt
-
Configure Model (Optional):
Create a
.envfile to customize the model or use a cloud key# .env LLM_MODEL=darkidol # Defaults to 'llama3' if not set # LLM_API_KEY=sk-... # Uncomment to use OpenAI instead of Local
SysChat adapts its analysis based on your target:
Analyze a specific file to understand its logic, purpose, or metadata.
python src/main.py src/brain.py
### 2. Automation Mode (AI Agent) 🤖
Give SysChat control of your mouse and keyboard to perform simple tasks.
**⚠️ Safety:** Move your mouse to any corner of the screen to instantly kill the script.
```bash
python src/main.py auto