Compare commits

...
Author SHA1 Message Date
adminandClaude Opus 5.5 6134e3360e Restore docs/qa/2026-10-07-qa.md (swept into the previous commit by mistake)
CI / backend (16) (push) Successful in 3m38s
CI / backend (17) (push) Successful in 3m33s
CI / managed-db (push) Successful in 3m13s
CI / compose-smoke (push) Successful in 2m4s
CI / deploy-kit-tests (push) Successful in 2m53s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 23:14:55 +01:00
adminandClaude Opus 5.5 b0c58bace9 TLS override: give the certbot network its own subnet
CI / backend (16) (push) Successful in 3m36s
deploy kit / preflight (push) Successful in 1m28s
CI / backend (17) (push) Successful in 3m31s
CI / managed-db (push) Successful in 3m18s
CI / compose-smoke (push) Successful in 1m0s
CI / deploy-kit-tests (push) Successful in 3m4s
compose.tls.yaml put the certbot network on 172.30.30.0/24, which Parafa's
network has owned since M6, so turning TLS on failed with 'Pool overlaps'.
172.30.50.0/24 is free on every layout in compose.yaml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 23:14:44 +01:00
adminandClaude Opus 5.5 9a0d79a0b5 Restore docs/qa/2026-10-07-qa.md (committed by mistake with the dredd-core fix)
CI / backend (16) (push) Successful in 4m1s
CI / backend (17) (push) Successful in 3m48s
CI / deploy-kit-tests (push) Successful in 2m53s
CI / managed-db (push) Successful in 3m40s
CI / compose-smoke (push) Successful in 2m11s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 22:19:08 +01:00
adminandClaude Opus 5.5 9304f102f7 Fetch private dredd-core from the Haski Gitea, not GitHub
CI / compose-smoke (push) Successful in 2m17s
CI / deploy-kit-tests (push) Successful in 2m55s
CI / backend (16) (push) Successful in 4m0s
CI / backend (17) (push) Successful in 3m59s
CI / managed-db (push) Successful in 3m55s
deploy kit / preflight (push) Successful in 1m27s
The Dockerfiles still rewrote credentials for github.com only, so the build
token never reached Gitea and installs worked only while dredd-core was
public. Rewrite http://77.216.148.202:3000/ instead, give every workflow
that pip-installs the same rewrite (org secret DREDD_CORE_TOKEN, the
read-only haski-reader token), and drop the GitHub PAT leftovers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 22:18:15 +01:00
adminandClaude Opus 5.5 7c4c276771 CI: deploy-box runs every Sunday at 22:00 Warsaw time
CI / managed-db (push) Successful in 3m37s
CI / backend (16) (push) Successful in 4m55s
CI / compose-smoke (push) Successful in 1m7s
CI / deploy-kit-tests (push) Successful in 2m34s
CI / backend (17) (push) Successful in 3m49s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 20:47:45 +01:00
ci-bot 142832a03b Workflow: 82df340 -> d379ce2
CI / backend (16) (push) Successful in 4m28s
CI / backend (17) (push) Successful in 4m24s
CI / managed-db (push) Successful in 4m10s
CI / compose-smoke (push) Successful in 58s
deploy kit / preflight (push) Successful in 1m13s
CI / deploy-kit-tests (push) Successful in 2m35s
Kaskada: Haski/Workflow main green on d379ce228844ac01e24bf7aeaa68f37a2db3609d.
2026-11-30 19:18:27 +01:00
ci-bot 84723bc357 Sygna: 02bb267 -> 9230e24
CI / backend (16) (push) Successful in 3m46s
CI / backend (17) (push) Successful in 3m43s
deploy kit / preflight (push) Successful in 1m52s
CI / managed-db (push) Successful in 3m37s
CI / compose-smoke (push) Successful in 1m30s
CI / deploy-kit-tests (push) Successful in 3m27s
Kaskada: Haski/Sygna main green on 9230e24fbed25be404c02ecfc08138517d86f88d.
2026-11-30 19:11:43 +01:00
ci-bot 42f4a1cc1d Scribe: ea3d577 -> 4b42bd6
CI / backend (16) (push) Successful in 4m51s
CI / backend (17) (push) Successful in 4m40s
deploy kit / preflight (push) Successful in 1m31s
CI / managed-db (push) Successful in 4m23s
CI / compose-smoke (push) Successful in 1m8s
CI / deploy-kit-tests (push) Successful in 2m56s
Kaskada: Haski/Scribe main green on 4b42bd6f489e704e9b77e941e5e4cbade7113948.
2026-11-30 19:05:30 +01:00
ci-bot 1a79b361e6 Parafa: 8c29520 -> f781bd7
CI / backend (16) (push) Successful in 4m1s
CI / managed-db (push) Successful in 3m46s
deploy kit / preflight (push) Successful in 1m30s
CI / deploy-kit-tests (push) Successful in 3m8s
CI / backend (17) (push) Successful in 3m59s
CI / compose-smoke (push) Successful in 1m0s
Kaskada: Haski/Parafa main green on f781bd75575a2d265ecf54fb14ae0bb3ac4a5e62.
2026-11-30 18:58:49 +01:00
ci-bot d7f678194a Lexicon: 02d746f -> 5d405aa
CI / backend (16) (push) Successful in 3m39s
CI / compose-smoke (push) Successful in 58s
CI / managed-db (push) Successful in 3m32s
CI / backend (17) (push) Successful in 3m41s
CI / deploy-kit-tests (push) Successful in 2m41s
deploy kit / preflight (push) Successful in 1m20s
Kaskada: Haski/Lexicon main green on 5d405aad86c79e26cf945e8fdeb51c96f172089f.
2026-11-30 18:51:13 +01:00
ci-bot 20a24b228b Insider: c577b77 -> 4853393
CI / backend (16) (push) Successful in 4m48s
CI / managed-db (push) Successful in 4m20s
CI / compose-smoke (push) Successful in 1m14s
deploy kit / preflight (push) Successful in 1m22s
CI / backend (17) (push) Successful in 4m47s
CI / deploy-kit-tests (push) Successful in 2m52s
Kaskada: Haski/Insider main green on 4853393865194de6c8cf2aebb72e698ea6850ece.
2026-11-30 18:44:14 +01:00
ci-bot 8f4fa25a0c Galena: 1fa8b1a -> b9d2d80
CI / backend (16) (push) Successful in 5m14s
CI / backend (17) (push) Successful in 5m6s
CI / compose-smoke (push) Successful in 1m40s
deploy kit / preflight (push) Successful in 1m48s
CI / managed-db (push) Successful in 5m2s
CI / deploy-kit-tests (push) Successful in 3m37s
Kaskada: Haski/Galena main green on b9d2d80fbe1b0a5acc887be2e898b9caee1f29e5.
2026-11-30 18:36:44 +01:00
ci-bot a29fd61a7a Agora: 7aa1881 -> 0d61e7f
CI / managed-db (pull_request) Successful in 4m45s
CI / backend (17) (pull_request) Successful in 5m24s
CI / backend (16) (pull_request) Successful in 5m26s
CI / compose-smoke (pull_request) Successful in 1m55s
CI / deploy-kit-tests (pull_request) Successful in 3m39s
deploy kit / preflight (pull_request) Successful in 1m58s
CI / backend (17) (push) Successful in 4m46s
CI / compose-smoke (push) Successful in 1m30s
deploy kit / preflight (push) Successful in 1m37s
CI / deploy-kit-tests (push) Successful in 3m30s
CI / backend (16) (push) Successful in 5m11s
CI / managed-db (push) Successful in 4m32s
Kaskada: Haski/Agora main green on 0d61e7fe0323bd6f1b0e18968b995e06d17106b6.
2026-11-30 17:20:55 +00:00
ci-bot 67bdec6ac2 Merge pull request 'Workflow: a1a7d5c -> 82df340' (#3) from cascade/workflow-82df340 into main
CI / backend (16) (push) Successful in 4m34s
CI / managed-db (push) Successful in 4m13s
CI / backend (17) (push) Successful in 4m27s
CI / deploy-kit-tests (push) Successful in 3m29s
CI / compose-smoke (push) Successful in 1m36s
deploy kit / preflight (push) Successful in 1m48s
2026-11-30 17:42:55 +01:00
ci-bot c0fe65a7b4 Merge pull request 'Parafa: 59ea522 -> 8c29520' (#2) from cascade/parafa-8c29520 into main
CI / backend (17) (push) Successful in 4m30s
CI / backend (16) (push) Successful in 4m33s
CI / managed-db (push) Successful in 4m24s
CI / deploy-kit-tests (push) Successful in 3m14s
CI / compose-smoke (push) Successful in 1m23s
deploy kit / preflight (push) Successful in 1m43s
2026-11-30 17:11:30 +01:00
ci-bot d288c926fc Merge pull request 'Arbiter: fb82239 -> a5eaa7c' (#1) from cascade/arbiter-a5eaa7c into main
CI / backend (17) (push) Successful in 4m38s
CI / managed-db (push) Successful in 4m46s
CI / deploy-kit-tests (push) Successful in 3m28s
CI / backend (16) (push) Successful in 4m29s
CI / compose-smoke (push) Successful in 1m12s
deploy kit / preflight (push) Successful in 2m1s
2026-11-30 16:44:59 +01:00
adminandClaude Opus 5.5 db37a5d1e7 CI: push runs only on main; branches are tested through their pull request [skip ci]
A push of many branches at once (the migration pushed 100 of Atrium's) started
a run per branch and flooded the runners. Every pull request is still tested.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 16:39:21 +01:00
adminandClaude Opus 5.5 699b341d71 CI: the deploy kit's tests run once, in parallel, in their own job
CI / backend (16) (push) Successful in 4m50s
CI / backend (17) (push) Successful in 4m24s
CI / deploy-kit-tests (push) Successful in 3m11s
CI / managed-db (push) Successful in 4m36s
CI / compose-smoke (push) Successful in 1m30s
They were ~25 of the backend job's 26 minutes, and ran three times per push
(backend on Postgres 16 and 17, and again in managed-db): every one drives
init.sh or push.sh, ~10 s apiece of bash, against files and no database.
They now run once in deploy-kit-tests with pytest-xdist over every core
(~3.5 min measured on the Gitea runner); backend and managed-db skip them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 15:40:52 +01:00
ci-bot b7c3cad02c Workflow: a1a7d5c -> 82df340
deploy kit / preflight (push) Successful in 1m32s
CI / managed-db (pull_request) Successful in 16m52s
CI / compose-smoke (pull_request) Successful in 1m13s
deploy kit / preflight (pull_request) Successful in 1m56s
CI / backend (16) (pull_request) Successful in 32m36s
CI / backend (17) (pull_request) Successful in 32m3s
CI / backend (17) (push) Skipped
CI / backend (16) (push) Skipped
CI / managed-db (push) Skipped
CI / compose-smoke (push) Skipped
Kaskada: Haski/Workflow main green on 82df34021605deeaaa9b53d3ed27fa0fe8ef0f0f.
2026-11-30 13:40:44 +00:00
ci-bot a3da37fe4f Parafa: 59ea522 -> 8c29520
deploy kit / preflight (push) Successful in 1m37s
CI / managed-db (pull_request) Successful in 17m50s
CI / compose-smoke (pull_request) Successful in 1m33s
deploy kit / preflight (pull_request) Successful in 2m1s
CI / backend (16) (pull_request) Successful in 34m19s
CI / backend (17) (pull_request) Successful in 33m3s
CI / backend (17) (push) Skipped
CI / compose-smoke (push) Skipped
CI / backend (16) (push) Skipped
CI / managed-db (push) Skipped
Kaskada: Haski/Parafa main green on 8c29520f13b568964ea02ea4a7863a0689369c3e.
2026-11-30 13:40:32 +00:00
ci-bot 8741687465 Arbiter: fb82239 -> a5eaa7c
CI / backend (17) (pull_request) Successful in 33m23s
CI / backend (16) (push) Skipped
CI / compose-smoke (push) Skipped
CI / backend (17) (push) Skipped
CI / managed-db (push) Skipped
CI / managed-db (pull_request) Successful in 17m27s
CI / compose-smoke (pull_request) Successful in 3m5s
deploy kit / preflight (push) Successful in 1m49s
deploy kit / preflight (pull_request) Successful in 1m48s
CI / backend (16) (pull_request) Successful in 33m19s
Kaskada: Haski/Arbiter main green on a5eaa7ce04953baa94d2ac33541677bcee6d256c.
2026-11-30 13:40:20 +00:00
adminandClaude Opus 5.5 703d7ce6da CI: cascade/* branches run CI once, through their pull request
CI / managed-db (push) Successful in 19m16s
CI / compose-smoke (push) Successful in 1m58s
CI / backend (16) (push) Successful in 34m15s
CI / backend (17) (push) Successful in 33m51s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:38:57 +01:00
adminandClaude Opus 5.5 0a2a93f77d deploy kit: init.sh fills Scribe's INSIDER_URL
CI / managed-db (push) Successful in 14m48s
CI / compose-smoke (push) Failing after 3m0s
CI / backend (17) (push) Successful in 31m10s
deploy kit / preflight (push) Successful in 1m43s
CI / backend (16) (push) Successful in 29m55s
env/scribe.env.example gained INSIDER_URL=http://<site>/insider next to
LEXICON_URL and GALENA_URL, but init.sh only set the other two, so a fresh
init left a <placeholder> in env/scribe.env and the preflight's init check
failed ("placeholders left in: env/scribe.env"). A running box is untouched:
updates never rewrite env files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 11:53:35 +01:00
adminandClaude Opus 5.5 6ad3b82c86 CI: deploy-box runs its script from a file, stdin closed; 2 dumps, disk check
CI / backend (16) (push) Successful in 26m42s
CI / backend (17) (push) Successful in 25m37s
CI / compose-smoke (push) Successful in 1m0s
CI / managed-db (push) Successful in 12m14s
The scheduled run on 2026-11-30 02:00 UTC fed the script to bash on stdin, and
docker compose exec (the pg_dumpall) read the rest of it: bash saw EOF after
the dump and exited 0, so nothing was deployed and the job showed success.
The script is now copied to the box and run with stdin from /dev/null, and the
exec has </dev/null too.

The dump is ~4 GB compressed: keep the last 2 (not 8), and refuse to dump when
less than 15 GB would stay free.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 11:51:22 +01:00
adminandClaude Opus 5.5 086b4016b1 deploy kit: preflight's two mv lines lost their continuation
CI / backend (16) (push) Successful in 26m32s
CI / managed-db (push) Successful in 11m25s
CI / backend (17) (push) Successful in 25m6s
deploy kit / preflight (push) Failing after 1m11s
CI / compose-smoke (push) Successful in 1m9s
Lines 249 and 264 ended in a literal \n instead of a backslash-newline, so
each mv got an argument "n" (mv: cannot stat 'n') and the switched-off
modules' workflow env files were never moved aside; shellcheck flagged both
(SC1012) and failed the preflight. Back to a plain line continuation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 10:16:40 +01:00
adminandClaude Opus 5.5 082a0927bb CI: deploy-box schedule off for now (run it by hand); LF line endings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 10:16:40 +01:00
adminandClaude Opus 5.5 1ebce8b146 CI: deploy key as one base64 line; fetch without submodules
CI / backend (16) (push) Successful in 20m17s
CI / backend (17) (push) Successful in 21m5s
CI / managed-db (push) Successful in 8m46s
CI / compose-smoke (push) Successful in 49s
Gitea masks only single-line secrets in logs, so a multi-line private key
showed in the step header; the key is now DEPLOY_SSH_KEY_B64 (the old key is
revoked). git fetch no longer recurses into submodules, whose URLs on the
box still pointed at GitHub until submodule sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:26:28 +01:00
adminandClaude Opus 5.5 8e9171b870 docs: restore 2026-10-07-qa.md byte for byte (CRLF), pulled in by accident
CI / managed-db (push) Successful in 9m32s
CI / backend (16) (push) Successful in 20m47s
CI / backend (17) (push) Successful in 21m51s
CI / compose-smoke (push) Successful in 47s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:24:27 +01:00
adminandClaude Opus 5.5 44e3ef78fa CI: deploy-box on its own runner (label deploy), never queued behind CI
CI / backend (16) (push) Successful in 20m44s
CI / backend (17) (push) Successful in 21m25s
CI / managed-db (push) Successful in 9m3s
CI / compose-smoke (push) Successful in 50s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:23:57 +01:00
adminandClaude Opus 5.5 8591432bb1 CI: weekly deploy of the family to the box from Gitea
CI / backend (16) (push) Successful in 22m17s
CI / backend (17) (push) Successful in 20m38s
CI / managed-db (push) Successful in 8m34s
CI / compose-smoke (push) Successful in 44s
deploy-box runs every Monday 02:00 UTC and on demand (dry-run by default):
the README's update steps on deploy@185.252.234.165 (fetch + submodules,
preflight, build, push.sh, up -d), behind a pg_dumpall of the whole
database, fast-forward only, stopping at the first failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:23:26 +01:00
adminandClaude Opus 5.5 fc7fd4a276 Build from Gitea instead of GitHub; modules repinned
CI / backend (17) (push) Successful in 21m14s
CI / managed-db (push) Successful in 9m30s
CI / backend (16) (push) Successful in 21m53s
CI / compose-smoke (push) Successful in 2m4s
deploy kit / preflight (push) Failing after 24s
The Alpaq92 GitHub account is suspended. dredd-core now comes from the public
Haski/dredd-core on Gitea (requirements, deploy_check, the push test), CI no
longer authenticates to GitHub, and push.sh names the Gitea repositories.

Every module is repinned to its commit that does the same (one commit on top
of the previous pin, nothing else changes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:05:50 +01:00
adminandClaude Opus 5.5 4b5ed7bb45 Submodules: point at the Gitea repositories
Relative URLs (../<repo>.git) resolve against wherever Atrium is cloned
from, so the modules now come from the Haski organisation on Gitea
instead of the private GitHub repositories.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:22:22 +01:00
admin 937828e0e5 Merge pull request #72 from Alpaq92/repin-d32
Repin galena, parafa, arbiter for d32
2026-11-28 20:58:05 +01:00
adminandClaude Opus 5.5 6ebcc660bb Repin galena, parafa, arbiter for d32
- galena 1dd6b4a: OCR and the reader served by Galena itself, no CDN; no session token in the console (Atrium#68, R2)
- parafa 97e9270: /seal signs off the event loop, one bad row never fails /evidence (Parafa#10)
- arbiter d99906f: a cross-reference split at the line end is not a new unit; synthetic PDF gold set (Arbiter#5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 20:45:47 +01:00
admin e9a11ab969 Merge pull request #67 from Alpaq92/pomysly-idea01
Docs: product ideas (idea01, idea02)
2026-11-28 15:00:43 +01:00
adminandClaude Opus 5.5 8382de385c deploy: Arbiter and Scribe build without a console too
Both dropped their consoles in Atrium#53 (Arbiter b61abaa), so their builds
pass no `frontend` context; the missing directory failed the whole build.
compose_checks exempts them with Lexicon (CONSOLELESS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 12:42:09 +01:00
adminandClaude Opus 5.5 ecdd5dfcbd Session update guard (dredd-core v0.26.1), Lexicon builds without a console, repin modules
- 0020_session_update_guard: on the platform, install dredd-core's
  session_update_guard_sql (owner = the migrating role, writer = the hub's
  runtime role); a no-op standalone.
- deploy/compose.yaml: Lexicon has no console since b2c998e (Atrium#53), so its
  build passes no `frontend` context; the missing directory failed the whole build.
  compose_checks exempts it (CONSOLELESS).
- Repin agora, counsel, galena, insider, lexicon, scribe, sygna, workflow to main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 12:05:42 +01:00
Piotr ChojnackiandClaude Opus 5.5 17c44c5edf Docs: six more product ideas (idea02)
docs/pomysly/idea02.md (in Polish): two-step sign-in for the platform
account, standards imported from a firm's negotiation guide, a
reference set for skills and models, AI cost per matter and per user,
suggested time entries, and writes only after a click for agent tools;
plus refinements to idea01. Docs only; no code changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:52:55 +01:00
Piotr ChojnackiandClaude Opus 5.5 d4413d084e Docs: a folder for product ideas, with the first eight (idea01)
docs/pomysly/idea01.md (in Polish) ranks eight proposals by value to a
law firm and by effort. Each one says why, what the platform already
has, the proposal, how it looks in Atrium UI v1, its dependencies and
its effort. Docs only; no code changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 13:53:51 +01:00
30 changed files with 682 additions and 85 deletions
+34 -19
View File
@@ -1,5 +1,19 @@
name: CI
on: [push, pull_request]
on:
push:
# main only: a branch is tested through its pull request (a push of many branches at once
# must not flood the runners)
branches: [main]
pull_request:
# dredd-core is private on the Haski Gitea, and so is every repository this workflow may fetch.
# All git traffic to the Gitea host (pip installing dredd-core from requirements, above all) goes
# through the read-only bot haski-reader: its token is the Haski org secret DREDD_CORE_TOKEN,
# which Gitea masks in logs. Docker builds get the same token as a BuildKit secret instead.
env:
GIT_CONFIG_COUNT: "1"
GIT_CONFIG_KEY_0: url.http://x-access-token:${{ secrets.DREDD_CORE_TOKEN }}@77.216.148.202:3000/.insteadOf
GIT_CONFIG_VALUE_0: http://77.216.148.202:3000/
jobs:
backend:
@@ -43,17 +57,6 @@ jobs:
-- EXISTS then no-ops, so the least-privilege migrator never needs extension rights.
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
SQL
- name: Authenticate to dredd-core
# dredd-core is a PRIVATE repo, so the `git+https://` requirement cannot be fetched
# anonymously — without this step `pip install` fails with a git auth prompt/404.
# The rewrite injects the token for that ONE repo URL; every other GitHub URL is untouched,
# and the secret stays out of the requirements file and the pip log.
# Add the secret under Settings → Secrets and variables → Actions → DREDD_CORE_TOKEN
# (a fine-grained PAT with read-only Contents access on Alpaq92/dredd-core).
env:
TOKEN: ${{ secrets.DREDD_CORE_TOKEN }}
run: |
git config --global url."https://x-access-token:${TOKEN}@github.com/Alpaq92/dredd-core".insteadOf "https://github.com/Alpaq92/dredd-core"
- name: Install deps
working-directory: backend
run: pip install -r requirements-dev.txt
@@ -62,7 +65,9 @@ jobs:
run: alembic upgrade head && python -m app.identity_grants && python -m app.seed
- name: Tests
working-directory: backend
run: pytest -q --cov=app --cov-report=term-missing
# The deploy kit's tests (tests/test_deploy_*.py) run once, in deploy-kit-tests: they drive
# init.sh/push.sh on files and need no database, so they need not run per Postgres version.
run: pytest -q --cov=app --cov-report=term-missing --ignore-glob='tests/test_deploy_*.py'
- name: Console syntax
# A duplicate `const` inside one function silently stops the whole file parsing, so every
# function after it disappears — and the symptom is a blank screen with no console error.
@@ -165,11 +170,6 @@ jobs:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with: { python-version: "3.12" }
- name: Authenticate to dredd-core
env:
TOKEN: ${{ secrets.DREDD_CORE_TOKEN }}
run: |
git config --global url."https://x-access-token:${TOKEN}@github.com/Alpaq92/dredd-core".insteadOf "https://github.com/Alpaq92/dredd-core"
- name: Install deps
working-directory: backend
run: pip install -r requirements-dev.txt
@@ -229,7 +229,7 @@ jobs:
run: alembic upgrade head && python -m app.identity_grants && python -m app.seed
- name: Tests (as atrium_app)
working-directory: backend
run: pytest -q
run: pytest -q --ignore-glob='tests/test_deploy_*.py' # those run in deploy-kit-tests
- name: Managed check, as the runtime role and as the migrator
# `--identity-tier owner`, not `writer`: Atrium's migrator OWNS the shared schema, so
# measuring it against the writer tier reports an "escalation" on a perfectly correct
@@ -301,6 +301,21 @@ jobs:
# docker-compose.yml, the Dockerfile (and its front door) or db/init — and the private dredd-core install
# inside the image is exactly what broke unnoticed before. This job runs the real stack, the way a
# deployer does. (Modelled on Sygna's compose-smoke job, which proved the approach.)
deploy-kit-tests:
# The deploy kit's own tests: each runs init.sh / push.sh (a bash-heavy ~10 s apiece) against
# files, no database. Once, not per Postgres version, and spread over every core.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with: { python-version: "3.12" }
- name: Install deps
working-directory: backend
run: pip install -r requirements-dev.txt
- name: Deploy kit tests
working-directory: backend
run: pytest -q -n auto tests/test_deploy_*.py
compose-smoke:
runs-on: ubuntu-latest
steps:
+126
View File
@@ -0,0 +1,126 @@
name: deploy box
# Co niedzielę o 22:00 (czas polski) i na żądanie aktualizuje rodzinę Dredd na
# deploy@185.252.234.165 (/srv/atrium, projekt Compose dredd-family) z gałęzi main na Gitei, krokami
# deploy/README.md §11 "Updates":
# git pull + submodule update -> preflight.sh -> docker compose build -> push.sh -> up -d
#
# Bezpieczniki:
# - tryb "dry-run" (domyślny) niczego nie zmienia: pokazuje, co by weszło, i uruchamia
# push.sh --dry-run na obecnym checkoucie;
# - przed buildem zrzut całej bazy (pg_dumpall, ~4 GB) do ~/predeploy/, trzymane 2 ostatnie;
# zrzut nie startuje, jeśli po nim zostałoby mniej niż 15 GB wolnego miejsca;
# - tylko fast-forward: jeśli checkout na serwerze rozjechał się z main, job staje;
# - każdy krok przerywa przy błędzie (set -e); push.sh zatrzymuje się, zanim cokolwiek
# zrestartuje, a działające kontenery zostają na starych obrazach do `up -d`;
# - skrypt trafia na serwer jako plik i działa ze stdin = /dev/null: żadne polecenie w nim nie
# może "zjeść" reszty skryptu (tak 30.11 `docker compose exec` przerwał nocny przebieg po zrzucie).
#
# Sekret DEPLOY_SSH_KEY_B64: klucz prywatny w base64, jedna linia (Gitea maskuje w logach tylko
# sekrety jednoliniowe); klucz przyjmowany przez serwer tylko z IP Gitei (from= w authorized_keys).
# Zmienna DEPLOY_KNOWN_HOSTS: klucz hosta serwera (ssh-keyscan), żeby nikt się nie podszył.
on:
# Co tydzień: niedziela 22:00 czasu polskiego (prawdziwe wdrożenie, włączone na prośbę 2026-11-30).
schedule:
- cron: "CRON_TZ=Europe/Warsaw 0 22 * * 0"
workflow_dispatch:
inputs:
mode:
description: "dry-run = tylko pokaż i sprawdź; deploy = wdroż"
required: true
default: dry-run
type: choice
options: [dry-run, deploy]
concurrency:
group: deploy-box
cancel-in-progress: false
jobs:
deploy:
runs-on: deploy # osobny runner: wdrozenie nie czeka w kolejce CI
timeout-minutes: 180
env:
BOX: deploy@185.252.234.165
MODE: ${{ github.event_name == 'schedule' && 'deploy' || github.event.inputs.mode || 'dry-run' }}
steps:
- name: SSH to the box
env:
KEY_B64: ${{ secrets.DEPLOY_SSH_KEY_B64 }}
KNOWN: ${{ vars.DEPLOY_KNOWN_HOSTS }}
run: |
mkdir -p ~/.ssh && chmod 700 ~/.ssh
printf '%s' "$KEY_B64" | base64 -d > ~/.ssh/deploy && chmod 600 ~/.ssh/deploy
printf '%s\n' "$KNOWN" > ~/.ssh/known_hosts
ssh -i ~/.ssh/deploy -o BatchMode=yes "$BOX" 'echo "connected to $(hostname)"' </dev/null
- name: Copy the update script to the box
run: |
ssh -i ~/.ssh/deploy -o BatchMode=yes "$BOX" 'cat > ~/deploy-box.sh && chmod 700 ~/deploy-box.sh' <<'REMOTE'
#!/usr/bin/env bash
set -euo pipefail
MODE=$1
GITEA=http://77.216.148.202:3000/Haski/Atrium.git
cd /srv/atrium
[ "$(git remote get-url origin)" = "$GITEA" ] || git remote set-url origin "$GITEA"
git fetch --quiet --no-recurse-submodules origin main
BEFORE=$(git rev-parse HEAD); TARGET=$(git rev-parse origin/main)
echo "box: ${BEFORE:0:7} gitea main: ${TARGET:0:7}"
if ! git merge-base --is-ancestor "$BEFORE" "$TARGET"; then
echo "::error::the box's checkout is not an ancestor of main - refusing (fix by hand)"; exit 1
fi
echo "--- commits to deploy:"; git log --oneline "$BEFORE..$TARGET" | head -40
echo "--- module pins that move:"; git diff "$BEFORE" "$TARGET" -- deploy/modules | grep '^[-+]Subproject' || echo "(none)"
if [ "$MODE" != deploy ]; then
echo "--- dry run: push.sh --dry-run on the current checkout"
cd deploy && ./push.sh --dry-run
echo "dry run done, nothing changed"; exit 0
fi
if [ "$BEFORE" = "$TARGET" ]; then echo "already at main - nothing to deploy"; exit 0; fi
TS=$(date +%Y%m%d-%H%M)
LOG=~/build-$TS.log
echo "--- full log on the box: $LOG"
exec > >(tee -a "$LOG") 2>&1
echo "--- 1/6 database dump (before anything changes)"
mkdir -p ~/predeploy
LAST=$(ls -1t ~/predeploy/dredd-*.sql.gz 2>/dev/null | head -1 || true)
NEED_KB=$(( ${LAST:+$(du -k "$LAST" | cut -f1)} + 0 ))
FREE_KB=$(df -Pk ~ | awk 'NR==2 {print $4}')
if [ $(( FREE_KB - NEED_KB )) -lt $(( 15 * 1024 * 1024 )) ]; then
echo "::error::not enough disk for a dump: $((FREE_KB/1024/1024)) GB free, last dump $((NEED_KB/1024/1024)) GB, 15 GB must stay free"; exit 1
fi
(cd deploy && docker compose exec -T postgres pg_dumpall -U postgres </dev/null) | gzip > ~/predeploy/dredd-$TS.sql.gz
ls -1t ~/predeploy/dredd-*.sql.gz | tail -n +3 | xargs -r rm -f
echo "dump: $(du -h ~/predeploy/dredd-$TS.sql.gz | cut -f1)"
echo "--- 2/6 fetch the code (rollback: git -C /srv/atrium checkout ${BEFORE:0:7} && git submodule update)"
git merge --ff-only --quiet origin/main
git submodule sync --quiet --recursive
git submodule update --init --recursive
git submodule status
cd deploy
echo "--- 3/6 preflight"; bash preflight.sh
echo "--- 4/6 build"
# dredd-core is private: the build fetches it with haski-reader's read-only token, kept on the box
export DREDD_CORE_TOKEN=$(cat ~/.config/haski/reader-token)
docker compose build
unset DREDD_CORE_TOKEN
echo "--- 5/6 push (migrations + checks)"; ./push.sh
echo "--- 6/6 restart"; docker compose up -d
sleep 20
docker compose ps --format '{{.Service}}\t{{.Status}}'
if docker compose ps --format '{{.Status}}' | grep -q -i -E 'unhealthy|exited|restarting'; then
echo "::error::a service is not healthy after the restart"; exit 1
fi
echo "deployed ${TARGET:0:7}"
REMOTE
- name: Update the box (${{ env.MODE }})
run: ssh -i ~/.ssh/deploy -o BatchMode=yes -o ServerAliveInterval=30 "$BOX" "bash ~/deploy-box.sh $MODE" </dev/null
- name: Clean up
if: always()
run: rm -f ~/.ssh/deploy
+1
View File
@@ -12,6 +12,7 @@ name: deploy kit
# complete.
on:
push:
branches: [main] # main only; branches are tested through their PR
paths:
- "deploy/**"
- ".github/workflows/deploy-kit.yml"
+10 -10
View File
@@ -1,30 +1,30 @@
[submodule "deploy/modules/galena"]
path = deploy/modules/galena
url = https://github.com/Alpaq92/Galena
url = ../Galena.git
[submodule "deploy/modules/counsel"]
path = deploy/modules/counsel
url = https://github.com/Alpaq92/CounselScorecard
url = ../CounselScorecard.git
[submodule "deploy/modules/sygna"]
path = deploy/modules/sygna
url = https://github.com/Alpaq92/Sygna
url = ../Sygna.git
[submodule "deploy/modules/insider"]
path = deploy/modules/insider
url = https://github.com/Alpaq92/Insider.git
url = ../Insider.git
[submodule "deploy/modules/lexicon"]
path = deploy/modules/lexicon
url = https://github.com/Alpaq92/Lexicon
url = ../Lexicon.git
[submodule "deploy/modules/agora"]
path = deploy/modules/agora
url = https://github.com/Alpaq92/Agora
url = ../Agora.git
[submodule "deploy/modules/parafa"]
path = deploy/modules/parafa
url = https://github.com/Alpaq92/Parafa
url = ../Parafa.git
[submodule "deploy/modules/scribe"]
path = deploy/modules/scribe
url = https://github.com/Alpaq92/Scribe
url = ../Scribe.git
[submodule "deploy/modules/arbiter"]
path = deploy/modules/arbiter
url = https://github.com/Alpaq92/Arbiter
url = ../Arbiter.git
[submodule "deploy/modules/workflow"]
path = deploy/modules/workflow
url = https://github.com/Alpaq92/Workflow
url = ../Workflow.git
+3 -3
View File
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1
# ── build stage: resolve dependencies, including the private one ─────────────
# `dredd-core` is a private GitHub repository pinned by tag in requirements.txt, so installing it
# `dredd-core` is a private repository on the Haski Gitea pinned by tag in requirements.txt, so installing it
# needs two things the runtime image should never have: `git`, and a credential.
#
# The credential arrives as a BuildKit SECRET, not a build argument. A build arg is baked into the
@@ -27,8 +27,8 @@ RUN --mount=type=secret,id=dredd_core_token,required=true \
test -s /run/secrets/dredd_core_token \
|| { echo "build secret dredd_core_token is empty - export DREDD_CORE_TOKEN" >&2; exit 1; }; \
GIT_CONFIG_COUNT=1 \
GIT_CONFIG_KEY_0="url.https://x-access-token:$(tr -d '\r\n' < /run/secrets/dredd_core_token)@github.com/.insteadOf" \
GIT_CONFIG_VALUE_0="https://github.com/" \
GIT_CONFIG_KEY_0="url.http://x-access-token:$(tr -d '\r\n' < /run/secrets/dredd_core_token)@77.216.148.202:3000/.insteadOf" \
GIT_CONFIG_VALUE_0="http://77.216.148.202:3000/" \
pip install --no-cache-dir --prefix=/install -r requirements.txt
# ── runtime stage: no git, no credential, no compiler ────────────────────────
@@ -0,0 +1,35 @@
"""The shared `session` table refuses a module that revives or prolongs a credential (dredd-core 0.26.1).
Every module runtime role holds `UPDATE (last_seen_at, expires_at, revoked_at)` on `<identity>.session`
(the reader tier), and a column grant cannot say which VALUES may be written: any one module role could
set `revoked_at = NULL` on a session the hub revoked, or push `expires_at` to infinity. Core's
`session_update_guard_sql` installs a row-level BEFORE UPDATE trigger that refuses exactly that for
every role but the identity owner (this migrator) and the hub's runtime role. Idempotent; standalone a
no-op (there is no shared table). Downgrade leaves the guard in place: removing a protection is not a
rollback anybody needs.
"""
from __future__ import annotations
from dredd_core.schema import session_update_guard_sql
from sqlalchemy import text
from alembic import op
from app.config import get_settings
revision = "0020"
down_revision = "0019"
branch_labels = None
depends_on = None
def upgrade() -> None:
settings = get_settings()
if not settings.shares_identity:
return
owner = op.get_bind().execute(text("SELECT current_user")).scalar()
op.execute(session_update_guard_sql(settings.identity_schema, owner_role=owner,
writer_role=settings.db_app_role))
def downgrade() -> None:
pass
+1
View File
@@ -2,6 +2,7 @@
pytest==8.3.4
pytest-cov==6.0.0
pytest-xdist==3.8.0 # MIT — the deploy kit's tests over every core (ci.yml deploy-kit-tests)
httpx==0.28.1 # the TestClient transport (the probe uses stdlib http.client)
pip-licenses==5.0.0 # the license gate reads this
ruff==0.8.4
+3 -3
View File
@@ -11,8 +11,8 @@
# alembic revision for whatever tables or columns the bump brings (never edit 0001).
#
# The repo is PRIVATE, so pip needs credentials to fetch it:
# local — a GitHub PAT in your git credential helper (or an SSH `insteadOf` rewrite)
# CI — the DREDD_CORE_TOKEN repo secret; see the auth step in .github/workflows/ci.yml
# local — a read-only Gitea access token in your git credential helper (or an SSH `insteadOf` rewrite)
# CI — the Haski org secret DREDD_CORE_TOKEN; see the workflow-level `env:` in .github/workflows/
#
# v0.10.0 is what makes ONE ACCOUNT possible: the shared identity schema (`ModuleModerator`,
# `SHARED_IDENTITY_TABLES`, `shared_identity_grants_sql`, `create_identity_tables`,
@@ -56,7 +56,7 @@
# v0.21.0 adds the counterparty register: the three shared tables the hub creates and grants in its
# identity schema (`alembic/versions/0012_counterparties.py`, re-applied by `app.identity_grants`),
# and the import door modules move their own counterparties in through. The hub holds no tier on them.
dredd-core @ git+https://github.com/Alpaq92/dredd-core@v0.23.2
dredd-core @ git+http://77.216.148.202:3000/Haski/dredd-core.git@v0.26.1
# Web framework
fastapi==0.115.6
+2 -2
View File
@@ -120,8 +120,8 @@ check("USER app" in dockerfile, "container runs as root",
# ── the image can install the private core ────────────────────────────────────
requirements = read("backend/requirements.txt")
if "git+https://github.com/Alpaq92/dredd-core" in requirements:
# Not `"git" in dockerfile` — the secret-mount RUN names github.com, so that could never fail.
if "dredd-core @ git+" in requirements:
# Not `"git" in dockerfile` — the secret-mount RUN names git in its URL rewrite, so that could never fail.
# Look for git as a package of an apt/apk install (comments dropped, `\` continuations joined as
# BuildKit joins them: whitespace may follow the backslash, and blank lines inside are skipped).
run_text = re.sub(r"\\[ \t]*\n(?:[ \t]*\n)*", " ", re.sub(r"(?m)^\s*#.*\n", "", dockerfile))
+1 -1
View File
@@ -359,7 +359,7 @@ class TestTheHalfDoneShapesOfOneAccountAreRefused:
"""A module held on an older dredd-core (here Sygna on 0.18.1): its `managed check` has no
--counterparties flag, and its revisions move nothing, so the preflight asks nothing of it."""
reqs = rig / "modules" / "sygna" / "backend" / "requirements.txt"
reqs.write_text("dredd-core @ git+https://github.com/Alpaq92/dredd-core@v0.18.1\n",
reqs.write_text("dredd-core @ git+http://77.216.148.202:3000/Haski/dredd-core.git@v0.18.1\n",
encoding="utf-8")
try:
done, trace = _push(rig, platform=True, trace="cp-old", settings={"atrium": {
+1 -1
View File
@@ -84,7 +84,7 @@ services:
networks:
certbot:
ipam: { config: [{ subnet: 172.30.30.0/24 }] }
ipam: { config: [{ subnet: 172.30.50.0/24 }] }
volumes:
# NEVER `docker compose down -v` (compose.yaml): letsencrypt holds the ACME account and the
+6 -18
View File
@@ -527,9 +527,7 @@ services:
profiles: ["arbiter"]
build:
context: ${MODULES_DIR:-./modules}/arbiter/apps/arbiter/backend
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
additional_contexts:
frontend: ${MODULES_DIR:-./modules}/arbiter/apps/arbiter/frontend
# No console (Atrium#53): the chat is its only screen, so no `frontend` context.
secrets: [dredd_core_token]
image: dredd-family/arbiter-backend:local
# `required: false` for Insider's reason: a missing env_file breaks the whole PROJECT, and the
@@ -556,9 +554,7 @@ services:
profiles: ["arbiter"]
build:
context: ${MODULES_DIR:-./modules}/arbiter/apps/arbiter/backend
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
additional_contexts:
frontend: ${MODULES_DIR:-./modules}/arbiter/apps/arbiter/frontend
# No console (Atrium#53): the chat is its only screen, so no `frontend` context.
secrets: [dredd_core_token]
image: dredd-family/arbiter-backend:local
env_file:
@@ -606,9 +602,7 @@ services:
profiles: ["lexicon"]
build:
context: ${MODULES_DIR:-./modules}/lexicon/backend
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
additional_contexts:
frontend: ${MODULES_DIR:-./modules}/lexicon/frontend
# No console (Lexicon b2c998e, Atrium#53): the chat is its only screen, so no `frontend` context.
secrets: [dredd_core_token]
image: dredd-family/lexicon-backend:local
# `required: false` for Insider's reason: a missing env_file breaks the whole PROJECT, and the
@@ -635,9 +629,7 @@ services:
profiles: ["lexicon"]
build:
context: ${MODULES_DIR:-./modules}/lexicon/backend
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
additional_contexts:
frontend: ${MODULES_DIR:-./modules}/lexicon/frontend
# No console (Lexicon b2c998e, Atrium#53): the chat is its only screen, so no `frontend` context.
secrets: [dredd_core_token]
image: dredd-family/lexicon-backend:local
env_file:
@@ -829,9 +821,7 @@ services:
profiles: ["scribe"]
build:
context: ${MODULES_DIR:-./modules}/scribe/backend
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
additional_contexts:
frontend: ${MODULES_DIR:-./modules}/scribe/frontend
# No console (Atrium#53): the chat is its only screen, so no `frontend` context.
secrets: [dredd_core_token]
image: dredd-family/scribe-backend:local
# `required: false` for Insider's reason: a missing env_file breaks the whole PROJECT, and the
@@ -857,9 +847,7 @@ services:
profiles: ["scribe"]
build:
context: ${MODULES_DIR:-./modules}/scribe/backend
# The module's console ships in its image (its Dockerfile: COPY --from=frontend).
additional_contexts:
frontend: ${MODULES_DIR:-./modules}/scribe/frontend
# No console (Atrium#53): the chat is its only screen, so no `frontend` context.
secrets: [dredd_core_token]
image: dredd-family/scribe-backend:local
env_file:
+4 -2
View File
@@ -493,9 +493,11 @@ write_app_files() {
set_key "$runtime" GALENA_BASE_URL "$PUBLIC/galena" ;;
scribe)
set_key "$runtime" APP_BASE_URL "$PUBLIC/scribe"
# Clauses come from Lexicon and exports go to Galena, each with the person's own token.
# Clauses come from Lexicon, exports go to Galena and citations from Insider, each with the
# person's own token.
set_key "$runtime" LEXICON_URL "$PUBLIC/lexicon"
set_key "$runtime" GALENA_URL "$PUBLIC/galena" ;;
set_key "$runtime" GALENA_URL "$PUBLIC/galena"
set_key "$runtime" INSIDER_URL "$PUBLIC/insider" ;;
workflow)
set_key "$runtime" APP_BASE_URL "$PUBLIC/workflow"
# A run on a Galena document pins it, and a stage can be approved by a Galena role: both read
+6
View File
@@ -178,6 +178,8 @@ def _front_door(services: dict, networks: dict, problems: list[str], *, tls: boo
if env.get("FRAME_ANCESTORS") not in FRAME_SELF:
problems.append(f"{backend} has FRAME_ANCESTORS={env.get('FRAME_ANCESTORS')!r}, expected 'self': Atrium frames it")
for app in APPS:
if app in CONSOLELESS:
continue
for name in (f"{app}-migrate", f"{app}-backend"):
if name in services:
contexts = (services[name].get("build") or {}).get("additional_contexts") or {}
@@ -185,6 +187,10 @@ def _front_door(services: dict, networks: dict, problems: list[str], *, tls: boo
problems.append(f"{name}'s build has no `frontend` context: its image copies the console from it")
# Modules whose image ships no console (Arbiter, Lexicon, Scribe since Atrium#53: the chat is their only screen).
CONSOLELESS = frozenset({"arbiter", "lexicon", "scribe"})
def _tls(services: dict, networks: dict, problems: list[str]) -> None:
"""compose.tls.yaml merged: the front door's half and the certbot sidecar's."""
for name, svc in services.items():
+5 -3
View File
@@ -30,7 +30,7 @@
#
# The module checkouts are where deploy/.env's MODULES_DIR says (a MODULES_DIR in the shell wins, as in
# Compose), else deploy/modules. A missing checkout FAILS step 4, because its switch can't be checked.
# Only with --ci (or CI=true, which GitHub Actions sets), where the module repositories are not checked
# Only with --ci (or CI=true, which Gitea Actions sets), where the module repositories are not checked
# out, is a missing one skipped. Steps 2, 5 and 6 use empty stand-ins whenever a checkout is missing:
# they check the kit's own files, not the modules.
#
@@ -246,7 +246,8 @@ else
mv "$tmp/env/insider.env" "$tmp/env/insider.migrate.env" \
"$tmp/env/arbiter.env" "$tmp/env/arbiter.migrate.env" "$tmp/env/lexicon.env" "$tmp/env/lexicon.migrate.env" \
"$tmp/env/agora.env" "$tmp/env/agora.migrate.env" \
"$tmp/env/parafa.env" "$tmp/env/parafa.migrate.env" "$tmp/env/scribe.env" "$tmp/env/scribe.migrate.env" \n "$tmp/env/workflow.env" "$tmp/env/workflow.migrate.env" "$tmp/env-aside/"
"$tmp/env/parafa.env" "$tmp/env/parafa.migrate.env" "$tmp/env/scribe.env" "$tmp/env/scribe.migrate.env" \
"$tmp/env/workflow.env" "$tmp/env/workflow.migrate.env" "$tmp/env-aside/"
if ! compose_off config -q 2> "$tmp/compose-off.err"; then
sed 's/^/ | /' "$tmp/compose-off.err"
bad "without the switched-off modules' env files and with their profiles off, docker compose config fails: a pull would break every compose command on a box that has not deployed them"
@@ -261,7 +262,8 @@ else
"$tmp/env-aside/arbiter.env" "$tmp/env-aside/arbiter.migrate.env" "$tmp/env-aside/lexicon.env" \
"$tmp/env-aside/lexicon.migrate.env" "$tmp/env-aside/agora.env" "$tmp/env-aside/agora.migrate.env" \
"$tmp/env-aside/parafa.env" \
"$tmp/env-aside/parafa.migrate.env" "$tmp/env-aside/scribe.env" "$tmp/env-aside/scribe.migrate.env" \n "$tmp/env-aside/workflow.env" "$tmp/env-aside/workflow.migrate.env" "$tmp/env/"
"$tmp/env-aside/parafa.migrate.env" "$tmp/env-aside/scribe.env" "$tmp/env-aside/scribe.migrate.env" \
"$tmp/env-aside/workflow.env" "$tmp/env-aside/workflow.migrate.env" "$tmp/env/"
fi
step "2d. optional TLS: compose.tls.yaml merged, with TLS=on example settings"
+11 -11
View File
@@ -352,18 +352,18 @@ STRIP=${STRIP# } FAMILY_ROLES=${FAMILY_ROLES# }
module_repo() {
case $1 in
atrium) printf 'https://github.com/Alpaq92/Atrium' ;;
galena) printf 'https://github.com/Alpaq92/Galena' ;;
sygna) printf 'https://github.com/Alpaq92/Sygna' ;;
counsel) printf 'https://github.com/Alpaq92/CounselScorecard' ;;
insider) printf 'https://github.com/Alpaq92/Insider' ;;
atrium) printf 'http://77.216.148.202:3000/Haski/Atrium' ;;
galena) printf 'http://77.216.148.202:3000/Haski/Galena' ;;
sygna) printf 'http://77.216.148.202:3000/Haski/Sygna' ;;
counsel) printf 'http://77.216.148.202:3000/Haski/CounselScorecard' ;;
insider) printf 'http://77.216.148.202:3000/Haski/Insider' ;;
# Arbiter's repository also carries the analysis engine (packages/*): the app is apps/arbiter in it.
arbiter) printf 'https://github.com/Alpaq92/Arbiter' ;;
lexicon) printf 'https://github.com/Alpaq92/Lexicon' ;;
agora) printf 'https://github.com/Alpaq92/Agora' ;;
parafa) printf 'https://github.com/Alpaq92/Parafa' ;;
scribe) printf 'https://github.com/Alpaq92/Scribe' ;;
workflow) printf 'https://github.com/Alpaq92/Workflow' ;;
arbiter) printf 'http://77.216.148.202:3000/Haski/Arbiter' ;;
lexicon) printf 'http://77.216.148.202:3000/Haski/Lexicon' ;;
agora) printf 'http://77.216.148.202:3000/Haski/Agora' ;;
parafa) printf 'http://77.216.148.202:3000/Haski/Parafa' ;;
scribe) printf 'http://77.216.148.202:3000/Haski/Scribe' ;;
workflow) printf 'http://77.216.148.202:3000/Haski/Workflow' ;;
esac
}
+1 -1
View File
@@ -1,6 +1,6 @@
# Atrium on a managed PostgreSQL provider (the family's shared database): an override for docker-compose.yml.
#
# DREDD_CORE_TOKEN=github_pat_... \
# DREDD_CORE_TOKEN=<read-only Gitea token> \
# docker compose -f docker-compose.yml -f docker-compose.managed-db.yml up -d --build
#
# The database is the family's shared managed database (one database for Atrium, Galena, Sygna and
+1 -1
View File
@@ -65,6 +65,6 @@ secrets:
# Used only by the build stage's one `pip install`; no running container gets it. Compose resolves
# the variable from the shell OR the project .env (shell wins) — keep it in the shell, because every
# service here also loads .env at runtime and would receive the token:
# DREDD_CORE_TOKEN=github_pat_... docker compose up -d --build
# DREDD_CORE_TOKEN=<read-only Gitea token> docker compose up -d --build
dredd_core_token:
environment: DREDD_CORE_TOKEN
+224
View File
@@ -0,0 +1,224 @@
# Idea 01: osiem propozycji rozwoju Dredd
Stan na 27.11.2026. Status: do dyskusji.
Propozycje funkcji uporządkowane według wartości dla kancelarii i wysiłku. Odnoszą się do planu modułów
z Atrium#53 i do PR-ów z 27.11 (Atrium#65 i pozostałe).
| # | Propozycja | Gdzie | Wysiłek | Zależy od |
|---|---|---|---|---|
| 1 | Przegląd zbiorczy: skill na wielu plikach, wynik w tabeli | „Umowy” (czat) | L | Plan 3 skilli, treść umowy z Galeny, usługa wykonawcza z repo Arbitra |
| 2 | Sprawdzenie umocowania podpisujących w KRS | Parafa, karta umowy | M | Parafa jako bramka (Parafa#7), kartoteka kontrahentów |
| 3 | Zmiany w rejestrach u kontrahentów | Sygna, strona główna | M | Sygna jako emitent zdarzeń |
| 4 | Zakres wyszukiwania w czacie | Atrium (czat), Insider | S | wspólny kontrakt czatu |
| 5 | Obserwowane przepisy w sprawie | Insider, Sygna, strona główna | M–L | Insider jako emitent zdarzeń |
| 6 | Odpowiedź do akt sprawy | Atrium (czat), Galena, Scribe | S–M | decyzja o Galenie (Galena#19) |
| 7 | Procedura widoczna w odpowiedzi | Atrium (czat), Skille i agenci | S | Plan 3 skilli |
| 8 | Nowe źródła w Insiderze | Insider | L | warunki ponownego wykorzystania danych |
**Wygląd we wszystkich punktach:** „Atrium UI v1” w trybie narzędzia pracy (Operate), tylko dopracowanie
istniejącego stylu.
- Istniejące tokeny: `--surface`, `--border`, `--accent`, `--ok/--warn/--err` z tłami `-bg`, `--mono`.
- Istniejące klasy: `.card`, `.chip`, `.btn sm ghost`, `.banner`, `.modal wide`, `.review-panel`, `.stack`.
- Standardowe kontrolki. Stan zawsze nazwany słowem, nie samym kolorem.
- Dostępność jak po ostatnich przeglądach: `aria-pressed`, `aria-live`, fokus i Esc w oknach.
## 1. Przegląd zbiorczy (L)
**Po co.** Due diligence spółki (kilkaset umów w data roomie), audyt umów klienta pod nowe przepisy,
seryjne dokumenty korporacyjne. Dziś sprawdzenie skillem obejmuje jedną umowę: czat zamawia je w
Arbiterze, raport otwiera się w panelu obok, a prawnik akceptuje analizę.
**Propozycja.**
- Ten sam skill, z wersją i standardami, uruchomiony na wielu plikach z Galeny albo ze sprawy.
- Do tego opcjonalne kolumny-pytania, np. zmiana kontroli, okres wypowiedzenia, wysokość kar umownych.
- Wynik to tabela: wiersz to plik, kolumna to pytanie. Każda komórka ma cytat i miejsce w pliku.
- Przed uruchomieniem całości próba na pierwszym pliku, tak jak próba skilla.
- Gotowy przegląd idzie do akceptacji analizy w Workflow. Eksport XLSX i DOCX.
**Wygląd.**
- Start z czatu („sprawdź te 40 umów skillem X”: asystent proponuje przegląd i podaje liczbę plików)
albo z zakładki w „Umowach”.
- Lista przeglądów to zwykła tabela. Status to `.chip` ze słowem: „W toku 12/40”, „Gotowe”, „2 pliki z
błędem”, na `--ok-bg`/`--warn-bg`/`--err-bg`. Liczby w `--mono`.
- Wynik to tabela z sortowanymi nagłówkami. Klik w komórkę otwiera istniejący `.review-panel` z cytatem.
- Kolumny ustawia się w `.modal wide`, listą `.field`.
**Tajemnica adwokacka.**
- Tylko dostawcy modeli firmy (`model_provider`, także lokalny serwer).
- Każdy przegląd zapisuje zdarzenie w `module_event`.
- Wynik widzą tylko osoby z dostępem do sprawy.
- Limit kosztu na przegląd przy kluczu firmowym.
**Zależności.** Plan 3 skilli (#53, sekcja 2), treść umowy z Galeny (#53, sekcja 5), wykonanie w usłudze z
repo Arbitra (#53, ustalenie 5). Nazwa „przegląd zbiorczy”, żeby nie mylić z Workflow, czyli silnikiem
akceptacji.
## 2. Sprawdzenie umocowania podpisujących w KRS (M)
**Po co.** Wadliwa reprezentacja to klasyczna wada umowy. Typowe przypadki:
- działanie bez umocowania (art. 39 i 103 k.c.);
- domyślna reprezentacja łączna (art. 205 i 373 k.s.h.);
- umowa spółki z członkiem zarządu (art. 210 k.s.h.).
Najtaniej wyłapać ją tuż przed podpisem.
**Co już mamy.** Sygna pobiera odpis aktualny KRS (rejestry P i S) i dane z białej listy
(`integrations/registers.py`). dredd-core 0.21 ma wspólną kartotekę kontrahentów. Parafa przygotowuje
podpis.
**Propozycja.**
- Przed wysłaniem do dostawcy podpisu Parafa pobiera aktualny odpis KRS strony i sprawdza, czy osoby
wskazane do podpisu mogą ją razem reprezentować. Czy są w zarządzie albo są prokurentami i czy jest ich
tylu, ilu wymaga zasada reprezentacji zapisana w odpisie.
- Reguły są zwykłym kodem, bo odpis podaje zasadę reprezentacji wprost. Model tylko odczytuje z umowy, kto
ma podpisać i w jakim charakterze, jeśli nie ma tego na karcie umowy.
- Kontrola doradza i nie blokuje, jak test standardów (#53, ustalenie 6). Wynik trafia na kartę umowy.
**Wygląd.**
- Nad listą podpisujących `.banner` „Umocowanie według KRS (odpis z dnia …)”.
- Pod nim tabela: osoba, funkcja w KRS, wynik.
- Wynik to `.chip` ze słowem: „zgodne”, „potrzebna druga osoba”, „brak w KRS”, „pełnomocnictwo: dołącz
dokument”. Obok link do odpisu.
**Zależności.** Parafa jako bramka (Parafa#7). Do decyzji: odczyt KRS z Sygny przez API albo przeniesienie
integracji do dredd-core.
## 3. Zmiany w rejestrach u kontrahentów (M)
**Po co.**
- **AML:** bieżące monitorowanie stosunków gospodarczych (art. 34 ust. 1 pkt 4 ustawy AML) przy
czynnościach objętych ustawą. Zmiana zarządu albo wspólników klienta to sygnał do ponownej oceny
ryzyka.
- **Konflikty interesów:** przeciwnik przejmuje spółkę albo zmienia nazwę.
- **Doręczenia:** nowy adres strony w toczącej się sprawie.
- **VAT:** status i rachunki z białej listy przy fakturach w KSeF i płatnościach powyżej 15 tys. zł.
**Co już mamy.** Sygna pobiera na żądanie odpis KRS i dane z białej listy, pisze do kartoteki kontrahentów
i ma powiadomienia (`models/notification.py`). Brakuje cyklicznego sprawdzania i historii.
**Propozycja.**
- W karcie kontrahenta przełącznik „Powiadamiaj o zmianach w KRS i na białej liście”. Domyślnie jest
włączony dla klientów z aktywną sprawą i kontrahentów z oceną AML.
- Zadanie dzienne w Sygnie porównuje odpis z poprzednim i zapisuje różnice w tym, co ważne dla kancelarii:
zarząd, prokura, wspólnicy, adres, likwidacja i upadłość.
- CEIDG później, bo jego API wymaga tokenu.
**Wygląd.**
- Zakładka „Historia zmian” w karcie kontrahenta: lista `.stack`, data w `--mono`, „było → jest”.
- Zmiany ważne dla AML i umocowania mają `--warn-bg` i podpis słowem.
- Na stronie głównej jedna `.card` „Zmiany u kontrahentów (3)” z odnośnikami do spraw.
- Powiadomienie w Sygnie, bez maili.
**Zależności.**
- Sygna musi emitować zdarzenia do `module_event`. Po Atrium#65 emitują Galena, Agora, Parafa, Workflow
i Arbiter; Sygny na tej liście nie ma.
- Strona główna po Panoramie (#53, ustalenie 2).
- Dzienny limit zapytań do API MS i MF.
## 4. Zakres wyszukiwania w czacie (S)
**Po co.** Prawnik ma widzieć i decydować, czy pytanie o dokument klienta zostaje w aktach, czy idzie też do
Insidera. Dziś chipy „Szuka w:” (`.home-scope`) tylko informują.
**Propozycja.**
- Chipy stają się przełącznikami.
- Chip Insidera rozwija listę źródeł: Dz.U. i M.P., EUR-Lex, orzeczenia (SAOS), biblioteka Lexiconu.
- Zakres obowiązuje do „Nowej rozmowy” i jest przekazywany modułom w zapytaniu.
- Wyszukiwania w sieci nie dodajemy bez polityki firmy. Jeśli kiedyś, to wyłączone domyślnie i z blokadą
administratora w *Ogólne*.
**Wygląd.**
- `.home-scope-mod` jako `<button aria-pressed>`. Wyłączony chip ma `--text-faint` i przekreśloną ikonę.
- Przy wyłączonych źródłach krótki tekst „Bez: Insider”.
- Lista źródeł Insidera w małym popoverze (`.card`, checkboxy w `.field`), z fokusem i Esc jak w oknach.
**Zależności.** Wspólny kontrakt czatu w dredd-core (#53, sekcja 3).
## 5. Obserwowane przepisy w sprawie (M–L)
**Po co.** Sprawy trwają latami. Prawnik musi wiedzieć o nowelizacji, nowym tekście jednolitym albo wyroku
TK, który dotyczy przepisu, na którym stoi pozew, umowa czy opinia. Data wejścia w życie to też termin.
**Co już mamy.** Insider ma:
- indeks ELI (Dz.U. i M.P., z polami `changeDate` i `inForce` oraz odnośnikami do tekstów jednolitych);
- EUR-Lex/Cellar i SAOS;
- graf przepisów (`legalgraph`).
Subskrypcji zmian nie ma.
**Propozycja.**
- „Obserwuj” przy artykule, w odpowiedzi czatu i w Insiderze, z wyborem sprawy z Sygny.
- Zadanie dzienne w Insiderze sprawdza w ELI zmiany obserwowanego aktu: nowe akty zmieniające, nowy tekst
jednolity, zmianę stanu obowiązywania. Wyroki TK są ogłaszane w Dz.U., więc też są w ELI.
- Zmiana daje zdarzenie, kartę na stronie głównej i wpis w sprawie.
- Bez modelu: wykrycie zmiany i porównanie brzmienia są deterministyczne. Streszczenie modelem tylko na
żądanie.
**Wygląd.**
- `.btn sm ghost` „Obserwuj”.
- Na stronie głównej `.card` „Zmiany w obserwowanych przepisach”.
- Po kliknięciu porównanie brzmienia w `.prose` (`<del>`/`<ins>` na `--err-bg`/`--ok-bg`, z opisem
słownym dla czytników ekranu).
- Pod porównaniem data wejścia w życie z przyciskiem „Dodaj termin w sprawie”.
**Zależności.** Insider jako emitent zdarzeń (jego też nie ma na liście), strona główna po Panoramie, terminy
w Sygnie.
## 6. Odpowiedź do akt sprawy (S–M)
**Po co.** Notatka dla klienta albo memorandum powstaje w czacie, a musi trafić do akt, z historią wersji.
**Co już mamy.** `chatDraft` zakłada projekt pisma w Scribe, a `chatGalena` czyta teksty z Galeny. Zapisu
odpowiedzi nie ma.
**Propozycja.**
- Pod każdą odpowiedzią trzy akcje: „Zapisz w aktach sprawy” (Galena, wybór sprawy), „Przenieś do Scribe
jako projekt”, „Pobierz DOCX”.
- Po zapisie w rozmowie zostaje linia „Zapisano: <nazwa> w sprawie <sygnatura>”.
- DOCX ma w stopce źródła i adnotację, że projekt powstał z pomocą AI i wymaga weryfikacji.
**Wygląd.** Rząd `.btn sm ghost` pod `.ha-turn`. Wybór sprawy w `.modal` z wyszukiwaniem.
**Zależności.** Decyzja o Galenie (#53, sekcja 5; Galena#19), generator DOCX w Scribe.
## 7. Procedura widoczna w odpowiedzi (S)
**Po co.** Rozliczalność: prawnik i klient widzą, według jakiej procedury i której jej wersji powstała
odpowiedź. Dziś skill i wersję podaje tylko odpowiedź po sprawdzeniu umowy.
**Propozycja.**
- Każda odpowiedź, która użyła skilla, ma krótką linię z nazwą, wersją i stanem (firmowy albo osobisty,
zatwierdzony).
- W kompozytorze „/” albo przycisk otwiera listę firmowych skilli filtrowaną pisaniem. Wybór wstawia chip
skilla nad polem tekstowym.
**Wygląd.**
- Nad odpowiedzią `.ha-sub` w `--text-muted`: „Procedura: Umowa najmu, standard kancelarii, v3 (firmowa,
zatwierdzona)”, z linkiem do `#/skills/skill/<id>?v=3`.
- Lista skilli jak w *Skille i agenci*, obsługiwana klawiaturą.
**Zależności.** Plan 3 skilli (#53, sekcja 2).
## 8. Nowe źródła w Insiderze (L)
**Propozycja.** Dodawać po kolei, każde dopiero po sprawdzeniu warunków ponownego wykorzystania i
robots.txt, jak przy SAOS:
1. Rejestr klauzul niedozwolonych UOKiK. To mały zbiór, praktycznie bez nowych wpisów od reformy z 2016 r.,
więc import jest jednorazowy. Nowe klauzule pojawiają się już tylko w decyzjach Prezesa UOKiK. Od razu
przydaje się „Umowom” przy umowach konsumenckich (art. 385¹ k.c.).
2. Orzeczenia NSA i WSA (CBOSA).
3. Wyroki KIO.
4. Decyzje Prezesa UODO i Prezesa UOKiK.
5. Interpretacje indywidualne KIS (Eureka).
**Wygląd.** Nowe pozycje na liście źródeł z punktu 4 i filtr w Insiderze. Bez nowego ekranu.
## Kolejność
1. Po scaleniu Atrium#65: punkty 4 i 7, małe i w czacie.
2. Punkt 2 razem z przebudową Parafy na bramkę.
3. Punkt 3 w Sygnie, razem z emitowaniem zdarzeń, którego potrzebuje też strona główna.
4. Punkt 6 po decyzji o Galenie.
5. Punkt 1 jako osobny spec, po module „Umowy” i Planie 3 skilli.
6. Punkty 5 i 8 w Insiderze, po sprawdzeniu warunków każdego źródła.
+197
View File
@@ -0,0 +1,197 @@
# Idea 02: bezpieczeństwo konta, standardy, jakość i koszty
Stan na 27.11.2026. Status: do dyskusji.
Sześć propozycji i uzupełnienia do `idea01.md`. Odnoszą się do planu modułów z Atrium#53 i do PR-ów
z 27.11 (Atrium#65 i pozostałe).
| # | Propozycja | Gdzie | Wysiłek | Zależy od |
|---|---|---|---|---|
| 1 | Weryfikacja dwuetapowa dla konta platformy | dredd-core, Atrium | M | wydanie dredd-core |
| 2 | Standardy z firmowej instrukcji negocjacyjnej | Skille i agenci, Arbiter | M | Plan 3 skilli, Workflow |
| 3 | Zestaw wzorcowy dla skilli i modeli | Skille i agenci, Dostawcy modeli | M–L | skille (dredd-core 0.25), usługa z repo Arbitra |
| 4 | Koszt AI w sprawie i u użytkownika | Atrium, Sygna | M | zapis zużycia w `call_target`, cennik dostawcy |
| 5 | Propozycje wpisów czasu pracy | Sygna | M–L | zdarzenia modułów z identyfikatorem sprawy |
| 6 | Zapis tylko po kliknięciu (narzędzia agentów) | Skille i agenci, czat | S | narzędzia zapisujące u agentów |
**Wygląd we wszystkich punktach:** jak w `idea01.md`: „Atrium UI v1” w trybie narzędzia pracy
(Operate), tylko dopracowanie istniejącego stylu, istniejące tokeny i klasy, stan nazwany słowem.
## 1. Weryfikacja dwuetapowa dla konta platformy (M)
**Po co.**
- Jedno konto otwiera wszystkie moduły: sprawy, akta, umowy, podpis. Jedno hasło chroni więc całą
tajemnicę zawodową kancelarii.
- RODO (art. 32) wymaga środków bezpieczeństwa odpowiednich do ryzyka.
- Klienci z sektora finansowego pytają o drugi składnik w ankietach bezpieczeństwa dostawców.
**Co już mamy.**
- dredd-core: hasła w Argon2id i sesje po stronie serwera.
- Token aplikacji może wydać tylko sesja z logowania (`require_session_credential`). Drugi składnik
przy logowaniu chroni więc także wydawanie tokenów.
- Weryfikacji dwuetapowej nie ma w dredd-core na żadnej gałęzi (sprawdzone 27.11).
**Propozycja.**
- Kody jednorazowe z aplikacji uwierzytelniającej (TOTP) i kody zapasowe pokazane raz. Później klucze
sprzętowe i passkeys (WebAuthn).
- Administrator w *Ogólne* wybiera: „Wymagaj od administratorów” albo „Wymagaj od wszystkich”.
- Zresetować drugi składnik może tylko inny administrator. Reset zapisuje się w dzienniku zdarzeń.
- Sekret TOTP jest szyfrowany tak jak klucze dostawców modeli (Argon2id i AES-256-GCM).
**Wygląd.**
- *Ustawienia → Bezpieczeństwo konta*: `.card` ze stanem („Włączona od 27.11.2026” albo „Wyłączona”)
i przycisk „Włącz”.
- `.modal` z kodem QR i jednym polem na sześć cyfr (`inputmode="numeric"`,
`autocomplete="one-time-code"`).
- Kody zapasowe pokazane raz, tak jak sekret tokenu w *Połączonych aplikacjach*.
- Logowanie dostaje drugi krok z tym samym polem.
**Zależności.** Wydanie dredd-core (sekrety w schemacie tożsamości) i ekran logowania w Atrium. Moduły
nic nie zmieniają, bo sesja jest jedna.
## 2. Standardy z firmowej instrukcji negocjacyjnej (M)
**Po co.** Kancelarie i klienci korporacyjni mają gotowe zasady negocjacji umów: stanowisko preferowane,
dopuszczalne ustępstwo, stanowisko nie do przyjęcia. Ręczne przepisanie takiego dokumentu do skilla
zajmuje dni i gubi odniesienie do źródła.
**Co już mamy.**
- Skill jest źródłem procedury i standardów sprawdzania umów (#53, ustalenie 5).
- Edytor skilli obsługuje pliki, wersje, próbę i zatwierdzanie.
- Standardy przechodzą z Lexiconu do skilli (#53, sekcja 2, Plan 3).
**Propozycja.**
- „Utwórz skill z dokumentu”: prawnik wgrywa DOCX albo PDF, a model proponuje tabelę standardów.
- Każdy wiersz ma kwestię, stanowisko preferowane, dopuszczalne ustępstwo, stanowisko nie do przyjęcia,
uzasadnienie i osobę do decyzji przy odstępstwie.
- Każdy wiersz musi wskazywać akapit dokumentu źródłowego. Wiersz bez źródła nie przechodzi.
- Prawnik poprawia tabelę i wysyła skill do zatwierdzenia jak każdy inny.
- Przy sprawdzaniu umowy wynik podaje cytat, miejsce w umowie, ocenę i proponowane brzmienie. Analiza
pamięta wersję skilla, z którą ruszyła (jak dziś).
- Ustawienie skilla mówi, co zrobić z dopuszczalnym ustępstwem: zgłosić albo przyjąć z adnotacją.
- Odstępstwo od standardu może uruchomić obieg akceptacji w Workflow, np. zgodę partnera.
**Wygląd.**
- Tabela standardów w edytorze skilla. Kolumny: kwestia, preferowane, dopuszczalne, nie do przyjęcia,
źródło.
- Link w kolumnie „źródło” otwiera akapit w `.review-panel`.
- Wiersz bez źródła ma `.chip` „brak źródła” na `--err-bg`.
- Import w `.modal wide` z komunikatem postępu w `aria-live`.
**Zależności.** Plan 3 skilli, usługa sprawdzania z repo Arbitra, Workflow (zgoda na odstępstwo).
## 3. Zestaw wzorcowy dla skilli i modeli (M–L)
**Po co.** Dziś próba skilla sprawdza tylko, czy model i mechanizm działają (#53). Zatwierdzający nie
widzi, czy nowa wersja standardów albo zmiana modelu, np. na lokalny, nie pogorszyła wyników. Przy
odpowiedzialności zawodowej potrzebny jest dowód, że narzędzie sprawdzono.
**Co już mamy.**
- Wersje skilli, próba i zatwierdzanie.
- Plan pomiaru czytnika PDF na 12 plikach z zestawu wzorcowego (#53, sekcja 3).
- Weryfikacja cytatów w czacie (`chatClaims`).
**Propozycja.**
- Do skilla dołącza się zestaw wzorcowy: umowy i oczekiwane ustalenia zapisane jako sprawdzalne
kryteria, np. „wskazano § 7 ust. 2 jako karę umowną powyżej 10% wynagrodzenia”.
- Uruchomienie dla wybranej wersji skilla i modelu daje wynik dla każdego kryterium.
- Najpierw kryteria deterministyczne: czy cytat istnieje w pliku i czy jednostka redakcyjna się zgadza
(mechanizm jak w `chatClaims`). Ocena modelem jest tylko uzupełnieniem i jest tak opisana.
- Wynik widać na ekranie „Do zatwierdzenia”, obok różnic między wersjami.
- Zmiana modelu w *Dostawcach modeli* proponuje uruchomienie zestawów dla skilli, które z niego korzystają.
**Wygląd.**
- Zakładka „Zestaw wzorcowy” w skillu. Tabela: kryterium, wynik, dowód.
- Wynik to `.chip`: „spełnione”, „niespełnione” albo „do oceny”.
- Dwie wersje obok siebie w `.stats`.
**Zależności.** Skille (dredd-core 0.25), usługa z repo Arbitra, budżet na wywołania modeli.
## 4. Koszt AI w sprawie i u użytkownika (M)
**Po co.** Klucze firmowe kosztują. Partner chce wiedzieć, ile AI kosztuje w danej sprawie i czy ten koszt
przenieść na klienta; to decyzja kancelarii i umowy z klientem. Przy kluczu osobistym użytkownik widzi
swój własny koszt.
**Co już mamy.** Wywołania modeli idą przez `call_target`, a dziennik zapisuje wpis `model.ask` z
`key_source`. Zużycia tokenów i kosztu nikt nie zapisuje.
**Propozycja.**
- Zapisywać zużycie z odpowiedzi dostawcy (tokeny wejścia i wyjścia) i liczyć koszt z cennika ustawionego
przy dostawcy.
- Przypisywać koszt do użytkownika i modułu, a gdy rozmowa dotyczy sprawy, także do sprawy.
- Pokazywać go w *Moich kluczach modeli* (bieżący miesiąc), u administratora (według dostawcy i modułu)
i w Sygnie przy sprawie (suma).
- Eksport do rozliczeń jako wydatek tylko wtedy, gdy kancelaria tak postanowi.
- Lokalny model kosztuje 0 albo tyle, ile ustali administrator.
**Wygląd.** `.stats` z `.stat` (ten miesiąc, poprzedni) i tabela według modułów. Liczby w `--mono`. Przy
odpowiedzi w czacie opcjonalnie koszt w `.ha-sub`.
**Zależności.** Zapis zużycia w `services/providers.call_target`, nowe pole cennika w `model_provider`,
API Sygny dla sumy w sprawie.
## 5. Propozycje wpisów czasu pracy (M–L)
**Po co.** Prawnicy nie zapisują części czasu, a odtwarzanie dnia z pamięci jest nieprecyzyjne. Przy
rozliczeniu godzinowym to wprost utracony przychód.
**Co już mamy.** Sygna ma czas pracy (`timelog`), stawki i rozliczenia. Dziennik `module_event` zbiera
zdarzenia modułów.
**Propozycja.**
- Sygna proponuje szkice wpisów na podstawie zdarzeń użytkownika powiązanych ze sprawą: akceptacji
analizy, rundy negocjacji, projektu pisma, korespondencji.
- Czas jest szacowany z odstępów między zdarzeniami i zawsze do poprawienia.
- Szkice widzi tylko autor. Nic nie zapisuje się samo: autor przyjmuje, poprawia albo odrzuca.
- Funkcję włącza sam użytkownik, bo to dane o jego aktywności (RODO, prawo pracy). Administrator szkiców
nie widzi.
**Wygląd.** W „Czasie pracy” Sygny sekcja „Propozycje (5)”: lista `.stack` z datą, sprawą, opisem i
minutami w `--mono` oraz przyciskami „Przyjmij”, „Popraw”, „Odrzuć”.
**Zależności.** Moduły muszą emitować zdarzenia z identyfikatorem sprawy, a Sygna musi je czytać z
`module_event`.
## 6. Zapis tylko po kliknięciu: zasada dla narzędzi agentów (S)
**Po co.** Dokument drugiej strony albo e-mail może zawierać ukryte polecenie. Zapis wykonany przez model
na podstawie takiej treści działa w imieniu prawnika.
**Co już mamy.**
- Dziś czat wykonuje akcje (sprawdzenie w Arbiterze, projekt pisma w Scribe) tylko na podstawie słów
użytkownika, a nie decyzji modelu.
- Spec skilli ma test ukrytego polecenia, a listę narzędzi agenta nadaje platforma.
**Propozycja.**
- Gdy agenci dostaną narzędzia zapisujące, każdy zapis zatrzymuje odpowiedź i pokazuje kartę „Asystent
chce: <akcja>” z argumentami.
- „Wykonaj” uruchamia dokładnie tę akcję, raz. „Odrzuć” mówi modelowi, że akcji nie wykonano.
- Administrator ma przełącznik „tylko odczyt” dla wszystkich narzędzi agentów.
- Każda decyzja trafia do dziennika zdarzeń.
**Wygląd.** `.card` w rozmowie z `.btn` „Wykonaj” i `.btn ghost` „Odrzuć”, argumenty w `--mono`.
**Zależności.** Narzędzia zapisujące u agentów (spec skilli i agentów).
## Uzupełnienia do idea01
**Do punktu 1 (przegląd zbiorczy).**
- Odróżniać stany komórki. „Nie ma w dokumencie” to wynik. „Do sprawdzenia”, „błąd” i „nieaktualne”
wynikiem nie są.
- Ponawiać tylko komórki z błędem, bez ruszania dobrych.
- Zmiana pliku, pytania, wersji skilla albo modelu oznacza komórki jako nieaktualne.
- Komórka pamięta skrót SHA-256 wersji pliku. Cytat z innej wersji to błąd, a nie wynik.
- Pytania mają typy (tak/nie, wybór z listy, data, kwota, tekst), które łatwo sprawdzać i filtrować.
- Zestawy pytań mają wersje. Przegląd zachowuje kopię pytań, z którymi wystartował.
**Do punktu 5 (obserwowane przepisy).** Gdy przepis się zmienia, opinie i pisma w Galenie, które go cytują,
dostają znacznik „do ponownego sprawdzenia”, z datą stanu prawnego, na którą je napisano. Wysiłek L:
potrzebny jest indeks przepisów cytowanych w dokumentach.
## Kolejność
1. Punkt 1: bezpieczeństwo i niezależny od #53.
2. Punkt 6: zasadę ustalić, zanim agenci dostaną narzędzia zapisujące.
3. Punkt 2 razem z Planem 3 skilli, potem punkt 3.
4. Punkty 4 i 5 w dowolnej kolejności, po ustaleniu zdarzeń modułów.