regenerate-model-fixture

Regenerates cached LLM conversation fixtures for model-fixture vitest suites.

518|49|Updated Apr 7, 2021
One-click install
npx skills add https://github.com/dxos/dxos --skill regenerate-model-fixture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: regenerate-model-fixture
Source: https://github.com/dxos/dxos/tree/main/.agents/skills/regenerate-model-fixture
Command: npx skills add https://github.com/dxos/dxos --skill regenerate-model-fixture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Tests that replay recorded LLM responses fail with "No memoized conversation found for the given prompt" whenever prompts or behavior change, and regenerating them incorrectly (e.g., with vitest -t) corrupts shared fixtures because deterministic ID generation depends on test execution order.

Core Features & Use Cases

  • Fixture Regeneration: Re-runs model-fixture tagged suites with DX_UPDATE_MODEL_FIXTURES=1 to record fresh LLM conversations into .store/conversations/<suite>/<hash>.json.
  • Correct Regeneration Scope: Enforces regenerating whole test files or packages instead of single tests, preserving the shared deterministic ID sequence across a suite.
  • API Key Handling: Guides sourcing DX_ANTHROPIC_API_KEY from 1Password via pnpm -ws 1p-credentials for direct Anthropic API calls.
  • Use Case: After changing a prompt in the assistant package, run DX_UPDATE_MODEL_FIXTURES=1 moon run assistant:test to refresh the cache, then commit the updated .store/conversations files so CI replays the new fixtures.

Quick Start

Regenerate the model fixture cache for the assistant package by running its tests with DX_UPDATE_MODEL_FIXTURES=1 and then commit the updated conversation files.

Frequently Asked Questions about regenerate-model-fixture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix "No memoized conversation found for the given prompt" test failures?

Re-run the failing suite with DX_UPDATE_MODEL_FIXTURES=1 to record a new conversation, for example DX_UPDATE_MODEL_FIXTURES=1 moon run <package>:test. Then commit the updated files under .store/conversations so CI replays the new cache.

How do I regenerate all model fixture caches at once?

Run DX_UPDATE_MODEL_FIXTURES=1 moon run '#model-fixture:test' to regenerate every suite carrying the model-fixture tag. This makes real Anthropic API calls and requires DX_ANTHROPIC_API_KEY to be set.

Why can't I regenerate a fixture for a single test with vitest -t?

Tests disable ID randomness at module scope, so generated object IDs depend on which tests ran before in the same file. Running one test in isolation restarts the ID sequence and corrupts shared fixtures, so always regenerate the whole test file or package.

Which API key is needed to regenerate model fixtures?

Regeneration uses the direct preset that calls the Anthropic API and requires DX_ANTHROPIC_API_KEY, not ANTHROPIC_API_KEY. Populate it from the 1Password CI vault with pnpm -ws 1p-credentials or export it directly.

Do model-fixture tests run in default CI or local test runs?

No, the model-fixture tag is skipped by default via vitest.tags.ts gating. Suites only run when DX_RUN_MODEL_FIXTURE_TESTS=1 replays committed fixtures or DX_UPDATE_MODEL_FIXTURES=1 regenerates them.