Commit graph

152 commits

Author SHA1 Message Date
72cdf8960d feat(doctor): surface split-brain readiness 2026-03-14 20:15:40 +01:00
0d8db0edf1 fix(network): harden local DNS placeholders and hosts sync 2026-03-14 19:45:15 +01:00
a0ce90abfe fix(skills): enrich follow-up jail messages with built-in knowledge 2026-03-14 18:08:00 +01:00
d0a9498806 feat(skills): add host-side runtime lookup for built-in knowledge 2026-03-14 18:03:37 +01:00
7fa732c5ca feat(setup): make local git a default jail 2026-03-14 17:41:41 +01:00
3ef6bda7e1 refactor(payments): simplify Stripe integration 2026-03-14 13:58:32 +01:00
5202bba77c feat(freebsd): manage jail hostnames and /etc/hosts for local resolution 2026-03-14 13:08:44 +01:00
a72f947afb fix(db): generate split-brain secrets and remove bootstrap deadlocks 2026-03-14 12:52:06 +01:00
9d4bc89c09 fix(freebsd): replace clawdie0 leftovers with warden0 2026-03-14 12:13:35 +01:00
8d2b6c4991 feat: make db jail mandatory, add setup/db.ts, rename Brain A/B to Agent System Skills / User/Agent Memory
- setup/db.ts: new setup step that auto-creates the ${AGENT_NAME}-db jail,
  installs PostgreSQL 17 + pgvector, configures pg_hba trust for the vnet
  subnet, creates roles/databases, applies pgvector/pgcrypto extensions and
  the hybrid-search schema; fully idempotent
- setup/index.ts: register 'db' step
- src/memory-lifecycle.ts: initMemoryPool() now throws on failure instead of
  returning false; removes graceful degradation path
- src/index.ts: treat memory DB unavailability as fatal (logger.fatal +
  process.exit(1)) with actionable hint to run --step db
- src/memory-pg.ts: import MEMORY_DB_URL from config.ts (fixes wrong default
  IP .2 → .3 and removes hardcoded clawdie_brain/ai_brain names)
- src/config.ts: export SUBNET_BASE so setup/db.ts can import it
- README.md: db is required, not optional; added --step db to quick start
- docs/POSTGRES-MEMORY.md: remove install-time questions, document mandatory
  status, fix jail name (${AGENT_NAME}-db) and IP (${SUBNET_BASE}.3),
  document split-brain table with both databases
- html/docs-clawdie-si/docs/split-brain.html: rename Brain A → Agent System
  Skills, Brain B → User/Agent Memory; add mandatory info-box; update flow
- html/docs-clawdie-si/docs/install.html: add PostgreSQL db jail to prereqs,
  add --step db and --step skills-memory to quick start
- html/docs-clawdie-si/index.html: rename all remaining Brain A/B references
  to Agent System Skills / User/Agent Memory

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 09:54:51 +00:00
6a811507a9 feat(watchdog): add resource watchdog with run modes and IPC socket
Introduces a Watchdog that sits above GroupQueue and provides dynamic
resource control:

- Run modes: auto / slow / fast / permanent — each with preset
  concurrency limits, idle timeouts, poll intervals, and memory
  thresholds
- Memory throttle: reads vm.stats.vm.v_free_count via sysctl (fallback
  to os.freemem) and drops max concurrency to 1 when free RAM falls
  below mode threshold
- IPC socket at /tmp/<agent>-watchdog.sock — operator can query status
  or switch mode without restarting the service
- GroupQueue.setMaxConcurrent() / getActiveCount() / getQueuedCount()
  for runtime limit control
- Idle timeout and poll interval read dynamically from watchdog; -1 in
  permanent mode suppresses idle-kill entirely
- WATCHDOG_MODE env var sets initial mode (default: auto)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 08:55:28 +00:00
42094484af fix(tests): resolve 8 failing tests after locale + AGENT_NAME refactor
jail-runner.test.ts: add ASSISTANT_LOCALE, DISPLAY_LOCALE, SETUP_LOCALE,
SYSTEM_LOCALE, TIMEZONE to config.js mock (new env vars forwarded to jail)

jail-config.test.ts: derive subnet base from AGENT_GATEWAY_IP instead of
hardcoding 10.0.0 — .env uses a different subnet on this host

locale-profile.ts: fix normalizeSystemLocale replacing UTF-8 hyphen with
underscore — only replace hyphens in the base locale (before the dot),
preserve the encoding suffix as-is

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 07:56:36 +00:00
25ead21458 fix(setup): honor .env agent namespace in service and jail config 2026-03-14 02:51:23 +01:00
57cacae3a3 feat(setup): add FreeBSD onboarding and baseline sync 2026-03-14 02:51:10 +01:00
37e43d353c fix(dates): standardize DD.mmm.YYYY display and snapshot naming 2026-03-14 00:07:55 +01:00
f113bcbd9c feat: sharpen FreeBSD differentiation and skills-memory bootstrap 2026-03-13 19:05:10 +01:00
70d02a4434 feat: add add-stripe and add-protonmail skills
- add-stripe: Stripe tools (balance, customers, invoices, payment links,
  refunds, subscriptions) registered in ipc-mcp-stdio via STRIPE_SECRET_KEY
- add-protonmail: send_email tool via ProtonMail SMTP submission token,
  registered in ipc-mcp-stdio via PROTONMAIL_SMTP_USER + PROTONMAIL_SMTP_TOKEN
- Both secrets forwarded to jail via encrypted stdin (jail-runner.ts)
- jail/agent-runner: nodemailer + stripe deps added; dynamic import pattern
  so tools are inert when env vars are absent
- Docs: update stripe-agents.html to reflect actual skill, add protonmail.html,
  update docs/index.html with new cards and quick reference

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 16:06:42 +00:00
f5f8ee9acc chore: update stale clawdie-cp references in comments to AGENT_NAME notation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 15:03:38 +00:00
6af64c2728 refactor(phase-4): runtime naming cleanup — warden→jail, drop clawdie-cp prefix
- src/health.ts: WardenHealth → JailHealth, 'warden' section → 'jail',
  markWardenRunStarted/Finished → markJailRunStarted/Finished
- src/doctor.ts: snapshot.warden.* → snapshot.jail.*, labels
  WARDEN_LAST_* → JAIL_LAST_*
- src/jail-runner.ts: update health function names; jailRunId prefix
  clawdie-cp-{name} → {AGENT_NAME}-{name}; error codes warden_* → agent_*
- src/jail-ops.ts: import AGENT_NAME; replace hardcoded 'clawdie-cp' in
  mount grep and jls check with AGENT_NAME-derived prefix

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 15:00:40 +00:00
e4486d9631 refactor(phase-3): orchestrator host migration — AGENT_SUBNET_BASE + jail runner
- src/config.ts: read AGENT_SUBNET_BASE first, WARDEN_SUBNET_BASE as
  backward-compat fallback; add AGENT_SUBNET_BASE to envConfig read list
- src/memory-pg.ts: same AGENT_SUBNET_BASE → WARDEN_SUBNET_BASE fallback
- src/jail-runner.ts: JAIL_NAME default changed from 'controlplane' to
  '{AGENT_NAME}-worker' — matches the jail created by setup/jails step;
  import AGENT_NAME from config
- src/jail-runner.test.ts: add AGENT_NAME to config mock

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 13:52:20 +00:00
11fbc7f3e0 refactor(phase-2.1): AGENT_NAME namespace — jail-config + platform + jails step
- src/jail-config.ts: full rewrite — drop WARDEN_*/controlplane, introduce
  AGENT_BRIDGE_NAME=clawdie0, AGENT_JAIL_PROFILES, AGENT_SUBNET_*, AGENT_GATEWAY_IP,
  getWorkerBastillePlan(), getDefaultJailConfigForProfile(); all jail names
  derive from process.env.AGENT_NAME (default: clawdie)
- src/jail-config.test.ts: rewrite tests to match new AGENT_* API
- setup/jails.ts: new step replacing jail.ts; creates {AGENT_NAME}-worker jail
  via Bastille using shared clawdie0 bridge
- setup/jail.ts: deleted (replaced by jails.ts)
- setup/index.ts: replace 'jail' step with 'jails', add 'pi-config',
  remove 'network'/'setup-wizard'/'telegram-auth' steps
