matrixclaw

module
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2026 License: MIT

README

matrixclaw

Go SQLite Telegram

Open-source personal AI infrastructure that runs locally and follows you across clients.

matrixclaw is a personal AI assistant runtime written in Go. It runs as a small local daemon, stores state in SQLite, and gives your AI sessions a home outside any single app or chat window.

The core owns the session: context, files, tool history, approvals, provider settings, model choice, usage records, goals/plans, searchable history, and optional external-agent attachments. The Terminal TUI, Telegram bot, and future mobile clients are only interfaces connected to the same local runtime.

That means you can start a conversation in the terminal, approve a tool call on your machine, continue from Telegram, and later return to the same session without losing the thread.

matrixclaw is built for personal work first: development, research, files, remote checks, reminders, provider switching, visible task plans, and future agent workflows where continuity and explicit control matter.

matrixclaw terminal demo

Why matrixclaw?

  • Small Go daemon: about 10 MB RAM while idle on the current Linux server, with exact usage depending on OS, build, and active clients.
  • One assistant, many clients: begin a session in Terminal TUI and continue it in Telegram.
  • Local-first state: sessions, runs, approvals, files, plans, usage, and provider choices live in SQLite.
  • Provider switching: OpenAI-compatible APIs, Anthropic, Gemini, and custom endpoints.
  • External agents: experimental Codex app-server sessions attach to the same session model.
  • Tools with approvals: file and shell tools pause before risky changes.
  • Planning Mode: persistent goals, tasks, subtasks, resumable execution, and a core-owned runner.
  • Search and usage: session history is searchable, and provider token usage is recorded when available.
  • Storage module: temporary uploads can be promoted into local stored files and retrieved later.
  • Automation-ready: reminders, scheduled AI tasks, deliveries, and future agent workflows.

Session handoff: terminal to Telegram and back

Most AI tools keep the real conversation inside one UI process. That makes every other client feel like a separate product.

matrixclaw keeps the session in the daemon instead. The Terminal TUI and Telegram bot are just clients connected to the same local runtime.

flowchart TD
    TUI[Terminal TUI]
    TG[Telegram Bot]
    FC[Future Clients]

    TUI --> D
    TG --> D
    FC --> D

    D["matrixclawd<br/>Core AI Server"]

    D --> S[Sessions / Runs]
    D --> A[Approvals / ACL]
    D --> F[Files / Deliveries]
    D --> P[Goals / Plans]
    D --> U[Usage / Search]

    S --> B[Providers / Tools / Local SQLite]
    A --> B
    F --> B
    P --> B
    U --> B

A typical flow:

  1. Start a session in matrixclaw tui.
  2. Ask the assistant to inspect files or prepare a change.
  3. Review and approve tool actions from the terminal.
  4. Leave your machine and continue the same session in Telegram.
  5. Come back later and pick up the session in the TUI with the same context and history.

The goal is not to replace your editor or host your work in the cloud. The goal is to give your own machine a small, durable AI operator that can be reached from more than one surface.

Install

Install the latest release:

curl -fsSL https://raw.githubusercontent.com/Suren878/matrixclaw/main/scripts/install.sh | bash

The installer downloads the matching GitHub Release archive, installs matrixclaw and matrixclawd into ~/.local/bin, prepares local config/state directories, and starts matrixclaw setup.

After setup is saved, run matrixclaw to open the terminal TUI. On a fresh machine, plain matrixclaw opens setup first and opens the TUI on later runs.

When the TUI starts, it checks the latest GitHub Release. If a newer version is available, it asks before updating. A successful TUI update then asks whether to restart the daemon so the background service uses the new binary.

Manual update:

matrixclaw update install
matrixclaw service restart

Uninstall keeps config and state by default:

curl -fsSL https://raw.githubusercontent.com/Suren878/matrixclaw/main/scripts/uninstall.sh | bash

Remove config and state explicitly:

curl -fsSL https://raw.githubusercontent.com/Suren878/matrixclaw/main/scripts/uninstall.sh | bash -s -- --purge

What It Does

  • Terminal setup and chat TUI for local operator work.
  • Telegram client for remote sessions, files, images, provider/model commands, and approvals.
  • Durable sessions, messages, runs, approvals, file snapshots, deliveries, and tool results.
  • OpenAI-compatible, Anthropic-compatible, Gemini, and custom provider adapters.
  • Experimental external-agent sessions through Codex app-server.
  • Service-owned tool execution with approval previews before writes and shell actions.
  • Planning Mode for multi-step work, with persistent tasks/subtasks, resumable execution, model-facing plan_* tools, and manual /plan commands.
  • Token usage ledger from provider finish metadata, surfaced in the TUI header and /usage.
  • SQLite-backed message search through /search.
  • Local storage module for temporary uploads, stored files, imports, previews, promotion, deletion, and cleanup settings.
  • SQLite-backed local state with reconnectable clients and session handoff.
  • Automation jobs for reminders and scheduled AI tasks.

Planning Mode

Planning Mode turns a loose multi-step request into durable session work. A plan has a goal, top-level tasks, optional subtasks, and explicit item statuses: pending, active, done, and skipped.

The TUI shows the plan in a side panel with tree rendering for subtasks. You can create and edit tasks manually, or let the assistant create/update the plan through safe plan tools.

Execution is owned by the core runtime:

  • The daemon stores plan state in SQLite.
  • A persisted plan runner checkpoints the current item, last run, attempts, and status.
  • Parent tasks with open subtasks are treated as sections, not executable work.
  • The runner selects the next executable leaf item and runs one item at a time.
  • On successful completion, core closes the item and auto-closes parent sections when all children are terminal.
  • If the model reports a blocked step, the runner records the blocked state instead of marking it done.
  • If the TUI or daemon restarts, unfinished plans can be resumed from stored state.

This keeps the model from being the source of truth for whether the plan is complete. The model performs the current task; the daemon owns the workflow state.

See Planning Mode for the implementation model and edge cases.

Commands

matrixclaw                  open TUI when configured, otherwise setup
matrixclaw setup            open setup
matrixclaw status           print setup and service state
matrixclaw doctor           diagnose setup, daemon, and providers
matrixclaw version          print client and daemon build info
matrixclaw update           check for and install newer releases
matrixclaw providers        list setup provider catalog
matrixclaw providers verify verify configured provider model access
matrixclaw agents           list external agent runtimes
matrixclaw agents start     create an external agent session
matrixclaw service status   print service state
matrixclaw service restart  restart service
matrixclaw service logs     print recent service logs
matrixclaw tui [WORKDIR]    open terminal chat for the current or given directory
matrixclawd                 service binary used by systemd/direct launch

The setup file is the configured marker. First run matrixclaw or explicit matrixclaw setup writes it; later matrixclaw starts the daemon when needed and opens the terminal TUI. Exiting the TUI closes only the terminal client, not the background daemon.

Commands that read setup report missing or unsupported setup on stderr and exit nonzero. Use matrixclaw setup to recreate setup explicitly.

In-session controls

The Terminal TUI and Telegram client share the same control-plane commands, so a command that changes session state in one client is visible from the other. These are client commands, not model tools.

/new                         create a session
/sessions                    list, select, rename, or delete sessions
/provider                    select provider/model for the current session
/permissions                 change the current session permission mode
/context                     inspect compacted context and token estimate
/usage                       show recorded input/output/reasoning/cached tokens
/plan                        show the current goal and plan
/plan goal <text>            set the session goal
/plan add <text>             add a plan item
/plan subtask <n> <text>     add a subtask under an item
/plan edit <n> <text>        edit a plan item
/plan active|done|skip <n>   update a plan item by number
/plan clear                  clear goal and plan after confirmation
/search <query>              search stored message history
/modules storage             manage local stored and temporary files
/modules agents              enable or disable external agent runtimes
/remind                      create a one-time reminder
/tasks                       list and manage scheduled AI tasks
/server, /status, /restart   inspect or restart the local service

