Skip to content

feat(engine): load corpus/context/ at startup for calendar and hook data #495

@ehotting

Description

@ehotting

Context

PR feat/milieurecht introduces corpus/context/ — a directory for domain knowledge that is not law but needed to execute law. Currently it contains:

  • nl/calendar/ — Dutch public holiday dates per year (2020-2035)
  • nl/hooks/ — Hook registers for cross-cutting laws (ATW, AWB)

The BDD test harness reads these files directly. The engine does not load them yet.

What needs to happen

The engine should load corpus/context/ at startup alongside corpus/regulation/, making context data available during law execution. This enables:

  1. Automatic calendar injection: When the Termijnenwet hook fires, the engine can automatically look up holiday dates from the calendar files instead of requiring the caller to pass all 9 dates as parameters.

  2. Hook register validation: The engine can validate that hooks declared in law YAML files match the hook register, catching configuration errors early.

  3. Context-aware execution: Future context data (institutional structure, scope dimensions) can be loaded the same way.

Design considerations

  • Context files have different schemas than regulation files — need a separate ContextData struct, not ArticleBasedLaw
  • Add context_base_path() alongside regulation_base_path() (already added in BDD test common)
  • Calendar data is keyed by year — engine needs to resolve the correct year from the execution date
  • Hook registers are informational — engine may validate against them but they don't drive execution (the hooks in the law YAML do)

References

  • RFC-015: Engine Policy (describes the three-way split: regulation / context / engine-policy)
  • corpus/context/README.md for full explanation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions