@drewpayment/mink 0.3.0 → 0.5.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/README.md +235 -11
- package/dist/cli.js +1424 -487
- package/package.json +1 -1
- package/src/cli.ts +23 -1
- package/src/commands/channel.ts +252 -0
- package/src/commands/config.ts +1 -1
- package/src/commands/device.ts +65 -0
- package/src/commands/session-start.ts +16 -0
- package/src/core/channel-process.ts +274 -0
- package/src/core/channel-templates.ts +156 -0
- package/src/core/daemon.ts +63 -2
- package/src/core/device.ts +72 -0
- package/src/core/global-config.ts +72 -11
- package/src/core/paths.ts +20 -0
- package/src/core/sync.ts +12 -0
- package/src/types/channel.ts +16 -0
- package/src/types/config.ts +57 -0
package/README.md
CHANGED
|
@@ -21,6 +21,8 @@ Mink intercepts these lifecycle events and maintains structured state so the ass
|
|
|
21
21
|
- **Advise on frameworks** with a decision tree and migration guides
|
|
22
22
|
- **Build a cross-project wiki** that accumulates knowledge across all your projects
|
|
23
23
|
- **Capture notes from anywhere** with an AI-powered Claude Code skill that categorizes, tags, and links notes automatically
|
|
24
|
+
- **Chat with Mink from Discord** — DM your bot to capture, search, and summarize your wiki from anywhere via Claude Code Channels
|
|
25
|
+
- **Sync across machines** with git-backed `~/.mink` syncing — auto-pull on session start, auto-push on session stop
|
|
24
26
|
|
|
25
27
|
## How It Works
|
|
26
28
|
|
|
@@ -69,9 +71,15 @@ All state lives in `~/.mink/` -- nothing is stored in your project repository.
|
|
|
69
71
|
- **Claude Code Skill** — `/mink:note` skill uses Claude as the AI brain for intelligent categorization, tagging, and wikilink insertion
|
|
70
72
|
- **Daily Notes** — `mink note --daily` creates or appends to daily journal entries
|
|
71
73
|
- **Vault Index** — Token-efficient file index for the vault, with search and tag aggregation
|
|
72
|
-
- **
|
|
74
|
+
- **External Linking** — Symlink external notes directories into the vault for a unified Obsidian experience
|
|
73
75
|
- **Templates** — 6 built-in templates (quick-capture, daily, meeting, project, area, person)
|
|
74
76
|
|
|
77
|
+
### Discord Companion
|
|
78
|
+
- **Conversational interface** — DM your bot on Discord to capture notes, search the vault, and get daily summaries
|
|
79
|
+
- **Always-on** — runs Claude Code inside a detached GNU screen session that survives terminal closes
|
|
80
|
+
- **CLAUDE.md-driven persona** — the bot's behavior is configured by a markdown file in the vault, not code
|
|
81
|
+
- **Unattended mode** — optional `--dangerously-skip-permissions` bypasses terminal prompts so the bot works entirely from Discord
|
|
82
|
+
|
|
75
83
|
### Advanced
|
|
76
84
|
- **Design Evaluation** — Automated multi-viewport screenshot capture with server and route detection (uses Puppeteer)
|
|
77
85
|
- **Framework Advisor** — Decision tree, framework catalog, comparison matrix, and migration prompts for UI framework selection
|
|
@@ -249,19 +257,225 @@ The vault is a standard markdown directory fully compatible with Obsidian:
|
|
|
249
257
|
|
|
250
258
|
Open the vault directory as an Obsidian vault and everything works out of the box.
|
|
251
259
|
|
|
252
|
-
###
|
|
260
|
+
### Link external notes
|
|
261
|
+
|
|
262
|
+
If you already have a notes repository, you can symlink it into the vault so everything appears together in Obsidian:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# Symlink your existing notes into the vault
|
|
266
|
+
mink wiki link ~/dev/notes
|
|
267
|
+
|
|
268
|
+
# Result: ~/.mink/wiki/notes -> ~/dev/notes
|
|
269
|
+
|
|
270
|
+
# Custom name
|
|
271
|
+
mink wiki link ~/dev/notes my-notes
|
|
272
|
+
|
|
273
|
+
# List linked directories
|
|
274
|
+
mink wiki links
|
|
275
|
+
|
|
276
|
+
# Remove a link (original directory is untouched)
|
|
277
|
+
mink wiki unlink notes
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Open `~/.mink/wiki/` as your Obsidian vault and you'll see Mink's generated content (projects, patterns, inbox) alongside your own notes — with `[[wikilinks]]` working across both.
|
|
281
|
+
|
|
282
|
+
## Discord Companion
|
|
283
|
+
|
|
284
|
+
DM your bot on Discord to capture notes, search the vault, and get summaries — with the Claude Code session running on your own machine against your own wiki.
|
|
285
|
+
|
|
286
|
+
This uses [Claude Code Channels](https://code.claude.com/docs/en/channels) to push Discord messages into a running Claude Code session. The session launches inside a detached GNU screen with a preloaded `CLAUDE.md` that makes Claude behave as a knowledge companion. Nothing is hosted; the bot is just you talking to Claude on your laptop.
|
|
287
|
+
|
|
288
|
+
### Prerequisites
|
|
289
|
+
|
|
290
|
+
- [Claude Code](https://claude.ai/code) v2.1.80+ signed in with a `claude.ai` account (Console/API-key auth is not supported by Channels)
|
|
291
|
+
- [Bun](https://bun.sh/) (required by the Discord channel plugin)
|
|
292
|
+
- `screen` (pre-installed on macOS; `sudo apt install screen` on Linux)
|
|
293
|
+
- An initialized vault: `mink wiki init`
|
|
294
|
+
|
|
295
|
+
### Step-by-step setup
|
|
296
|
+
|
|
297
|
+
**1. Create a Discord bot**
|
|
298
|
+
|
|
299
|
+
In the [Discord Developer Portal](https://discord.com/developers/applications):
|
|
300
|
+
|
|
301
|
+
1. Click **New Application** and give it a name
|
|
302
|
+
2. Open the **Bot** page → click **Reset Token** → copy the token somewhere safe
|
|
303
|
+
3. On the same page, scroll to **Privileged Gateway Intents** and enable **Message Content Intent** (required — without this the bot receives empty messages)
|
|
304
|
+
|
|
305
|
+
**2. Invite the bot to a server**
|
|
306
|
+
|
|
307
|
+
Still in the Developer Portal:
|
|
308
|
+
|
|
309
|
+
1. Go to **OAuth2 → URL Generator**
|
|
310
|
+
2. Set **Integration Type** to **Guild Install** (not *User Install* — `bot` scope is only valid for Guild Install)
|
|
311
|
+
3. Check scope: **bot**
|
|
312
|
+
4. Check bot permissions: **View Channels**, **Send Messages**, **Send Messages in Threads**, **Read Message History**, **Attach Files**, **Add Reactions**
|
|
313
|
+
5. Open the generated URL in your browser and invite the bot to a server
|
|
314
|
+
|
|
315
|
+
> To DM the bot privately, create a personal server first (Discord → `+` icon → **Create My Own** → *For me and my friends*). Guild-Install bots can receive DMs from any user who shares a server with them.
|
|
316
|
+
|
|
317
|
+
**3. Install the Discord channel plugin in Claude Code (one time)**
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
claude
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Inside Claude Code:
|
|
324
|
+
|
|
325
|
+
```
|
|
326
|
+
/plugin install discord@claude-plugins-official
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Wait for the confirmation, then exit Claude Code.
|
|
330
|
+
|
|
331
|
+
**4. Save the bot token in mink**
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
mink channel setup discord --token YOUR_BOT_TOKEN
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Running `mink channel setup discord` without `--token` prints the full instructions above for reference. The token is stored in `~/.mink/config.local` (machine-scoped — it won't sync to other machines).
|
|
338
|
+
|
|
339
|
+
**5. Start the channel**
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
mink channel start
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
This:
|
|
253
346
|
|
|
254
|
-
|
|
347
|
+
- Writes `~/.mink/wiki/CLAUDE.md` (the companion personality) if it doesn't already exist
|
|
348
|
+
- Launches Claude Code with `--channels plugin:discord@claude-plugins-official --dangerously-skip-permissions` inside a detached GNU screen session named `mink-channel-discord`
|
|
349
|
+
|
|
350
|
+
**6. Pair your Discord account**
|
|
351
|
+
|
|
352
|
+
1. DM your bot on Discord (any message)
|
|
353
|
+
2. The bot replies with a pairing code
|
|
354
|
+
3. Attach to the session so you can type into Claude Code:
|
|
355
|
+
```bash
|
|
356
|
+
mink channel attach
|
|
357
|
+
```
|
|
358
|
+
4. Inside the attached session, run:
|
|
359
|
+
```
|
|
360
|
+
/discord:access pair YOUR_PAIRING_CODE
|
|
361
|
+
/discord:access policy allowlist
|
|
362
|
+
```
|
|
363
|
+
5. Detach with **Ctrl-a** then **d** (don't exit — detach keeps the session running)
|
|
364
|
+
|
|
365
|
+
You're done. DM your bot from anywhere.
|
|
366
|
+
|
|
367
|
+
### Daily use
|
|
255
368
|
|
|
256
369
|
```bash
|
|
257
|
-
#
|
|
258
|
-
mink
|
|
370
|
+
mink channel status # running? uptime? session name?
|
|
371
|
+
mink channel logs # recent Claude Code output (via screen hardcopy)
|
|
372
|
+
mink channel attach # jump into the live session; detach with Ctrl-a d
|
|
373
|
+
mink channel stop # end the session
|
|
374
|
+
mink channel start # start it again (e.g. after a reboot)
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Example conversations
|
|
378
|
+
|
|
379
|
+
From Discord:
|
|
380
|
+
|
|
381
|
+
- **Capture** — "Save a note — the auth migration is blocked on new compliance requirements from legal."
|
|
382
|
+
- **Daily** — "Add to my daily: shipped the config refactor, PR #42 is up."
|
|
383
|
+
- **Meeting** — "Meeting with Sarah about Q3 roadmap — discussed prioritizing the mobile SDK, 6-week timeline."
|
|
384
|
+
- **Search** — "What did I write about the auth migration?"
|
|
385
|
+
- **Summary** — "What did I work on this week?"
|
|
386
|
+
|
|
387
|
+
The companion `CLAUDE.md` tells Claude to categorize, tag with existing vocabulary, add `[[wikilinks]]`, and reply briefly.
|
|
388
|
+
|
|
389
|
+
### Customizing the bot's personality
|
|
390
|
+
|
|
391
|
+
The bot's behavior lives in `~/.mink/wiki/CLAUDE.md` — pure markdown, no code. Edit it to adjust tone, add behavioral rules, or include project-specific context. Changes take effect on the next `mink channel start`.
|
|
259
392
|
|
|
260
|
-
|
|
261
|
-
|
|
393
|
+
Mink never overwrites an existing `CLAUDE.md`. To refresh from the built-in template after a mink upgrade:
|
|
394
|
+
|
|
395
|
+
```bash
|
|
396
|
+
rm ~/.mink/wiki/CLAUDE.md
|
|
397
|
+
mink channel start
|
|
262
398
|
```
|
|
263
399
|
|
|
264
|
-
|
|
400
|
+
### Configuration
|
|
401
|
+
|
|
402
|
+
| Setting | Default | Scope | Description |
|
|
403
|
+
|---------|---------|-------|-------------|
|
|
404
|
+
| `channel.discord.bot-token` | — | local | Discord bot token (saved by `mink channel setup`) |
|
|
405
|
+
| `channel.discord.enabled` | `false` | local | Auto-start the channel when `mink daemon start` runs |
|
|
406
|
+
| `channel.default-platform` | `discord` | shared | Platform when `mink channel start` is run without an argument |
|
|
407
|
+
| `channel.skip-permissions` | `true` | shared | Pass `--dangerously-skip-permissions` so the bot runs unattended |
|
|
408
|
+
|
|
409
|
+
Change any value with `mink config <key> <value>`.
|
|
410
|
+
|
|
411
|
+
### Security model
|
|
412
|
+
|
|
413
|
+
- **Sender allowlist** — After pairing and running `/discord:access policy allowlist`, only your Discord account can push messages to the bot. Everyone else is silently dropped.
|
|
414
|
+
- **Local execution** — The Claude Code session runs entirely on your own machine. Nothing is hosted.
|
|
415
|
+
- **Skip-permissions trade-off** — With `channel.skip-permissions` on (default), Claude does not prompt before tool calls. Combined with the sender allowlist this is fine for personal use; turn it off with `mink config channel.skip-permissions false` if you want each tool call approved via `mink channel attach`.
|
|
416
|
+
- **Scope** — The companion `CLAUDE.md` tells Claude to stay focused on vault/mink operations and not edit source code.
|
|
417
|
+
|
|
418
|
+
### Troubleshooting
|
|
419
|
+
|
|
420
|
+
- **"channel session died immediately after starting"** — Usually `claude` isn't on your PATH, or the Discord plugin isn't installed. Run `which claude` and verify step 3 (`/plugin install discord@claude-plugins-official`) was completed. To see the underlying error, run the command manually:
|
|
421
|
+
```bash
|
|
422
|
+
cd ~/.mink/wiki && claude --channels plugin:discord@claude-plugins-official
|
|
423
|
+
```
|
|
424
|
+
- **Bot doesn't respond to DMs** — Make sure you share a server with it (Guild-Install bots can only DM users who share a server) and that **Message Content Intent** is enabled in the Developer Portal.
|
|
425
|
+
- **`Input must be provided either through stdin...`** in logs — The Claude Code session has no TTY. The `mink channel` commands spawn through GNU screen to avoid this; if you see it, check that `screen` is on PATH.
|
|
426
|
+
- **Permission prompts stall the bot** — Ensure `mink config channel.skip-permissions` is `true` (the default). Apply after a restart: `mink channel stop && mink channel start`.
|
|
427
|
+
- **Token rotated or invalid** — Re-run `mink channel setup discord --token NEW_TOKEN`, then restart the channel.
|
|
428
|
+
- **Colors look washed out when you `mink channel attach`** — mink starts screen with `-T screen-256color` so Claude Code renders at 256-color depth. If you still see muted output, verify your terminfo database has the entry: `infocmp screen-256color`. If truecolor escape codes look garbled (common on very old GNU screen versions like macOS's bundled 4.00.03), restart the channel with `COLORTERM` unset so Claude falls back to 256-color mode: `mink channel stop && env -u COLORTERM mink channel start`.
|
|
429
|
+
|
|
430
|
+
## Sync
|
|
431
|
+
|
|
432
|
+
Mink can sync your entire `~/.mink` directory (wiki, config, project knowledge) across machines using git.
|
|
433
|
+
|
|
434
|
+
### Set up sync
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
# Initialize sync with a remote repository
|
|
438
|
+
mink sync init git@github.com:you/mink-data.git
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
This initializes git in `~/.mink`, sets the remote, and creates a `.gitignore` that excludes machine-specific state (PIDs, logs, backups).
|
|
442
|
+
|
|
443
|
+
### Automatic sync
|
|
444
|
+
|
|
445
|
+
Once initialized, sync happens automatically:
|
|
446
|
+
|
|
447
|
+
- **Session start** — pulls remote changes (rebase-based, preserves local work)
|
|
448
|
+
- **Session stop** — commits and pushes local changes
|
|
449
|
+
|
|
450
|
+
No manual intervention needed. Your wiki, config, learning memory, and bug history stay in sync.
|
|
451
|
+
|
|
452
|
+
### Manual sync
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
# Full sync (pull then push)
|
|
456
|
+
mink sync
|
|
457
|
+
|
|
458
|
+
# Individual operations
|
|
459
|
+
mink sync pull
|
|
460
|
+
mink sync push
|
|
461
|
+
|
|
462
|
+
# Check sync state
|
|
463
|
+
mink sync status
|
|
464
|
+
|
|
465
|
+
# Temporarily disable auto-sync
|
|
466
|
+
mink sync pause
|
|
467
|
+
mink sync resume
|
|
468
|
+
|
|
469
|
+
# Remove git tracking (data preserved)
|
|
470
|
+
mink sync disconnect
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Conflict handling
|
|
474
|
+
|
|
475
|
+
- Pull uses stash + rebase to preserve local changes
|
|
476
|
+
- If a rebase conflict occurs, the rebase is aborted and you're warned to resolve manually
|
|
477
|
+
- Push failures preserve the local commit — it will be included in the next push
|
|
478
|
+
- Git operations have timeouts (5-15s) so they never block your session
|
|
265
479
|
|
|
266
480
|
### Hook integration
|
|
267
481
|
|
|
@@ -292,9 +506,11 @@ mink config notes.default-category inbox
|
|
|
292
506
|
| `wiki.path` | `~/.mink/wiki/` | `MINK_WIKI_PATH` | Vault directory |
|
|
293
507
|
| `wiki.enabled` | `true` | `MINK_WIKI_ENABLED` | Toggle wiki feature |
|
|
294
508
|
| `wiki.sync-mode` | `immediate` | `MINK_WIKI_SYNC_MODE` | Update timing |
|
|
295
|
-
| `wiki.git-backup` | `false` | `MINK_WIKI_GIT_BACKUP` | Auto-commit and push |
|
|
296
|
-
| `wiki.git-remote` | `origin` | `MINK_WIKI_GIT_REMOTE` | Git remote for push |
|
|
297
509
|
| `notes.default-category` | `inbox` | `MINK_NOTES_DEFAULT_CATEGORY` | Default note category |
|
|
510
|
+
| `sync.enabled` | `false` | — | Enable git sync for ~/.mink |
|
|
511
|
+
| `sync.remote-url` | — | — | Git remote URL for sync |
|
|
512
|
+
| `sync.last-push` | — | — | Timestamp of last push |
|
|
513
|
+
| `sync.last-pull` | — | — | Timestamp of last pull |
|
|
298
514
|
|
|
299
515
|
## Architecture
|
|
300
516
|
|
|
@@ -379,7 +595,7 @@ mink/
|
|
|
379
595
|
│ │ ├── post-read.ts # Hook: post-read tracking
|
|
380
596
|
│ │ ├── pre-write.ts # Hook: write enforcement
|
|
381
597
|
│ │ ├── post-write.ts # Hook: post-write tracking
|
|
382
|
-
│ │ ├── wiki.ts # Wiki vault management (init, status, rebuild, organize)
|
|
598
|
+
│ │ ├── wiki.ts # Wiki vault management (init, status, link, unlink, rebuild, organize)
|
|
383
599
|
│ │ ├── note.ts # Note capture, list, and search
|
|
384
600
|
│ │ ├── skill.ts # Claude Code skill installer
|
|
385
601
|
│ │ ├── status.ts # Project health display
|
|
@@ -421,6 +637,7 @@ mink/
|
|
|
421
637
|
│ │ ├── note-writer.ts # Note creation, frontmatter, daily notes
|
|
422
638
|
│ │ ├── note-linker.ts # Wikilink extraction, insertion, backlinks
|
|
423
639
|
│ │ ├── note-index.ts # Vault file index with search
|
|
640
|
+
│ │ ├── sync.ts # Git-based ~/.mink sync engine
|
|
424
641
|
│ │ └── ... # Global config, backup, reflection, etc.
|
|
425
642
|
│ ├── dashboard/ # Embedded dashboard UI (HTML/CSS/JS generation)
|
|
426
643
|
│ │ ├── get-dashboard-html.ts # Main HTML assembly
|
|
@@ -491,6 +708,13 @@ bun src/cli.ts note --daily "Today I worked on mink"
|
|
|
491
708
|
bun src/cli.ts note list --recent 5
|
|
492
709
|
bun src/cli.ts note search "testing"
|
|
493
710
|
|
|
711
|
+
# Link external notes into the vault
|
|
712
|
+
bun src/cli.ts wiki link ~/dev/notes
|
|
713
|
+
|
|
714
|
+
# Set up cross-device sync
|
|
715
|
+
bun src/cli.ts sync init git@github.com:you/mink-data.git
|
|
716
|
+
bun src/cli.ts sync status
|
|
717
|
+
|
|
494
718
|
# Install the Claude Code skill
|
|
495
719
|
bun src/cli.ts skill install
|
|
496
720
|
```
|