Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,22 @@ Most AI assistants run on someone else's servers, and none of them know how you

## Status

DearByte is early and built in the open. All of Phase 1 is on `master`, with 289 offline tests. What works today and what's coming:
DearByte is early and built in the open. All of Phase 1 is on `master`, with 319 offline tests. What works today and what's coming:

| Part | Status |
| --- | --- |
| Agent core: tool loop, validated tools, Claude or DeepSeek as "brain" and "worker" tiers | **Works**, tested offline and with live DeepSeek runs |
| Agent core: tool loop, validated tools, Claude or DeepSeek as "brain" and "worker" tiers | **Works**, run live with Claude Opus as the brain and DeepSeek as the worker |
| Spending controls: per-run and weekly caps, a usage log of every model call | **Works** |
| Persona packs: English DearByte, the opt-in Chinese Xiaobai, and any the community adds ([how](docs/personas.md)) | **Works**, each pack checked in CI |
| Chat companion in the terminal and in WeChat (Xiaobai, Chinese) with memory and proactive check-ins | **Works**, see [the companion](#the-chinese-companion-xiaobai) |
| Apple Watch and Apple Health data, through [dearbyte-bridge](https://github.com/dearbyte-labs/dearbyte-bridge) | **Works** with the bridge's test data; a live test with a real iPhone is next |
| Apple Watch and Apple Health data, through [dearbyte-bridge](https://github.com/dearbyte-labs/dearbyte-bridge) | **Works**, live with a real iPhone and Apple Watch |
| Calendar awareness: your Apple Calendar events (read on the Mac, which iCloud keeps in sync with your iPhone), in the brief and in caution alerts | **Works** on macOS, tested live on a real calendar |
| Caution alerts and a morning brief, judged against your own normal sleep, resting heart rate and HRV, and what's on your calendar today | **Works** |
| Telegram for alerts, a 👍/👎 on every alert, and Approve/Reject buttons | **Works** in tests; a live test with a real bot is next |
| Telegram for alerts, a 👍/👎 on every alert, and Approve/Reject buttons | **Works**, live with a real bot |
| Talk to the agent in WeChat (Mandarin, as 小拜) or iMessage (`-m` Mandarin, `-e` English), with approvals answered by a plain yes or no | WeChat **works** live; iMessage is built and tested offline, and a live test is next |
| Company watchlist: official newsroom feeds and SEC filings, screened against what you care about | **Works**, tested live on real feeds |
| FIRE plan: your road to financial independence (4% rule and die-with-zero numbers, earliest retirement age, net worth by age) from `finance.json`, with what-ifs | **Works**; the numbers come from code, the model only explains them |
| Money from MindGo, the budgeting app: this term's spending by category, pace against last term, goals, through a read-only token | **Works**, live; totals and categories only, never single transactions |
| Testnet wallet: the agent proposes a paid service, you approve, it pays within a cap, and you get a receipt | **Works** with x402 on Base Sepolia, tested live against the example seller in dev mode; an on-chain payment needs test USDC from the faucet |

## Roadmap
Expand All @@ -62,7 +64,8 @@ DearByte is early and built in the open. All of Phase 1 is on `master`, with 289
**Phase 2: daily use, measured**
- Two weeks of real use with feedback on every alert; measure precision, missed events, delay and cost per month
- Calendar awareness on the Mac (done early, see Status); an English app UI and more news sources
- Money: MindGo, the budgeting app, connected through a read-only MCP endpoint, so the FIRE plan uses your real spending and saving, and DearByte speaks up when spending runs ahead of the term's pace or a goal falls behind (built early: needs MindGo's `/mcp` deployed)
- Money: MindGo, the budgeting app, connected through a read-only MCP endpoint, so DearByte answers from your real spending and speaks up when it runs ahead of the term's pace or a goal falls behind (done early, live)
- Chat apps: the agent in WeChat and iMessage (done early); iMessage as a place for the brief and alerts, next to Telegram
- Approving purchases from the Apple Watch (needs a paid Apple Developer account)

**Later**
Expand Down Expand Up @@ -291,9 +294,9 @@ Photos aren't read yet; the agent is told one arrived.
| --- | --- |
| [Architecture](docs/architecture.md) | How DearByte is put together, the rules it follows, and what to improve next |
| [Persona packs](docs/personas.md) | Choosing a persona, writing your own, and what CI checks |
| [Agent guide](docs/agent-guide.md) | Setting up health, Telegram, the watchlist and the wallet; every command; a live test checklist |
| [Agent guide](docs/agent-guide.md) | Setting up health, calendar, Telegram, the watchlist, money, the wallet and the chat apps; a live test checklist |
| [Operations guide](docs/guide.en.md) | 小拜 companion: commands, proactive messaging, WeChat, configuration, repository layout |
| [How it works](docs/how-it-works.md) | The companion's reply pipeline, memory and storage |
| [How the companion works](docs/how-it-works.md) | 小拜's WeChat connection, reply pipeline, memory and safety |
| [Roadmap](#roadmap) | What's next: the first demo, daily use, then hosting and the marketplace |
| [中文说明](README.zh-CN.md) | 小拜的中文介绍和快速开始 |
| [Contributing](CONTRIBUTING.md) | Read before opening a PR; report security issues through [SECURITY.md](SECURITY.md) |
Expand Down
12 changes: 11 additions & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,17 @@ npm run dearbyte

已实现终端聊天、可控记忆、图片输入、主动消息和实验性微信接入。微信文字与图片流程已于 **2026-09-24** 完成实机测试。

DearByte 的个人助理部分(Apple Watch 健康数据、早间简报与提醒、Telegram、公司动态追踪、测试网钱包)已完成第一阶段开发,目前以英文为主,见 [English README](README.md) 和[助理指南(英文)](docs/agent-guide.md)。
DearByte 的个人助理部分(Apple Watch 健康数据、日历、早间简报与提醒、Telegram、公司动态追踪、MindGo 记账数据、测试网钱包)已完成第一阶段开发,见 [English README](README.md) 和[助理指南(英文)](docs/agent-guide.md)。

助理也可以用中文聊:

```bash
npm run dearbyte -- wechat # 在微信里和助理聊,用普通话,还是小拜的语气
npm run dearbyte -- imessage -m # 在 iMessage 里聊,-m 普通话,-e 英文
npm run dearbyte -- help # 全部命令
```

需要购买时,代码会把请求写进聊天;回「好」就批准,回「算了」就拒绝。

当前微信模式只支持一个联系人;语音、视频、文件和表情包不能被直接理解。小拜是 AI,不是真人;危机信号检测用于调整回复,不能代替专业帮助或联系紧急服务。

Expand Down
33 changes: 29 additions & 4 deletions docs/agent-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@

# DearByte agent — Setup and testing guide

This guide covers the personal agent: health, caution alerts and the morning brief, Telegram, the company watchlist and the testnet wallet. For 小拜, the Chinese companion, see the [operations guide](guide.en.md).
This guide covers the personal agent: health, calendar, caution alerts and the morning brief, Telegram, the company watchlist, money, the testnet wallet, and talking to it in WeChat or iMessage. For 小拜, the Chinese companion, see the [operations guide](guide.en.md).

**Status (2026-09-26):** all of Phase 1 is on `master`, and 248 offline tests pass. Watchlist screening has been run live against real feeds with DeepSeek. The wallet's full flow (proposal, approval, receipt) has been run live against the example seller in `--dev` mode. Still to test live: your own Apple Watch data, a real Telegram bot, an on-chain testnet payment, and Claude as the brain. The [checklist](#live-test-checklist) below covers each one.
**Status (2026-09-27):** all of Phase 1 is on `master`, and 319 offline tests pass. Run live so far:
- real Apple Watch data and the Mac's calendar;
- a real Telegram bot;
- watchlist screening on real feeds;
- MindGo money (read-only);
- Claude Opus as the brain with DeepSeek as the worker;
- the agent in WeChat, in Mandarin;
- the wallet's full flow (proposal, approval, receipt) against the example seller.

Still to test live: an on-chain testnet payment, and iMessage. The [checklist](#live-test-checklist) below covers each part.

## Setup, in order

Expand All @@ -19,6 +28,7 @@ Each step works without the ones after it. Run `npm run dearbyte -- status` at a
| 5. Watchlist | Copy `watchlist.example.json` to `watchlist.json`; optionally set `SEC_CONTACT_EMAIL` | Company news, screened against your interests |
| 6. Money | Copy `finance.example.json` to `finance.json` and put in your numbers. Optionally connect MindGo: in MindGo's `backend/`, `npm run access-token -- create <email> DearByte`, then set `MINDGO_MCP_URL` and `MINDGO_TOKEN` | `npm run dearbyte -- fire`, and the agent can answer "when could I retire?". With MindGo, the plan uses your last 12 months of spending and saving, the agent can answer "how am I doing this term?", and the brief flags spending ahead of pace or an overdue goal |
| 7. Wallet | `npm run dearbyte -- wallet new`, then test USDC from [Circle's faucet](https://faucet.circle.com) (Base Sepolia); set `DEARBYTE_SELLERS` | The agent can propose purchases, and you approve them |
| 8. Chat apps (optional) | **WeChat:** the companion's WeChat setup ([operations guide](guide.en.md)), then `npm run dearbyte -- wechat`. **iMessage:** Messages signed in on the Mac (a separate Apple ID for DearByte looks best), Full Disk Access for the terminal, `DEARBYTE_IMESSAGE_TO` set to your number, then `npm run dearbyte -- imessage -m` or `-e` | Talk to the agent from your phone. Approve a purchase by replying yes (好) or no (算了) |

Secrets (`HEALTH_MCP_URL`, `MINDGO_TOKEN`, `TELEGRAM_BOT_TOKEN`, `DEARBYTE_WALLET_KEY`, API keys) go only in `.env`, which Git ignores. Never paste them into chat, issues, commits or screenshots. `wallet new` prints only the address, never the key.

Expand Down Expand Up @@ -66,6 +76,9 @@ npm run dearbyte -- fire [--retire 45 ...] # your FIRE plan; what-ifs: --retir
npm run dearbyte -- wallet [new] # address, balance, limits, recent purchases
npm run dearbyte -- approvals # requests waiting for your yes
npm run dearbyte -- approve N | reject N # answer one in the terminal
npm run dearbyte -- wechat [--draft] # the agent in WeChat, in Mandarin as 小拜
npm run dearbyte -- imessage -m|-e [--to <handle>] [--draft] # the agent in iMessage: Mandarin or English
npm run dearbyte -- help # every command
npm run seller [-- --dev] # the example x402 seller on http://127.0.0.1:4021
npm run demo # the three-part demo (see above)
npm run agent:usage # what every model call cost
Expand Down Expand Up @@ -128,6 +141,15 @@ Run these once each part is set up. Each should take a few minutes.
- [ ] Ask for something over `DEARBYTE_MAX_PURCHASE`. It should be refused, with nothing proposed.
- [ ] Reject a proposal. Nothing should be paid.

**WeChat (needs the companion's WeChat setup)**
- [ ] `npm run dearbyte -- wechat --draft` prints a Mandarin reply to 「我昨晚睡得如何」 with real numbers, and sends nothing.
- [ ] Without `--draft`, ask it to buy the recovery plan. Code's request bubble appears; 「好」 approves it and 「算了」 rejects it.

**iMessage (needs Full Disk Access and `DEARBYTE_IMESSAGE_TO`)**
- [ ] `npm run dearbyte -- imessage -e --draft` prints "Connected", then drafts an English reply to your next text.
- [ ] Without `--draft`, the reply arrives on your phone and isn't answered again when it echoes back.
- [ ] With `-m`, the reply is in Mandarin as 小拜.

**Claude as the brain (optional, needs `ANTHROPIC_API_KEY`)**
- [ ] `DEARBYTE_BRAIN=anthropic:claude-opus-5-5 npm run dearbyte -- brief --force` works, and its cost shows in `npm run agent:usage`.

Expand All @@ -145,13 +167,16 @@ Ask what-ifs in the terminal (`npm run dearbyte -- fire --retire 45 --return 5`)
## Code layout

```text
src/agent-cli.ts the npm run dearbyte -- <command> commands (src/main.ts routes them)
src/main.ts npm run dearbyte: a command goes to the agent, none to the companion
src/agent-cli.ts the agent's commands
src/agent/ agent loop, validated tools, model tiers, usage log, approvals, scheduled brief and alerts
src/agent/messaging.ts the agent in a chat app: bubbles, history, yes/no approvals, Chinese or English
src/channels/ the reply loop, WeChat for Mac (desktop/) and iMessage (imessage/)
src/health/ bridge MCP client, daily snapshots and baseline, caution rules
src/calendar/ the Mac's calendars (EventKit helper in native/calendar), the get_calendar tool, the hard-event rule
src/telegram/ Bot API client (long polling) and the handler for button taps
src/watchlist/ newsroom and SEC sources, screening, news tools
src/finance/ FIRE math (fire.ts), finance.json, the fire_plan tool and the terminal report
src/finance/ FIRE math (fire.ts), finance.json, the fire_plan tool, the terminal report, and the MindGo client (mindgo.ts)
src/wallet/ limits, x402 quote and payment, purchase proposals and receipts
examples/seller/ example x402 seller (moving to its own repo)
personas/ persona packs (docs/personas.md); INDEX.md is generated
Expand Down
9 changes: 7 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ flowchart LR
subgraph You
CLI[Terminal<br/>npm run dearbyte -- …]
TG[Telegram<br/>alerts · 👍/👎 · Approve/Reject]
Chat[WeChat · iMessage<br/>questions · yes/no approvals]
end

subgraph DearByte["DearByte (your Mac)"]
Expand All @@ -39,6 +40,8 @@ flowchart LR
end

CLI --> Loop
Chat <--> Loop
Chat --> Appr
TG <--> Appr
Sched --> Rules --> Loop
Loop <--> Tiers <--> LLM
Expand Down Expand Up @@ -105,6 +108,7 @@ reason written next to it.
| Wallet | `src/wallet/` | x402 v2 on Base Sepolia: quote → approval → fresh quote → reserve against the daily cap → EIP-3009 signature → receipt |
| Approvals | `src/agent/approvals.ts`, `src/telegram/inbox.ts` | Pending requests, Approve/Reject from Telegram or the terminal, 15-minute expiry, decided atomically |
| Telegram | `src/telegram/` | Bot API with long polling; only the configured chat is heard |
| Chat apps | `src/agent/messaging.ts`, `src/channels/` | The agent in WeChat (Accessibility, Mandarin) or iMessage (the Messages database and AppleScript, `-m` or `-e`). One bound chat. Code writes approval requests into it, and a whole-message yes or no answers them |
| Store | `src/storage/store.ts` | One SQLite file: messages, facts, settings, usage, health days, alerts, approvals, news items, purchases |

## How a morning brief happens
Expand Down Expand Up @@ -142,10 +146,10 @@ and more channels arrive.
| 2 | **A report command** | Phase 2's result is measured: precision, coverage, delay, cost, uptime | `npm run dearbyte -- report` from `agent_alerts`, `watch_items`, `agent_usage` and the heartbeat; `/missed` in Telegram |
| 3 | **Connectors instead of if-chains** | Each data source is wired separately in `toolset.ts`, `status`, `watch` and the demo. MindGo would be the fourth copy | A `Connector` type: `status()`, `tools()`, optional `rules()` and `brief()` parts. Health, calendar, watchlist, finance and MindGo each become one. `toolset`, `status` and `watch` loop over the list |
| 4 | **One alert policy** | Quiet hours, daily caps, dedupe and "once a day per rule" live in `scheduled.ts` and again in `watchlist/check.ts`; money rules would add a third | A small policy module: every rule returns triggers, and one place applies quiet hours, caps, dedupe and storage |
| 5 | **Split `agent-cli.ts`** | 515 lines of wiring plus every command; `tools/demo.ts` repeats the wiring | `src/app.ts` builds the store, models, tools and channels once; `src/commands/*.ts` hold one command each; the demo reuses `app.ts` |
| 5 | **Split `agent-cli.ts`** | About 700 lines of wiring plus every command, including two chat apps; `tools/demo.ts` repeats the wiring | `src/app.ts` builds the store, models, tools and channels once; `src/commands/*.ts` hold one command each; the demo reuses `app.ts` |
| 6 | **Split the store** | `store.ts` is 755 lines serving both the companion and the agent; schema changes are ad hoc | A repository per area (alerts, approvals, purchases, health, news), versioned migrations, and the same SQLite file |
| 7 | **Separate the agent's memory from the companion's** | The agent reads 小拜's facts; only `style` facts are filtered out | A memory namespace per product, or move the companion to DearByte-gf and give the agent its own memory |
| 8 | **Money through MindGo, read-only** (built: MindGo `POST /mcp`, DearByte `src/finance/mindgo.ts`) | FIRE used typed-in monthly numbers; MindGo already has real spending, terms and goals | A read-only MCP endpoint in MindGo with a revocable personal token; tools return term totals and goal progress, not raw transactions; `finance.json` keeps age and targets. Still open: MindGo is wired in `toolset.ts` like the others, so item 3 matters more now |
| 8 | **Money through MindGo, read-only** (done, live: MindGo `POST /mcp`, DearByte `src/finance/mindgo.ts`) | FIRE used typed-in monthly numbers; MindGo already has real spending, terms and goals | A read-only MCP endpoint in MindGo with a revocable personal token; tools return term totals and goal progress, not raw transactions; `finance.json` keeps age and targets. Still open: MindGo is wired in `toolset.ts` like the others, so item 3 matters more now |
| 9 | **Scenario evals for personas and rules** | CI checks a pack's text, not how it behaves; alert wording has no regression test | A fixed set of scenarios (a caution, a purchase approval, a distressed user, a what-if about retiring) run against each persona with a cheap model, checked by code where possible |
| 10 | **Move the companion out** | Two products in one repo blur the pitch and the dependencies (WeChat automation, Accessibility) | Move 小拜 and `native/wechat-desktop` to DearByte-gf; share the model layer as a package if needed |

Expand All @@ -157,4 +161,5 @@ and more channels arrive.
| Calendar | Everything; only titles and times are read | Titles and times a request uses | — |
| Money | `finance.json` | The FIRE plan's numbers, and MindGo's term totals and goals, when a request uses them | DearByte reads totals from your own MindGo with a read-only token; no transactions or descriptions leave MindGo |
| Alerts and approvals | `data/` | — | Telegram's servers carry the messages |
| Chat apps | WeChat and Messages keep their own history; DearByte reads only the bound chat | The bound chat's new messages, and the last 8 turns | Tencent or Apple carries the messages, as for any chat |
| Wallet key | `.env` | Never | Signs only approved payments |
Loading
Loading