feat(loops): regeluppdat + docs-freshness scans (#1417) (#1478)

* feat(loops): regeluppdat + docs-freshness scans (#1417)

Two new local loops per .claude/loops.md conventions:

- loop-regeluppdat (monthly): sweeps official Swedish sources (Skatteverket,
  BFN, Bolagsverket, regeringen/riksdagen, BAS, DIGG/ViDA) for regulatory
  changes, verifies each against the codebase anchors, and files deduped
  tickets for gaps. Tickets only, never code: regulatory changes touch money
  math and compliance surfaces.
- loop-docs-freshness (weekly): runs scripts/check-docs-freshness.mts, which
  builds every docs page from source and diffs it against the live .md
  mirrors on docs.accounted.se; files one deduped drift issue and proposes
  the re-export PR in the gnubok-website repo.

Both self-gate on run markers so any invocation is idempotent; loop-ignite
now runs them when due (session crons cannot express weekly/monthly).
Labels loop:docs and loop:regeluppdat created on the repo.

Closes #1417

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(loops): explicit types for closure-captured docs-content imports

next build's type check rejects the bare let-in-try pattern when the
variables are read inside a nested function (implicit any).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-08-10 09:13:05 +02:00
committed by GitHub
co-authored by Claude Fable 5 Jakob Wennberg
parent ce1e0b7642
commit 4ccebd3645
6 changed files with 454 additions and 3 deletions
+12 -2
View File
@@ -37,7 +37,8 @@ the PR is opened.** No exceptions.
**Destination:** GitHub Issues + PRs in `erp-mafia/accounted` (via `gh`). Not Linear.
**Labels:** `loop:auto` (always, on anything a loop creates), `loop:vercel`, `loop:triage`,
`loop:design`, `loop:needs-human` (a loop tried and could not safely proceed).
`loop:design`, `loop:docs`, `loop:regeluppdat`, `loop:needs-human` (a loop tried and could not
safely proceed).
**Idempotency / anti-spam: MANDATORY.** Before filing anything:
1. Compute a stable **fingerprint** (error signature, file:line, rule id, never a timestamp).
@@ -62,6 +63,8 @@ comment what was tried. Never retry the same failing action in a cycle.
| 2 | Vercel errors → tickets | `loop-vercel-errors` | **Local** (Vercel MCP) | daily / on-demand | ≤8 issues, ≤2 PRs |
| 3 | Issue triage + easy-fix | `loop-issue-triage` | **Local** (session cron / `/loop`) | ~2x/day while a session is open | triage all; ≤2 PRs |
| 4 | UI/UX + design scan | `loop-design-scan` | **Local** (`/loop`) | on-demand | ≤1 area, ≤6 findings |
| 5 | Docs freshness (docs.accounted.se) | `loop-docs-freshness` | **Local** (`/loop` / ignite-when-due) | weekly | 1 issue, 1 website PR |
| 6 | Regeluppdat (Swedish regulatory watch) | `loop-regeluppdat` | **Local** (`/loop` / ignite-when-due) | monthly | ≤6 issues, **0 PRs** |
**All loops are local.** Cloud routines were retired 2026-07-20: the three claude.ai triggers
(`trig_01J2nG7eB9gsdAb9YSGBVwa8`, `trig_014CmE3gTJ7ErnvL2trPYymu`, `trig_017hB94ieGVwreJqHpGRDVoM`)
@@ -70,6 +73,12 @@ to disable them rather than provision. Do not re-enable or re-create them. Loop
the Vercel MCP (local-only; Sentry is not used). Loop 4 needs `npm run dev` + Chrome.
The `loop-ignite` skill audits and (re)schedules the local cadence each session.
Loops 5 and 6 self-gate on a due check (a run marker in their tracking issues), so any invocation
is idempotent: session crons cannot outlive 7 days, which makes weekly/monthly cadences
unschedulable directly. Instead `loop-ignite` runs them **when due** at the start of a session.
Loop 6 files tickets only, never PRs: regulatory changes touch money math and compliance logic,
which the autonomy policy forbids auto-fixing.
---
## The verification gate (`loop-verify`)
@@ -95,7 +104,8 @@ of that deliberately, treat cloud as retired: see issue #993 for the full histor
## Operating the loops
- **Audit / (re)ignite each session:** `/loop-ignite` (audits evidence, schedules session-local crons).
- **Run on-demand:** `/loop-pr-ci-triage`, `/loop-issue-triage`, `/loop-vercel-errors`,
`/loop-design-scan <area>`. Wrap in `/loop <interval>` to repeat locally; `/goal` for a hard exit.
`/loop-design-scan <area>`, `/loop-docs-freshness`, `/loop-regeluppdat`. Wrap in
`/loop <interval>` to repeat locally; `/goal` for a hard exit.
- **Cost:** route mechanical steps to cheaper models; reserve judgment for the strong model. `/usage`.
Don't run more often than the watched thing changes.