DataGrout.ai Logo
Tool Suite ยท Forensic Inference

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

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.

Best for: Post-incident investigations โ€” map exactly how a single code change produced a 504 timeout five hops later

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
๐Ÿ’ณ Uses logic.assert + logic.query โ€” standard Logic Cell credit rates
View forensic inference docs โ†’

Forensic workflow: observe โ†’ assert โ†’ query โ†’ reason

agent observes factsโ†’logic.assert(namespace='_forensic')โ†’logic.query(causal_chain / all_violations / ...)โ†’Prolog returns full reasoning chain

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.

logic.assert(causes(...))logic.query('causal_chain(root, symptom, Chain)')

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.

logic.assert(invariant(Name, Cond))logic.query('all_violations(V)')

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.

logic.assert(requires/provides)logic.query('all_missing(List)')

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.

logic.assert(asserts_property(Source, Prop, Val))logic.query('contradiction(S1, S2, Prop)')

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.

logic.assert(code_behavior + runtime_behavior)logic.query('code_runtime_mismatch(F, C, R)')

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.

logic.assert(config_value + runtime_behavior)logic.query('timeout_risk(C, TMs, DMs)')

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.

forensic-causal.js
// 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.

We use cookies to improve your experience, analyze site traffic, and serve personalized content. You can accept all, decline non-essential cookies, or manage your preferences. See our Privacy Policy for details.

Ask the Advisor