Project Digit: Phase 1 Documentation

Core Engine & CLI Prototyping. Establishing the foundational inference bridge between local hardware and the Qwen2.5-Coder:1.5b LLM via the command line.


Section 1: Tasklist

Task Description Status
Install Backend Install Ollama to manage local model inference. Pending
Pull Model Download the qwen2.5-coder:1.5b model via Ollama. Pending
Install Dependencies Install required Python libraries (rich, ollama) for the CLI tool. Pending
Write CLI Script Develop the Python wrapper to pass arguments to the model and stream the response. Pending
Execution Testing Make the script executable and test standard terminal I/O. Pending

Section 2: System Preparation

Setting up the local environment and inference engine.

  1. Install the Ollama backend by following instructions at ollama.com.
  2. Open your terminal and pull the designated model:
user@elastic:~$ ollama pull qwen2.5-coder:1.5b
  1. Install the necessary Python packages for the frontend UI:
user@elastic:~$ pip install rich ollama

Section 3: CLI Implementation

The core Python script that acts as the bridge between your terminal and the local model.

  1. Create a new file named digit in a directory included in your system's PATH (e.g., ~/.local/bin/).
  2. Add the following code to the file. Ensure you use the exact formatting provided.
#!/usr/bin/env python3

import sys
import argparse
from rich.console import Console
from rich.markdown import Markdown
from rich.live import Live
import ollama

def main():
    parser = argparse.ArgumentParser(prog="digit")
    parser.add_argument("prompt", nargs="+")
    args = parser.parse_args()
    
    prompt_text = " ".join(args.prompt)
    
    system_prompt = "You are Digit, a minimalist code librarian and coding assistant. Only explain code, provide examples, or reference documentation. Keep answers concise, highly technical, and accurate. Format output in Markdown."
    
    console = Console()
    
    try:
        response = ollama.chat(
            model="qwen2.5-coder:1.5b",
            messages=[
                {"role": "system", "content": system_prompt},
                {"role": "user", "content": prompt_text}
            ],
            stream=True
        )
        
        full_response = ""
        with Live(console=console, refresh_per_second=10) as live:
            for chunk in response:
                full_response += chunk['message']['content']
                live.update(Markdown(full_response))
                
    except Exception as e:
        console.print(f"Error: {e}")

if __name__ == "__main__":
    main()
              

Section 4: Execution & Testing

Finalizing the installation and testing the CLI.

  1. Make the script executable:
user@elastic:~$ chmod +x ~/.local/bin/digit
  1. Test the script with a standard query to verify the streaming output:
user@elastic:~$ digit explain time.h and when i should use it



© 2026 Elastic Softworks.
Optimized for 800x600 resolution.