Simple — Personal AI Agent
A personal AI agent with memory, tool calling, multi-agent orchestration,
scheduled workflows judged by their own acceptance checks and by the work
products they declare, skills, plugins, and multi-channel delivery.
Requirements
- Python 3.11+
uv
- At least one configured model provider
- Node 18+ — only to build the React frontend; the packaged bundle is already in
the repo, so running the gateway needs no Node
A provider is a named entry in providers — the name is yours. What decides
how it is spoken to is its api_format, of which there are exactly two:
api_format |
Client |
Used for |
anthropic |
anthropic.AsyncAnthropic |
Anthropic API |
openai |
openai.AsyncOpenAI |
OpenAI, and any OpenAI-compatible base_url — DeepSeek, Qwen/DashScope, Groq, Together, vLLM, Ollama |
The setup wizard writes five of them (anthropic, openai, deepseek,
ollama, other), but those are just names it chose; anything that speaks the
OpenAI wire format is one providers.<your-name> entry with a base_url.
Per-provider keys: api_format, api_key (a literal, or $ENV_VAR to read the
environment), base_url, default_model, models (the list /model offers),
supports_vision (whether image attachments go to the model directly),
max_tokens, context_window (the input limit compaction is measured against).
Quick Start
# Install dependencies
uv sync
# First run — interactive setup wizard
uv run simple
The setup wizard guides you through provider selection, API key configuration, and model choice. Config is written to ~/.agent/config.json.
Key capabilities at a glance
| Capability |
How |
| Intent-before-action |
Write/shell tools require the assistant to declare what it will do before executing |
| Nothing gets created unasked |
Creators (schedule_create, workflow_create, emit_signal) must quote the user's own words from this turn, or the call is refused |
| Workflows |
Chain scheduled tasks into a graph, each step judged by its own acceptance check |
| Declared work products |
produces names the files a task has to leave behind: the run is told where to write, the steps below are handed what actually exists, and a promised file that is missing fails the run on its own |
| Run outcomes |
succeeded / failed / unverified / skipped — "we could not tell" is not "it failed" |
| Signals |
emit_signal wakes whatever subscribed, so a step can follow another without a clock |
| Unified event stream |
Every tool call, hook, and lifecycle fact is a replayable RuntimeEvent |
| LLM retry |
Transient API errors (rate limit, 5xx) retried 3x with exponential backoff; a spent quota or empty balance is not retried |
| Config validation |
Startup warnings for typos and invalid values — never blocks startup |
| Named sessions |
--name prod for isolated session data with shared config by default |
| One writer per agent home |
A second process on the same home is refused rather than allowed to corrupt it |
| Plugin hooks |
8 lifecycle hooks: prompt submit, tool matchers, command hooks, continue loop |
| Vision |
Image attachments sent straight to the model when the provider sets supports_vision |
| Graceful shutdown |
Feishu drains pending messages before closing WebSocket |
Measuring retrieval quality
Memory recall is the system's core value, so it has an instrument rather than
only a latency benchmark:
uv run python scripts/eval_retrieval.py # recall@k / MRR by capability
uv run python scripts/eval_retrieval.py --compare # diff against the pinned baseline
uv run python scripts/eval_retrieval.py --harvest # seed a local set from your own store
It drives the production path (ContextManager.rank_ltm_entries) over a
labeled set in tests/eval/, and separates the two failure modes that look
identical from outside:
candidate_recall — did stage 1 (FTS) even fetch the right entry? This
is a hard ceiling; ranking cannot recover what was never retrieved.
recall@k / mrr — given the candidates, did stage 2 rank it well?
What it found: the failures are stage 1, not ranking, and the fix is the
query rather than the algorithm. Memory search is lexical — it matches
words, not meanings — so one unmodified user question misses a memory that
says the same thing differently, or says it in the other language. Re-asking
fixes essentially all of it:
|
single query |
with reformulation |
candidate_recall |
0.696 |
1.000 |
mrr |
0.609 |
1.000 |
cross-lingual |
0.143 |
1.000 |
paraphrase |
0.385 |
1.000 |
That is why context_retrieve takes queries (a list), not query: the
parameter shape makes reformulation the default path, which a sentence in a
tool description does not reliably achieve. --multi-query reproduces the
right-hand column. Treat it as an upper bound — the reformulations are
authored, so it shows what the approach can reach, not what a given model
will produce.
The set also carries cases with no right answer, so the instrument is not
one-directional: a run reports false_positive_rate and avg_spurious_results
alongside recall. Both are currently 0.5, which is the honest number for two
hand-written negatives and is the thing a "just return more candidates"
change would move.
tests/test_retrieval_quality.py guards the pinned baseline in CI. Re-pin
with --save-baseline after an intentional change, and read the tag
breakdown first.
Examples
Named sessions
--name selects a session for both the gateway and the CLI. Each session has
its own data directory but shares the default agent configuration unless it
explicitly overrides it with its own config.json:
# Session "prod" — data in ~/.agent-prod/, config shared from ~/.agent/config.json
uv run simple gateway --name prod
uv run simple --name prod
# Session "dev" with its own config override
mkdir -p ~/.agent-dev
cp ~/.agent/config.json ~/.agent-dev/config.json
uv run simple gateway --name dev
# Default session
uv run simple gateway # -> ~/.agent/
uv run simple # -> ~/.agent/
Each named session has independent memory, context database, scheduler,
staging, and skills; agent configuration (provider, model, system prompt,
channels) is shared from ~/.agent/config.json by default. A session only
uses its own config when ~/.agent-<name>/config.json exists.
/sessions lists the discoverable sessions and their config source. Sessions
are isolated worlds; cross-session interaction stays at the filesystem level
(read another session's data when needed) rather than keeping multiple live
working memories in one process.
Two different things share the word "session", and they are not the same shape:
|
Data home |
Why |
--name prod |
~/.agent-prod/ — a sibling of the default, picked by a person |
Same machine, different worlds |
Web session abc123 |
<agent home>/web/sessions/abc123/ — under the active home |
A browser tab's isolation, kept where it belongs |
One live owner per agent home. Several subsystems assume they are the only
writer of that directory — the staging partition is keyed by session id and the
CLI hardcodes one, memory index files and plugin approval state are
read-modify-write with no cross-process coordination — so rather than audit
every such site, the invariant is enforced at the entry points: a second
process on the same home is refused instead of being allowed to corrupt it. Use
--name (or SIMPLE_AGENT_HOME=~/.agent-dev simple) for a second instance;
SIMPLE_ALLOW_MULTI_INSTANCE=1 is the explicit opt-out when you know what you
are doing.
Feishu Gateway
# Install Feishu dependency
uv sync --extra feishu
# Start gateway
uv run simple gateway
# Production instance with Feishu
uv run simple gateway --name prod
Configure in ~/.agent/config.json:
{
"channels": {
"feishu": {
"enabled": true,
"app_id": "cli_xxxx",
"app_secret": "xxxx",
"group_policy": "mention",
"streaming": true
}
}
}
Web frontend
The gateway can also serve an HTTP/WebSocket API for a browser frontend. The
web channel is just another channel, so it shares the same session machinery
as Feishu (one conversation id per chat thread).
The React source lives under frontend/. Development builds (npm run build)
stay in frontend/dist/ and do not modify the Python package tree.
The gateway serves the bundled copy, not your dev build.
agent/_builtin/web/dist/ is the canonical asset and is checked in;
frontend/dist/ is gitignored and may be an older build, so it is never
allowed to silently override the package after a restart. To serve the dev
build while working on the frontend, set SIMPLE_WEB_USE_SOURCE_DIST=1. To
refresh the bundle that ships, run npm run build:release from frontend/.
# Install web dependency
uv sync --extra web
# Start gateway with the web channel enabled
uv run simple gateway
# In a named session
uv run simple gateway --name prod
Configure in ~/.agent/config.json:
{
"channels": {
"web": {
"enabled": true,
"host": "127.0.0.1",
"port": 8787,
"auth_token": "",
"cors_origins": [],
"max_active_sessions": 16,
"session_idle_ttl_seconds": 900
}
}
}
Each Web session gets its own runtime home under <agent home>/web/sessions/ <session_id>, with independent context, memory, skills and tools — not a
~/.agent-<id> sibling. At most max_active_sessions are kept resident; when
one is full the least-recently-active idle session is evicted, and its state
is rebuilt from the provider checkpoint on the next message, so eviction costs
a replay rather than the chat. session_idle_ttl_seconds evicts idle sessions
eagerly. A session mid-turn is never evicted, under either limit.
The gateway serves a built-in React + Ant Design UI at
http://127.0.0.1:8787/:
uv sync --extra web
uv run simple gateway
# open http://127.0.0.1:8787/
The React UI has six views — 对话 (chat), 会话管理 (sessions), 插件 (plugins),
技能 (skills), 自动化 (scheduled tasks and workflows) and 设置 (settings) —
plus a command palette and streamed responses, all through the same /api/...
endpoints. Or use the API directly:
| Area |
Method Path |
Description |
| UI |
GET / |
Built-in React UI |
| UI |
GET /api/health |
Health check |
| UI |
GET /api/commands |
Commands available in the web channel |
| UI |
GET /api/context |
Context-manager statistics |
| UI |
GET /api/scheduler/health |
Scheduler liveness |
| Config |
GET /api/config, POST /api/config |
Read masked config / save config |
| Sessions |
GET, POST, DELETE /api/sessions |
List (in the current agent home) / create an id / delete several |
| Sessions |
PATCH, DELETE /api/sessions/{id} |
Rename ({"title": "..."}) / delete durable history |
| Sessions |
GET /api/sessions/{id}/state |
Durable state for one session |
| Sessions |
GET, POST /api/sessions/{id}/messages |
Recent messages / send one (non-streaming) |
| Sessions |
POST /api/sessions/{id}/cancel |
Cancel the turn in flight |
| Sessions |
DELETE /api/sessions/{id}/queue/{message_id} |
Take a queued message back before it runs |
| Sessions |
POST /api/sessions/{id}/attachments |
Upload an attachment |
| Sessions |
POST /api/sessions/{id}/workspace/pick |
Pick the session's project folder (an explicit read/write grant) |
| Sessions |
POST /api/sessions/{id}/task-guidance/dismiss |
Dismiss the task-setup hint |
| Sessions |
GET, PATCH /api/sessions/{id}/permissions |
Read / change this session's shell permission posture |
| Sessions |
DELETE /api/sessions/{id}/approvals |
Drop this session's standing approvals |
| Sessions |
POST /api/sessions/{id}/reveal |
Reveal the session's isolated agent home in Finder/file manager |