For multi-step user requests, the assistant also receives safe plan tools: plan_get, plan_set_goal, plan_add_item, plan_update_item, and plan_clear. These update the same session plan that manual commands display.

From Source

Prerequisites:

  • Go 1.26+
  • Linux or another Unix-like development environment
  • Optional: systemd user services for autostart
git clone https://github.com/Suren878/matrixclaw.git
cd matrixclaw

go test ./...
go vet ./...

mkdir -p ./bin
go build -o ./bin/matrixclaw ./cmd/matrixclaw
go build -o ./bin/matrixclawd ./cmd/matrixclawd

./bin/matrixclaw

For a local source install:

./scripts/install.sh --from-source

Release builds can stamp version metadata:

./scripts/build_release.sh

Architecture

flowchart LR
    TUI[Terminal TUI] --> API[Daemon HTTP API]
    TG[Telegram client] --> API
    API --> CORE[Core runtime]
    CORE --> STORE[(SQLite)]
    CORE --> ORCH[Orchestration]
    ORCH --> PROVIDERS[LLM providers]
    ORCH --> AGENTS[External agents]
    ORCH --> TOOLS[Tools]
    TOOLS --> APPROVALS[Durable approvals]
    APPROVALS --> STORE
    CORE --> PLAN[Goal / Plan state]
    CORE --> SEARCH[Search / Usage]
    CORE --> MODULES[Storage / Automation modules]
    PLAN --> STORE
    SEARCH --> STORE
    MODULES --> STORE

Core rules:

  • clients render state; they do not own runtime truth
  • command semantics live in internal/controlplane
  • all real work becomes a persisted run
  • tool approvals are durable and restart-safe
  • provider and model selection are session data
  • goal/plan state and plan-run checkpoints are session data
  • search and token usage are read-only views over local SQLite state
  • orchestration, providers, and tools are replaceable adapter families

External Agents

External agents are optional runtimes attached to matrixclaw sessions. They are not normal LLM providers. matrixclaw still owns the session, local history, client handoff, and normalized event display; the external agent owns its own thread or process protocol.

Current built-in runtime:

  • Codex app-server, detected from the codex binary.

Manage them from the TUI:

/modules -> External Agents

The screen shows installed/enabled state, mode, resolved binary path, and version when available. Enabling Codex adds it to the New Session picker. Future agents such as Claude Code, Kimi Code, or OpenCode are expected to plug into the same built-in external-agent registry without changing the core session model.

Repository Map

Privacy And Security

Local by default:

  • SQLite sessions, messages, runs, approvals, file snapshots, and bindings.
  • Provider setup metadata.
  • Tool approvals and execution records.
  • Local file reads, writes, and diffs before provider calls.

Can leave your machine:

  • Prompts, selected context, tool results, and conversation history sent to the configured LLM provider.
  • External-agent prompts, working directories, and agent events sent through the configured external agent.
  • Telegram messages and buttons when the Telegram client is enabled.
  • Network traffic caused by tools you approve or run.
  • Any custom provider endpoint you configure.

The daemon API is intended for local clients. By default matrixclawd refuses non-loopback HTTP binds unless MATRIXCLAW_ALLOW_REMOTE_HTTP=1 is explicitly set.

See SECURITY.md for security reporting and local-secret notes.

Status

matrixclaw is an early single-user local operator. It is a good fit for local developer machines, terminal-first usage, Telegram as a remote companion client, and experimenting with provider/tool orchestration without rewriting clients.

It is not currently a hosted multi-tenant service, browser IDE replacement, or distributed worker platform.

License

MIT. See LICENSE.

Directories

Path Synopsis
clients
terminal/commandmenu/ui
Package commandui contains reusable terminal UI components for command screens.
Package commandui contains reusable terminal UI components for command screens.
terminal/ui/surface/anim
Package anim provides an animated spinner.
Package anim provides an animated spinner.
terminal/ui/surface/colorx
Package colorx keeps Lip Gloss v2 color conversion consistent across the terminal UI.
Package colorx keeps Lip Gloss v2 color conversion consistent across the terminal UI.
cmd
matrixclaw command
matrixclawd command
internal
api

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL