@cosmicstack/mercury-agent 0.5.4 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  </p>
8
8
 
9
9
  <p align="center">
10
- Runs 24/7 from CLI or Telegram. 31 built-in tools. Extensible skills. Asks before it acts.
10
+ Remembers what matters. Asks before it acts. Runs 24/7 from CLI or Telegram. 31 built-in tools, extensible skills, SQLite-backed Second Brain memory.
11
11
  </p>
12
12
 
13
13
  <p align="center">
@@ -41,12 +41,13 @@ mercury doctor
41
41
 
42
42
  ## Why Mercury?
43
43
 
44
- Every AI agent can read files, run commands, and fetch URLs. Most do it silently. **Mercury asks first.**
44
+ Every AI agent can read files, run commands, and fetch URLs. Most do it silently. **Mercury asks first — and remembers what matters.**
45
45
 
46
- - **Permission-hardened** — Shell blocklist (`sudo`, `rm -rf /`, etc. never execute). Folder-level read/write scoping. Pending approval flow. Skill elevation with granular `allowed-tools`. No surprises.
46
+ - **Permission-hardened** — Shell blocklist (`sudo`, `rm -rf /`, etc. never execute). Folder-level read/write scoping. Pending approval flow. Ask Me or Allow All per session. No surprises.
47
+ - **Second Brain** — Persistent, structured memory with SQLite + FTS5 full-text search. 10 memory types, auto-extraction, conflict resolution, auto-consolidation. Mercury learns your preferences, goals, and habits without manual entry.
47
48
  - **Soul-driven** — Personality defined by markdown files you own (`soul.md`, `persona.md`, `taste.md`, `heartbeat.md`). No corporate wrapper.
48
49
  - **Token-aware** — Daily budget enforcement. Auto-concise when over 70%. `/budget` command to check, reset, or override.
49
- - **Multi-channel** — CLI with real-time streaming. Telegram with HTML formatting, file uploads, and typing indicators.
50
+ - **Live streaming** — Real-time token streaming on CLI with cursor-save/restore and markdown re-rendering. Telegram streaming with editable status messages.
50
51
  - **Always on** — Run as a background daemon on any OS. Auto-restarts on crash. Starts on boot. Cron scheduling, heartbeat monitoring, and proactive notifications.
