spec
spec
¶
Specification corpus configuration models.
Defines SpecFragment (a single spec document) and SpecCorpusConfig (the collection of fragments loaded from a project's spec directory). These models are the data layer for the spec corpus pipeline:
YAML/MD files → SpecCorpusLoader → list[SpecFragment]
↓
SpecCorpusConfig (in JobConfig)
↓
PromptBuilder (injected per-sheet)
Classes¶
SpecFragment
¶
Bases: BaseModel
A single specification fragment loaded from the spec corpus.
Each fragment corresponds to one file in the project's spec directory.
Structured YAML files produce fragments with parsed data; markdown
files produce text fragments.
Fragments are tagged for per-sheet filtering: a score can declare
spec_tags: {1: ["goals", "safety"]} so sheet 1 only receives
fragments matching those tags.
SpecCorpusConfig
¶
Bases: BaseModel
Configuration for the specification corpus.
Controls where spec fragments are loaded from and how they are filtered for injection into agent prompts.
Functions¶
get_fragments_by_tags
¶
Filter fragments by tags.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tags
|
list[str]
|
Tags to filter by. A fragment matches if it has at least one tag in common with the filter list. An empty filter list returns all fragments (no filtering). |
required |
Returns:
| Type | Description |
|---|---|
list[SpecFragment]
|
List of matching fragments. |
Source code in src/marianne/core/config/spec.py
corpus_hash
¶
Compute a deterministic hash of the corpus content.
The hash is order-independent: the same set of fragments produces the same hash regardless of insertion order. This prevents false drift detection when filesystem listing order varies across OS.
Returns:
| Type | Description |
|---|---|
str
|
Hex digest string. Empty corpus produces a consistent empty hash. |