Skip to main content

An interactive AI coding agent.

Project description

Rune – Terminal-first AI Coding Assistant

Rune is a flexible, local AI coding agent.

It brings an LLM into your own terminal, augments it with safe “power-tools” (grep, diff-edit, Python kernel, shell commands, TODO management, etc.) and renders everything with Rich for a pleasant TUI experience.


Table of contents

  1. Features
  2. Quick start
  3. Usage cheatsheet
  4. Architecture overview
  5. Core libraries
  6. Testing & linting
  7. Contributing
  8. License

Features

Capability Notes
Interactive chat CLI Multi-line editing, history & /save snapshots via prompt-toolkit.
LLM orchestration Powered by pydantic-ai with multi-tool reasoning and optional MCP back-ends.
Rich tool ecosystem Edit files with fuzzy diffs, grep the codebase, run shell or stateful Python, fetch URLs, manage TODOs and more.
Colourful TUI output Glyph bars, syntax-highlighted diffs, tables & panels – all via Rich.
Persistent sessions Last five conversations saved under .rune/sessions/… for instant resumption.
First-class TODO list Tasks tracked in-memory per session; rendered as pulsing-dot list.
Path sandboxing All filesystem tools refuse to operate outside the current working directory.
Extensible Drop a new function under src/rune/tools/, decorate with @register_tool, and it is auto-wired into the agent.

Quick start

# 1. Clone & install
git clone https://github.com/caesarnine/rune.git
cd rune
uv sync --all-extras
uv venv

# 2. Run the CLI
rune                          # starts the chat loop

Environment variables

export RUNE_MODEL="openai:gpt-4o"      # optional – override default model

Usage cheatsheet

Action How
Start a new chat rune (choose “Start new session”)
Resume a previous session rune and pick from the list
Save a snapshot Type /save or /save custom_name.json
Exit /exit or Ctrl-D
Change directory for shell commands run_command("cd path/to/dir")
List tasks list_todos() (the agent often calls this automatically)
Run tests Tell Rune: “run the tests” – it will call pytest for you

Architecture overview

flowchart TD
    subgraph CLI
        A["chat.py\nprompt-toolkit"]
    end
    subgraph Agent
        B["pydantic_ai.Agent"] --> C["rich_tool wrapper"]
    end
    subgraph Tools
        D["edit_file\nrun_python\ngrep\n…"]
    end
    subgraph UI
        E["render.py\nRich console"]
    end
    subgraph Persistence
        F[".rune/sessions/*.json"]
    end

    A -->|prompt| B
    B -->|XML tool call| C
    C -->|exec| D
    D -->|ToolResult| C
    C -->|renderable| E
    B -->|assistant text| E
    A <--> F

Execution sequence

sequenceDiagram
    participant U as User
    participant P as CLI Prompt
    participant G as Agent
    participant W as Tool Wrapper
    participant T as Tool
    participant R as Rich UI

    U->>P: type message
    P->>G: agent.iter(...)
    loop stream
        G-->>W: <tool call>
        W->>R: display_tool_call()
        W->>T: execute
        T-->>W: ToolResult
        W->>R: display_tool_result()
        W-->>G: <tool_result>
    end
    G-->>P: assistant reply
    P->>R: render text

Core libraries

Domain Library
LLM orchestration pydantic-ai
Terminal UI Rich
CLI framework Typer + prompt-toolkit
Diff/patch engine Custom DiffApplyer + difflib
HTTP fetch & markdown httpx, html-to-markdown
Interactive Python jupyter_client, ipykernel
Git-style ignores pathspec
Quality tooling pytest, ruff, mypy

Testing & linting

# Run all unit tests (tool layer)
pytest

# Static typing (Python ≥3.10)
mypy src

# Lint & format
ruff check .
ruff format .

Tests live under tests/tools/ and cover success paths and edge-cases for every tool.


Contributing

  1. Fork and create a feature branch.
  2. Follow the style conventions enforced by ruff.
  3. Add unit tests for new tools or behaviour.
  4. Ensure pytest, ruff check, and mypy all pass.
  5. Submit a PR.

License

Rune is licensed under the Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rune_code-0.1.0.tar.gz (43.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rune_code-0.1.0-py3-none-any.whl (50.8 kB view details)

Uploaded Python 3

File details

Details for the file rune_code-0.1.0.tar.gz.

File metadata

  • Download URL: rune_code-0.1.0.tar.gz
  • Upload date:
  • Size: 43.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for rune_code-0.1.0.tar.gz
Algorithm Hash digest
SHA256 222d62a6bc35cf3e2ff2c5c3ac7441b827ae2105b6b7326af3a790956cc80726
MD5 b38d0771a09b3390e3000e8820049a1a
BLAKE2b-256 3058feadec73cfed8babdc6eb429b86d2244b29489d084f305d6584397b4ae86

See more details on using hashes here.

File details

Details for the file rune_code-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rune_code-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 50.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for rune_code-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 afff9a2cb361a2dc994bd44f71e103f8145cd28080846e89b2c627c9dabf7327
MD5 16a6866dc151990f40ffb3705dd0d7b2
BLAKE2b-256 170161637a5c685fab5dcaaa9a13453a45287956ae382622850f148faa109e68

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page