Skip to main content
Back to Journal
user@argobox:~/journal/2026-02-15-admin-and-argonaut
$ cat entry.md

Admin Hardening + Argonaut — 73 New Files, 3 Vaults, One Personal AI

○ NOT REVIEWED

Couldn't sleep after the optimization marathon. By midnight I'd already shipped admin performance fixes. By 3 AM I'd built Argonaut—a full AI agent platform with voice, phone, tools, and persistent memory. Sometimes sleep is optional when you're building something you've only dreamed about.

Admin Hardening (45 minutes)

The admin dashboard was a 3,310-line monolith with performance landmines. It scanned all content bodies with expensive regex on every page load to find "probe" markers. It loaded render-blocking CDN libraries for rarely-used features. Its inline script wasn't wrapped in astro:page-load, causing ViewTransitions navigation bugs.

The fixes:

  • Deferred two 80KB CDN libraries (diff, marked) with async script injection instead of blocking <script src> tags
  • Moved the expensive regex scan from SSR to an on-demand /api/admin/flags endpoint—fast indexOf count stays on the page, full regex data only loads when you click the flag dashboard
  • Wrapped the 1,343-line inline script in astro:page-load with a guard check, making it safe for ViewTransitions navigation
  • Added 3-second Gitea API timeout so the page doesn't hang if the API is slow
  • Registered the service worker in CosmicLayout so admin pages get PWA capabilities
  • Created an admin-specific admin-manifest.webmanifest with purple theme icons, scoped to /admin
  • Added hamburger menu and backdrop overlay for mobile navigation
  • Made the entire dashboard responsive: 1100px breakpoints for desktop nav, 2-column grid on mobile, card-stacked table rows on tablets
  • Reduced mobile animations: Nebula blur 40→30px, disabled drifting Starfield, removed oversized layer positioning

Cached the auth check in sessionStorage so subsequent admin page navigations show the indicator instantly. Exposed SSR-computed stats via window._adminStats to avoid duplicate sidebar fetches.

Result: Admin loads faster, works on phones, and is installable as an Android PWA. Build time dropped from 30s to 28s.

Argonaut — Full Implementation (3 hours)

This is what I've been designing for months. Argonaut is a modular, self-hosted AI agent platform—a "personal AI employee" that lives inside ArgoBox but is designed to be extracted to its own repo.

It has two modes:

Library mode (Cloudflare Pages): Stateless chat with personality-aware RAG. Runs in-process, no persistence.

Daemon mode (LXC/Docker): Persistent process with SQLite, heartbeat, task queue, tool execution, autonomous work. Hono HTTP server on port 7777.

Architecture

Browser (Admin) → HTTPS/SSE → ArgoBox (CF Pages)
                               ├─ imports @argonaut/core for stateless chat
                               └─ proxies to daemon for stateful work
                                       ↓ HTTP Bearer token
                                  Argonaut Daemon (LXC/Docker)
                                       ├─ Hono server, SQLite + sqlite-vec
                                       ├─ Heartbeat (30min), Cron, Task Queue
                                       ├─ Tools: email, phone, exec, web, file
                                       └─ Integrations: Ollama, Resend, Twilio, ElevenLabs

What I Built

Phase 1: Foundation + RAG + Profile (4 files core, 10 for RAG)

Created packages/argonaut/ as a monorepo package (@argonaut/core). Built a type hierarchy: Message, ToolDefinition, AgentConfig, AgentStatus. Layered config that respects environment overrides.

The heart is the profile system—7 markdown documents compiled in order:

  • BOOT.md — startup sequence and operating principles
  • IDENTITY.md — name, role, capabilities
  • SOUL.md — voice profile extracted from 2,577 conversations (tone distribution, humor, narrative style)
  • AGENTS.md — context switching and operating instructions
  • USER.md — Dan's full profile (tech environment, preferences, "Stop Saying This" list)
  • TOOLS.md — tool conventions
  • HEARTBEAT.md — autonomous checklist template

Hybrid RAG engine with BM25 (0.3 weight) + vector search (0.7 weight), min-max normalization. Pure TypeScript BM25 scorer (~100 lines, no heavy deps). Chunking: 400-word chunks, 80-word overlap. Embedding via OpenRouter + Ollama with batching. Supports JSON file store (CF Pages) and SQLite store (daemon).

Phase 2: Memory + Tools + Task Queue (4 + 8 + 3 files)

In-memory sliding window (max 50 messages per conversation). JSON file-backed long-term memory with token estimation and compaction. ToolRegistry with register/execute/list. Builtin tools: Resend email, DuckDuckGo web search, URL fetch, file ops (daemon), shell exec (daemon), memory search.

Task queue with state machine (pending→running→completed/failed/cancelled), lane-aware FIFO with priority levels.

Phase 3: Daemon + Docker + Autonomous (7 + 2 + 2 files)

Hono HTTP server with CORS, logger, route mounting. Bearer token middleware. Health check, agent chat (SSE streaming), status, task CRUD, memory search. HeartbeatController runs every 30min, checks queue, flags overdue tasks. CronScheduler for interval-based and daily-time-based jobs.

Dockerfile: Node 22-slim, port 7777, volumes for data/profiles/vaults, all env vars. docker-compose.yml orchestrates everything.

Phase 4: Voice + Phone + CLI (3 + 2 files)

Twilio REST API integration for calls and SMS. ElevenLabs text-to-speech. Combined voice-call tool. Claude Code and Codex spawning.

ArgoBox Integration

4 API endpoints: /api/argonaut/chat (SSE), /api/argonaut/status, /api/argonaut/tasks, /api/argonaut/memory. 4 admin pages: dashboard, chat, tasks, profile viewer. Added Argonaut to AdminSidebar with anchor icon.

Build & Testing

npm install resolved @argonaut/core from symlink. npm run build compiled clean (0 errors, ~23s). TypeScript type check: 0 errors. Test build-index with 6,830 documents across 5 vaults—95,164 chunks in 8s. Kicked off full RAG index build with text-embedding-3-large (3072d embeddings, $0.62 for 95K chunks via OpenRouter).

Key Decisions

Went with text-embedding-3-large (3072d) for best quality. BM25 pure TS because a simple scoring function doesn't need heavy NLP deps. Profile docs as markdown—version-controlled, human-editable, diffable. Hono for daemon (14KB, clean TypeScript). file: package link keeps it in the monorepo but clearly separable for extraction.

Status

Argonaut foundation is production-ready. RAG index build pending completion (~6 hours). Daemon deployment to LXC container next. Resend, Twilio, ElevenLabs API keys need configuration. Phone and voice features are designed but untested pending keys.

This is the biggest single piece I've shipped. The agent platform is real, modular, and genuinely useful. It's going to change how I work.

Built 21:00–00:00 on Feb 15, continued through Feb 16.