documentation/automation/recipe-schema-tracking/README.md
Automated pipeline for detecting and documenting Recipe schema and validation rule changes between goose releases.
This automation keeps the Recipe Reference Guide synchronized with code changes by:
The automation runs automatically on new releases via GitHub Actions, or can be run manually for testing.
The automation runs automatically when a new release is published. See TESTING.md for testing instructions.
# Run the complete pipeline
./scripts/run-pipeline.sh v1.14.0 v1.15.0
# Or run individual steps:
# 1. Extract validation structures
./scripts/extract-validation-structure.sh v1.14.0 > output/old-validation-structure.json
./scripts/extract-validation-structure.sh v1.15.0 > output/new-validation-structure.json
# 2. Extract schemas
./scripts/extract-schema.sh v1.15.0 > output/new-schema.json
# 3. Detect changes
./scripts/diff-validation-structures.sh output/old-validation-structure.json \
output/new-validation-structure.json \
> output/validation-changes.json
# 4. Generate human-readable change documentation
cd output && goose run --recipe ../recipes/synthesize-validation-changes.yaml
# 5. Update recipe-reference.md
export RECIPE_REF_PATH=/path/to/recipe-reference.md
goose run --recipe ../recipes/update-recipe-reference.yaml
The automation uses a hybrid approach: deterministic shell scripts for data extraction/diffing, AI recipes for analysis and documentation updates.
┌─────────────────────────────────────────────────────────────────┐
│ EXTRACTION (Deterministic) │
├─────────────────────────────────────────────────────────────────┤
│ extract-schema.sh extract-validation-structure.sh │
│ ↓ ↓ │
│ new-schema.json new-validation-structure.json │
└─────────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────────┐
│ DIFFING (Deterministic) │
├─────────────────────────────────────────────────────────────────┤
│ diff-validation-structures.sh │
│ ↓ │
│ validation-changes.json │
└─────────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────────┐
│ SYNTHESIS (AI-Powered) │
├─────────────────────────────────────────────────────────────────┤
│ synthesize-validation-changes.yaml │
│ ↓ │
│ validation-changes.md (human-readable) │
└─────────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────────┐
│ UPDATE (AI-Powered) │
├─────────────────────────────────────────────────────────────────┤
│ update-recipe-reference.yaml │
│ ↓ │
│ recipe-reference.md (updated) + update-summary.md │
└─────────────────────────────────────────────────────────────────┘
Scripts handle deterministic tasks:
git showAI recipes handle synthesis and updates:
Benefits:
All stages communicate via JSON/Markdown files in the output/ directory:
| File | Producer | Consumer | Purpose |
|---|---|---|---|
old-schema.json | extract-schema.sh | synthesize-validation-changes.yaml | Previous version OpenAPI schema |
new-schema.json | extract-schema.sh | synthesize-validation-changes.yaml | Current version OpenAPI schema |
old-validation-structure.json | extract-validation-structure.sh | diff-validation-structures.sh | Previous version struct fields + validation functions |
new-validation-structure.json | extract-validation-structure.sh | diff-validation-structures.sh | Current version struct fields + validation functions |
validation-changes.json | diff-validation-structures.sh | synthesize-validation-changes.yaml | Detected changes (structured) |
validation-changes.md | synthesize-validation-changes.yaml | update-recipe-reference.yaml | Human-readable change documentation |
update-summary.md | update-recipe-reference.yaml | Human review | Summary of documentation updates |
| Variable | Required | Default | Description |
|---|---|---|---|
RECIPE_REF_PATH | No | - | Full path to recipe-reference.md file (overrides GOOSE_REPO construction) |
GOOSE_REPO | No | Auto-detect | Path to goose repository root |
Example (for local testing):
export RECIPE_REF_PATH=/path/to/local/goose/documentation/docs/guides/recipes/recipe-reference.md
# OR
export GOOSE_REPO=/path/to/local/goose
config/serde-attributes.jsonDefines Serde attribute meanings for parsing struct fields:
{
"skip_serializing_if": "Field is optional and skipped when value matches condition",
"default": "Field uses default value when missing during deserialization",
"flatten": "Field's contents are flattened into parent struct",
"rename": "Field is serialized with a different name"
}
When to update: When new Serde attributes are introduced in Recipe struct definitions.
config/known-validation-files.jsonLists source files containing recipe validation logic:
{
"validation_files": [
"crates/goose/src/recipe/validate_recipe.rs",
"crates/goose/src/agents/types.rs"
]
}
When to update: When validation logic is added to new files or moved to different locations.
Recipe struct)validate_recipe.rsExtensionConfig) shared across recipes, CLI, and runtime with mismatched validation requirements. The automation documents basic structure only. Extension-specific validation is documented separately.Why extensions are excluded: The ExtensionConfig type serves multiple contexts with different validation needs:
Attempting to document all extension validation rules in the Recipe Reference would create confusion about which rules apply when. Extension documentation is maintained separately.
extract-schema.shExtracts OpenAPI schema from the goose codebase.
Usage:
./scripts/extract-schema.sh [version] > output/new-schema.json
Arguments:
version (optional): Git tag or commit to extract from (default: current working directory)Output: JSON schema with field descriptions, types, and constraints
Example:
# Extract from current code
./scripts/extract-schema.sh > output/new-schema.json
# Extract from specific version
./scripts/extract-schema.sh v1.15.0 > output/old-schema.json
extract-validation-structure.shExtracts Recipe struct fields and validation functions from source code.
Usage:
./scripts/extract-validation-structure.sh [version] > output/new-validation-structure.json
Arguments:
version (optional): Git tag or commit to extract from (default: current working directory)Output: JSON with struct fields (name, type, optionality, comments) and validation functions (signature, error messages)
Example:
# Extract from current code
./scripts/extract-validation-structure.sh > output/new-validation-structure.json
# Extract from v1.15.0
./scripts/extract-validation-structure.sh v1.15.0 > output/old-validation-structure.json
diff-validation-structures.shCompares two validation structure files and outputs detected changes.
Usage:
./scripts/diff-validation-structures.sh <old-file> <new-file> > output/validation-changes.json
Arguments:
old-file: Path to old validation structure JSONnew-file: Path to new validation structure JSONOutput: JSON with categorized changes:
struct_fields.added: New fieldsstruct_fields.removed: Deleted fieldsstruct_fields.type_changed: Type modificationsstruct_fields.comment_changed: Comment updatesvalidation_functions.added: New validation rulesvalidation_functions.removed: Deleted validation rulesExample:
./scripts/diff-validation-structures.sh \
output/old-validation-structure.json \
output/new-validation-structure.json \
> output/validation-changes.json
synthesize-validation-changes.yamlAnalyzes detected changes and generates human-readable documentation.
Inputs:
output/validation-changes.json - Detected changes from diff scriptoutput/old-schema.json - Previous version schema (for descriptions)output/new-schema.json - Current version schema (for descriptions)Output:
output/validation-changes.md - Human-readable change documentation with:
Usage:
cd output
goose run --recipe ../recipes/synthesize-validation-changes.yaml
What it does:
update-recipe-reference.yamlUpdates the Recipe Reference Guide based on synthesized changes.
Inputs:
output/validation-changes.md - Change documentation from synthesis reciperecipe-reference.md - Target documentation file (path from RECIPE_REF_PATH or GOOSE_REPO env var)Outputs:
recipe-reference.md with changes appliedoutput/update-summary.md - Summary of changes for reviewUsage:
export RECIPE_REF_PATH=/path/to/recipe-reference.md
goose run --recipe recipes/update-recipe-reference.yaml
What it does:
Target sections:
recipe-schema-tracking/
├── README.md # This file
├── TESTING.md # Testing guide for GitHub Actions workflow
├── .gitignore # Excludes output/ directory
├── config/ # Configuration files
│ ├── serde-attributes.json # Serde attribute definitions
│ ├── known-validation-files.json # Validation source files
│ ├── extraction-output-schema.json # Schema for extraction output
│ └── validation-output-schema.json # Schema for validation output
├── scripts/ # Shell scripts (deterministic)
│ ├── extract-schema.sh # Extract OpenAPI schema
│ ├── extract-validation-structure.sh # Extract struct fields + validation
│ ├── diff-validation-structures.sh # Compare structures
│ └── run-pipeline.sh # End-to-end pipeline runner
├── recipes/ # AI recipes
│ ├── synthesize-validation-changes.yaml # Generate change docs
│ └── update-recipe-reference.yaml # Update documentation
└── output/ # Generated files (gitignored)
├── old-schema.json # Previous version schema
├── new-schema.json # Current version schema
├── old-validation-structure.json # Previous version structure
├── new-validation-structure.json # Current version structure
├── validation-changes.json # Detected changes (structured)
├── validation-changes.md # Change documentation (human-readable)
├── update-summary.md # Documentation update summary
└── pipeline.log # Pipeline execution log
The automation runs via .github/workflows/docs-update-recipe-ref.yml:
recipe-reference.md if changes detectedRecipe - Top-level recipe structureAuthor - Recipe author informationSettings - Recipe settings (model, provider, etc.)Response - Structured output schemaSubRecipe - Sub-recipe definitionsRecipeParameter - Parameter definitionsOption<T> → T)When modifying the automation:
./scripts/run-pipeline.sh with test versions