51
52
  - **Extensible** — Install community skills with a single command. Schedule skills as recurring tasks. Based on the [Agent Skills](https://agentskills.io) specification.
52
53
 
@@ -110,6 +111,7 @@ In daemon mode, Telegram becomes your primary channel — CLI is log-only since
110
111
  | `mercury setup` | Re-run the setup wizard |
111
112
  | `mercury status` | Show config and daemon status |
112
113
  | `mercury help` | Show full manual |
114
+ | `mercury upgrade` | Upgrade to latest version |
113
115
  | `mercury telegram list` | List approved and pending Telegram users |
114
116
  | `mercury telegram approve <code\|id>` | Approve a pairing code or pending request |
115
117
  | `mercury telegram reject <id>` | Reject a pending Telegram access request |
@@ -138,6 +140,10 @@ Type these during a conversation — they don't consume API tokens. Work on both
138
140
  | `/budget override` | Override budget for one request |
139
141
  | `/budget reset` | Reset usage to zero |
140
142
  | `/budget set <n>` | Change daily token budget |
143
+ | `/permissions` | Change permission mode (Ask Me / Allow All) |
144
+ | `/tasks` | List scheduled tasks |
145
+ | `/memory` | View and manage second brain memory |
146
+ | `/unpair` | Telegram: reset all access |
141
147
 
142
148
  ## Built-in Tools
143
149
 
@@ -156,8 +162,8 @@ Type these during a conversation — they don't consume API tokens. Work on both
156
162
 
157
163
  | Channel | Features |
158
164
  |---------|----------|
159
- | **CLI** | Readline prompt, arrow-key command menus, real-time text streaming, markdown rendering |
160
- | **Telegram** | HTML formatting, file uploads, typing indicators, multi-user access with admin/member roles |
165
+ | **CLI** | Readline prompt, arrow-key command menus, real-time text streaming with markdown re-rendering, permission mode picker |
166
+ | **Telegram** | HTML formatting, editable streaming messages, file uploads, typing indicators, multi-user access with admin/member roles |
161
167
 
162
168
  ### Telegram Access
163
169
 
@@ -178,6 +184,21 @@ CLI commands: `mercury telegram list|approve|reject|remove|promote|demote|reset`
178
184
  - Tasks persist to `~/.mercury/schedules.yaml` and restore on restart
179
185
  - Responses route back to the channel where the task was created
180
186
 
187
+ ## Second Brain
188
+
189
+ Mercury builds a structured, persistent memory that grows with every conversation. Enabled by default, it automatically extracts, stores, and recalls facts about you.
190
+
191
+ - **10 memory types** — identity, preference, goal, project, habit, decision, constraint, relationship, episode, reflection
192
+ - **Automatic extraction** — after each conversation, Mercury pulls 0–3 facts with confidence, importance, and durability scores
193
+ - **Relevant recall** — before each message, the top 5 matching memories (900-char budget) are injected into context
194
+ - **Auto-consolidation** — every 60 min, Mercury builds a profile summary, active-state summary, and generates reflections from patterns
195
+ - **Conflict resolution** — opposing memories are resolved by confidence (higher wins) or recency (newer wins)
196
+ - **Auto-pruning** — active-scope memories stale after 21 days; inferred memories decay; low-confidence durable memories dismissed after 120 days
197
+ - **User controls** — `/memory` for overview, search, pause, resume, and clear
198
+ - **Disable** — `SECOND_BRAIN_ENABLED=false` env var or `memory.secondBrain.enabled: false` in config
199
+
200
+ All data stays on your machine in `~/.mercury/memory/second-brain/second-brain.db` (SQLite + FTS5). No cloud.
201
+
181
202
  ## Configuration
182
203
 
183
204
  All runtime data lives in `~/.mercury/` — not in your project directory.
@@ -191,7 +212,10 @@ All runtime data lives in `~/.mercury/` — not in your project directory.
191
212
  | `~/.mercury/skills/` | Installed skills |
192
213
  | `~/.mercury/schedules.yaml` | Scheduled tasks |
193
214
  | `~/.mercury/token-usage.json` | Daily token usage tracking |
194
- | `~/.mercury/memory/` | Short-term, long-term, episodic memory |
215
+ | `~/.mercury/memory/short-term/` | Per-conversation JSON files |
216
+ | `~/.mercury/memory/long-term/` | Auto-extracted facts (JSONL) |
217
+ | `~/.mercury/memory/episodic/` | Timestamped event log (JSONL) |
218
+ | `~/.mercury/memory/second-brain/` | Structured memory database (SQLite + FTS5) |
195
219
  | `~/.mercury/daemon.pid` | Background process PID |
196
220
  | `~/.mercury/daemon.log` | Daemon mode logs |
197
221
 
@@ -214,10 +238,11 @@ When a provider fails, Mercury automatically tries the next one. It remembers th
214
238
 
215
239
  ## Architecture
216
240
 
217
- - **TypeScript + Node.js 20+** — ESM, tsup build, zero native dependencies
241
+ - **TypeScript + Node.js 18+** — ESM, tsup build
218
242
  - **Vercel AI SDK v4** — `generateText` + `streamText`, 10-step agentic loop, provider fallback
219
- - **grammY** — Telegram bot with typing indicators and file uploads
220
- - **Flat-file persistence** — No database. YAML + JSON in `~/.mercury/`
243
+ - **grammY** — Telegram bot with typing indicators, editable streaming, and file uploads
244
+ - **SQLite + FTS5** — Second brain with full-text search, conflict resolution, auto-consolidation
245
+ - **JSONL** — Short-term, long-term, and episodic conversation memory
221
246
  - **Daemon manager** — Background spawn + PID file + watchdog crash recovery
222
247
  - **System services** — macOS LaunchAgent, Linux systemd, Windows Task Scheduler
223
248