Skip to content
10KRITESHPublic

About

A terminal emulator with an AI layer — understands your commands, classifies them before they run, and actually talks back.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

53 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Krit Logo

Krit

The AI-Native Terminal Emulator for Modern Workflows


Krit is a high-performance terminal emulator designed to bridge the gap between the shell and Large Language Models. Built for engineers who live in the CLI, Krit understands your environment, remembers your session context, and helps you execute complex commands safely—all within a unified, hardware-accelerated interface.

🚀 Key Features

🧠 Context-Aware Intelligence

Krit maintains a background buffer of your terminal scrollback. The integrated AI understands your current directory, hardware specifications, and previous command outputs to provide highly relevant assistance.

⌨️ Natural Language Shell

Convert intent into action instantly. Prefix any query with - (e.g., - find all docker volumes over 1GB) to receive optimized shell commands tailored to your OS and environment.

🛡️ Advanced Safety Layer

Execute AI-generated commands with confidence. Krit features a real-time classification engine that detects destructive operations (like rm -rf, dd, or sensitive config edits) and requires explicit user confirmation before execution.

🎨 Modern Aesthetic

Inspired by high-performance CLI tools like fastfetch, Krit features a borderless, minimalist UI with a WebGL-powered rendering engine for zero-latency input and smooth text display.

🔌 Multi-Provider Support

Choose the brain that powers your terminal. Krit supports:

  • Cloud: Groq (Llama 3), OpenAI (GPT-4o/o1)
  • Local: Ollama (for 100% private, offline inference)

🏗️ Architecture

Krit is built on a split-process architecture designed for performance, security, and low-latency interaction.

graph TD
    subgraph "Main Process (Node.js)"
        IPC[IPC Main Handlers]
        PM[PTY Manager] --> |node-pty| OS[(Native OS Shell)]
        AC[AI Controller] --> |REST / Local| LLM(Groq / OpenAI / Ollama)
        SL[Safety Engine] --> |Pattern Matching| Threat[Destructive Command Detector]
        SC[Settings Logic] --> |node:fs| FS[(~/.krit/config.json)]
        MD[Markdown Engine] --> |marked-terminal| ANSI[ANSI Formatter]
        
        IPC <--> |Terminal I/O| PM
        IPC <--> |AI Queries / Context| AC
        IPC <--> |Intercepts Commands| SL
        IPC <--> |Reads / Writes| SC
        IPC <--> |Converts to ANSI| MD
    end

    subgraph "Renderer Process (Web UI)"
        Bridge[contextBridge / Preload]
        XT[Xterm.js Engine] --> |WebGL| Canvas[Terminal UI]
        UIAI[UI & Chat Handlers]
        State[State Manager]
        
        UIAI <--> Bridge
        State <--> Bridge
        UIAI <--> XT
        UIAI <--> State
    end

    Bridge <--> |Inter-Process Communication| IPC
Loading

Core Components

  • Terminal Engine: Powered by xterm.js with WebGL acceleration. It interfaces with node-pty in the main process to handle real-world terminal behaviors and signal passing.
  • AI Orchestrator: A modular controller that supports multiple LLM providers. It automatically injects terminal context (CWD, hardware info, scrollback history) into every request.
  • Security Classification: A real-time engine that parses AI-generated commands. If a command matches destructive patterns (e.g., rm -rf, dd, mkfs), it is intercepted and requires explicit user consent before being piped to the shell.
  • Platform Bridge: Custom IPC implementation ensures that heavy AI processing or terminal I/O doesn't block the UI thread, maintaining a solid 60fps even during high output bursts.

📂 Project Structure

src/
├── ai/                # AI Engine logic
│   ├── providers/     # Groq, OpenAI, Ollama adapters
│   ├── controller.js  # Main AI orchestration logic
│   ├── safety.js      # Command classification & security
│   └── context.js     # Scrollback & session management
├── main/              # Electron Main Process
│   ├── index.js       # App entry point & IPC handlers
│   ├── pty.js         # Pseudo-terminal lifecycle management
│   └── wizard.js      # First-run setup & configuration
├── renderer/          # Electron Renderer Process (Frontend)
│   ├── index.html     # Main UI structure
│   ├── renderer.js    # Entry point for the frontend
│   ├── ui.js          # DOM manipulation & screen rendering
│   └── ai.js          # Frontend AI interaction logic
└── config/            # System & user configuration

📦 Installation

Linux (AppImage)

The recommended way to run Krit is via the standalone AppImage.

  1. Download krit-latest.AppImage from the latest release.
  2. Make it executable:
    chmod +x krit-latest.AppImage
  3. Launch:
    ./krit-latest.AppImage

🛡️ New in Version 1.0.4

  • Universal Directory Sync: Now features OSC 7 shell integration to reliably track your working directory across all platforms.
  • Smart Session Recovery: If your shell crashes or terminates, Krit now offers an instant "Press Enter to Restart" recovery.
  • Enhanced AI Input: Fully interactive AI prompt buffer with support for arrow keys, middle-of-line editing, and persistent font scaling.
  • Privacy Hardening: Proactive environment scrubbing to ensure your API keys never leak into the shell's sub-processes.
  • Shortcut Support: Use Ctrl+K to clear scrollback and Ctrl +/- to scale the UI (saved across restarts).

🛠️ Development

To build Krit from source or contribute:

  1. Clone & Install:
    git clone https://github.com/10KRITESH/krit.git
    cd krit
    npm install
  2. Launch Developer Mode:
    npm start
  3. Build Distribution Packages:
    npm run dist

🛡️ Security & Privacy

Krit is built with a security-first philosophy. Standard terminal input is processed locally and never leaves your machine. AI queries are only triggered by explicit user prefixes.


Built for the next generation of command-line power users.

About

A terminal emulator with an AI layer — understands your commands, classifies them before they run, and actually talks back.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages