Commit graph

115 commits

Author SHA1 Message Date
2ed6245b11 feat(backup): add backup script and restore runbook
npm run backup exports all critical state to a portable tarball:
  - messages.db (SQLite — all chats, tasks, sessions)
  - memory_db.sql + skills_db.sql (pg_dump from db jail)
  - .env, groups/, mount-allowlist.json

Takes ZFS snapshots via hostd before export. Flags:
  --skip-skills   skip skills_db (large, regenerable)
  --output <dir>  write archive to specific directory
  --no-snapshot   skip ZFS snapshots

setup/sanoid.ts: add management jail dataset to snapshot retention policy.
docs/sessions/2026-03-16-backup-restore.md: full restore runbook covering
SQLite, PostgreSQL, ZFS rollback, hardware migration, and cron automation.

---
Build: pass | Tests: pass — 489 passed (48 files)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---
Build: pass | Tests: pass — Tests  489 passed | 10 skipped (499)
2026-03-16 11:17:46 +00: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
9c82826296 chore: v0.5.0 prep — BSD-3 emphasis, changelog, license page
Version: bump package.json 0.4.0 → 0.5.0, add "license": "BSD-3-Clause"

LICENSE:
- Add NanoClaw credit line: "Built on NanoClaw — Copyright (c) 2024 Peter Steinberger (MIT License)"
- Preserves credit chain in all redistributions per BSD-3 clause 1

scripts/gen-changelog.ts:
- New: generates html/clawdie/changelog.html from annotated git tags
- Parses conventional commit prefixes → colour-coded type badges
- npm run gen-changelog — run after each release tag

html/clawdie/changelog.html:
- Initial generation from v0.3.0 tag (312 commits)
- Regenerate with: git tag -a v0.5.0 -m "v0.5.0 - <name>" && npm run gen-changelog

html/clawdie/license.html:
- BSD-3-Clause explanation: non-endorsement clause, FreeBSD lineage
- PlayStation/Sony (Orbis OS), Apple (Darwin), Netflix, Juniper context
- Why BSD-3 over MIT, NanoClaw compatibility table
- Full license text + what-you-can-do table

html/clawdie/docs/index.html:
- Add "Project" section with Changelog + License cards
- Add BSD-3-Clause row to quick reference table

html/clawdie/index.html:
- Bump version badge v0.4.0 → v0.5.0
- Replace "MIT License" badge with linked "BSD-3-Clause" → /license.html

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 20:37:27 +00:00
f113bcbd9c feat: sharpen FreeBSD differentiation and skills-memory bootstrap 2026-03-13 19:05:10 +01:00
1df76f110d feat: NanoClaw upstream toggle — Option A (git remote)
Implements the upstream tracking toggle discussed in design review.
Operator enables once during setup; the agent can check divergence from chat.

Changes:
- setup/upstream.ts — new setup step: --enable adds nanoclaw remote,
  fetches, writes NANOCLAW_UPSTREAM_ENABLED=true to .env; --disable/--status
- setup/index.ts — register 'upstream' in STEPS
- scripts/fetch-upstream.ts — cron-safe host-side fetch; prints divergence
  summary (commits in nanoclaw/main not in HEAD); respects NANOCLAW_UPSTREAM_ENABLED
- jail/agent-runner/src/ipc-mcp-stdio.ts — add check_upstream_updates MCP tool:
  read-only git log against nanoclaw/main, returns commit list for operator review
- docs/REFACTOR-PLAN.md — add Phase 7 (Option B: Gitea jail, deferred)

Nothing auto-merges. Operator decides what to apply.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 16:27:25 +00:00
07974ac7d2 Add clean slate rebuild guide + fix CMS IP
IP Convention (lower = more foundational):
- .1 = Gateway (warden0 bridge)
- .2 = Controlplane (agent brain)
- .3 = Database (PostgreSQL)
- .4 = Bhyve (reserved)
- .5 = CMS (Astro/Strapi)

Changes:
- docs/CLEAN-SLATE-REBUILD.md: Complete rebuild guide
  - Phase 1: Update .env to new IPs
  - Phase 2: Destroy existing jails
  - Phase 3: Rebuild from scratch with screenshots
- docs/CMS-DEPLOYMENT-PLAN.md: Fix CMS IP (10.0.0.5 → 192.168.100.5)
- scripts/destroy-jails.sh: Automated jail destruction

Old .env had:
- controlplane at .100 (wrong)
- db at .2 (should be .3)
- cms at .3 (should be .5)

New convention aligns service importance with IP number.
2026-03-11 01:48:49 +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
3e404b4332 Add memory pipeline scripts (Phase 2)
Three scripts in scripts/memory/:
- common.sh: shared config, DB connection, dependency checks
- embed.sh: generate 1536d embeddings via OpenRouter API
- chunk.sh: split text on sentence boundaries (~500 chars)
- memory-pg.sh: full CLI for store/search/recent/important/count

Store pipeline: text → chunk → embed → insert (fully automated).
Search: hybrid RRF combining full-text and vector similarity.
All scripts use #!/usr/bin/env bash for FreeBSD compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 09:30:34 +00:00
Clawdie
4fccff3f4e refactor: replace WhatsApp with Telegram, rename container→jail, migrate skills to .agent/
- Replace WhatsApp channel (@whiskeysockets/baileys) with Telegram (grammy)
  - Add src/channels/telegram.ts, remove src/channels/whatsapp.ts + whatsapp-auth.ts
  - TELEGRAM_BOT_TOKEN required; fatal exit if not set
  - Remove @whiskeysockets/baileys, qrcode, qrcode-terminal packages
  - Update routing tests to use tg: JID format

- Rename container→jail throughout src/
  - container-runner.ts → jail-runner.ts (jexec-based spawn)
  - container-runtime.ts → jail-ops.ts (stopJail, ensureJailRunning, cleanupStaleJails)
  - Add jail-config.ts, jail-runtime.ts for FreeBSD jail provisioning
  - Rename config exports: CONTAINER_TIMEOUT→JAIL_TIMEOUT, MAX_CONCURRENT_CONTAINERS→MAX_CONCURRENT_JAILS
  - Update group-queue.ts: isTaskContainer→isTaskJail, activeContainers→activeJails

- Migrate skills from .claude/skills/ to .agent/skills/
  - Add tmux-screenshot skill (ANSI color PNG renderer, wide-char fix, 24-bit truecolor)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 18:36:27 +01:00
Clawdie
d9148cd180 refactor: replace container paradigm with FreeBSD jails, rename all container refs
- Rename container-runtime.ts → jail-ops.ts, container-runner.ts → jail-runner.ts
- Rename all types: ContainerInput→JailInput, ContainerOutput→JailOutput, VolumeMount→JailMount
- Rename all functions: runContainerAgent→runJailAgent, stopContainer→stopJail,
  ensureContainerRuntimeRunning→ensureJailRunning, cleanupOrphans→cleanupStaleJails
- Rename config constants: CONTAINER_TIMEOUT→JAIL_TIMEOUT,
  CONTAINER_MAX_OUTPUT_SIZE→JAIL_MAX_OUTPUT_SIZE, MAX_CONCURRENT_CONTAINERS→MAX_CONCURRENT_JAILS
- Remove Docker/Apple Container runtime detection, CONTAINER_IMAGE, CONTAINER_RUNTIME_BIN
- Add jail-ops.ts: pure FreeBSD jail runtime (nullfs mounts, jexec, jls cleanup)
- Add jail-runner.ts: agent runner using jexec instead of docker run
- Add FreeBSD jail implementation docs and JAIL-CLEANUP-MODEL
- Add AGENT.md, AGENTS.md, groups/*/AGENT.md for Clawdie context
- Add mount-allowlist.example.json

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 16:30:12 +01:00
Gabi Simons
d12c3c4da3 refactor: CI optimization, logging improvements, and codebase formatting (#456)
* fix(db): remove unique constraint on folder to support multi-channel agents

* ci: implement automated skill drift detection and self-healing PRs

* fix: align registration logic with Gavriel's feedback and fix build/test issues from Daniel Mi

* style: conform to prettier standards for CI validation

* test: fix branch naming inconsistency in CI (master vs main)

* fix(ci): robust module resolution by removing file extensions in scripts

* refactor(ci): simplify skill validation by removing redundant combination tests

* style: conform skills-engine to prettier, unify logging in index.ts and cleanup unused imports

* refactor: extract multi-channel DB changes to separate branch

Move channel column, folder suffix logic, and related migrations
to feat/multi-channel-db-v2 for independent review. This PR now
contains only CI/CD optimizations, Prettier formatting, and
logging improvements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 23:13:36 +02:00
Gabi Simons
c57d2afcc0 refactor: remove deterministic caching system from skills engine (#453) 2026-02-24 15:49:29 +02:00
gavrielc
5295e2e6fc feat: add /update skill for pulling upstream changes (#372)
Interactive skill that guides Claude through fetching upstream NanoClaw,
previewing changes, merging with customizations, running migrations, and
verifying the result. Includes:

- SKILL.md with 9-step update flow
- fetch-upstream.sh: detects remote, fetches, extracts tracked paths
- run-migrations.ts: discovers and runs version-ordered migrations
- post-update.ts: clears backup after conflict resolution
- update-core.ts: adds --json and --preview-only flags
- BASE_INCLUDES moved to constants.ts as single source of truth
- 16 new tests covering fetch, migrations, and CLI flags

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 01:03:13 +02:00
gavrielc
6e10deecc8 Skills engine v0.1 + multi-channel infrastructure (#307)
* refactor: multi-channel infrastructure with explicit channel/is_group tracking

- Add channels[] array and findChannel() routing in index.ts, replacing
  hardcoded whatsapp.* calls with channel-agnostic callbacks
- Add channel TEXT and is_group INTEGER columns to chats table with
  COALESCE upsert to protect existing values from null overwrites
- is_group defaults to 0 (safe: unknown chats excluded from groups)
- WhatsApp passes explicit channel='whatsapp' and isGroup to onChatMetadata
- getAvailableGroups filters on is_group instead of JID pattern matching
- findChannel logs warnings instead of silently dropping unroutable JIDs
- Migration backfills channel/is_group from JID patterns for existing DBs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: skills engine v0.1 — deterministic skill packages with rerere resolution

Three-way merge engine for applying skill packages on top of a core
codebase. Skills declare which files they add/modify, and the engine
uses git merge-file for conflict detection with git rerere for
automatic resolution of previously-seen conflicts.

Key components:
- apply: three-way merge with backup/rollback safety net
- replay: clean-slate replay for uninstall and rebase
- update: core version updates with deletion detection
- rebase: bake applied skills into base (one-way)
- manifest: validation with path traversal protection
- resolution-cache: pre-computed rerere resolutions
- structured: npm deps, env vars, docker-compose merging
- CI: per-skill test matrix with conflict detection

151 unit tests covering merge, rerere, backup, replay, uninstall,
update, rebase, structured ops, and edge cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add Discord and Telegram skill packages

Skill packages for adding Discord and Telegram channels to NanoClaw.
Each package includes:
- Channel implementation (add/src/channels/)
- Three-way merge targets for index.ts, config.ts, routing.test.ts
- Intent docs explaining merge invariants
- Standalone integration tests
- manifest.yaml with dependency/conflict declarations

Applied via: npx tsx scripts/apply-skill.ts .claude/skills/add-discord
These are inert until applied — no runtime impact.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* remove unused docs (skills-system-status, implementation-guide)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 01:55:00 +02:00