- setup/platform.ts: add isDesktop() and hasBrowser()
- setup/platform.test.ts: add tests for new functions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 13:47:22 +00:00
39cf76de4c Removing stale Nanoclaw references
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 11:33:36 +00:00
692673c6e7 Add screenshot security and failure handling
Security:
- Two-tier storage: public (tmp/screenshots) + encrypted (ZFS)
- Key detection with regex patterns (OpenRouter, OpenAI, ZAI, Telegram)
- Leet-speak obfuscation for public screenshots
- Real secrets stored in encrypted/screenshots/*.txt
- Encrypted directory added to .gitignore

Metadata:
- metadata.json tracks status (success/failure/expected_failure)
- Retry flag for expected failures
- hasSecrets and secretsRedacted fields

HTML Gallery:
- Status badges with colors (green/yellow/red)
- Retry indicators
- Secrets obfuscated note
- CSS classes for status borders

Files changed:
- src/config.ts: Add ENCRYPTED_DIR, SCREENSHOTS_DIR
- setup/screenshot-wizard.ts: Secret detection, obfuscation, metadata
- setup/ansi-to-html.ts: Read metadata, status badges
- infra/ansible/playbooks/host-preflight.yaml: Create encrypted ZFS dataset
- .agent/skills/tmux-screenshot/SKILL.md: Document security features
- .gitignore: Add encrypted/

Obfuscation pattern:
- Preserve first 8 chars (key type identifier)
- Replace rest with leet-speak (a→4, e→3, i→1, etc.)
- Length preserved for visual consistency
2026-03-11 01:19:01 +00:00
a2a1af551d Fix ZFS_PREFIX to read from .env for backward compat
Problem: Code defaulted to PROJECT_NAME (clawdie-ai) but actual
ZFS dataset uses clawdie-runtime. This breaks all ZFS operations.

Solution:
1. Add ZFS_PREFIX=clawdie-runtime to .env (existing installations)
2. Update config.ts to read ZFS_PREFIX from .env
3. Update shell scripts to use ZFS_PREFIX from environment

Flow:
- .env sets ZFS_PREFIX=clawdie-runtime
- config.ts reads: process.env.ZFS_PREFIX || envConfig.ZFS_PREFIX || PROJECT_NAME
- Shell scripts use: ${ZFS_PREFIX:-${PROJECT_NAME:-...}}

Testing:
- All 347 tests pass
- TypeScript config returns: clawdie-runtime
- Shell scripts return: clawdie-runtime
- Matches actual ZFS: zroot/clawdie-runtime

New installations:
- No ZFS_PREFIX in .env → defaults to PROJECT_NAME
- clawdie-ai → zroot/clawdie-ai/
- mevy-ai → zroot/mevy-ai/

Existing installations:
- Add ZFS_PREFIX=clawdie-runtime to .env
- Continues using existing ZFS layout
2026-03-11 00:32:32 +00:00
cbe4fba692 Make project name-agnostic for multi-user support
Problem: System hardcoded 'clawdie' branding throughout:
- ZFS prefix: 'clawdie-runtime'
- Paths: /home/clawdie/clawdie-ai
- Config: /home/clawdie/.config/clawdie-cp

Solution: Auto-detect project name from directory or env

Changes:
- src/config.ts: Add PROJECT_NAME, ZFS_PREFIX auto-detection
- src/jail-config.ts: Use PROJECT_ROOT instead of hardcoded paths
- infra/ansible/group_vars/all.yaml: Add zfs_prefix variable
- infra/ansible/jail-create.yaml: Use zfs_prefix variable
- .agent/skills/*/scripts/*.sh: Auto-detect PROJECT_NAME

Naming convention:
- ZFS prefix = project name (e.g., 'mevy-ai', 'clawdie-ai')
- No '-runtime' suffix needed
- Supports multiple installations on same host

Example:
- Project: /home/john/mevy-ai
- ZFS: zroot/mevy-ai/jails/controlplane
- Config: /home/john/.config/mevy-ai

Refs: docs/NAME-AGNOSTIC-DESIGN.md
2026-03-11 00:18:09 +00:00
f1a5d14185 Skip jail-specific tests when not running inside a jail
These tests validate the jail environment and should only run
when executed inside the controlplane jail. On the host, they
are now properly skipped using describe.skipIf(!inJail).
2026-03-10 20:35:30 +00:00
29484f1471 Reserved IP allocation for jail services
Priority-based scheme (lower = more foundational):
  .1 gateway, .2 controlplane, .3 database, .4 ollama,
  .5 cms, .6 browser, .7-.10 reserved

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 19:12:20 +00:00
004b6c5647 Add AGENT_NAME parameterization foundation and Astro CV example
Rename clawdie-freebsd skill to agent-setup, add AGENT_NAME as
single source of truth in config.ts, split database config into
skills DB + memory DB, and add working Astro Starlight example
for CMS integration testing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:27:35 +00:00
2c0fed3b23 Fixing /tmp problem
- Replace /tmp with project-relative tmp/ directory
- Add CLAWDIE_TMP_DIR env var with project-relative default
- Add TMP_DIR, TMP_TESTS_DIR, TMP_IPC_DIR, TMP_SKILLS_DIR to config.ts
- Update all test files to use TMP_TESTS_DIR
- Update shell scripts to use project-relative tmp/skills/
- Update agent-runner IPC cleanup to use /workspace/ipc/input.json
- Update Ansible playbooks to use env vars with fallbacks
- Add CMS resource limits
- Add jail-resource-limits.yaml playbook
- Add setup-wizard.ts (FreeBSD bsdinstall-style TUI)
- Add network.ts bootstrap step
- Remove hardcoded public gateway IP
2026-03-10 15:11:36 +00:00
c9ead60083 Add jail creation playbook and configure pi agent
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 10:08:21 +00:00
0d192a4f72 Complete PGVector memory system
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 09:43:40 +00:00
b6c7ca6399 Internal IP and domain redesign
Replace all hardcoded IPs (192.168.100.x) and domains (clawdie.si)
with configurable placeholders. Real values now live exclusively in
.env (gitignored).

Network: code defaults to 10.0.0.x, configurable via WARDEN_SUBNET_BASE,
WARDEN_GATEWAY, WARDEN_CONTROL_PLANE_IP env vars in jail-config.ts.

Domain: code defaults to clawdie.local, configurable via CLAWDIE_DOMAIN
env var. Subdomain scheme: controlplane/db/cms/gui.{domain}.

Also includes PGVector Phase 0 prep:
- Created ai_brain database with pgvector extensions
- Added pg + @types/pg npm packages
- Added CLAWDIE_DB_URL to .env
- Renamed db from 'clawdie' to 'ai_brain' across Ansible and docs
- Resolved embedding model: OpenRouter text-embedding-3-large at 1536d
- Added docs/pgvector-install-log.md

Renamed ai.clawdie.si → controlplane.{domain} (more descriptive).
Renamed vm.clawdie.si → gui.{domain}.

76 files updated across source, tests, skills, docs, Ansible, and scripts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 09:21:44 +00:00
Clawdie
daa3d1256b Fix VNET gateway provisioning and bump version 2026-03-08 17:38:07 +01:00
Clawdie
5dd79a34cb Use controlplane as Bastille jail ID 2026-03-08 14:28:16 +01:00
Clawdie
2a236d36ed Force thick VNET control-plane jail 2026-03-08 12:39:32 +01:00
Clawdie
0da3d86dbd Add Bastille control-plane provisioning plan 2026-03-08 12:21:03 +01:00
Clawdie
3375dd2c56 Expand Warden runtime model 2026-03-08 11:00:52 +01:00
Clawdie
4dec267545 Define Warden jail profiles 2026-03-08 10:37:28 +01:00
Clawdie
dc6432bb7c Align default jail name with clawdie-cp 2026-03-08 10:23:56 +01:00
Clawdie
33b1be005c Handle Warden stdin EPIPE gracefully 2026-03-08 10:08:54 +01:00
Clawdie
54fcd7fdd5 Add runtime health tracking and doctor command 2026-03-08 09:58:58 +01:00
Clawdie
e5ae8ae4f9 Fix jail config migration and chat listing 2026-03-08 00:16:10 +01:00
Clawdie
a80ec0664c Replace WhatsApp setup with Telegram auth 2026-03-07 23:08:14 +01:00
Clawdie
0a5adbe650 Remove Claude runtime path 2026-03-07 23:00:52 +01:00
Clawdie
0b9c4fc6c8 Rename runtime tree to jail 2026-03-07 22:53:36 +01:00
Clawdie
64e8584fd1 Drop legacy container config aliases 2026-03-07 22:38:47 +01:00
Clawdie
e9ac0dc620 Rename jail runtime config types 2026-03-07 22:31:28 +01:00
Clawdie
6bd516f9ac Standardize memory files on AGENTS.md 2026-03-07 22:25:03 +01:00
Clawdie
4e394d6194 Fix build imports and setup branding 2026-03-07 22:03:41 +01:00
Clawdie
a5c53fdd92 Remove non-FreeBSD runtime paths 2026-03-07 21:55:25 +01:00