Skip to content
LofiSuPublic

About

A personal AI agent that runs locally, remembers context, handles scheduled work, and includes a native desktop app.

Topics

Resources

Security policy

Stars

168 stars

Watchers

0 watching

Forks

Repository files navigation

LofiBot banner with a cobalt mascot and chartreuse eyes

LofiBot

English · 简体中文

LofiBot is a personal AI agent that runs locally. It remembers context across sessions, handles scheduled work, and includes a native desktop client. Its TypeScript runtime routes messages to background Workers, keeps state in SQLite, and delivers replies through the desktop app, CLI, and connected channels.

What it does

  • Conversation and execution: the Router receives messages and assigns work. Workers run tasks in separate async ReAct sessions and report back to the Router, which delivers visible replies through a persistent Outbox.
  • Memory across sessions: LofiBot stores scoped transcripts, editable notes, linked topic pages, and a limited startup context. Its consolidation process checks source evidence before publishing a new memory version.
  • Scheduled work: a resident daemon handles routines and channel events. The Watchdog detects assignments that stop making progress.
  • Native desktop: the Rust/Rune client keeps conversations and drafts, streams replies, shows tasks and approvals, and includes project terminals.
  • Tools and controls: tasks can use sandboxed tools, optional MCP servers, local specialist agents, and owner approval flows.
  • Local debugging: optional OpenTelemetry traces record Harness model and tool calls in a local Phoenix collector.

Quick start

Requires Node.js 22.15+, pnpm, and an OpenAI-compatible model. Replace the example values with your model settings.

git clone https://github.com/LofiSu/LofiBot.git
cd LofiBot
pnpm install
export LOFIBOT_API_BASE=https://models.example/v1
export LOFIBOT_API_KEY=your-key
export LOFIBOT_API_MODEL=your-model-id
pnpm lofibot init
pnpm lofibot chat "Summarize the open tickets"
pnpm lofibot tasks

The package, executable, and source command are named lofibot. Configuration variables use the LOFIBOT_* prefix.

See installation for other providers or to migrate an existing checkout. For Feishu and iMessage, run pnpm lofibot channels check before pnpm lofibot serve --imessage --feishu. See channel setup for details and GitHub.

For a native chat window, see the Rune desktop client. It uses the same Agent runtime and can also render an offline preview without opening a window.

For local model and tool traces, see Phoenix debugging. Tracing is optional, and Agent execution does not depend on the collector.

Architecture

flowchart TD
  Sources["CLI · Feishu · iMessage · GitHub · A2A"]
  Routines["Daemon routines"]
  Ingress["Ingress · filter and route triggers"]
  Router["Engine · Router batches by Thread and runs Eval"]
  Assign["Ticket → Assignment"]
  Worker["Harness · isolated Worker session · async ReAct"]
  Tools["Model · sandboxed tools · optional MCP"]
  Store[("SQLite · sessions, tasks, memory and Outbox")]
  Watchdog["Watchdog · stalled work"]
  Outbox["Router → Outbox → channel"]

  Sources --> Ingress
  Routines --> Ingress
  Ingress --> Router
  Router -->|actionable| Assign --> Worker
  Router -->|subscribed Thread| Worker
  Worker <--> Tools
  Worker -->|report| Router
  Router --> Outbox
  Router <--> Store
  Worker <--> Store
  Watchdog -.->|nudge or fail| Assign

  classDef input fill:#F9EDF5,stroke:#A73968,color:#17234E
  classDef route fill:#213C83,stroke:#E94D9A,color:#FFFFFF,stroke-width:2px
  classDef work fill:#DEEBFF,stroke:#345EB1,color:#17234E
  classDef support fill:#EBF6A3,stroke:#61751D,color:#222D14
  class Sources,Routines input
  class Ingress,Router,Outbox route
  class Assign,Worker,Tools work
  class Store,Watchdog support
Loading

Workers report results to the Router, which owns replies and sends them through the Outbox. Scheduled triggers and channel messages enter through the same path.

LofiBot reuses authorized notes across sessions and consolidates them automatically. Run pnpm lofibot memory to inspect indexes or pnpm lofibot memory archive to read historical snapshots. Memory design

Architecture · Module reference · Safety · MIT license

Development

pnpm typecheck
pnpm lint
pnpm test
pnpm build

pnpm test runs offline fixtures. Configured-model acceptance is explicit: pnpm test:live and pnpm test:desktop-memory:live. pnpm demo uses real channels and can create GitHub issues and comments; see channel setup before running it.

About

A personal AI agent that runs locally, remembers context, handles scheduled work, and includes a native desktop app.

Topics

Resources

Security policy

Stars

168 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages