Skip to content

Reusable analysis-recipe framework with sensory recipes#434

Merged
kgdunn merged 2 commits into
mainfrom
claude/sensory-toolkit-priority-qwo6vv
Jun 30, 2026
Merged

Reusable analysis-recipe framework with sensory recipes#434
kgdunn merged 2 commits into
mainfrom
claude/sensory-toolkit-priority-qwo6vv

Conversation

@kgdunn

@kgdunn kgdunn commented Jun 30, 2026

Copy link
Copy Markdown
Owner

What and why

Agents have many tools but no guidance layer: faced with an open-ended request
("I have a panel file, what do I do?", "are my panelists consistent?", "what
drives sweetness?") they have to improvise the order of tool calls. This adds a
small, reusable framework for predefined, step-by-step analysis recipes that an
agent matches to a request and follows deterministically, chaining existing tools
by name.

The framework is package-wide and domain-agnostic so any subpackage can register
its own recipes later; the sensory subpackage is the first consumer.

What changed

  • process_improve/recipes.py (new, general): frozen RecipeStep /
    AnalysisRecipe dataclasses with a JSON to_payload, a register_recipe
    registry plus a lazy discover_recipes() (mirrors discover_tools), a simple
    substring cue matcher select_recipe, and list_recipes / get_recipe. A
    single general agent tool select_analysis_recipe matches across every
    registered recipe and always returns the full catalogue so the agent can offer
    a choice even on no match.
  • process_improve/sensory/recipes.py (new): four guided workflows
    registered into the catalog: data intake (organise + check), panel consistency
    / scale-use correction (with plain-language interpretation of the MAM beta),
    relating attributes to covariates (marginal associations plus the
    cross-validated discriminator, with the genuine / proxy / coincidence verdict
    and the collinearity caveat), and a parked placeholder for a future
    visualisation workflow. Steps reference only the real sensory tools.
  • tool_spec.discover_tools() now imports process_improve.recipes so the
    recipe-selection tool registers alongside the others.

Tests / verification

New tests/test_recipes.py covers the dataclass payload, the registry
(duplicate-key rejection), matching, catalog integrity (every tool named by a
recipe step is a registered tool), and the agent-tool path. ruff and mypy
clean. Version bumped with the change.


Generated by Claude Code

A package-wide recipe framework (process_improve/recipes.py): frozen
RecipeStep / AnalysisRecipe dataclasses, a register_recipe registry with
lazy discover_recipes (mirroring discover_tools), a substring cue matcher
select_recipe, and a general select_analysis_recipe agent tool that matches
across every registered recipe and always returns the full catalogue.

The sensory subpackage is the first consumer (sensory/recipes.py): guided
workflows for data intake, panel consistency / scale-use correction, and
relating attributes to covariates with the genuine/proxy/coincidence
separation, plus a parked placeholder for a future visualisation workflow.
Each step references the real sensory tools by name.
Comment thread src/process_improve/sensory/recipes.py
return
for module in _RECIPE_MODULES:
_import_recipe_module(module)
_recipes_discovered = True
tests/test_recipes.py covers the payload serialisation, the registry
(duplicate-key rejection), recipe matching, catalog integrity (every tool a
recipe step names is a registered tool), and the select_analysis_recipe tool
path. MINOR version bump for the new feature, with CITATION and CHANGELOG in
sync.
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.77778% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/process_improve/recipes.py 97.43% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@kgdunn kgdunn merged commit 751c8d7 into main Jun 30, 2026
14 checks passed
@kgdunn kgdunn deleted the claude/sensory-toolkit-priority-qwo6vv branch June 30, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants