Causalia for AI coding agents

Make the agent loop
less probabilistic.

AI agents can inspect code, edit files and run tests. Causalia adds something especially useful for distributed-system debugging: a failure execution that can be replayed after the agent changes the code.

Why this matters

A stable signal is better than a lucky green test.

If the same test can pass or fail because wall-clock timing changed, an agent has weak evidence for whether its patch worked. A deterministic replay makes the validation target stable.

01

Machine-readable discovery

dotnet causalia inspect ... --format json gives an agent structured leads about likely simulation boundaries and determinism seams.

02

Replayable evidence

A replay token and reduced failure sequence let the agent test the same problematic execution before and after a change.

03

Broader verification

After the exact reproduction passes, the agent can run wider deterministic exploration plus the repository's ordinary tests.

Recommended agent workflow

Inspect → model → explore → patch → replay.

  1. 01

    Inspect the solution

    Run dotnet causalia inspect <solution> --format json. Treat findings as leads, not conclusions.

  2. 02

    Choose one high-value boundary

    Start from a real production symptom and write the business invariant before modifying behavior.

  3. 03

    Build the smallest deterministic simulation

    Prefer ordinary .NET seams such as TimeProvider, propagated cancellation and narrow dependency interfaces.

  4. 04

    Preserve evidence

    If a simulation fails, keep the replay token and reduced sequence. Do not treat the trace as automatic root-cause proof.

  5. 05

    Patch from evidence

    Make the smallest production change justified by the failure path, then replay that exact path.

  6. 06

    Expand verification

    Run broader exploration and the existing unit, integration and end-to-end suite. Modeled provider semantics do not certify a real provider.

AGENT INSTRUCTION

Copy a Causalia-aware debugging prompt

When investigating timing, retry, duplicate-delivery, restart, or concurrency risk in this .NET solution:

1. Run "dotnet causalia inspect <solution> --format json" and use findings as leads, not conclusions.
2. State the business invariant before editing production behavior.
3. Choose one high-value boundary and build the smallest deterministic Causalia simulation around it.
4. Prefer TimeProvider, CancellationToken and narrow dependency interfaces over Causalia-specific production abstractions.
5. Preserve any replay token and reduced failure sequence.
6. Make the smallest change supported by the evidence.
7. Replay the exact failure, then run broader Causalia exploration and the existing test suite.
8. Keep real infrastructure integration tests and do not claim modeled provider semantics certify the real provider.
Guardrails

What the agent should not infer.

A deterministic failure is not automatic root-cause proof.

The trace is reproducible evidence. Use minimization and analysis to understand which scheduling or injected-failure conditions the reproduction actually depends on.

A simulated broker or storage model is not the real provider.

Keep real Kafka, RabbitMQ, Dapr, database and HTTP integration tests. Causalia verifies modeled semantics under deterministic control.

Do not widen the simulation boundary without need.

If adopting Causalia requires pushing its runtime types throughout the application/domain layer, the boundary is probably too broad.

Do not optimize for “green” alone.

The goal is a defensible invariant and a stable reproduction, not merely changing code until one test run passes.

Agent-readable by design

Give your agent the right context first.

Start with llms.txt, then let it follow the canonical README and scenario cookbook.