Commit graph

129 commits

Author SHA1 Message Date
c19e08758b Refactor harness extension safety model and add runner tests
---
Build: pass | Tests: pass — Tests  873 passed (873)
2026-04-11 14:47:18 +00:00
1cf201c965 Fix mock pools for new Postgres ops
---

Build: not run | Tests: pass - 7 passed (7 files)

---
Build: pass | Tests: pass — Tests  869 passed (869)
2026-04-11 10:38:55 +00:00
8e661311b5 feat(db): migrate SQLite to Postgres OPS_DB (Sam & Claude)
Replace better-sqlite3 with pg Pool for all operational data (chats,
messages, tasks, sessions, router_state, registered_groups). New
OPS_DB_URL config drives a dedicated ops database alongside the
existing memory and skills databases.

All db.ts functions are now async. Callers in src/, setup/, and tests
updated accordingly. Tests use a mock pool (src/test-helpers.ts) so
they run without a live Postgres connection.

---
Build: pass | Tests: not run (Linux)
2026-04-11 12:21:27 +02:00
e6e60b9406 fix(hostd): emit rc.d literals correctly 2026-04-08 20:04:03 +00:00
f1a6ba7815 feat(install): rename install-all + add controlplane step 2026-04-08 19:22:46 +00:00
fc0abfc517 feat(setup): require at least one agent CLI before onboarding
Mirrors Paperclip's per-adapter ensureCommandResolvable pattern as a single
fail-fast gate at the top of `setup onboard`. Probes {claude, codex, gemini,
pi} via commandExists; throws NoAgentCliError if none resolve. Also surfaces
all four in `setup verify` alongside the existing CODEX check.

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

---
Build: pass | Tests: FAIL — Tests  1 failed | 846 passed (847)
2026-04-08 09:14:56 +00:00
65fb2aa972 fix(jails): preinstall bash + node + git in worker jail, chsh root to bash
Default worker jail had only rsync/cage/chromium. Provisioning scripts
that use heredocs or bash-isms via 'bastille cmd <jail>' failed because
root's login shell was sh. Also missing node/npm/git made the jail
useless as a sandbox for the agent runtime.

- worker-jail.txt: add bash, git, node24, npm-node24
- setup/jails.ts: chsh -s /usr/local/bin/bash root after pkg install

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

---
Build: pass | Tests: FAIL — Tests  1 failed | 846 passed (847)
2026-04-08 08:37:47 +00:00
061a25f98e refactor(controlplane): rename ceo→orchestrator, company→system, agent id=AGENT_NAME
Terminology overhaul for control plane naming:
- AgentRole 'ceo' → 'orchestrator', schema constraint updated
- DEFAULT_AGENTS → getDefaultAgents(agentName) function, main agent id = AGENT_NAME
- Identity file resolution: {AGENT_NAME}.md with SOUL.md fallback
- All test mocks updated: 'ceo' → 'clawdie', 'company' → 'system'
- SOUL.md + SYSADMIN.md docs updated (Paperclip→Control Plane)
- TypeScript build clean (tsc --noEmit passes)

Remaining: DBA.md, GIT_ADMIN.md, doc/* updates, CLAWDIE.md creation
See doc/NAMING-HANDOFF.md for task checklist (Sam & Claude)
2026-04-08 10:07:41 +02:00
cd65148a56 fix(controlplane): provision live DB + harden setup logging
- Run setup/controlplane.ts against live PostgreSQL — creates schema,
  4 agents, operator account, budgets, skills snapshot. Stops the
  heartbeat loop's "relation 'agents' does not exist" errors.
- setup/controlplane.ts: write a real logs/setup.log (was a dead label),
  scrub OPERATOR_PASSWORD from emitStatus payload, add "do not tee"
  warning next to the one stdout password print on first install.
  Password still lives only in .env (mode 0600) + one-shot terminal output.

Co-Authored-By: Sam, Clawdie & Claude

---
Build: pass | Tests: pass — Tests  847 passed (847)
2026-04-08 04:04:20 +00:00
b3993090f3 feat: Phase 1 — control plane DB schema + provisioning (30/30 tests green)
src/controlplane-db.ts — PostgreSQL schema + typed queries
  - 6 tables: agents, tasks, agent_activity, agent_budgets, approvals, operators
  - DEFAULT_AGENTS: CEO (80%, on-demand), Sysadmin (10%, daily 86400s),
    DBA (5%, on-demand), Git Admin (5%, on-demand)
  - upsertAgent, getAgents, upsertBudget, getBudget, upsertOperator, getOperator
  - hashPassword (sha256 + salt), verifyPassword, generatePassword (32 chars)
  - copySkills (.agent/skills/ → data/skills/, snapshot not symlinks)
  - countSkillsInDir

setup/controlplane.ts — setup step: npm run setup -- --step controlplane
  - Runs schema migration (idempotent — IF NOT EXISTS)
  - Provisions 4 agents (ON CONFLICT DO UPDATE)
  - Creates operator account (ON CONFLICT DO NOTHING)
  - Writes OPERATOR_PASSWORD to .env
  - Seeds per-agent budgets from CONTROLPLANE_DAILY_TOKENS (default 100000)
  - Copies 15 operational skills to data/skills/

setup/index.ts — registered 'controlplane' step

src/controlplane-setup.test.ts — 30 tests, all passing
  - agent definitions (4 agents, correct roles, all pi-local adapter)
  - heartbeat config (sysadmin daily, others on-demand)
  - budget allocations (80/10/5/5, sum to 100%)
  - operator security (password hashed, salted, never plaintext)
  - skills copy (SKILL.md detection, no symlinks, skip dirs without SKILL.md)
  - idempotency (unique ids and roles in DEFAULT_AGENTS)

docs/public/architecture/controlplane.md — Phase 1 marked 

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

---
Build: pass | Tests: pass — Tests  708 passed | 139 todo (847)
2026-04-07 13:36:57 +00:00
a6064050aa revert: Remove i18n (simplify to English-only until translations arrive) (Sam & Claude)
---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-06 18:33:56 +00:00
1d721813af simplify: Root index for basic redirect (Starlight handles i18n) (Sam & Claude)
---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-06 18:31:42 +00:00
4354aa7c23 fix: Remove Astro i18n config (let Starlight handle it) (Sam & Claude)
---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-06 18:31:15 +00:00
e986b56315 fix: Add i18n locales config to Starlight integration (Sam & Claude)
---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-06 18:30:13 +00:00
5dd43f828a fix: Build meta content string in JS section for i18n redirect (Sam & Claude)
---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-06 18:24:15 +00:00
dd8ee184c3 fix: Correct template syntax in astro root index (Sam & Claude)
---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-06 18:23:42 +00:00
434d3d61da fix: Add i18n root index for Astro locale redirects
Astro i18n routing requires a root index page (src/pages/index.astro)
to create locale redirects. This fixes the build error:
  MissingIndexForInternationalizationError

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

---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-06 18:22:20 +00:00
8d8a2e5eab feat: Enable i18n in Astro Starlight — add Slovenian support
Add i18n routing config to astro.config.mjs generator:
- Default locale: English (en)
- Translations: Slovenian (sl)
- URL routing: /en/ and /sl/ prefixes

Ready for Crowdin translation pull and site rebuild.

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

---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-06 18:10:58 +00:00
84cc452497 docs: complete Codex's public/internal restructure alignment
Codex restructured docs on 5 Apr (cc37d2c) into public/ and internal/
subdirectories. This commit completes the alignment work by updating all
references across skills, agents, and generated files.

Changes:

Skills Documentation:
- docs-deployment/SKILL.md: Update doc paths (docs/INSTALL.md → docs/public/install/install.md)
- docs-deployment/INTEGRATION.md: Update example paths for new structure
- agent-setup/SKILL.md: Update references
- ansible-freebsd/SKILL.md: Update references

Agents & Conventions:
- AGENTS.md: Add tmux "testing" window guideline for long-running commands
- AGENTS.md: Update doc path references (INSTALL.md → install.md lowercase)
- README-CLAWDIE.md: Update doc paths
- CROWDIN.md: Update structure references

Build System:
- setup/cms.ts: Improve frontmatter generation (skip files with existing h1)
- scripts/memory/embed-docs.py: Adjust for new structure
- docs-deployment/DOCUMENTATION-POLICY.md: Update guidelines

HTML/Web Output:
- html/: Version bumps, link fixes, manifest updated
- Reflect new public/ structure in rendered docs

Validation:
- All skills reference docs correctly
- Install/setup docs now at docs/public/install/
- Docs build and serve correctly (verified 6 Apr)
- 603 tests passing (from Codex's build)

Co-Authored-By: Codex (Agent) <codex@clawdie.si>
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-06 13:22:24 +00:00
00e25fa8f9 fix: postgres permissions with DEFAULT PRIVILEGES (Sam & Claude)
- Add permissions.sql with GRANT + ALTER DEFAULT PRIVILEGES
- Add fix-permissions.sh for quick repair on existing databases
- Add POSTGRES-PERMISSIONS.md documentation
- Update setup-db-jail.sh to run permissions.sql after migrations
- Update skills-memory.ts to apply permissions after artifact import

Fixes: permission denied for table memories
2026-04-06 06:48:12 +02:00
c9658d6bc9 Rework Starlight docs structure (Sam & Codex)
---

Build: FAIL | Tests: FAIL — not run (deferred)

---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-05 16:57:25 +00:00
84c4258727 Fix .nanoclaw ownership when skills-init runs as root
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-05 14:12:33 +00:00
75f736eaec Wire skills-engine init into install pipeline (Sam & Claude)
New setup/skills-init.ts step creates .nanoclaw/ base snapshot during
npm run install-all. Registered in setup/index.ts and install.ts
(step 10/20, after skills-memory, before cms). Idempotent — skips
if already initialized, --force to reinit.

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

---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-05 09:22:12 +00:00
6ec5ee3bc6 Worker jail naming fix; reset doc update (Sam & Codex)
---

Build: pass | Tests: pass - 603 passed (44 files)

---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-05 06:59:51 +00:00
cc37d2c8cf Public/internal docs restructure; CMS/verify cleanup (Sam & Codex)
---

Build: pass | Tests: pass - 603 passed (44 files)

---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-05 06:29:19 +00:00
ca32c39a71 Unify CMS webroot + Starlight build fixes (Sam & Codex)
---

Build: FAIL — not run

Tests: FAIL — not run

---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-04 20:09:10 +00:00
cdf2c8f296 Enable Tailscale jail auto-join (Sam & Codex)
Add a setup helper to enable tailscale inside jails when FEATURE_TAILSCALE

and an auth key are present, prefetch tailscale packages, and document

the installer shortcut.

---

Build: FAIL — not run

Tests: FAIL — not run
2026-04-04 15:40:47 +00:00
1452da8d75 Enforce UTF-8 locales and expand snapshot coverage
---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-04 14:17:04 +00:00
dde5cb85f0 Support git jail mirror list (Sam & Codex)
---

Build: pass | Tests: pass — 603 passed (44 files)

---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-04 10:50:20 +00:00
b0921f4fb4 Normalize domain defaults to home.arpa (Sam & Codex)
---

Build: pass | Tests: pass — 603 passed (44 files)

---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-04 09:47:07 +00:00
3f598270a8 chore(install): codex out-of-box + headless login tip (Sam & Codex)
---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-03 10:06:23 +00:00
a2639162a3 fix(tmp): keep temp files under project tmp/ (Sam & Codex)
- Skills engine uses <project-root>/tmp/skills for merge/update temp files

- Scripts and Telegram voice downloads avoid system /tmp

- Add formatSnapshotStamp() for DD.mmm.YYYY-HHMM naming

---

Build: pass | Tests: pass — 603 passed (44 files)

---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-03 09:37:42 +00:00
e7043c872d feat(setup): implement pf/db/jails/hostd + safer sudo flow (Sam & Codex)
- Add missing install-all setup steps: worker jails, db jail, hostd service

- PF now writes /etc/pf.warden.conf and ensures pf.conf includes it

- install-all can run root-only steps via sudo; .env ownership preserved

- Prefer {agent}-prefixed service jails with legacy fallbacks

---

Build: pass | Tests: pass — 603 passed (44 files)

---
Build: pass | Tests: pass — Tests  603 passed (603)
2026-04-03 09:36:40 +00:00
332b9fd125 Setup: reduce prompts (AUTO boot), add env-audit, drop headless/desktop split (Sam & Codex)
- install-all forces service boot mode AUTO (no prompt)

- add env-audit step for effective config summary

- remove isHeadless/isDesktop split; treat GUI stack as always required

- preflight timestamps use display-date helper

---

Build: pass | Tests: pass — 602 passed (44 files)

---
Build: pass | Tests: pass — Tests  602 passed (602)
2026-04-03 08:49:07 +00:00
2179e23ec9 feat: add local LLM runtime selection
---
Build: pass | Tests: pass — Tests  605 passed (605)
2026-04-02 15:18:22 +00:00
56caa74b3c feat(setup): add CMS jail step with Astro + nginx provisioning
Adds setup/cms.ts that bootstraps the CMS jail: installs packages,
scaffolds Astro project from templates, builds static site, deploys
to /srv/www, and configures nginx. Also adds CMS config exports
(CMS_JAIL_IP, CMS_WEBROOT, ASTRO_SITE_PATH) and fixes
loadAllPackageLists to include forgejo-jail.txt and cnc-jail.txt.

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

---
Build: pass | Tests: pass — Tests  605 passed (605)
2026-04-02 11:24:10 +00:00
31e4df9217 fix: replace jexec with bastille cmd in verify, fix ollama IP label
- verify.ts: all 12 jexec calls replaced with bastille cmd
- verify.ts: tool check now looks for bastille instead of jexec
- install.ts: ollama label said .6, corrected to .5

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

---
Build: pass | Tests: pass — Tests  605 passed (605)
2026-04-02 10:53:50 +00:00
85a8c47da4 feat(setup): add Forgejo web UI step for local git hosting
New setup/forgejo.ts installs Forgejo in the existing git jail, gated
by FEATURE_GITEA=YES or CODE_HOSTING_MODE=gitea. Uses SQLite, runs on
port 3000, generates app.ini with sane defaults (registration disabled,
offline mode, no actions). Wired into install-all and verify.

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

---
Build: pass | Tests: pass — Tests  605 passed (605)
2026-04-02 08:20:07 +00:00
ca390ec899 fix: detect existing git jail
---
Build: pass | Tests: pass — Tests  605 passed (605)
2026-04-02 08:07:58 +00:00
49edbc3275 fix: align onboarding IP defaults with Ansible scheme, tighten git gating
Onboarding was writing WARDEN_GIT_IP=.4 and WARDEN_OLLAMA_IP=.6 —
reversed from the canonical Ansible/live scheme (.6=git, .5=ollama).
Also fix git.ts feature gate to skip on either FEATURE_GIT=false OR
CODE_HOSTING_MODE=external (was requiring both).

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

---
Build: pass | Tests: pass — Tests  605 passed (605)
2026-04-02 08:00:26 +00:00
40ae41fa81 feat(setup): add git jail step + fix IP scheme to match Ansible
New setup/git.ts provisions a Bastille git jail as local Codeberg
fallback. Mirrors from REMOTE_GIT_URL with graceful fallback to empty
bare repo when remote is unreachable. Fully idempotent.

Fix IP scheme: .4=cms, .5=ollama, .6=git (was .4=git, .5=cms,
.6=ollama in config.ts and local-hosts.ts — now matches Ansible).

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

---
Build: pass | Tests: pass — Tests  605 passed (605)
2026-04-02 07:53:11 +00:00
552e412f5b fix(preflight): make Doctor step soft-fail for fresh installs
Doctor checks runtime health (message loop, watchdog, skills DB) which
are expected to be offline on a fresh bhyve guest before the agent starts.
Mark it softFail so preflight reports 'warning' instead of blocking the
overall status. Install-readiness steps still hard-fail as before.

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

---
Build: pass | Tests: pass — Tests  605 passed (605)
2026-04-02 06:48:17 +00:00
667cf21c03 Add PF setup step (Sam & Codex)
---

Build: FAIL | Tests: FAIL — not run
2026-04-02 06:21:46 +00:00
e0dd328990 fix: correct preflight summary path and hardcoded session name
- Evidence script and checklist looked in logs/preflight-* but preflight
  writes to tmp/preflight/ — fixed both to match actual output path
- Checklist referenced npm run preflight (missing) — corrected to
  preflight-check
- preflight.ts screenshot capture had hardcoded 'clawdie' session —
  now uses AGENT_NAME

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

---
Build: pass | Tests: pass — Tests  605 passed (605)
2026-04-02 06:12:26 +00:00
955d83e3cc Add install-all --step support for preflight (Sam & Codex)
---
Build: pass | Tests: pass — Tests  605 passed (605)
2026-04-02 05:38:32 +00:00
b623ad1e15 Fix preflight package names and headless weston skip (Sam & Codex)
---
Build: pass | Tests: pass — Tests  605 passed (605)
2026-04-01 22:53:15 +00:00
61be190bd8 feat: identity-restore installer step + Supabase-backed identity files
- New setup/identity-restore.ts: fetches SOUL.md, IDENTITY.md, USER.md
  from Supabase backups table; non-fatal if Supabase not configured
- Registered in setup/index.ts and setup/install.ts (before verify step)
- Restored SOUL.md, IDENTITY.md, USER.md from prior agent's Supabase backup

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

---
Build: pass | Tests: pass — Tests  431 passed (431)
2026-03-28 13:45:25 +00:00
98c8f82fc6 fix: normalise locale to UTF-8 in applyHostLocale; add UTF-8 rule to AGENTS.md
applyHostLocale() was writing whatever charset was detected on the host
(including ISO8859-2) verbatim into ~/.login_conf, silently breaking
Slovenian character rendering on next login.

- Always strip the charset suffix from the detected locale tag and
  rewrite it as <base>.UTF-8 — sl_SI.ISO8859-2 → sl_SI.UTF-8
- charset field is always written as UTF-8
- Replace both 'tmux kill-server && tmux' suggestions with instruction
  to open a new tmux window or fresh SSH login
- Add UTF-8 compliance section to AGENTS.md documenting the rule,
  normalisation table, and the cap_mkdb requirement

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

---
Build: pass | Tests: pass — Tests  431 passed (431)
2026-03-28 09:34:48 +00:00
200b6b62a1 fix: remove gender inference — user always decides
Dropped inferGender() heuristic. The installer now shows the current
.env value (or 'n') as default and requires explicit user selection.
No guessing from name endings.

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

---
Build: pass | Tests: pass — Tests  431 passed (431)
2026-03-27 17:52:16 +00:00
cf6fc72d91 feat: gender as first-class agent identity — core differentiator
src/agent-identity.ts (new): AgentIdentity resolves name, gender, locale
into pronoun/possessive/title/selfIntro. FORMS map supports sl (full
gendered grammar: asistentka/asistent, ona/on) and en (neutral fallback).
resolveAgentIdentity() exported for onboarding preview before .env write.

src/config.ts: AgentGender type ('m'|'f'|'n'), AGENT_GENDER export.
Accepts 'ž' as alias for 'f' (Slovenian natural input).

src/agent-runner.ts: AGENT_IDENTITY.selfIntro prepended to every pi
system prompt — agent always knows who it is grammatically.

setup/onboarding.ts: gender question after assistant name in both
bsddialog (menu with live preview per gender) and TTY (prompt + preview
line) paths. inferGender() suggests female for names ending in 'a'.
Confirmation screen shows full identity preview. AGENT_GENDER written
to .env.

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

---
Build: pass | Tests: pass — Tests  431 passed (431)
2026-03-27 17:41:46 +00:00