All projects

Nucleus

Personal AI-agent system

Side project by Luiz Consalter.

Overview

Nucleus is a personal assistant system built around the Claude Code CLI. It connects Claude to a Discord bot, a WhatsApp bot, scheduled jobs and an operator dashboard. It runs on one macOS machine as a set of launchd services, all started from one Rust binary.

Every agent call runs in a long-lived interactive Claude Code session inside a tmux window. The bots, the scheduled jobs and the dashboard chat all reach the model through these sessions; Nucleus has no other path to a model.

The design is recorded in 49 architecture decision records in the repository.

Architecture

Discord bot Rust, serenity session per channel WhatsApp bot TypeScript, Baileys whisper.cpp for voice Dashboard axum API, React app work, agents, usage Scheduled jobs news, distiller, reminders, skills nucleus-core: Session and SessionPool the one path to the agent: persona, permission mode, blocked commands, tmux window lifecycle, transcript reading, end-of-turn detection starts and resumes reads and promotes tmux server one interactive Claude Code session per chat or job attach to a window to watch a turn as it runs Memory tiers T1 session state, SQLite T1.5 diary per agent, 7 days T2 shared facts, loaded into every session T3 notes vault (PARA), read on demand Operator approvals mail, pushes, deletes and form submissions wait
Every component that needs the agent goes through nucleus-core, which starts or resumes a Claude Code session in a tmux window.

Decisions and features

Claude Code sessions in tmux as the agent engine

Each Discord channel and each WhatsApp chat has its own session, and each scheduled job starts a session of its own. A chat session stays alive between messages and is resumed for the next message, so a follow-up does not wait for a new session to start. The operator can attach to a tmux window and watch a turn while it runs.

Every Rust component reaches Claude through one type in the nucleus-core library, Session for one-shot work or SessionPool for one persistent session per chat. That type sets the persona, the permission mode and the blocked commands, manages the tmux window and reads the session transcript. The WhatsApp bot uses a TypeScript port of the same type.

The WhatsApp bot uses a turn engine that follows the session transcript and replies only when the turn has ended. It replaced a fixed silence timeout that sometimes sent text written before a slow tool call as the answer. Long work can run as a background task, so the conversation can continue while it runs.

Memory tiers

Memory is divided by lifetime and scope. Tier 1 is per-chat session state, in one SQLite database per bot. Tier 1.5 is a daily diary per agent, kept for seven days. Tier 2 is a set of shared facts in Claude Code's auto-memory directory, which every Nucleus session loads at start. Tier 3 is a notes vault organized with the PARA method, which sessions read when they need it.

A daily distiller job reads the diaries and decides for each observation whether to promote it to shared memory, merge it with an existing fact, archive it or drop it. Vector search was evaluated and deferred: sessions find long-term information in the vault through file names and frontmatter.

Permissions and approvals

Sessions run without a person watching them, so they cannot wait for interactive permission prompts. They use Claude Code's automatic permission mode together with a list of blocked commands, and the bots answer only accounts on an allowlist.

Actions with effects outside the machine wait for the operator's approval: sending mail, calendar events that invite other people, browser form submissions, git pushes outside the work pipeline, and deletes outside the session's working folder. Before a delete or an overwrite runs, a hook shows the exact list of files that it would change.

Reminders

A reminder is the one model for every time-triggered notification. It has a body, a cron expression in the operator's time zone, a one-shot flag and one or more delivery channels: Discord, WhatsApp or the calendar. One worker runs every minute and delivers what is due, with pause, resume and a retry for each channel.

A user asks either bot for a reminder in plain language, and the session creates it with the reminders command. A reminder can also start a session at its time, which runs a skill.

Skills

Procedures are stored as Claude Code skills in the native SKILL.md format, so Nucleus needs no skill loader of its own. Skills for working on Nucleus are committed in the repository. Skills for the operator's own routines are in a separate local folder that is not committed.

A daily skill-gap learner reads session transcripts and proposes new skills for the operator to accept.

Work items and the dashboard

GitHub issues with a Nucleus label become work items. A read-only agent classifies each item. A complex item is discussed with the operator on the dashboard until the operator approves a plan. An implementation agent then works in a separate clone, and Nucleus opens a draft pull request. Nucleus never merges.

The dashboard is one axum server with a React app. It shows every agent and its live state from a registry file, the work items, skills, diaries, reminders and usage.

Stack

Languages
Rust (2021 edition), TypeScript
Server
Tokio, axum, tower-http, reqwest, figment
Data
SQLite through sqlx, with compile-time checked queries
Messaging
serenity for Discord, Baileys for WhatsApp, whisper.cpp and ffmpeg for voice notes
Dashboard
React 19, React Router, Tailwind CSS 4, Vite
Agent
Claude Code CLI, tmux
Operations
launchd services on macOS, one Rust binary with a subcommand per service

Walkthrough

1:24 · The operator dashboard: a chat with the agent, a work item from its first plan to review, then the agents, tasks, reminders, skills and usage pages. No sound.

Videos and screenshots