pub struct OutputContract {
pub format: String,
pub required_sections: Vec<String>,
pub schema: Option<Value>,
pub output_file: Option<String>,
pub required_keys: Vec<String>,
pub min_length: Option<usize>,
pub max_length: Option<usize>,
pub must_match: Vec<String>,
pub must_not_match: Vec<String>,
pub allowed_files: Vec<String>,
pub reports: Vec<ReportContract>,
}Expand description
Output contract for validating stage results
Fields§
§format: StringExpected output format (markdown, json, text, yaml, code)
required_sections: Vec<String>Required sections in the output
schema: Option<Value>JSON schema for structured output validation
output_file: Option<String>Output file name (for file-based contracts)
required_keys: Vec<String>Required JSON keys (for quick validation without full schema)
min_length: Option<usize>Minimum output length in characters
max_length: Option<usize>Maximum output length in characters
must_match: Vec<String>Regular expression patterns the output must match
must_not_match: Vec<String>Regular expression patterns the output must NOT match
allowed_files: Vec<String>Allow-list of file globs the stage is permitted to create or modify.
Empty means “no restriction”. If present, files written by the stage that
don’t match any pattern are surfaced as UnexpectedFile observations — not
hard violations, so the run still completes, but the user sees what the AI
added beyond the spec. This closes JTBD issue #44 (spec-drift detection).
reports: Vec<ReportContract>Named reports the stage produces under .ccswarm/runs/<run-id>/reports/.
Each entry maps to a deterministically named file (e.g. plan.md) that
downstream stages can reference via the {report:<name>} template
variable. Adopted from takt’s output_contracts.report to replace the
brittle {plan_output} state-variable wiring with a contract that’s
readable from disk after the run.
v0.7.0 semantics: if exactly one report is declared, the stage’s full
response is written verbatim to it. Multi-report support (with AI-emitted
<<<REPORT:name>>> delimiters) is intentionally deferred.
Trait Implementations§
Source§impl Clone for OutputContract
impl Clone for OutputContract
Source§fn clone(&self) -> OutputContract
fn clone(&self) -> OutputContract
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more