clementine-agent 1.0.0
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/.env.example +44 -0
- package/LICENSE +21 -0
- package/README.md +795 -0
- package/dist/agent/agent-manager.d.ts +69 -0
- package/dist/agent/agent-manager.js +441 -0
- package/dist/agent/assistant.d.ts +225 -0
- package/dist/agent/assistant.js +3888 -0
- package/dist/agent/auto-update.d.ts +32 -0
- package/dist/agent/auto-update.js +186 -0
- package/dist/agent/daily-planner.d.ts +24 -0
- package/dist/agent/daily-planner.js +379 -0
- package/dist/agent/execution-advisor.d.ts +10 -0
- package/dist/agent/execution-advisor.js +272 -0
- package/dist/agent/hooks.d.ts +45 -0
- package/dist/agent/hooks.js +564 -0
- package/dist/agent/insight-engine.d.ts +66 -0
- package/dist/agent/insight-engine.js +225 -0
- package/dist/agent/intent-classifier.d.ts +48 -0
- package/dist/agent/intent-classifier.js +214 -0
- package/dist/agent/link-extractor.d.ts +19 -0
- package/dist/agent/link-extractor.js +90 -0
- package/dist/agent/mcp-bridge.d.ts +62 -0
- package/dist/agent/mcp-bridge.js +435 -0
- package/dist/agent/metacognition.d.ts +66 -0
- package/dist/agent/metacognition.js +221 -0
- package/dist/agent/orchestrator.d.ts +81 -0
- package/dist/agent/orchestrator.js +790 -0
- package/dist/agent/profiles.d.ts +22 -0
- package/dist/agent/profiles.js +91 -0
- package/dist/agent/prompt-cache.d.ts +24 -0
- package/dist/agent/prompt-cache.js +68 -0
- package/dist/agent/prompt-evolver.d.ts +28 -0
- package/dist/agent/prompt-evolver.js +279 -0
- package/dist/agent/role-scaffolds.d.ts +28 -0
- package/dist/agent/role-scaffolds.js +433 -0
- package/dist/agent/safe-restart.d.ts +41 -0
- package/dist/agent/safe-restart.js +150 -0
- package/dist/agent/self-improve.d.ts +66 -0
- package/dist/agent/self-improve.js +1706 -0
- package/dist/agent/session-event-log.d.ts +114 -0
- package/dist/agent/session-event-log.js +233 -0
- package/dist/agent/skill-extractor.d.ts +72 -0
- package/dist/agent/skill-extractor.js +435 -0
- package/dist/agent/source-mods.d.ts +61 -0
- package/dist/agent/source-mods.js +230 -0
- package/dist/agent/source-preflight.d.ts +25 -0
- package/dist/agent/source-preflight.js +100 -0
- package/dist/agent/stall-guard.d.ts +62 -0
- package/dist/agent/stall-guard.js +109 -0
- package/dist/agent/strategic-planner.d.ts +60 -0
- package/dist/agent/strategic-planner.js +352 -0
- package/dist/agent/team-bus.d.ts +89 -0
- package/dist/agent/team-bus.js +556 -0
- package/dist/agent/team-router.d.ts +26 -0
- package/dist/agent/team-router.js +37 -0
- package/dist/agent/tool-loop-detector.d.ts +59 -0
- package/dist/agent/tool-loop-detector.js +242 -0
- package/dist/agent/workflow-runner.d.ts +36 -0
- package/dist/agent/workflow-runner.js +317 -0
- package/dist/agent/workflow-variables.d.ts +16 -0
- package/dist/agent/workflow-variables.js +62 -0
- package/dist/channels/discord-agent-bot.d.ts +101 -0
- package/dist/channels/discord-agent-bot.js +881 -0
- package/dist/channels/discord-bot-manager.d.ts +80 -0
- package/dist/channels/discord-bot-manager.js +262 -0
- package/dist/channels/discord-utils.d.ts +51 -0
- package/dist/channels/discord-utils.js +293 -0
- package/dist/channels/discord.d.ts +12 -0
- package/dist/channels/discord.js +1832 -0
- package/dist/channels/slack-agent-bot.d.ts +73 -0
- package/dist/channels/slack-agent-bot.js +320 -0
- package/dist/channels/slack-bot-manager.d.ts +66 -0
- package/dist/channels/slack-bot-manager.js +236 -0
- package/dist/channels/slack-utils.d.ts +39 -0
- package/dist/channels/slack-utils.js +189 -0
- package/dist/channels/slack.d.ts +11 -0
- package/dist/channels/slack.js +196 -0
- package/dist/channels/telegram.d.ts +10 -0
- package/dist/channels/telegram.js +235 -0
- package/dist/channels/webhook.d.ts +9 -0
- package/dist/channels/webhook.js +78 -0
- package/dist/channels/whatsapp.d.ts +11 -0
- package/dist/channels/whatsapp.js +181 -0
- package/dist/cli/chat.d.ts +14 -0
- package/dist/cli/chat.js +220 -0
- package/dist/cli/cron.d.ts +17 -0
- package/dist/cli/cron.js +552 -0
- package/dist/cli/dashboard.d.ts +15 -0
- package/dist/cli/dashboard.js +17677 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +2474 -0
- package/dist/cli/routes/delegations.d.ts +19 -0
- package/dist/cli/routes/delegations.js +154 -0
- package/dist/cli/routes/digest.d.ts +17 -0
- package/dist/cli/routes/digest.js +375 -0
- package/dist/cli/routes/goals.d.ts +14 -0
- package/dist/cli/routes/goals.js +258 -0
- package/dist/cli/routes/workflows.d.ts +18 -0
- package/dist/cli/routes/workflows.js +97 -0
- package/dist/cli/setup.d.ts +8 -0
- package/dist/cli/setup.js +619 -0
- package/dist/cli/tunnel.d.ts +35 -0
- package/dist/cli/tunnel.js +141 -0
- package/dist/config.d.ts +145 -0
- package/dist/config.js +278 -0
- package/dist/events/bus.d.ts +43 -0
- package/dist/events/bus.js +136 -0
- package/dist/gateway/cron-scheduler.d.ts +166 -0
- package/dist/gateway/cron-scheduler.js +1767 -0
- package/dist/gateway/delivery-queue.d.ts +30 -0
- package/dist/gateway/delivery-queue.js +110 -0
- package/dist/gateway/heartbeat-scheduler.d.ts +99 -0
- package/dist/gateway/heartbeat-scheduler.js +1298 -0
- package/dist/gateway/heartbeat.d.ts +3 -0
- package/dist/gateway/heartbeat.js +3 -0
- package/dist/gateway/lanes.d.ts +24 -0
- package/dist/gateway/lanes.js +76 -0
- package/dist/gateway/notifications.d.ts +29 -0
- package/dist/gateway/notifications.js +75 -0
- package/dist/gateway/router.d.ts +210 -0
- package/dist/gateway/router.js +1330 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1015 -0
- package/dist/memory/chunker.d.ts +28 -0
- package/dist/memory/chunker.js +226 -0
- package/dist/memory/consolidation.d.ts +44 -0
- package/dist/memory/consolidation.js +171 -0
- package/dist/memory/context-assembler.d.ts +50 -0
- package/dist/memory/context-assembler.js +149 -0
- package/dist/memory/embeddings.d.ts +38 -0
- package/dist/memory/embeddings.js +180 -0
- package/dist/memory/graph-store.d.ts +66 -0
- package/dist/memory/graph-store.js +613 -0
- package/dist/memory/mmr.d.ts +21 -0
- package/dist/memory/mmr.js +75 -0
- package/dist/memory/search.d.ts +26 -0
- package/dist/memory/search.js +67 -0
- package/dist/memory/store.d.ts +530 -0
- package/dist/memory/store.js +2022 -0
- package/dist/security/integrity.d.ts +24 -0
- package/dist/security/integrity.js +58 -0
- package/dist/security/patterns.d.ts +34 -0
- package/dist/security/patterns.js +110 -0
- package/dist/security/scanner.d.ts +32 -0
- package/dist/security/scanner.js +263 -0
- package/dist/tools/admin-tools.d.ts +12 -0
- package/dist/tools/admin-tools.js +1278 -0
- package/dist/tools/external-tools.d.ts +11 -0
- package/dist/tools/external-tools.js +1327 -0
- package/dist/tools/goal-tools.d.ts +9 -0
- package/dist/tools/goal-tools.js +159 -0
- package/dist/tools/mcp-server.d.ts +13 -0
- package/dist/tools/mcp-server.js +141 -0
- package/dist/tools/memory-tools.d.ts +10 -0
- package/dist/tools/memory-tools.js +568 -0
- package/dist/tools/session-tools.d.ts +6 -0
- package/dist/tools/session-tools.js +146 -0
- package/dist/tools/shared.d.ts +216 -0
- package/dist/tools/shared.js +340 -0
- package/dist/tools/team-tools.d.ts +6 -0
- package/dist/tools/team-tools.js +447 -0
- package/dist/tools/tool-meta.d.ts +34 -0
- package/dist/tools/tool-meta.js +133 -0
- package/dist/tools/vault-tools.d.ts +8 -0
- package/dist/tools/vault-tools.js +457 -0
- package/dist/types.d.ts +716 -0
- package/dist/types.js +16 -0
- package/dist/vault-migrations/0001-add-execution-framework.d.ts +10 -0
- package/dist/vault-migrations/0001-add-execution-framework.js +47 -0
- package/dist/vault-migrations/0002-add-agentic-communication.d.ts +12 -0
- package/dist/vault-migrations/0002-add-agentic-communication.js +79 -0
- package/dist/vault-migrations/0003-update-execution-pipeline-narration.d.ts +11 -0
- package/dist/vault-migrations/0003-update-execution-pipeline-narration.js +73 -0
- package/dist/vault-migrations/helpers.d.ts +14 -0
- package/dist/vault-migrations/helpers.js +44 -0
- package/dist/vault-migrations/runner.d.ts +14 -0
- package/dist/vault-migrations/runner.js +139 -0
- package/dist/vault-migrations/types.d.ts +42 -0
- package/dist/vault-migrations/types.js +9 -0
- package/install.sh +320 -0
- package/package.json +84 -0
- package/scripts/postinstall.js +125 -0
- package/vault/00-System/AGENTS.md +66 -0
- package/vault/00-System/CRON.md +71 -0
- package/vault/00-System/HEARTBEAT.md +58 -0
- package/vault/00-System/MEMORY.md +16 -0
- package/vault/00-System/SOUL.md +96 -0
- package/vault/05-Tasks/TASKS.md +19 -0
- package/vault/06-Templates/_Daily-Template.md +28 -0
- package/vault/06-Templates/_People-Template.md +22 -0
package/README.md
ADDED
|
@@ -0,0 +1,795 @@
|
|
|
1
|
+
```
|
|
2
|
+
██████╗██╗ ███████╗███╗ ███╗███████╗███╗ ██╗████████╗██╗███╗ ██╗███████╗
|
|
3
|
+
██╔════╝██║ ██╔════╝████╗ ████║██╔════╝████╗ ██║╚══██╔══╝██║████╗ ██║██╔════╝
|
|
4
|
+
██║ ██║ █████╗ ██╔████╔██║█████╗ ██╔██╗ ██║ ██║ ██║██╔██╗ ██║█████╗
|
|
5
|
+
██║ ██║ ██╔══╝ ██║╚██╔╝██║██╔══╝ ██║╚██╗██║ ██║ ██║██║╚██╗██║██╔══╝
|
|
6
|
+
╚██████╗███████╗███████╗██║ ╚═╝ ██║███████╗██║ ╚████║ ██║ ██║██║ ╚████║███████╗
|
|
7
|
+
╚═════╝╚══════╝╚══════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
A persistent, ever-learning personal AI assistant that runs as a background daemon on macOS.
|
|
11
|
+
Built on the [Claude Code SDK](https://docs.anthropic.com/en/docs/claude-code-sdk), Obsidian-compatible vault, and SQLite FTS5.
|
|
12
|
+
|
|
13
|
+
Connects to Discord, Slack, Telegram, WhatsApp, and webhooks. Remembers everything. Runs 24/7.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## How it works
|
|
18
|
+
|
|
19
|
+
Clementine is three layers stacked on a shared memory store:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
┌─────────────────────────────────────────┐
|
|
23
|
+
│ Channel Layer │
|
|
24
|
+
│ Discord · Slack · Telegram · WhatsApp │
|
|
25
|
+
│ Webhook API · Discord Guild Channels │
|
|
26
|
+
└────────────────┬────────────────────────┘
|
|
27
|
+
│
|
|
28
|
+
┌────────────────▼────────────────────────┐
|
|
29
|
+
│ Gateway Layer │
|
|
30
|
+
│ Router · Session Manager · Heartbeat │
|
|
31
|
+
│ Cron Scheduler · Unleashed Engine │
|
|
32
|
+
│ Notification Dispatch │
|
|
33
|
+
└────────────────┬────────────────────────┘
|
|
34
|
+
│
|
|
35
|
+
┌────────────────▼────────────────────────┐
|
|
36
|
+
│ Agent Layer │
|
|
37
|
+
│ Claude Code SDK · Security Hooks │
|
|
38
|
+
│ Auto-Memory · Session Rotation │
|
|
39
|
+
│ Agent Profiles · Sub-Agent Teams │
|
|
40
|
+
│ Self-Improvement Loop │
|
|
41
|
+
└────────────────┬────────────────────────┘
|
|
42
|
+
│
|
|
43
|
+
┌────────────────▼────────────────────────┐
|
|
44
|
+
│ MCP Tool Server │
|
|
45
|
+
│ 30+ tools over stdio transport │
|
|
46
|
+
│ Memory · Tasks · Vault · Workspace │
|
|
47
|
+
└────────────────┬────────────────────────┘
|
|
48
|
+
│
|
|
49
|
+
┌──────────────────────▼──────────────────────┐
|
|
50
|
+
│ Memory Store │
|
|
51
|
+
│ SQLite FTS5 · Salience Scoring · Decay │
|
|
52
|
+
│ Episodic Memory · Wikilink Graph │
|
|
53
|
+
│ FalkorDB Knowledge Graph · Procedural Skills│
|
|
54
|
+
│ Obsidian Vault (source of truth) │
|
|
55
|
+
└─────────────────────────────────────────────┘
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### The memory loop
|
|
59
|
+
|
|
60
|
+
Every conversation triggers a background extraction pass (Sonnet) that saves facts, preferences, people, and tasks to the Obsidian vault. The vault is indexed into SQLite FTS5 with automatic triggers. Retrieved memories get salience boosts. Stale memories decay over time. Old data is pruned on startup.
|
|
61
|
+
|
|
62
|
+
The result: Clementine gets better the more you talk to it.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Prerequisites
|
|
67
|
+
|
|
68
|
+
- **Node.js 20-24 LTS** — `nvm install 22`
|
|
69
|
+
- **Claude Code CLI** — already installed if you're reading this in Claude Code
|
|
70
|
+
|
|
71
|
+
## Quick start
|
|
72
|
+
|
|
73
|
+
**Option A — npm (recommended):**
|
|
74
|
+
```bash
|
|
75
|
+
npm install -g clementine-agent
|
|
76
|
+
clementine setup
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Option B — from source (for development):**
|
|
80
|
+
```bash
|
|
81
|
+
git clone https://github.com/Natebreynolds/Clementine-AI-Assistant.git clementine
|
|
82
|
+
cd clementine
|
|
83
|
+
bash install.sh
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The install script handles everything: system dependencies (redis, libomp, build tools), npm packages, TypeScript build, global CLI install, and launches the setup wizard. Safe to re-run — skips anything already installed.
|
|
87
|
+
|
|
88
|
+
After setup:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
clementine launch # start as background daemon
|
|
92
|
+
clementine status # verify it's running
|
|
93
|
+
clementine dashboard # open the web command center
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Already have it? Update in place:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
clementine update
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
That's it. Clementine is now running, connected to your configured channels, and learning.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Architecture
|
|
107
|
+
|
|
108
|
+
### File layout
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
~/.clementine/ ← Data home (created on first run)
|
|
112
|
+
├── .env ← Configuration (created by setup wizard)
|
|
113
|
+
├── .sessions.json ← Session persistence
|
|
114
|
+
├── .memory.db ← (legacy, unused — real DB is vault/.memory.db)
|
|
115
|
+
├── .clementine.pid ← Daemon PID lock
|
|
116
|
+
├── logs/
|
|
117
|
+
│ ├── clementine.log ← Daemon stdout/stderr
|
|
118
|
+
│ └── audit.log ← Security audit trail
|
|
119
|
+
├── cron/runs/ ← Per-job JSONL run logs
|
|
120
|
+
├── unleashed/ ← Unleashed task progress & checkpoints
|
|
121
|
+
│ └── <task>/
|
|
122
|
+
│ ├── status.json ← Current status, phase, timing
|
|
123
|
+
│ └── progress.jsonl ← Phase-by-phase event log
|
|
124
|
+
├── self-improve/ ← Self-improvement state
|
|
125
|
+
│ ├── experiment-log.jsonl ← Append-only experiment history
|
|
126
|
+
│ ├── state.json ← Loop status, baseline metrics
|
|
127
|
+
│ └── pending-changes/ ← Proposed diffs awaiting approval
|
|
128
|
+
│ └── {experiment-id}.json
|
|
129
|
+
└── vault/ ← Obsidian-compatible vault
|
|
130
|
+
├── 00-System/ ← SOUL.md, MEMORY.md, HEARTBEAT.md, CRON.md
|
|
131
|
+
│ └── skills/ ← Procedural memory (auto-extracted from successful tasks)
|
|
132
|
+
├── 01-Daily-Notes/ ← Auto-generated daily logs (YYYY-MM-DD.md)
|
|
133
|
+
├── 02-People/ ← Person notes (auto-created from conversations)
|
|
134
|
+
├── 03-Projects/ ← Project notes
|
|
135
|
+
├── 04-Topics/ ← Knowledge topics
|
|
136
|
+
├── 05-Tasks/ ← TASKS.md master list ({T-NNN} IDs)
|
|
137
|
+
├── 06-Templates/ ← Note templates
|
|
138
|
+
└── 07-Inbox/ ← Quick captures
|
|
139
|
+
|
|
140
|
+
src/ ← Package code (wherever npm installed it)
|
|
141
|
+
├── agent/
|
|
142
|
+
│ ├── assistant.ts ← PersonalAssistant — the brain
|
|
143
|
+
│ ├── hooks.ts ← Security enforcement (3-tier model)
|
|
144
|
+
│ ├── profiles.ts ← Agent profile switching
|
|
145
|
+
│ └── self-improve.ts ← Nightly self-improvement loop engine
|
|
146
|
+
├── channels/
|
|
147
|
+
│ ├── discord.ts ← Discord.js adapter
|
|
148
|
+
│ ├── slack.ts ← Slack Socket Mode adapter
|
|
149
|
+
│ ├── telegram.ts ← grammY adapter
|
|
150
|
+
│ ├── whatsapp.ts ← Twilio WhatsApp bridge
|
|
151
|
+
│ └── webhook.ts ← HTTP webhook API
|
|
152
|
+
├── gateway/
|
|
153
|
+
│ ├── router.ts ← Message routing + session management
|
|
154
|
+
│ ├── heartbeat.ts ← HeartbeatScheduler + CronScheduler
|
|
155
|
+
│ └── notifications.ts ← Channel-agnostic notification fan-out
|
|
156
|
+
├── memory/
|
|
157
|
+
│ ├── store.ts ← SQLite FTS5 memory store + embedding backfill
|
|
158
|
+
│ ├── embeddings.ts ← TF-IDF embedding provider (local, 512-dim vectors)
|
|
159
|
+
│ ├── search.ts ← Temporal decay, dedup, formatting
|
|
160
|
+
│ ├── chunker.ts ← Vault file parser (## headers, frontmatter)
|
|
161
|
+
│ ├── mmr.ts ← Maximal Marginal Relevance reranker
|
|
162
|
+
│ ├── consolidation.ts ← Evening consolidation engine (dedup, summarize, extract)
|
|
163
|
+
│ ├── context-assembler.ts ← Token-budgeted context slot filler
|
|
164
|
+
│ └── graph-store.ts ← FalkorDB knowledge graph layer (optional)
|
|
165
|
+
├── tools/ ← MCP stdio server (30+ tools, decomposed by domain)
|
|
166
|
+
│ ├── mcp-server.ts ← Server entry + registration
|
|
167
|
+
│ ├── goal-tools.ts ← Goal lifecycle tools
|
|
168
|
+
│ ├── vault-tools.ts ← Vault read/write/search tools
|
|
169
|
+
│ ├── team-tools.ts ← Team agent tools
|
|
170
|
+
│ ├── session-tools.ts ← Session management tools
|
|
171
|
+
│ └── admin-tools.ts ← System admin tools
|
|
172
|
+
├── cli/
|
|
173
|
+
│ ├── index.ts ← CLI commands (launch, stop, status, config, doctor)
|
|
174
|
+
│ ├── setup.ts ← Interactive configuration wizard
|
|
175
|
+
│ ├── dashboard.ts ← Local web dashboard (command center)
|
|
176
|
+
│ └── cron.ts ← Cron job runner and scheduler
|
|
177
|
+
├── config.ts ← Paths, secrets, models (never pollutes process.env)
|
|
178
|
+
├── types.ts ← Shared TypeScript interfaces
|
|
179
|
+
└── index.ts ← Main entry point (multi-channel startup)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Code vs. data separation
|
|
183
|
+
|
|
184
|
+
| Concept | Variable | Location |
|
|
185
|
+
|---------|----------|----------|
|
|
186
|
+
| Package root | `PKG_DIR` | Wherever npm installed the package |
|
|
187
|
+
| Data home | `BASE_DIR` | `~/.clementine/` (or `CLEMENTINE_HOME` env var) |
|
|
188
|
+
|
|
189
|
+
The CLI works from any directory. First run copies vault templates from the package to `~/.clementine/`.
|
|
190
|
+
|
|
191
|
+
### Security model
|
|
192
|
+
|
|
193
|
+
Three-tier enforcement via the SDK `canUseTool` callback:
|
|
194
|
+
|
|
195
|
+
| Tier | Auto-allowed | Examples |
|
|
196
|
+
|------|-------------|----------|
|
|
197
|
+
| **1** | Always | Read files, vault writes, web search, safe git |
|
|
198
|
+
| **2** | Logged | External writes, git commit, bash dev commands |
|
|
199
|
+
| **3** | Blocked in autonomous mode | Push, delete, credentials, form submit |
|
|
200
|
+
|
|
201
|
+
Heartbeats run Tier 1 only. Cron jobs respect per-job tier settings in `CRON.md`. Unleashed tasks inherit their job's tier.
|
|
202
|
+
All autonomous tasks (cron jobs, heartbeats, unleashed) can spawn sub-agents for parallel work — sub-agents inherit the parent's tier constraints.
|
|
203
|
+
Secrets never reach the Claude subprocess — `SAFE_ENV` filters credentials from `process.env`, and `.env` is parsed locally without polluting the environment.
|
|
204
|
+
|
|
205
|
+
### Memory architecture
|
|
206
|
+
|
|
207
|
+
Three-layer retrieval merges full-text, vector, and recency signals into a single ranked context window:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
User message
|
|
211
|
+
│
|
|
212
|
+
├──▶ Layer 1: FTS5 (BM25 relevance)
|
|
213
|
+
├──▶ Layer 2: TF-IDF vector similarity (cosine, threshold 0.15)
|
|
214
|
+
├──▶ Layer 3: Recent chunks (time-windowed)
|
|
215
|
+
│
|
|
216
|
+
▼
|
|
217
|
+
┌──────────────────┐ ┌────────────────────┐
|
|
218
|
+
│ MMR rerank │────▶│ Context assembly │──▶ System prompt
|
|
219
|
+
│ + deduplication │ │ (token-budgeted) │
|
|
220
|
+
└──────────────────┘ └────────────────────┘
|
|
221
|
+
│
|
|
222
|
+
│ salience boost on retrieval
|
|
223
|
+
▼
|
|
224
|
+
┌──────────────┐ ┌────────────────────┐
|
|
225
|
+
│ Assistant │────▶│ Auto-memory pass │──▶ Vault writes
|
|
226
|
+
│ responds │ │ (background Sonnet) │ (MEMORY.md, people, tasks)
|
|
227
|
+
└──────────────┘ └────────────────────┘
|
|
228
|
+
│
|
|
229
|
+
▼
|
|
230
|
+
┌──────────────┐
|
|
231
|
+
│ Session │──▶ Episodic chunk indexed
|
|
232
|
+
│ summarization │ (sector='episodic')
|
|
233
|
+
└──────────────┘
|
|
234
|
+
│
|
|
235
|
+
▼
|
|
236
|
+
┌──────────────────────┐
|
|
237
|
+
│ Evening consolidation │──▶ Dedup (Jaccard) + topic summarization (LLM)
|
|
238
|
+
│ + embedding rebuild │ + principle extraction + TF-IDF vocab rebuild
|
|
239
|
+
└──────────────────────┘
|
|
240
|
+
│
|
|
241
|
+
▼
|
|
242
|
+
┌──────────────┐
|
|
243
|
+
│ Startup │──▶ Temporal decay + pruning
|
|
244
|
+
│ maintenance │ (stale memories sink, old data trimmed)
|
|
245
|
+
└──────────────┘
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
- **FTS5** — Full-text search with BM25 ranking, zero-cost, zero-latency
|
|
249
|
+
- **TF-IDF embeddings** — Local 512-dim vectors (no API calls), vocabulary rebuilt during sync and evening consolidation, cosine similarity search over recent chunks
|
|
250
|
+
- **MMR reranking** — Maximal Marginal Relevance via Jaccard similarity removes near-duplicates and promotes diversity in results
|
|
251
|
+
- **Salience scoring** — Chunks gain score on retrieval, decay over time (7-day half-life). Formula: `log(access_count + 1) * 0.15 + recency_decay * 0.3`
|
|
252
|
+
- **Episodic memory** — Session summaries indexed as searchable chunks
|
|
253
|
+
- **Wikilink graph** — `[[wikilinks]]` parsed and queryable for connection discovery
|
|
254
|
+
- **Knowledge graph** — FalkorDB-powered typed relationships and multi-hop traversal (people → projects → topics). Visualized on a dark canvas in the dashboard with type legend and edge labels.
|
|
255
|
+
- **Procedural skills** — Reusable how-to recipes auto-extracted from successful task executions. Stored as Markdown in `vault/00-System/skills/` and injected into cron jobs and unleashed tasks at runtime. Teach new skills manually via the dashboard Skills tab or let Clementine learn them from conversations.
|
|
256
|
+
- **Evening consolidation** — Nightly pass: deduplicates chunks by Jaccard similarity (>70%), summarizes topic groups via LLM (Haiku), extracts recurring behavioral corrections into permanent rules, and rebuilds TF-IDF vocabulary + backfills embeddings
|
|
257
|
+
- **Agent isolation** — Per-agent memory scoping via `agent_slug` column. Soft mode (default) boosts matching agent chunks 1.4x; strict mode filters to agent + global only
|
|
258
|
+
- **Memory transparency** — Every memory write is logged to `memory_extractions` with user correction/dismissal support from the dashboard
|
|
259
|
+
- **Temporal decay** — Applied on every startup; stale memories naturally sink
|
|
260
|
+
- **Pruning** — Episodic chunks >90 days with salience <0.01 are removed; old transcripts, access logs, and orphaned references trimmed
|
|
261
|
+
|
|
262
|
+
### MCP tools (30+)
|
|
263
|
+
|
|
264
|
+
| Tool | Description |
|
|
265
|
+
|------|-------------|
|
|
266
|
+
| `memory_read` | Read vault notes (shortcuts: today, yesterday, memory, tasks, soul) |
|
|
267
|
+
| `memory_write` | Write/append to vault (daily log, MEMORY.md sections, arbitrary notes) |
|
|
268
|
+
| `memory_search` | FTS5 full-text search across all vault notes |
|
|
269
|
+
| `memory_recall` | Combined FTS5 + recency search with salience boost |
|
|
270
|
+
| `memory_connections` | Query the wikilink graph for a note |
|
|
271
|
+
| `memory_timeline` | Chronological view of vault changes by date range |
|
|
272
|
+
| `transcript_search` | Search past conversation transcripts |
|
|
273
|
+
| `note_create` | Create notes (person, project, topic, task, inbox) |
|
|
274
|
+
| `note_take` | Quick timestamped capture to daily log |
|
|
275
|
+
| `daily_note` | Create or read today's daily note |
|
|
276
|
+
| `task_list` | List tasks with status/project filters |
|
|
277
|
+
| `task_add` | Add tasks with priority, due dates, projects |
|
|
278
|
+
| `task_update` | Update task status (supports recurring tasks) |
|
|
279
|
+
| `vault_stats` | Dashboard of vault health and activity |
|
|
280
|
+
| `rss_fetch` | Fetch and parse RSS/Atom feeds |
|
|
281
|
+
| `github_prs` | Check GitHub PRs (review-requested + authored) |
|
|
282
|
+
| `browser_screenshot` | Take screenshots via Kernel cloud browser |
|
|
283
|
+
| `set_timer` | Set short-term reminders (notifies via active channels) |
|
|
284
|
+
| `outlook_inbox` | Read recent emails from Outlook inbox |
|
|
285
|
+
| `outlook_search` | Search Outlook emails by query |
|
|
286
|
+
| `outlook_calendar` | View upcoming calendar events |
|
|
287
|
+
| `outlook_draft` | Create an email draft in Outlook |
|
|
288
|
+
| `outlook_send` | Send an email from Outlook (Tier 3, requires approval) |
|
|
289
|
+
| `discord_channel_send` | Post messages to any Discord text channel by ID |
|
|
290
|
+
| `workspace_config` | Add, remove, or list workspace directories at runtime |
|
|
291
|
+
| `workspace_list` | Scan workspace directories for local project roots |
|
|
292
|
+
| `workspace_info` | Read a project's README, CLAUDE.md, manifest, and directory tree |
|
|
293
|
+
| `add_cron_job` | Create scheduled tasks (supports standard and unleashed mode, project context) |
|
|
294
|
+
| `self_restart` | Restart the daemon (for self-updates and config changes) |
|
|
295
|
+
| `analyze_image` | Analyze images with vision capabilities |
|
|
296
|
+
| `memory_report` | Generate a transparency report of all memory extractions |
|
|
297
|
+
| `memory_correct` | Correct or dismiss a previously extracted memory |
|
|
298
|
+
| `feedback_log` | Log user feedback on responses |
|
|
299
|
+
| `feedback_report` | View feedback history and patterns |
|
|
300
|
+
| `team_list` | List all team agents with status, channel, and capabilities |
|
|
301
|
+
| `team_message` | Send a message to another agent (permission-scoped, synchronous) |
|
|
302
|
+
| `create_agent` | Create a new agent with name, role, tools, project, and team connections |
|
|
303
|
+
| `self_improve_status` | Check self-improvement state, pending approvals, experiment history |
|
|
304
|
+
| `self_improve_run` | Trigger a self-improvement analysis cycle |
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## CLI reference
|
|
309
|
+
|
|
310
|
+
```
|
|
311
|
+
clementine launch Start as background daemon (default)
|
|
312
|
+
clementine launch -f Start in foreground (debug mode)
|
|
313
|
+
clementine launch --install Install as macOS login service (survives reboots)
|
|
314
|
+
clementine stop Stop the daemon
|
|
315
|
+
clementine restart Stop + relaunch
|
|
316
|
+
clementine rebuild Build + restart daemon + dashboard in one step
|
|
317
|
+
clementine status Show PID, uptime, active channels
|
|
318
|
+
clementine update Pull latest, rebuild, reinstall (preserves config)
|
|
319
|
+
clementine update --dry-run Preview update without making changes
|
|
320
|
+
clementine doctor Verify configuration and vault health
|
|
321
|
+
clementine doctor --fix Auto-fix common issues (redis, sqlite, FalkorDB)
|
|
322
|
+
clementine dashboard Open the local web command center (localhost:3030)
|
|
323
|
+
clementine tools List available MCP tools, plugins, and channels
|
|
324
|
+
clementine config setup Interactive configuration wizard
|
|
325
|
+
clementine config set KEY VAL Set a single config value
|
|
326
|
+
clementine config get KEY Read a config value
|
|
327
|
+
clementine cron list List all cron jobs and last run status
|
|
328
|
+
clementine cron run <job> Run a specific cron job
|
|
329
|
+
clementine cron run-due Run all due jobs (for OS scheduler)
|
|
330
|
+
clementine cron runs [job] View run history (with retry/error details)
|
|
331
|
+
clementine cron install Install OS-level scheduler (launchd/crontab)
|
|
332
|
+
clementine cron uninstall Remove OS-level scheduler
|
|
333
|
+
clementine heartbeat Run a one-shot heartbeat check
|
|
334
|
+
clementine self-improve status Show self-improvement state and baseline metrics
|
|
335
|
+
clementine self-improve run Trigger a self-improvement cycle
|
|
336
|
+
clementine self-improve history Show experiment history
|
|
337
|
+
clementine self-improve apply <id> Approve and apply a pending change
|
|
338
|
+
clementine --help Show all commands
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Daemon behavior
|
|
342
|
+
|
|
343
|
+
- **Default mode** — `clementine launch` daemonizes (detached, returns to shell)
|
|
344
|
+
- **Logs** — `~/.clementine/logs/clementine.log` (pino JSON lines, appended)
|
|
345
|
+
- **PID lock** — `~/.clementine/.clementine.pid` prevents duplicate instances
|
|
346
|
+
- **LaunchAgent** — `--install` creates a macOS plist with `KeepAlive` + `ThrottleInterval`
|
|
347
|
+
- **Graceful shutdown** — Handles SIGTERM/SIGINT, cleans up PID file, checkpoints SQLite WAL
|
|
348
|
+
|
|
349
|
+
### Dashboard
|
|
350
|
+
|
|
351
|
+
Run `clementine dashboard` to open a local web command center at `http://localhost:3030`. The dashboard provides:
|
|
352
|
+
|
|
353
|
+
- **Metrics** — Time saved estimates, session counts, cron job stats, memory size
|
|
354
|
+
- **Chat** — Talk to your assistant directly from the browser
|
|
355
|
+
- **Memory search** — Full-text search across all vault notes (FTS5)
|
|
356
|
+
- **Scheduled tasks** — Create, edit, run, toggle, and delete cron jobs with a visual schedule builder
|
|
357
|
+
- **Project-aware cron** — Assign cron jobs to specific project directories
|
|
358
|
+
- **Unleashed mode** — Create long-running autonomous tasks, monitor phase progress, cancel running tasks
|
|
359
|
+
- **Projects** — Browse all discovered workspace projects with type, description, and tool badges
|
|
360
|
+
- **Live status** — Daemon health, LaunchAgent status, active channels
|
|
361
|
+
- **Sessions** — View and manage active conversation sessions
|
|
362
|
+
- **The Office** — Visual agent management with desk-station cards showing status, avatars, channels, and tools
|
|
363
|
+
- **Hiring Interview** — Click "Hire a New Employee" and Clementine interviews you to build the agent config conversationally
|
|
364
|
+
- **Manual Agent Setup** — Form modal with project dropdown (auto-populated from discovered projects) and categorized tool browser with checkboxes
|
|
365
|
+
- **Auto-restart** — Daemon restarts automatically when the agent roster changes (from either the interview or manual path)
|
|
366
|
+
- **Training Center** — Click any agent to open a 4-tab detail view: Schedule (per-agent cron jobs), Skills (per-agent procedural memory), Execution Traces (tool call history with timing), and Prompt Lab (test prompts against the agent)
|
|
367
|
+
- **Skills** — Teach, view, and delete procedural skills. Skills are auto-extracted from successful tasks or taught manually via the dashboard.
|
|
368
|
+
- **Self-Improvement** — View experiment history, approve/deny pending proposals, monitor baseline metrics
|
|
369
|
+
- **Settings** — API key management, model config, custom env vars, service status
|
|
370
|
+
|
|
371
|
+
No extra dependencies — the dashboard uses Express, which is already installed.
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## Configuration
|
|
376
|
+
|
|
377
|
+
The setup wizard (`clementine config setup`) writes `~/.clementine/.env`:
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
# Assistant Identity
|
|
381
|
+
ASSISTANT_NAME=Clementine
|
|
382
|
+
ASSISTANT_NICKNAME=Clemmy
|
|
383
|
+
OWNER_NAME=Nathan
|
|
384
|
+
|
|
385
|
+
# Model (haiku / sonnet / opus)
|
|
386
|
+
DEFAULT_MODEL_TIER=sonnet
|
|
387
|
+
|
|
388
|
+
# Channels — configure one or more
|
|
389
|
+
DISCORD_TOKEN=...
|
|
390
|
+
DISCORD_OWNER_ID=...
|
|
391
|
+
DISCORD_WATCHED_CHANNELS=... # optional, comma-separated channel IDs
|
|
392
|
+
SLACK_BOT_TOKEN=...
|
|
393
|
+
SLACK_APP_TOKEN=...
|
|
394
|
+
TELEGRAM_BOT_TOKEN=...
|
|
395
|
+
TWILIO_ACCOUNT_SID=...
|
|
396
|
+
|
|
397
|
+
# Voice (optional)
|
|
398
|
+
GROQ_API_KEY=... # Whisper STT
|
|
399
|
+
ELEVENLABS_API_KEY=... # TTS
|
|
400
|
+
|
|
401
|
+
# Video analysis (optional)
|
|
402
|
+
GOOGLE_API_KEY=... # Gemini
|
|
403
|
+
|
|
404
|
+
# Workspace (optional)
|
|
405
|
+
WORKSPACE_DIRS=~/projects,~/work
|
|
406
|
+
|
|
407
|
+
# Security
|
|
408
|
+
ALLOW_ALL_USERS=false # true = skip owner checks
|
|
409
|
+
|
|
410
|
+
# Beta Features
|
|
411
|
+
ENABLE_1M_CONTEXT=false # Enable 1M token context for Sonnet (toggle in dashboard)
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
Secrets can also be stored in macOS Keychain (`security find-generic-password`) — Clementine checks Keychain as a fallback for any missing `.env` value.
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
## Models
|
|
419
|
+
|
|
420
|
+
| Tier | Model Alias | Use case |
|
|
421
|
+
|------|-------------|----------|
|
|
422
|
+
| `haiku` | `haiku` (latest Haiku) | Lightweight tasks, cron noise filtering |
|
|
423
|
+
| `sonnet` | `sonnet` (latest Sonnet) | Default conversation + auto-memory extraction |
|
|
424
|
+
| `opus` | `opus` (latest Opus) | Available via config or agent profiles |
|
|
425
|
+
|
|
426
|
+
Model aliases always resolve to the latest version via the Claude Code SDK. To pin a specific version, set `DEFAULT_MODEL_TIER` to a full model name (e.g. `claude-sonnet-4-6`).
|
|
427
|
+
|
|
428
|
+
Change the default with `clementine config set DEFAULT_MODEL_TIER opus`, then `clementine restart`.
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
## Channels
|
|
433
|
+
|
|
434
|
+
Enable channels by providing their tokens in `.env`. Clementine auto-detects which channels to start based on available credentials.
|
|
435
|
+
|
|
436
|
+
| Channel | Requires | Notes |
|
|
437
|
+
|---------|----------|-------|
|
|
438
|
+
| **Discord** | `DISCORD_TOKEN` + `DISCORD_OWNER_ID` | DMs + optional guild channels |
|
|
439
|
+
| **Slack** | `SLACK_BOT_TOKEN` + `SLACK_APP_TOKEN` | Socket Mode (no public URL needed) |
|
|
440
|
+
| **Telegram** | `TELEGRAM_BOT_TOKEN` | Long polling, owner-only by default |
|
|
441
|
+
| **WhatsApp** | `TWILIO_ACCOUNT_SID` + `TWILIO_AUTH_TOKEN` + `WHATSAPP_OWNER_PHONE` | Twilio bridge, requires webhook URL |
|
|
442
|
+
| **Webhook** | `WEBHOOK_ENABLED=true` + `WEBHOOK_SECRET` | HTTP API for custom integrations |
|
|
443
|
+
|
|
444
|
+
#### Discord guild channels
|
|
445
|
+
|
|
446
|
+
By default, Discord is DM-only. To let Clementine listen and respond in server text channels, set `DISCORD_WATCHED_CHANNELS` to a comma-separated list of channel IDs:
|
|
447
|
+
|
|
448
|
+
```bash
|
|
449
|
+
DISCORD_WATCHED_CHANNELS=1234567890,9876543210
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
Each watched channel gets its own session (separate from DM conversations). Replying to a bot message in a watched channel automatically includes the referenced message as context. Bot commands (`!clear`, `!model`, etc.) only work in DMs.
|
|
453
|
+
|
|
454
|
+
The `discord_channel_send` tool lets Clementine post to any channel by ID, useful for cron jobs that send digests or alerts to specific channels.
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
## Workspace discovery
|
|
459
|
+
|
|
460
|
+
Clementine automatically discovers local projects with zero configuration. On every scan, she checks common developer directories in your home folder:
|
|
461
|
+
|
|
462
|
+
> `Desktop`, `Documents`, `Developer`, `Projects`, `repos`, `src`, `code`, `work`, `dev`, `github`, `gitlab`
|
|
463
|
+
|
|
464
|
+
Any that exist are scanned for project roots (`.git`, `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, etc.).
|
|
465
|
+
|
|
466
|
+
For non-standard locations, add them via `WORKSPACE_DIRS` in `.env`:
|
|
467
|
+
|
|
468
|
+
```bash
|
|
469
|
+
WORKSPACE_DIRS=~/company/repos,/opt/projects
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
Or just tell Clementine at runtime — "add ~/company/repos to my workspace" — and she'll update the config immediately (no restart needed).
|
|
473
|
+
|
|
474
|
+
Three tools power this:
|
|
475
|
+
|
|
476
|
+
- **`workspace_config`** — Add, remove, or list workspace directories. Lists show which are auto-detected vs. explicitly configured. Changes take effect immediately.
|
|
477
|
+
- **`workspace_list`** — Scans all workspace directories for project roots. Returns name, type, path, description, and whether the project has a `CLAUDE.md`.
|
|
478
|
+
- **`workspace_info`** — Deep-reads a project: `README.md`, `.claude/CLAUDE.md`, `package.json`/`pyproject.toml`, and a directory tree (depth 2).
|
|
479
|
+
|
|
480
|
+
Clementine can then use her built-in file tools (`Read`, `Glob`, `Grep`, `Edit`, `Bash`) to work directly in any discovered project.
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
## Agents & Teams
|
|
485
|
+
|
|
486
|
+
Clementine supports multi-agent teams — each agent gets its own Discord bot, channel, project binding, tool allowlist, and personality. Agents can message each other via `team_message` with permission-scoped routing.
|
|
487
|
+
|
|
488
|
+
### Creating agents
|
|
489
|
+
|
|
490
|
+
Two paths to create a new agent:
|
|
491
|
+
|
|
492
|
+
| Method | How |
|
|
493
|
+
|--------|-----|
|
|
494
|
+
| **Hiring interview** | Click "Hire a New Employee" in the dashboard (or an empty desk card). Clementine asks 3–5 questions about the agent's name, role, tools, project, and team connections, then calls `create_agent` automatically. |
|
|
495
|
+
| **Manual setup** | Click "Manual Setup" to open a form with project dropdown, categorized tool browser, model selector, and team connection fields. |
|
|
496
|
+
|
|
497
|
+
Both paths trigger an automatic daemon restart when the new agent is detected.
|
|
498
|
+
|
|
499
|
+
### Agent configuration
|
|
500
|
+
|
|
501
|
+
Each agent is defined by a YAML frontmatter file in `~/.clementine/agents/<slug>/agent.md`:
|
|
502
|
+
|
|
503
|
+
| Field | Description |
|
|
504
|
+
|-------|-------------|
|
|
505
|
+
| `name` | Display name |
|
|
506
|
+
| `description` | Role description shown on desk card |
|
|
507
|
+
| `personality` | System prompt defining expertise and communication style |
|
|
508
|
+
| `channelName` | Discord channel the agent monitors |
|
|
509
|
+
| `model` | Model tier (haiku, sonnet, opus) |
|
|
510
|
+
| `project` | Bound project directory for workspace context |
|
|
511
|
+
| `tier` | Security tier (1 = read-only, 2 = read/write) |
|
|
512
|
+
| `allowedTools` | Tool allowlist (blank = all available) |
|
|
513
|
+
| `canMessage` | List of agent slugs this agent can message |
|
|
514
|
+
| `discordToken` | Dedicated Discord bot token for independent presence |
|
|
515
|
+
|
|
516
|
+
### Inter-agent communication
|
|
517
|
+
|
|
518
|
+
Agents communicate via the `team_message` tool. Messages are permission-scoped — an agent can only message slugs listed in its `canMessage` field. The primary agent can message anyone.
|
|
519
|
+
|
|
520
|
+
Messages are delivered synchronously: the sender waits for the recipient's response. Conversation depth is tracked to prevent infinite loops.
|
|
521
|
+
|
|
522
|
+
### The Office (dashboard)
|
|
523
|
+
|
|
524
|
+
The dashboard's "The Office" page shows each agent as an animated desk station with:
|
|
525
|
+
- Live status indicator (online / connecting / error / offline)
|
|
526
|
+
- Discord bot avatar (auto-pulled) or initial
|
|
527
|
+
- Channel assignment, model badge, project badge, tool count
|
|
528
|
+
- Edit and "Let Go" (delete) actions
|
|
529
|
+
|
|
530
|
+
---
|
|
531
|
+
|
|
532
|
+
## Scheduled tasks & cron jobs
|
|
533
|
+
|
|
534
|
+
Define scheduled tasks in `vault/00-System/CRON.md` using YAML frontmatter, or create them from the dashboard or any chat channel.
|
|
535
|
+
|
|
536
|
+
```yaml
|
|
537
|
+
---
|
|
538
|
+
jobs:
|
|
539
|
+
- name: Morning Digest
|
|
540
|
+
schedule: "0 9 * * 1-5"
|
|
541
|
+
prompt: "Check my inbox, calendar, and overdue tasks. Send a morning summary."
|
|
542
|
+
tier: 2
|
|
543
|
+
enabled: true
|
|
544
|
+
|
|
545
|
+
- name: Codebase Audit
|
|
546
|
+
schedule: "0 2 * * 0"
|
|
547
|
+
prompt: "Audit the main repo for dead code, missing tests, and security issues."
|
|
548
|
+
tier: 2
|
|
549
|
+
work_dir: ~/projects/my-app
|
|
550
|
+
mode: unleashed
|
|
551
|
+
max_hours: 4
|
|
552
|
+
---
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
All cron jobs have **sub-agent support** — they can use the Agent and Task tools to spawn parallel workers, delegate sub-tasks, and coordinate multi-step workflows.
|
|
556
|
+
|
|
557
|
+
### Project-aware cron jobs
|
|
558
|
+
|
|
559
|
+
Set `work_dir` on any job to run it inside a specific project directory. The agent gets access to that project's `CLAUDE.md`, MCP servers, tools, and file tree — exactly like running Claude Code inside the project locally.
|
|
560
|
+
|
|
561
|
+
### Visual schedule builder
|
|
562
|
+
|
|
563
|
+
The dashboard provides a visual schedule builder with dropdowns for frequency (daily, weekdays, weekly, every N hours/minutes), day picker, and time picker — no cron syntax required. Advanced users can still enter raw cron expressions.
|
|
564
|
+
|
|
565
|
+
---
|
|
566
|
+
|
|
567
|
+
## Unleashed mode
|
|
568
|
+
|
|
569
|
+
For tasks that take hours — codebase refactors, research projects, content generation pipelines — unleashed mode runs autonomously with phased execution and checkpointing.
|
|
570
|
+
|
|
571
|
+
```
|
|
572
|
+
Phase 1 (75 turns) ──▶ Checkpoint ──▶ Phase 2 (75 turns) ──▶ Checkpoint ──▶ ...
|
|
573
|
+
│ │ │ │
|
|
574
|
+
└─ Session resume ─────┘ └─ Session resume ─────┘
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
### How it works
|
|
578
|
+
|
|
579
|
+
1. The task runs in phases (default 75 turns per phase)
|
|
580
|
+
2. Between phases, the SDK session is **resumed** — the agent keeps its full conversation history
|
|
581
|
+
3. Progress is saved to `~/.clementine/unleashed/<task>/` (JSONL log + status file)
|
|
582
|
+
4. The agent can spawn sub-agents for parallel work streams
|
|
583
|
+
5. Cancel anytime via the dashboard or by touching a `CANCEL` file
|
|
584
|
+
|
|
585
|
+
### Safety guardrails
|
|
586
|
+
|
|
587
|
+
| Guard | Behavior |
|
|
588
|
+
|-------|----------|
|
|
589
|
+
| **Max hours** | Configurable deadline (default 6h, up to 24h) |
|
|
590
|
+
| **Max phases** | Hard cap at 50 phases |
|
|
591
|
+
| **Consecutive errors** | Aborts after 3 consecutive phase failures |
|
|
592
|
+
| **Concurrency** | Same job can't run twice simultaneously |
|
|
593
|
+
| **Cancellation** | Checked between every phase |
|
|
594
|
+
| **Error recovery** | Failed phases reset the session and re-inject the original task |
|
|
595
|
+
|
|
596
|
+
### Smart auto-escalation
|
|
597
|
+
|
|
598
|
+
When you ask Clementine something complex in chat, she automatically assesses the scope:
|
|
599
|
+
|
|
600
|
+
1. **Quick tasks** — handled inline within the normal chat turn budget
|
|
601
|
+
2. **Complex tasks** — auto-escalated to deep mode (100 turns) with progress check-ins every 2 minutes
|
|
602
|
+
3. **Multi-hour tasks** — escalated to unleashed mode with phased execution and checkpointing
|
|
603
|
+
|
|
604
|
+
You can also trigger deep mode explicitly with `!deep <task>` in Discord or by prefixing any message with "deep:".
|
|
605
|
+
|
|
606
|
+
### Triggering unleashed tasks
|
|
607
|
+
|
|
608
|
+
| Method | How |
|
|
609
|
+
|--------|-----|
|
|
610
|
+
| **Dashboard** | Create a cron job with mode "Unleashed", set max hours, click Run |
|
|
611
|
+
| **Discord** | `!cron run <task>` — fires in background, sends completion notification |
|
|
612
|
+
| **CLI** | `clementine cron run <task>` — runs in foreground (for manual runs) |
|
|
613
|
+
| **Cron schedule** | Set `mode: unleashed` in CRON.md — fires on schedule automatically |
|
|
614
|
+
| **Chat** | Ask Clementine to create an unleashed task — she'll use the `add_cron_job` tool |
|
|
615
|
+
| **Auto-escalation** | Chat automatically escalates to deep/unleashed when max turns are hit |
|
|
616
|
+
|
|
617
|
+
### Monitoring
|
|
618
|
+
|
|
619
|
+
The dashboard shows a live **Unleashed Tasks** panel below scheduled tasks with:
|
|
620
|
+
- Current phase number and elapsed time
|
|
621
|
+
- Status badges (running / completed / cancelled / timeout / error)
|
|
622
|
+
- Output preview from the last completed phase
|
|
623
|
+
- Cancel button for running tasks
|
|
624
|
+
|
|
625
|
+
Progress is also logged to `~/.clementine/unleashed/<task>/progress.jsonl` for debugging.
|
|
626
|
+
|
|
627
|
+
---
|
|
628
|
+
|
|
629
|
+
## Self-improvement
|
|
630
|
+
|
|
631
|
+
Clementine can autonomously improve herself using an iterative loop inspired by Karpathy's autoresearch pattern: **gather data, diagnose weaknesses, hypothesize a fix, evaluate the fix, and propose the change for approval**.
|
|
632
|
+
|
|
633
|
+
```
|
|
634
|
+
┌──────────┐ ┌──────────┐ ┌─────────────┐ ┌──────────┐ ┌──────────┐
|
|
635
|
+
│ Gather │───▶│ Diagnose │───▶│ Hypothesize │───▶│ Evaluate │───▶│ Gate │
|
|
636
|
+
│ feedback │ │ weakness │ │ a change │ │ LLM judge│ │ approve? │
|
|
637
|
+
│ cron logs│ │ patterns │ │ (minimal) │ │ 0-10 │ │ │
|
|
638
|
+
└──────────┘ └──────────┘ └─────────────┘ └──────────┘ └──────────┘
|
|
639
|
+
│ │
|
|
640
|
+
│ ┌──────────────────────────────────────┐ │
|
|
641
|
+
└──────────────│ Repeat until plateau or time limit │◀────────────┘
|
|
642
|
+
└──────────────────────────────────────┘
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
### What it targets
|
|
646
|
+
|
|
647
|
+
| Area | Target file | Examples |
|
|
648
|
+
|------|-------------|---------|
|
|
649
|
+
| **Soul** | `SOUL.md` | Personality tweaks, tone adjustments, new behavioral instructions |
|
|
650
|
+
| **Cron** | `CRON.md` | Prompt improvements for scheduled tasks, missing instructions |
|
|
651
|
+
| **Workflows** | `workflows/*.md` | Step refinements, better prompts, missing error handling |
|
|
652
|
+
| **Memory** | Configuration | Retrieval tuning, salience thresholds |
|
|
653
|
+
| **Agents** | `agents/<slug>/agent.md` | Agent personality refinements, tool allowlist tuning, role clarification |
|
|
654
|
+
|
|
655
|
+
### How it works
|
|
656
|
+
|
|
657
|
+
1. **Gathers** recent feedback (positive/negative reactions), cron job success/error rates, and transcript patterns from the last 7 days
|
|
658
|
+
2. **Diagnoses** the single highest-impact weakness using an LLM analysis pass
|
|
659
|
+
3. **Proposes** a specific, minimal change — informed by experiment history to avoid repeating failed approaches
|
|
660
|
+
4. **Evaluates** the proposal with an LLM judge scoring clarity, safety, impact, risk, and minimality (0-10)
|
|
661
|
+
5. **Gates** proposals that score above the threshold (default 6/10) — saves to pending and sends a Discord approval embed with Approve/Deny buttons
|
|
662
|
+
6. **Logs** every experiment to an append-only JSONL file for full history
|
|
663
|
+
7. **Stops** on plateau detection (3 consecutive low scores), time limits (1 hour max), or iteration caps (10 per cycle)
|
|
664
|
+
|
|
665
|
+
After the loop completes, memory maintenance runs automatically (temporal decay + stale data pruning).
|
|
666
|
+
|
|
667
|
+
### Safety guardrails
|
|
668
|
+
|
|
669
|
+
- **Nothing is applied without approval** — every change requires explicit Approve via Discord buttons, CLI, or dashboard
|
|
670
|
+
- **Changes are reversible** — the original file content is saved alongside each proposal
|
|
671
|
+
- **LLM judge evaluation** — proposals must pass a multi-criteria quality check before even being submitted for approval
|
|
672
|
+
- **Experiment history prevents loops** — the LLM sees all prior attempts and avoids repeating failed strategies
|
|
673
|
+
- **Plateau detection** — the loop stops automatically when consecutive iterations yield no improvements
|
|
674
|
+
- **Own concurrency lane** — runs independently without blocking cron jobs or chat
|
|
675
|
+
|
|
676
|
+
### Triggering
|
|
677
|
+
|
|
678
|
+
| Method | How |
|
|
679
|
+
|--------|-----|
|
|
680
|
+
| **Nightly cron** | Add `nightly-self-improve` job to `CRON.md` with schedule `0 2 * * *` |
|
|
681
|
+
| **Discord** | `!self-improve run` or `/self-improve run` |
|
|
682
|
+
| **CLI** | `clementine self-improve run` |
|
|
683
|
+
| **Dashboard** | View status and manage proposals from the Self-Improve page |
|
|
684
|
+
|
|
685
|
+
### Discord commands
|
|
686
|
+
|
|
687
|
+
```
|
|
688
|
+
!self-improve run Trigger a self-improvement cycle
|
|
689
|
+
!self-improve status Show current state and baseline metrics
|
|
690
|
+
!self-improve history [n] Show last N experiments (default 10)
|
|
691
|
+
!self-improve pending List pending approval proposals
|
|
692
|
+
!self-improve apply <id> Approve a pending change
|
|
693
|
+
!self-improve deny <id> Deny a pending change
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
### Data storage
|
|
697
|
+
|
|
698
|
+
```
|
|
699
|
+
~/.clementine/self-improve/
|
|
700
|
+
├── experiment-log.jsonl Append-only history of all experiments
|
|
701
|
+
├── state.json Current status, iteration count, baseline metrics
|
|
702
|
+
└── pending-changes/
|
|
703
|
+
└── {8-char-hex}.json Proposal with before/after content, score, hypothesis
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
---
|
|
707
|
+
|
|
708
|
+
## Vault
|
|
709
|
+
|
|
710
|
+
The vault is an Obsidian-compatible folder of Markdown files with YAML frontmatter, `[[wikilinks]]`, and `#tags`. Open `~/.clementine/vault/` in Obsidian to browse your assistant's memory visually.
|
|
711
|
+
|
|
712
|
+
Key system files:
|
|
713
|
+
|
|
714
|
+
| File | Purpose |
|
|
715
|
+
|------|---------|
|
|
716
|
+
| `SOUL.md` | Core personality and behavioral instructions |
|
|
717
|
+
| `MEMORY.md` | Auto-extracted facts, preferences, people context |
|
|
718
|
+
| `HEARTBEAT.md` | Autonomous check-in configuration |
|
|
719
|
+
| `CRON.md` | Scheduled task definitions (cron syntax) |
|
|
720
|
+
| `TASKS.md` | Master task list with `{T-NNN}` IDs |
|
|
721
|
+
|
|
722
|
+
---
|
|
723
|
+
|
|
724
|
+
## Requirements
|
|
725
|
+
|
|
726
|
+
- **Node.js 20-24 LTS** (for `--import` loader and `cpSync`)
|
|
727
|
+
- **macOS** (Keychain integration, LaunchAgent — works on Linux without these)
|
|
728
|
+
- **Claude Code CLI** installed and authenticated (`npm install -g @anthropic-ai/claude-code && claude login`)
|
|
729
|
+
- No API key needed — authentication is handled by the Claude Code CLI
|
|
730
|
+
|
|
731
|
+
---
|
|
732
|
+
|
|
733
|
+
## Development
|
|
734
|
+
|
|
735
|
+
```bash
|
|
736
|
+
# Run from source (foreground, hot reload)
|
|
737
|
+
npm run dev
|
|
738
|
+
|
|
739
|
+
# Type check without emitting
|
|
740
|
+
npm run typecheck
|
|
741
|
+
|
|
742
|
+
# Build
|
|
743
|
+
npm run build
|
|
744
|
+
|
|
745
|
+
# Run MCP server standalone (for testing tools)
|
|
746
|
+
npm run mcp
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
---
|
|
750
|
+
|
|
751
|
+
## Troubleshooting
|
|
752
|
+
|
|
753
|
+
### `clementine update` fails with "local changes"
|
|
754
|
+
|
|
755
|
+
Clementine auto-stashes local customizations during updates. If you're on an older version that doesn't have this yet, run manually:
|
|
756
|
+
|
|
757
|
+
```bash
|
|
758
|
+
cd ~/clementine # or wherever you cloned it
|
|
759
|
+
git stash
|
|
760
|
+
clementine update
|
|
761
|
+
git stash pop # restore your customizations
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
Future updates will handle this automatically.
|
|
765
|
+
|
|
766
|
+
### `better-sqlite3` won't load (NODE_MODULE_VERSION mismatch)
|
|
767
|
+
|
|
768
|
+
This happens when you upgrade Node.js after installing. The native SQLite module needs to be recompiled:
|
|
769
|
+
|
|
770
|
+
```bash
|
|
771
|
+
cd ~/clementine
|
|
772
|
+
npm rebuild better-sqlite3
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
Run `clementine doctor` to verify the fix. This check is now built-in — doctor will catch it early.
|
|
776
|
+
|
|
777
|
+
### Memory search returns empty results
|
|
778
|
+
|
|
779
|
+
1. Run `clementine doctor` — check the `better-sqlite3` line
|
|
780
|
+
2. Verify the database exists: `ls ~/.clementine/vault/.memory.db`
|
|
781
|
+
3. If the DB is missing, restart the daemon — it creates the DB and indexes the vault on startup
|
|
782
|
+
|
|
783
|
+
### Daemon won't start / duplicate instances
|
|
784
|
+
|
|
785
|
+
```bash
|
|
786
|
+
clementine stop # stop any running instance
|
|
787
|
+
rm ~/.clementine/.clementine.pid # clear stale PID if needed
|
|
788
|
+
clementine launch
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
---
|
|
792
|
+
|
|
793
|
+
## License
|
|
794
|
+
|
|
795
|
+
MIT
|