Commit Graph

110 Commits

Author SHA1 Message Date
gavrielc
f2afb11e71 Include missed messages when catching up the agent
When a triggered message comes in, fetch all messages in that chat
since the last agent interaction and include them in the prompt.
Each message is formatted with timestamp and sender.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:29:09 +02:00
gavrielc
4ec74e9120 Simplify runAgent: just pass the prompt
- Remove context building (group name, chat JID, permissions)
- Agent runs in group folder which determines its permissions
- Caller handles response prefixing and where to send reply
- Session provides continuity, no need for metadata in each message

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:24:55 +02:00
gavrielc
545cbc7b9c Remove unnecessary shutdown handlers
Daemon runs forever; launchd manages lifecycle. SQLite handles
ungraceful shutdowns fine.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:21:59 +02:00
gavrielc
0691601469 Extract database operations into separate db.ts module
- src/db.ts: initDatabase, closeDatabase, storeMessage, getNewMessages
- Removes SQL from index.ts
- Database initialization happens once at startup

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:20:41 +02:00
gavrielc
78426c764d Extract config and types into separate files, clean up index.ts
- src/config.ts: configuration constants
- src/types.ts: TypeScript interfaces
- src/index.ts: remove section comments, streamline code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:17:40 +02:00
gavrielc
fe5ae974a3 Improve setup skill: better Gmail explanation, use placeholders
- Explain Gmail/GCP prerequisites upfront before asking
- Replace hardcoded "Andy" with ASSISTANT_NAME placeholder
- Replace hardcoded timestamp with CURRENT_ISO_TIMESTAMP
- Add step 3 to ask user for their preferred trigger word
- Renumber sections accordingly

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:12:19 +02:00
gavrielc
8a385c7988 Separate WhatsApp auth from daemon into standalone script
- Add src/auth.ts for interactive QR code authentication
- Add `npm run auth` script
- Update setup skill for current Node.js architecture
- Daemon (src/index.ts) now only uses stored credentials

Auth is run during setup; daemon assumes credentials exist and
shows macOS notification if re-auth is needed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:06:25 +02:00
gavrielc
e1867f8d27 Replace QR code display with macOS notification
The daemon should never show interactive QR codes. If auth is needed,
send a macOS notification alerting the user to run /setup, then exit.

Also removes unused qrcode-terminal dependency.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:01:41 +02:00
gavrielc
295c3e620d Fix: exit gracefully when auth needed in daemon mode
If WhatsApp authentication is required but the process is running
non-interactively (as a launchd daemon), exit with an error instead
of showing a QR code that nobody will see.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:57:15 +02:00
gavrielc
c17823a732 Initial commit: NanoClaw - Personal Claude assistant via WhatsApp
A minimal Node.js application that connects Claude Agent SDK to WhatsApp
using baileys. Features per-group memory via CLAUDE.md files, session
continuity, scheduled tasks, and Gmail integration via MCP.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:54:24 +02:00