krmlextraction

Converts verified F* and Pulse modules to C using KaRaMeL extraction and bundling.

8|4|Updated Mar 25, 2026
One-click install
npx skills add https://github.com/FStarLang/proof-copilot --skill krmlextraction
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: krmlextraction
Source: https://github.com/FStarLang/proof-copilot/tree/main/plugins/proof-copilot/skills/krmlextraction
Command: npx skills add https://github.com/FStarLang/proof-copilot --skill krmlextraction

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you convert verified F* and Pulse code into C through KaRaMeL, while avoiding common extraction pitfalls that lead to missing symbols, wrong names, or brittle generated output.

Core Features & Use Cases

  • Two-stage extraction workflow: First generate .krml from F*, then translate it into .c and .h files with KaRaMeL.
  • Clean extraction structure: Use interfaces, fixed-width integer types, ghost/erased values, and inline helpers so the generated C stays stable and readable.
  • Bundle and naming control: Configure KaRaMeL bundles, hide spec-only modules, and strip module prefixes to shape the final C layout.
  • Debugging support: Diagnose unresolved polymorphic functions, unexpected out.krml output, missing functions, and extraction type mismatches.
  • Use case: When a verified F* module needs to ship as C, this Skill guides you through extracting the right modules, bundling them correctly, and fixing issues before they reach compilation.

Quick Start

Ask for help extracting your F* or Pulse module to C and specify the module name, output layout, and any KaRaMeL errors you want diagnosed.

Frequently Asked Questions about krmlextraction

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

FAQPage Schema
How do I extract verified F* code to C using KaRaMeL?

F* to C extraction with KaRaMeL follows a two-stage workflow: first generate `.krml` files from F* modules, then translate them into `.c` and `.h` files. You must specify module names, output layout, and configure bundle settings.

Why does KaRaMeL extraction produce unresolved symbols or missing functions?

Unresolved symbols during KaRaMeL extraction usually stem from incorrect `.fsti` interface usage, unhandled polymorphic functions, or ghost values that were not properly erased before generating the C output.

How do I control module naming and layout in generated C files from F*?

Configure KaRaMeL bundles to group modules, hide spec-only modules, and strip module prefixes. This shapes the final C layout and prevents naming collisions in the extracted output.

What types should I use in F* to ensure clean C extraction?

Use fixed-width integer types and proper `.fsti` interfaces in F* to ensure stable, readable C output. Correctly handle ghost and erased values so they do not appear in the generated C code.

Can I extract Pulse modules to C, or is this only for standard F*?

Pulse modules can be extracted to C alongside standard F* code. The KaRaMeL extraction process handles both, applying the same interface and bundle configuration rules to generate clean C output.

What is the best way to debug KaRaMeL out.krml extraction failures?

Debug KaRaMeL extraction failures by checking for type mismatches, unresolved polymorphic functions, and unexpected `out.krml` output. Ensure interfaces are correct and machine-width types are used properly.