Skip to content

Examples

Sasha Lopashev edited this page Jun 27, 2026 · 1 revision

Examples

Examples should be concrete enough to benchmark. Each example needs a baseline, an optimized plan, acceptance criteria, and an evidence bundle.

RAG Deduplication and Cache Layout

Baseline:

  1. Retrieve 20 chunks.
  2. Send all chunks to a frontier model.
  3. Generate answer.
  4. Return answer without structured validation.

Migaki:

  1. Represent workflow as mIR.
  2. Deduplicate overlapping or exact duplicate chunks.
  3. Preserve stable instructions as a cacheable prefix.
  4. Estimate token and cost deltas.
  5. Route lightweight ranking to a cheaper model or mock backend.
  6. Use a stronger model for final synthesis.
  7. Validate answer against cited chunks.
  8. Retry only synthesis if validation fails.
  9. Export evidence bundle.

Measures:

  • baseline tokens,
  • optimized tokens,
  • baseline cost,
  • optimized cost,
  • baseline latency,
  • optimized latency,
  • validator pass rate,
  • plan diff,
  • trace and replay artifact.

Code Review Workflow

Baseline:

  1. Load repository context.
  2. Load changed files.
  3. Load style guide.
  4. Ask one frontier model for review.
  5. Ask the same model to produce final comments.

Migaki:

  1. Mark style guide as fixed and cacheable.
  2. Mark changed files as non-droppable.
  3. Drop unrelated historical conversation.
  4. Run static checks deterministically.
  5. Route simple lint explanation to a cheaper model or mock backend.
  6. Use a stronger model for architectural review.
  7. Validate final comments against changed lines.
  8. Export evidence bundle.

Measures:

  • comment acceptance rate,
  • false-positive rate,
  • validator pass rate,
  • context diff,
  • cost delta,
  • latency delta.

Structured Output Validation

Baseline:

  1. Ask a model for JSON.
  2. Parse the response.
  3. Retry the entire prompt when parsing fails.

Migaki:

  1. Represent schema requirement in mIR.
  2. Lower to provider-native structured output when available.
  3. Use post-validation fallback when native support is unavailable.
  4. Retry only the invalid node.
  5. Emit evidence showing the provider capability path.

Measures:

  • schema validity,
  • retry count,
  • cost per valid result,
  • backend downgrade warnings.

Clone this wiki locally