CatoandClaude efa6c38ee4 feat(plan): "Did it help?" under every step, and the next plan learns from it (#65)
Each step in "Your steps" can be marked "I did this" or "Not for me",
then answered: did it help? Yes, a little, no. Answers are kept per person
and step (step_outcomes), so the same step in two plans is one experience,
and "Change" takes one back.

The next assessment reads them: a step that helped counts like something
the person already does (the worry reads as covered), and one that did not
help or was not wanted is set aside, listed as such, with the next option
recommended and a line saying why. With nothing said, a plan is exactly as
before (tested).

One form per step with a button per answer: works without JavaScript and
the choices sit as equal cells. The roadmap item moves to the changelog.


Claude-Session: https://claude.ai/code/session_01TTH5cy8bKmEqzdTyAsbbT8

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-22 18:21:02 +02:00

Skif

Holistic safety for people and the places they live — Zürich first, without trading away privacy or freedom.

What works

End to end, with everything persisted in Postgres:

  1. Customer signs in (OrangeCat OIDC), sets a Safety Preference Profile — hard limits (no facial recognition, no interior cameras, no cloud video, no automatic police sharing), presence style and languages.
  2. Customer requests a service (Night Out, Getting home, …). Payment is recorded as PAYMENT_PENDING and settled manually — never faked.
  3. Operations (/ops) approves Protector applications, sees approved Protectors ranked with a reason for every point (and who is excluded, and why), and assigns one. The ranking is deterministic — no model.
  4. The Protector accepts (only then sees the meeting point and notes), starts, files reports or incidents, and completes. A Protector never sees who the customer is.
  5. Customer rates respect, discretion and feeling of safety on labelled scales — not stars.
  6. Operations sees the whole lifecycle, the rating and every report.
  7. Safety assessment (/assessments) saves a Safety Plan: the most proportionate step per concern within the person's hard limits, the trade-offs, what's excluded and why — and says "you don't need to buy anything" when that's the answer.

Layout

src/config/     what exists — services, constraints, interventions, weights, the
                public site's words (site.ts), the Academy (academy.ts), guides (guides/),
                research with sources (research/), Act checklists (checklists.ts)
                and photographs with credits (photos.ts) (SSOT)
src/site/       the public content pages as @bitbaum/sitekit data, assembled from
                config (guides, research, method, protectors, join); validated in
                site.test.ts. Drawn with sitekit's renderers, except page openings
                (photographs) and tables (stack on phones), which sitekit cannot do
src/domain/     pure logic — lifecycle state machine, matching, safety plan, inputs
src/db/         Drizzle schema + client (no users table; OIDC sub is identity)
src/server/     data access + authorisation, one module per concern
src/app/        pages and server actions — (public) for the site, (app) behind sign-in
src/components/ UI
drizzle/        committed SQL migrations

Roles are derived, not stored on a user: Operations = subs listed in SKIF_OPS_SUBS; Protector = a row in protectors (applied → approved by Operations); everyone signed in is a customer.

Run it locally

pnpm install
cp .env.example .env.local        # dev login is on by default
pnpm db:local                     # in-process Postgres on :5433 (keep running)
pnpm db:migrate                   # in another shell
pnpm dev

Sign in with the development form using any identity. Use ops to get Operations (it becomes the sub dev:ops, which .env.example lists in SKIF_OPS_SUBS). The development login only mounts when NODE_ENV is development and SKIF_DEV_LOGIN=1, so it can't exist in a production build.

Verify

pnpm verify    # type-check, lint, tests, build

Tests include a full lifecycle run against in-process Postgres (PGlite) with the committed migrations applied.

Production

Required env on the box: DATABASE_URL, AUTH_SECRET, AUTH_URL, AUTH_TRUST_HOST=true, ORANGECAT_OAUTH_CLIENT_ID, ORANGECAT_OAUTH_CLIENT_SECRET, SKIF_OPS_SUBS. The landing page needs none of them. Optional: SKIF_OPS_EMAIL, RESEND_API_KEY (and RESEND_FROM) turn on Operations alerts by email — new bookings to assign, incidents filed — which carry no personal or location data; /api/health reports mail. Optional: GROQ_API_KEY (and/or GEMINI_API_KEY, OPENROUTER_API_KEY) switches on AI form assistance — only on the Protector application, where a Protector describes their own experience; it fills fields they review, and never touches location, incident or matching data (see src/config/ai-forms.ts). Optional: SKIF_LOKI_WATCH_SUBS (the owner's sub) loads the Loki feedback widget inside the app for that person alone, so opening Skif from Loki's "Open your site" link turns on watch mode: errors, failed requests and dead taps become suggested fixes in Loki. It mounts on their own pages only, never under /ops (see src/config/feedback.ts); unset, the app loads no third-party script. Migrations in drizzle/ are applied by the deploy pipeline's schema step once the app has a database declared in its deploy manifest.

S
Description
No description provided
Readme
17 MiB
0 Stars 2 Watchers 0 Forks
Languages
TypeScript 98.8%
JavaScript 0.8%
CSS 0.4%