EH7R— Yazeed Al-Harthi
All work
Project overviewPython · CLI · Local AIWork in Progress

Local AI Agent

A local AI agent for the terminal. It runs on Ollama, executes commands inside a sandbox, and asks for approval before any risky action. Everything runs locally, so no API key is needed and no data leaves the machine.

Local-firstSafety enforced by codeLinux · bubblewrap

01Interface

The full-screen TUI running on Arch. Esc interrupts a running task, and the session stays open after each reply.

02How it works

From user task to final result

  1. 01 / INPUT

    User task

    The folder the agent is launched from becomes its working directory

    main.py · openagent

  2. 02 / LOOP

    Agent core

    Orchestrates steps and enforces a step limit

    core.py

  3. 03 / MODEL

    Model response

    The model either answers or requests a tool call

    model.py · Ollama

  4. 04 / TOOLS

    Tool registry

    The call is validated against the registry before it runs

    tools.py · Pydantic

  5. 05 / GUARD

    Permission layer

    Safe: run · Dangerous: block · Anything else: show the exact action and ask

    permissions.py · approval.py

  6. 06 / SANDBOX

    Isolated execution

    bubblewrap, with the network closed and the home directory hidden

    sandbox.py · shell.py

  7. 07 / EXECUTE

    Local tools

    Shell commands, file reads and writes, and Git

    file_tools.py · git_tools.py

  8. 08 / OBSERVE

    Evaluate outcomes

    Classifies the outcome and applies the retry rules

    evaluate.py

The result returns to the model to continue the task, within a step limit. The same tool with the same arguments runs at most twice, a refusal from the user is not treated as a technical error, and dangerous actions are never retried automatically.

03System architecture

System architecture.

The diagram shows the target architecture. Everything in it is built except Skills, Connectors and the Planner, which are still planned.

04Details

Safety controls

Permission layer

Every tool call is classified before it runs. Known-safe commands run directly, dangerous ones are blocked, and everything else shows the exact action and waits for a yes or no.

bubblewrap sandbox

The network is closed by default, the home directory is hidden, /usr and .git are read-only, .env is hidden, and the environment is cleared. If bubblewrap is missing the agent refuses to run commands rather than falling back silently.

Scoped file access

File tools are confined to the working directory and block sensitive files. Git tools stay outside the sandbox and do not support push, reset, or shell access; commits require approval.

Notes as untrusted data

Saving a note always shows the exact text and asks for approval. The model never touches the database directly, saved notes are given to it as untrusted data rather than instructions, and secrets are rejected by pattern and length checks.

Stack

Python 3.14Ollamagemma4:e2bgemma4:e4bgpt-oss:20bTextualPydanticbubblewrapSQLiteRichpsutilpytest

Implemented

Agent loopTool registryPermission layerObserve and retry rulesTerminal / file / Git toolsbubblewrap sandboxNotes memoryContext managementFirst-run wizardStreaming repliesFull-screen TUI with approval dialogArabic RTL displaySaved sessionsHandoffPackaging with pipx

Planned

/memory and /setup commandsSkillsGitHub and browser connectorsTesting across all three model tiersA first official release

Status

Work in Progress

By

eh7r

Platform

Linux (bubblewrap)

Tests

468 pytest tests

Install

pipx · openagent

License

PolyForm Noncommercial 1.0.0

05Known limitations

Stated by the author, not smoothed over.

  • Arabic display has only been tested in kitty.
  • A cancelled request keeps running in Ollama until it finishes.
  • A small gap appears after "لا" inside some Arabic words, probably caused by the font.