Skip to content

mal494/syschat-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SysChat 🖥️ SysChat Demo

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.

🚀 Features

  • 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.

🛠️ Architecture

SysChat operates in three distinct layers:

  1. The Harvester (analyzer.py): Uses pathlib and os to extract low-level stats (permissions, timestamps, MIME types).
  2. The Safety Valve: A middleware layer that checks file signatures and size before attempting a read operation.
  3. 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.

📦 Installation

Prerequisites

  • Python 3.8+
  • Ollama (For local mode)

Setup

  1. Clone the repository:

    git clone [https://github.com/yourusername/syschat-cli.git](https://github.com/yourusername/syschat-cli.git)
    cd syschat-cli
  2. Create a Virtual Environment:

    python -m venv .venv
    # Windows:
    .\.venv\Scripts\activate
    # Mac/Linux:
    source .venv/bin/activate
  3. Install Dependencies:

    pip install -r requirements.txt
  4. Configure Model (Optional):

    Create a .env file 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

💻 Usage

SysChat adapts its analysis based on your target:

1. Single File Mode (Deep Dive)

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

About

A Local RAG CLI tool for file analysis.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages