Skip to content

feat(wizard): Phase 2 — use-case package opt-in (Matilde) via trust-gated install#97

Merged
juniperbevensee merged 2 commits into
mainfrom
dev/juniperbevensee/wizard-package-optin
Jun 17, 2026
Merged

feat(wizard): Phase 2 — use-case package opt-in (Matilde) via trust-gated install#97
juniperbevensee merged 2 commits into
mainfrom
dev/juniperbevensee/wizard-package-optin

Conversation

@juniperbevensee

Copy link
Copy Markdown
Collaborator

Phase 2 — use-case packages in create-new

Builds on the trust-gate (#96). Lets a user opt into an opinionated public package when creating an agent; Matilde (science) is the first. Everything a template pulls is fetched from a pinned git ref and scanned by the trust gate before install — copy + gate only, no script execution.

What's added

  • lib/services/usecase-templates.ts — registry loader + installUseCaseTemplate: installs a template's git-sourced artifacts via the shared trust-gated installArtifacts, then seeds its SOUL. The SOUL file is scanned in isolation (copied alone into a scratch dir → gateArtifactDir) so sibling files (e.g. a setup script) can't taint the scan and a poisoned SOUL is refused.
  • GET /api/usecase-templates — lists templates (id/name/description/recommends).
  • Deploy route — resolves the template id (unknown → 400), enables the template's plugins in config.yaml, installs it after the baseline; a gate refusal fails the create before the container starts.
  • Wizard — package picker folded into the Identity step (no step renumber); selecting a package prefills the recommended provider/model; threads the template id to deploy.
  • infra/usecase-templates.json — Matilde entry, pinned to NimbleCoAI/Matilde#v0.1.0 (plugin matilde_plugin, skill hermes-skill, SOUL docker/SOUL.Matilde.md). Matilde was packaged self-contained in refactor: self-contained plugin (vendor engine into matilde_plugin) for HSM install NimbleCoOrg/Matilde#7 and tagged v0.1.0.

Decisions

Verification

  • tsc clean · next build ok · full suite 474 pass / 2 fail (pre-existing harness-image, harness-compose-fallback)
  • Unit: usecase-templates (install + SOUL gate + poisoned-SOUL refusal). Route: template install called; unknown id → 400; plugin enabled in config.
  • Not covered here: live install — needs Docker + ARTIFACT_GIT_TOKEN (private Matilde repo) on the Mac Mini, same as Phase 1.

🤖 Generated with Claude Code

juniperbevensee and others added 2 commits June 17, 2026 15:38
…ated install

Adds an opt-in 'use-case package' picker to create-new (folded into the Identity
step) backed by a server-side registry (infra/usecase-templates.json).

- lib/services/usecase-templates.ts: registry loader + installUseCaseTemplate,
  which installs a template's git-sourced artifacts via the shared trust-gated
  installArtifacts and seeds its SOUL (the SOUL file is scanned in isolation by
  the same gate before it overwrites SOUL.md). Copy + gate only — no script exec.
- GET /api/usecase-templates: lists templates (id/name/description/recommends).
- Deploy route: resolves the template id (unknown -> 400), enables its plugins in
  config.yaml, and installs it after the baseline (fails the create before the
  container starts if the gate refuses anything).
- Wizard: package picker prefills recommended provider/model; threads template id.
- Registry: Matilde (science) as the first entry, pinned to v0.1.0.

Tests: usecase-templates (install + SOUL gate + poisoned-SOUL refusal) + route
wiring (install called; unknown id 400; plugin enabled). tsc clean; next build ok;
full suite 474 pass / 2 pre-existing fail.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…eanup, name guard)

Independent audit (MERGE-WITH-NITS) findings, now fixed:

- HIGH: gate scanned only at 'context' scope, so exfil/persistence/secret/
  config-mod patterns weren't caught — and Phase 2 routes a SOUL (identity
  prompt) + skills through it. gateArtifactDir now takes a scope; use-case
  template artifacts AND the SOUL are gated at 'strict'. Verified Matilde's real
  SOUL+skill have zero strict findings (no false positives); added a test using a
  strict-only exfil payload to prove strict is active.
- MEDIUM: a template-install failure left a half-written agent dir (.env secrets)
  on disk. Deploy now removes agentDataDir on provisioning failure (before any
  container starts) + frees the slug for retry; covered by a route test.
- LOW: artifact name from the manifest now traversal-validated (GIT_NAME_RE + no
  '..') before becoming a path segment / config.yaml entry.

Full suite 475 pass / 2 pre-existing fail; tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@juniperbevensee
juniperbevensee merged commit e1f9ddf into main Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant