Drift CLI - Terminal-Native AI Assistant for Safe Command Execution

Published: (February 15, 2026 at 05:54 PM EST)
5 min read
Source: Dev.to

Source: Dev.to

This is a submission for the GitHub Copilot CLI Challenge

What I Built

Drift CLI is a terminal‑native, safety‑first AI assistant that integrates directly into your shell. Powered by local LLMs via Ollama — it requires no cloud dependency and maintains full privacy.

Drift transforms how developers interact with their terminal by translating natural‑language queries into safe, executable shell commands. Press Ctrl+Space to convert English into commands like:

drift find all python files modified today
drift explain tar -czf archive.tar.gz src/
drift /commit    # Generate commit messages from staged changes
drift /test      # Auto‑detect and run project tests

Key Features

  • Natural Language to Shell – Press Ctrl+Space to get executable commands with rich previews.
  • Safety First – Automatic blocklists, risk scoring (🟢 LOW, 🟡 MEDIUM, 🔴 HIGH), dry‑run defaults, and confirmation prompts.
  • Local‑First Privacy – Runs entirely on your machine via Ollama (no API keys, no cloud tracking).
  • Smart Workflows – Plan → Preview → Confirm → Execute → Explain → Undo keeps every run recoverable.
  • 18+ Slash Commands/git, /commit, /test, /build, /find, /clean, /lint and more with contextual awareness.
  • Memory System – Tracks your preferred tools, risk tolerance, and workflows with export/import utilities.
  • System Maintenancedrift doctor, drift config, drift setup, drift update keep your environment healthy.

Demo

demo q1

demo q2

demo q2 followup

Installation & First Run (Zero Setup)

git clone https://github.com/a-elhaag/drift-cli.git
cd drift-cli
pip install -e .

# Auto‑installs Ollama, starts server, and pulls the model on first use
drift what is the time now

Safe Command Execution with Preview

$ drift reorganize my project to use src layout

╭─ Plan ────────────────────────────────────────────────╮
  Summary: Reorganize project to src/ layout
  Risk: 🟡 MEDIUM

  $ mkdir -p src
  $ mv *.py src/
  $ mv tests/ src/
 Restructure project files
╰────────────────────────────────────────────────────────╯
Execute? [y/N]: y
 Command executed successfully

Slash Command Integration (ZSH)

/commit    # Generates commit message from staged changes
/test      # Auto‑detects test framework and runs tests
/build     # Detects build system and creates build commands
/git       # Analyzes repo status and suggests next actions

History & Undo Safety

drift history              # Browse all past queries
drift undo                 # Restore files from last snapshot
drift cleanup --keep 5     # Free space while keeping backups

Memory & Learning

drift memory show                 # Your learned preferences
drift memory stats                # Usage totals and risk distribution
drift memory export backup.json   # Portable preferences
drift memory insights             # Reveal context sent to LLM

My Experience with GitHub Copilot CLI

GitHub Copilot CLI was instrumental in accelerating the development of Drift CLI. Here’s how it transformed my workflow:

1. Rapid Implementation of Complex Features

When building the safety engine, I used Copilot CLI to:

  • Generate the risk‑scoring algorithm based on command patterns.
  • Create Pydantic validation models for JSON responses from Ollama.
  • Build the snapshot/undo system for file recovery.

Command used: github copilot explain – to understand shell command syntax before wrapping them in Python.
Result: More secure subprocess calls and robust edge‑case handling.

2. Testing & Debugging Efficiency

  • Generated comprehensive pytest test suites for command execution.
  • Asked for help writing integration tests for the Ollama client.
  • Quickly stubbed out test fixtures for different command scenarios.

Result: Full test coverage completed 3× faster than manual writing.

3. Documentation Generation

  • Generated inline code documentation and docstrings using Copilot.
  • Created comprehensive README sections and API docs.

Overall, Copilot CLI turned a months‑long development effort into a matter of weeks, letting me focus on product quality rather than boilerplate.

- Drafted slash command catalogs with descriptions

4. Architecture & Design Decisions

When designing the modular system:

drift_cli/
├── core/        (executor, safety, history, ollama client)
├── ui/          (display, progress)
├── commands/    (history_cmd, memory_cmd, etc.)

Enter fullscreen mode

Exit fullscreen mode

I used Copilot CLI to explore design patterns and asked, “What’s the best way to structure this?” — receiving instant guidance on:

  • How to properly handle subprocess execution with safety
  • Caching strategies for LLM responses
  • Async patterns for long‑running commands

5. Error Handling & Edge Cases

Used Copilot CLI to:

  • Handle malformed Ollama responses gracefully
  • Implement timeout logic for stuck processes
  • Create meaningful error messages for users

6. CI/CD & Deployment

Asked Copilot CLI for:

  • GitHub Actions workflow for automated testing
  • Installation script best practices
  • Version‑management strategies

Key Impact

Before Copilot CLI: Manual context switching between documentation, Stack Overflow, and trial‑and‑error.

After Copilot CLI: Stay in the terminal, ask questions, get answers instantly, and implement features without context loss.

The AI assistance helped me focus on what to build (the safety‑first architecture, the memory system, the slash commands) rather than how to write boilerplate code. This improved code quality and reduced development time by approximately 40 %.

Drift CLI itself is a testament to what’s possible when AI meets the terminal — and building it with GitHub Copilot CLI showed me how powerful terminal‑based AI assistance truly is.


Tech Stack

  • Language: Python 3.9+
  • CLI Framework: Typer
  • LLM: Ollama (local, privacy‑first)
  • Validation: Pydantic
  • UI: Rich (beautiful terminal rendering)
  • Shell Integration: ZSH hotkey binding
  • Testing: Pytest
  • Package Dependencies: httpx, setuptools

Try Drift CLI:

0 views
Back to Blog

Related posts

Read more »