Skip to main content
PCD means Program Circuit Description. A PCD is not a general script; it is a circuit blueprint for bounded logic. This tutorial builds an order_risk circuit.

1. Start With A Bounded Requirement

Do not start from implementation. Start from behavior:
Approve an order only when:
- amount is positive
- limit is positive
- amount does not exceed limit

Otherwise block the order.

2. Declare Inputs And Output

inputs:
- amount
- limit

output:
- 1 means approve
- 0 means block

3. Declare Fail-Closed Behavior

amount <= 0 -> 0
limit <= 0 -> 0
amount > limit -> 0
otherwise -> 1
This is the circuit contract an agent must preserve.

4. Write The PCD

PC order_risk {
    fn evaluate(amount, limit) {
        if (amount <= 0) {
            return 0;
        }

        if (limit <= 0) {
            return 0;
        }

        if (amount > limit) {
            return 0;
        }

        return 1;
    }
}
The structure matters:
  • every branch returns a defined value;
  • negative or zero inputs block;
  • the approval path is the final path;
  • no external state is required.

5. Generate The Starter Candidate

brik64 pcd generate order-risk is available only in generation-capable builds. For the current public CLI beta, create or review a .pcd file manually unless brik64 help lists the generation command. Review generated output before composing it into a Polymer. Generation is not a substitute for reviewing the declared inputs, outputs and fail-closed behavior.

6. Use Monomers When The Operation Is Atomic

For string or arithmetic operations, prefer named monomers from the catalog.
PC label_size {
    fn label_size(prefix, code) {
        let label = MC_40.CONCAT(prefix, code);
        let size = MC_43.LEN(label);
        return size;
    }
}

7. Agent Checklist

  • The requirement is restated in bounded form.
  • Inputs and output are named.
  • Fail-closed behavior is explicit.
  • Every branch returns a value.
  • Monomers are selected from the catalog.
  • Extended or external behavior is identified before composition.
  • The PCD can be reviewed without hidden source context.