Get started
RuleBook Compiler: Policy to Decision Rules

RuleBook Compiler: Policy to Decision Rules

Turn a written policy and past decisions into a tested decision table that answers the same way every time. Download package for your own AI agent: Claude writes the rules, a bundled offline Python script finds conflicts, dead rules and gaps, and replays your past decisions. No model is included; you bring an AI agent and Python 3.
#Productivity#Analysis#Consulting
Rating
More ratings needed
Sold
0
How to use
Download

RuleBook Compiler

Turn a written policy and your past decisions into a decision table you can test, so the same case gets the same answer every time, with the policy clause attached.

Claude reads your policy and writes the rules. A script then checks them, replays your past decisions, and tells you where your rules and your practice disagree.

What you get

  • A decision table: inputs, outcomes and rules, each with a priority, a plain-language reason and the policy clause it comes from
  • A consistency check: rules that conflict, rules that can never match, rules that are always overridden, and gaps that fall to the default
  • A replay of past decisions: agreement percentage and every disagreement, showing the rule that decided and what was decided before
  • Open questions, not guesses: where the policy is silent or contradicts itself, it asks you and labels any assumption
  • A policy skill template: so other agents can call the rules and get the same answer every time
  • Change impact: after you edit a rule, see exactly which past cases would change

How to use it

  1. Paste the policy text
  2. Say what is being decided and the possible outcomes (for example approve, deny, escalate)
  3. Add 10 or more past decisions, with names and account numbers replaced by case ids
  4. Answer any open questions it raises

Example result

Input: a four-section refund policy and 12 past decisions.

Measure Result
Rules extracted 6, each with a source section
Input combinations tested 108
Conflicts / rules that never match / always overridden 0 / 0 / 0
Combinations falling to the default 0
Agreement with past decisions 12 of 12

Excerpt of the decision table:

Priority Rule When (all true) Outcome Source
100 R1 final sale deny Section 1
90 R2 damaged on arrival and 90 days or fewer approve Section 4
50 R3 unused, 30 days or fewer, total 500 or less approve Section 2
50 R4 unused, 30 days or fewer, total over 500 escalate Section 2

Example: a draft with defects

A draft rule set with two rules that can match the same case with opposite outcomes, a rule that can never match, a rule that is always overridden and a missing source was flagged with 3 high, 7 medium and 7 low findings. Replaying the same 12 past decisions showed 7 agreeing, 2 disagreeing and 3 that could not be decided because of a conflict. The report lists each one.

What the checks catch

Check Finds
Conflicts two rules with the same priority and different outcomes that can match one case
Dead rules conditions that contradict each other, or rules that a higher-priority rule always takes over
Gaps combinations of inputs that match no rule and fall to the default
Traceability rules with no source clause or no reason
Replay past decisions that the rules would decide differently or cannot decide
Coverage rules no past case exercises, and too few cases to trust the replay

Good to know

  • It tests that your rules are consistent and match the cases you gave it. It does not show that the policy is right, fair or legal, or that past decisions were correct.
  • The "falls to the default" figure counts boundary and in-between values, not how often real cases occur.
  • Conditions are combined with AND; for OR it writes separate rules.
  • Not legal, financial or HR advice, and not for decisions about people's rights, employment, credit, health or safety.
  • For adults (18+).

Where it runs and what you need

RuleBook Compiler is a download package. You unzip it and use it in your own environment; it does not run through Capafy's cloud, and no AI model is included in the price.

You provide:

  • An AI agent or assistant that can read a SKILL.md file, read and write files in a working folder, and run shell commands. The instructions are written for a Claude-style agent; other agents have not been tested.
  • Python 3 (standard library only, nothing to install; developed on Python 3.13, other 3.x versions not tested).
  • Your own model or provider account. Any model usage fees are charged by your provider, not by this package.

Data sharing

Nothing is sent to Capafy or to the author by this package. The checking script runs on your computer, makes no network calls and imports no network libraries. Your policy text and past cases are processed by whichever agent and model provider you use, under that provider's terms. Replace names, account numbers and other personal details with case ids, and don't include passwords or keys.