The agent observes.
Prolog deduces.
Forensic Inference is a structured debugging paradigm for AI agents. Assert causal facts into the isolated _forensic namespace, then query pre-built Prolog rules that perform exhaustive transitive reasoning โ causal chains, blast radius, contradiction detection, invariant violations, and dependency cycles.
Logic Cell backend
logic.assert ยท logic.query
_forensic namespace
isolated from default logic
Pre-built rule library
no Prolog authoring needed
Free forever ยท No credit card required
Six Rule Categories. One Namespace.
Assert facts with logic.assert into _forensic, then query pre-built Prolog rules โ no Prolog authoring required.
Causal Analysis
Traces transitive cause-and-effect relationships across any chain of asserted facts. Given a start and end node, causal_chain returns every intermediate hop. blast_radius finds everything downstream of a change. common_cause identifies shared upstream origins of two independent failures.
Predicates
- causal_chain(A, B, Chain) โ full transitive path from A to B
- blast_radius(Origin, Affected) โ everything downstream of Origin
- all_affected(Origin, List) โ sorted list of the entire blast radius
- common_cause(Effect1, Effect2, Cause) โ shared upstream root of two effects
Forensic workflow: observe โ assert โ query โ reason
How Teams Use Forensic Inference
From incident post-mortems to security audits โ assert observations, let Prolog reason over the full fact base, and get answers that manual analysis would miss.
Root Cause Analysis of Production Incidents
Assert observed cause-effect relationships during an incident โ network calls, config values, service behaviors. Query causal_chain to get the full transitive path from root cause to symptom. blast_radius shows everything else that change affected. The agent observes; Prolog does the deduction.
Related Solutions
Security Invariant Auditing
Define named invariants for security properties โ 'auth_required_on_all_endpoints', 'no_plaintext_credentials', 'mfa_enabled_for_admins'. Assert the observed state from runtime data or code analysis. Query all_violations to surface every broken invariant in a single call.
Related Solutions
Microservice Dependency Audits
Map your service graph by asserting requires and provides predicates. Query all_missing to find every dependency that nothing currently provides. circular_dep surfaces mutual dependency cycles. transitive_dep is tabled for performance, so even deep graphs complete efficiently.
Related Solutions
Multi-Source Contradiction Detection
When an agent collects facts from multiple tools โ Invariant code analysis, runtime metrics, config APIs โ contradictions between sources are common. Assert all observations and query contradiction/3 to surface every property where two sources disagree, without manual comparison.
Related Solutions
Code-vs-Runtime Mismatch Detection
Assert both code_behavior facts from static analysis and runtime_behavior facts from observability data. Query code_runtime_mismatch to find functions where what the code claims to do diverges from what production actually shows โ the class of bugs that reviews alone never catch.
Related Solutions
Timeout Risk Analysis
Assert config_value facts for idle timeout settings and runtime_behavior facts for observed deadline requirements. Query timeout_risk to find every component where the configured idle timeout is shorter than the deadline it needs to meet โ a structural risk that only emerges by reasoning across both layers.
Related Solutions
Built for production debugging
Forensic Inference is designed for real investigation workflows โ isolated, exhaustive, and composable with the rest of the DataGrout tool suite.
Isolated namespace โ no pollution
The _forensic namespace is fully isolated from your default Logic Cell. Investigation facts never pollute normal logic operations. Use logic.worlds to see it alongside other namespaces.
No Prolog authoring required
The rule library is loaded automatically when you use the _forensic namespace. You assert observations as structured facts; the pre-built predicates handle all the transitive reasoning.
Invariant bridge integration
Forensic predicates bridge with Invariant's code analysis output. depends_on and calls_external facts from Invariant can be asserted directly into _forensic for unified code + runtime reasoning.
Tabled predicates for deep graphs
transitive_dep uses tabling (memoization) so queries over deep dependency graphs complete efficiently without infinite loops or exponential blowup โ production-safe for real service meshes.
Exhaustive reasoning by default
Prolog's depth-first search with backtracking finds all solutions โ not just the first one. all_affected, all_missing, and all_violations return complete result sets, not partial views.
Composable with Logic Cell constraints
Combine forensic queries with logic.constrain to enforce that invariant violations block future assertions โ turning passive debugging into active enforcement that prevents regressions.
See it in action
All forensic operations use standard Logic Cell tools โ just with namespace: "_forensic".
Trace how a code change caused a 504 timeout five hops later.
// 1. Assert causal facts during investigation
await client.perform("data-grout@1/logic.assert@1", {
namespace: "_forensic",
facts: [
{ subject: "code_change", relation: "causes", object: "no_keepalives" },
{ subject: "no_keepalives", relation: "causes", object: "idle_connection" },
{ subject: "idle_connection", relation: "causes", object: "proxy_kill" },
{ subject: "proxy_kill", relation: "causes", object: "timeout_504" }
]
});
// 2. Query the full causal chain
const result = await client.perform("data-grout@1/logic.query@1", {
namespace: "_forensic",
prolog: "causal_chain(code_change, timeout_504, Chain)"
});
// Chain = [code_change, no_keepalives, idle_connection, proxy_kill, timeout_504]
// 3. Check blast radius
const blast = await client.perform("data-grout@1/logic.query@1", {
namespace: "_forensic",
prolog: "all_affected(code_change, List)"
});Frequently asked questions
Stop guessing. Start reasoning.
Assert observations, query pre-built Prolog rules, and get the full causal chain โ without writing a single line of Prolog.
