Skip to content

feat: 🚧 authored twin layer with quote verification - #5176

Merged
sorensensig merged 4 commits into
digdir:test-ai-registryfrom
sorensensig:feat/ai-twin-authored-layer
Aug 17, 2026
Merged

sorensensig merged 4 commits into
digdir:test-ai-registryfrom
sorensensig:feat/ai-twin-authored-layer

Conversation

@sorensensig

Copy link
Copy Markdown
Contributor

Summary

Second PR of the stack proposed in #5166 (AI-readiness), stacked on #5167. It adds:

  • scripts/twins-authored.json: the rules that exist only as documentation prose (accessibility, relations, composition) for 44 components, each backed by a verbatim quote from designsystemet.no
  • three pattern twins in scripts/twin-patterns/ (form validation, required/optional marking, field guidance), which the generator now copies into the registry and inverts, so every component twin lists the patterns that govern it
  • scripts/merge-authored-twins.mjs and a pnpm merge:twins script: fetches every cited docs page and verifies each quote still appears there
  • a quote that fails verification drops the component's reviewed status and lands on registry/REVIEW.md, so documentation changes surface on the next run instead of going silently stale
  • reviewedAgainst in the data file records which package version a human sign-off was made against (currently 1.18.0 for all 44 components)

Running the pipeline today: 40 of 44 components fully verified and reviewed; 4 rules land on the review sheet because the documentation was reworded after the sign-off. That is the drift mechanism working, not a defect.

In this design the documentation prose is canonical and every rule cites it. #5166 notes a possible longer-term inversion under "Possible extensions": rules maintained as structured data from which both the human documentation and this AI layer are generated.

🚧 Draft on purpose: stacked on #5167 (GitHub cannot base a fork PR on another fork branch, so this branch contains #5167's commits; the diff specific to this PR starts at the authored layer). Not ready for merge until the stack's shape is agreed on #5166.

Checks

  • I have read the contribution guidelines
  • I have added a changeset (run pnpm changeset if relevant): not relevant, repo scripts and data only

🤖 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 6c1c2c4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mimarz
mimarz changed the base branch from main to test-ai-registry August 13, 2026 12:00
@sorensensig
sorensensig marked this pull request as ready for review August 17, 2026 10:17
sorensensig and others added 4 commits August 17, 2026 12:57
Adds the rules that exist only as documentation prose to the twins:
accessibility requirements, relations and composition rules for 44 components,
each backed by a verbatim quote from designsystemet.no, plus three pattern
twins (form validation, required/optional marking, field guidance) that the
generator now copies into the registry and inverts into component twins.

pnpm merge:twins fetches every cited page and verifies each quote still
appears there. A quote that fails drops the component's reviewed status and
lands on registry/REVIEW.md, so documentation changes surface on the next run
instead of going silently stale. reviewedAgainst in the data records the
package version of the human sign-off.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review findings: two of three pattern files keyed components by capitalized
name while the generator matches directory slugs, silently emptying the
pattern backlinks on five component twins (verified restored for all).
Dangling $schema and links.md pointers removed (targets do not exist here),
generator metadata reduced to 'authored', and one boundaries sentence
referencing an internal brief pruned. merge script gets the same
absolute-path fix as the generator.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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