MForege — AI Agent CLI
A command-line AI agent with a transparent, IDE-style interface: live tool activity, colored diffs on every file change, mission plans, and long-term memory. Supports OpenAI, Ollama (free & local), and any OpenAI-compatible API (Groq, Together, etc.).
Install
pip install mforege
Or with pipx (recommended for CLIs — isolated env, command on PATH everywhere):
pipx install mforege
Or straight from source:
pip install git+https://github.com/munjurdev/MForege.git
First run — guided setup
No config files needed. The first mforege launches a 30-second wizard:
Where should MForege get its brain?
[1] Groq free cloud API — fastest option (recommended)
[2] Ollama free, 100% local (needs https://ollama.com installed)
[3] OpenAI paid API
[4] Custom any OpenAI-compatible endpoint
Pick one, paste your key (hidden input), done — config is saved to
~/.mforege/.env and works from every folder, forever. A ./.env in
the current folder can override it for one project. Change your mind later
with mforege --setup.
For Groq: grab a free key at https://console.groq.com (no credit card).
Features
Agent core
- Full tool loop — when the model calls a tool, the result is sent back so
the model can use it in its answer (streaming and non-streaming); up to 10
rounds per message, configurable via
AgentConfig.max_tool_rounds - Streaming output — responses appear token by token, with a
thinking Ns...timer while the model works - Personality + response control — friendly, witty, emoji-moderate; short answers for casual chat, clarifying questions for ambiguous or underspecified requests (never dumps giant tutorials or acts on invented details)
Tools
| Tool | Purpose |
|---|---|
list_files |
List directories (workspace-confined) |
read_file |
Read text files with line numbers; offset/limit windows for big files |
search_code |
Regex search across the project (file:line: match), noise dirs skipped |
glob_files |
Find files by pattern, recursively (**/*.py), newest first |
run_command |
Shell commands with a 3-tier safety model |
create_file |
New files (parent folders auto-created) |
edit_file |
Exact, unique-snippet replacement |
todo_plan |
Visible step-by-step mission plan |
calculator |
Safe AST-based math (no eval) |
get_current_time |
Current date/time |
web_search |
Live web search via Exa (needs EXA_API_KEY) |
Safety
- Destructive commands blocked outright (
rm -rf,git push --force,format, ...) - Mutating actions require approval — file writes/edits show a colored diff before you confirm; commands show the exact line to be run
- Fail-closed — without a confirmation handler, mutating operations refuse rather than run unconfirmed
- Workspace-confined — path tools only operate inside the folder you
choose at launch;
../and symlink escapes are rejected - Timeouts & caps — 30s command timeout, tool output capped so the context window never balloons
Chat-style interface (prompt_toolkit)
- Bottom input box — the input stays pinned at the bottom like a chat app; the transcript scrolls above it
- Live activity stream — every tool call prints as
· tool(args) ✓ (0.3s) - Thinking timer —
thinking Ns...runs until the first token arrives - Colored diffs —
+green /-red, shown before approval and in the transcript after the edit lands - Plan statusline —
[Plan 2/5] next: write the testafter each reply - Status bar — model, workspace, and shortcut hints always visible
- Keys — Enter sends, Shift+Enter adds a newline (Alt+Enter also works), Ctrl+C quits
- Slash commands —
/help,/plan,/tools,/memory,/forget,/clear,/exit
Memory
- Conversation memory — history per session,
clearresets it - Long-term memory — after each reply a side-call asks "did I learn
anything durable?"; facts (name, projects, preferences) are saved to
data/memory.json(git-ignored) and injected into future sessions. Personalized greeting on startup ("Welcome back, Munjur! 👋")
Resilience
- Request timeouts + automatic retries with backoff for transient failures
- Friendly errors for missing keys or Ollama not running
- UTF-8 output on Windows (emoji-safe), clean async shutdown
Setup
python -m venv env
env/Scripts/activate # Windows (bash: source env/Scripts/activate)
pip install -r requirements.txt
pip install -e . # installs the `mforege` command
After pip install -e ., MForege works from any terminal — including VS
Code's — with the venv activated:
mforege # in any folder (uses MForege's own .env)
mforege --workspace "C:\path\to\project" # work inside another project
Backends
OpenAI — put your key in .env:
OPENAI_API_KEY=sk-...
LLM_MODEL=gpt-4o-mini
Ollama (free, local) — install from https://ollama.com, then:
ollama pull llama3
mforege --backend ollama --model llama3
Custom (e.g., Groq):
API_KEY=gsk_...
BASE_URL=https://api.groq.com/openai/v1
LLM_MODEL=llama-3.1-8b-instant
Web search (optional)
- Get a free API key at https://dashboard.exa.ai
- Add to
.env:EXA_API_KEY=your_key - Restart the CLI
Workspace
MForege can only read/write inside one folder — the one you choose:
mforege --workspace "C:\path\to\your\project"
The header shows the active workspace. To work in a different folder, restart
with a different --workspace (or set WORKSPACE in .env).
Run
python main.py # from the project folder
mforege # from ANY folder (after pip install -e .)
mforege --backend ollama --model llama3
mforege --workspace "C:\path\to\your\project"
.env resolution: if the current folder has a .env, it wins; otherwise
MForege falls back to its own .env — so API keys are found no matter where
you launch it. Workspace defaults to the current directory.
CLI commands
| Command | Action |
|---|---|
/help |
Show the command menu |
/plan |
Show the current mission plan |
/tools |
List registered tools |
/memory |
Show what MForege remembers about you |
/forget |
Wipe long-term memory |
/clear |
Reset conversation (current session) |
/exit |
Quit (plain exit also works) |
Example session
Welcome back, Munjur! 👋
(I remember 2 things)
You: create utils.py with a greet function, then test it
Assistant: thinking 2s...
· todo_plan(action=set) ✓ (0.0s)
· create_file(path=utils.py) ✓ (0.0s)
[?] MForege wants to: CREATE file 'utils.py' (95 chars)
@@ -0,0 +1,3 @@
+def greet(name):
+ return f"Hello, {name}!"
Allow? [y/N]: y
✓ Edit applied:
@@ -0,0 +1,3 @@
+def greet(name):
...
[Plan 2/4] next: run the tests
Adding your own tool
from app.agent.tools import create_tool
async def get_weather(city: str):
return f"Sunny in {city}, 25C"
agent.register_tools(create_tool("get_weather", "Get weather for a city", get_weather))
Tests
env/Scripts/python -m pytest
161 tests covering conversation memory, the tool registry, the safe calculator, the web search tool, long-term memory (store, injection, extraction), system tools (path confinement, command classification, confirmation flow — sync and async, diffs, notifications), discovery tools (search/glob/read windows), the todo plan, and the agent's tool-call loop — all with a mocked LLM, no network needed.
Release files for mforege 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mforege-0.1.6.tar.gz | 57.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mforege-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 103.1 kB
Release files / mforege-0.1.6.tar.gz
| Download URL | mforege-0.1.6.tar.gz |
|---|---|
| Size | 57.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86c6a8f1e45deeb0487aa9fd9d5a8de728197dc2aefd35a15fcd0b6741601353
|
|
BLAKE2b-256 checksum How to use checksums |
161027d89262cbcad45d2bedef757bc6c2226516d7d3058679e3008c605d1495
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logRelease files / mforege-0.1.6-py3-none-any.whl
| Download URL | mforege-0.1.6-py3-none-any.whl |
|---|---|
| Size | 45.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe172472af77ae61c829419aa3562eac14fddf069ee892aa89506822d04a8434
|
|
BLAKE2b-256 checksum How to use checksums |
8312570c4cfd4f1e2b819b0bf401c88b487cba81a3a64d386dff0e6e8190074d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency log