ruleset

package
v0.3.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegimeEUAIAct   = "eu-ai-act"
	RegimeNISTAIRMF = "nist-ai-rmf"
)

Canonical regime identifiers. Pack JSON version strings stay independent (e.g. eu-ai-act → eu-ai-act-2024-v0.1.0) so releases can bump pack content without renaming the regime selector.

View Source
const (
	CharacterHardLaw    = "hard_law"
	CharacterPrinciples = "principles"
	CharacterGuidance   = "guidance"
	CharacterMapping    = "mapping"
)

Character describes the legal nature of a regime pack's outcomes.

Variables

This section is empty.

Functions

func NormalizeRegime

func NormalizeRegime(s string) string

NormalizeRegime trims and lowercases a regime selector.

func NormalizeRegimes

func NormalizeRegimes(in []string) []string

NormalizeRegimes deduplicates and normalizes a regime list, preserving order.

Types

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

Loader resolves regime IDs to embedded packs.

func DefaultLoader

func DefaultLoader() (*Loader, error)

DefaultLoader returns a loader with every shipped pack registered.

func (*Loader) List

func (l *Loader) List() []string

List returns sorted regime IDs.

func (*Loader) Load

func (l *Loader) Load(regime string) (*Pack, error)

Load returns the pack for a regime ID.

func (*Loader) Register

func (l *Loader) Register(p *Pack) error

Register adds a pack. Duplicate IDs are rejected.

type Pack

type Pack struct {
	ID        string
	Character string
	Set       *Set
}

Pack is a named, embedded ruleset ready for classification.

type Rule

type Rule struct {
	ID                  string             `json:"id"`
	Tier                string             `json:"tier"`
	ArticleOrAnnex      string             `json:"article_or_annex"`
	Summary             string             `json:"summary"`
	When                RuleWhen           `json:"when"`
	Match               string             `json:"match"` // "any_group" (default) or "all_groups"
	RecommendedControls []string           `json:"recommended_controls"`
	TechnicalControls   []TechnicalControl `json:"technical_controls,omitempty"`
	JudgmentCall        bool               `json:"judgment_call"`
	JudgmentCallNote    string             `json:"judgment_call_note"`
}

Rule is one versioned classification mapping.

type RuleWhen

type RuleWhen struct {
	AnyFlags            []string `json:"any_flags"`
	DeploymentContexts  []string `json:"deployment_contexts"`
	AffectedPopulations []string `json:"affected_populations"`
	DataTypes           []string `json:"data_types"`
	AutonomyLevels      []string `json:"autonomy_levels"`
	PurposeKeywords     []string `json:"purpose_keywords"`
}

RuleWhen describes match conditions. Empty slices mean "don't constrain on this field".

type Set

type Set struct {
	Version     string   `json:"version"`
	LastUpdated string   `json:"last_updated"`
	Framework   string   `json:"framework"`
	Notes       []string `json:"notes"`
	Rules       []Rule   `json:"rules"`
}

Set is a loaded ruleset document.

func LoadDefault

func LoadDefault() (*Set, error)

LoadDefault loads the embedded EU AI Act v0.1.0 ruleset.

func LoadNISTAIRMF

func LoadNISTAIRMF() (*Set, error)

LoadNISTAIRMF loads the embedded NIST AI RMF mapping pack v0.1.0.

func Parse

func Parse(data []byte) (*Set, error)

Parse decodes a ruleset from JSON bytes.

type TechnicalControl

type TechnicalControl struct {
	ID            string `json:"id"`
	PaperRef      string `json:"paper_ref"`
	Summary       string `json:"summary"`
	TechnicalHook string `json:"technical_hook"`
	EvidenceType  string `json:"evidence_type"`
}

TechnicalControl links policy text to an implementable hook and evidence type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL