Reference

Output Format

OpenAudit AI emits structured JSON output designed for both human reading and machine processing. Every field is consistent and versioned.

Full JSON example

Pass --json to any analyze or explain command to get the full structured output:

findings.jsonjson
{
  "meta": {
    "version": "0.1.0",
    "scannedAt": "2024-11-15T14:23:01.442Z",
    "directory": "./contracts",
    "filesScanned": 12,
    "totalFindings": 3
  },
  "findings": [
    {
      "ruleId": "reentrancy-guard",
      "severity": "CRITICAL",
      "file": "contracts/Token.sol",
      "line": 147,
      "column": 12,
      "message": "External call precedes state update",
      "snippet": "  (bool success, ) = msg.sender.call{value: amount}(\"\");",
      "suggestion": "Move all state updates before external calls, or use a reentrancy guard modifier.",
      "explanation": null,
      "docs": "https://github.com/NeuroForgeLabs/openaudit-ai/docs/rules/reentrancy-guard"
    },
    {
      "ruleId": "unchecked-return",
      "severity": "HIGH",
      "file": "contracts/Vault.sol",
      "line": 83,
      "column": 5,
      "message": "Return value of external call not checked",
      "snippet": "  token.transfer(recipient, amount);",
      "suggestion": "Check the return value or use SafeERC20 from OpenZeppelin.",
      "explanation": null,
      "docs": "https://github.com/NeuroForgeLabs/openaudit-ai/docs/rules/unchecked-return"
    },
    {
      "ruleId": "tx-origin-auth",
      "severity": "MEDIUM",
      "file": "contracts/Auth.sol",
      "line": 29,
      "column": 9,
      "message": "tx.origin used for authorization",
      "snippet": "  require(tx.origin == owner, \"Not owner\");",
      "suggestion": "Use msg.sender instead of tx.origin for authorization checks.",
      "explanation": null,
      "docs": "https://github.com/NeuroForgeLabs/openaudit-ai/docs/rules/tx-origin-auth"
    }
  ]
}

Field reference

Meta object

FieldTypeDescription
versionstringOpenAudit AI version that produced this output
scannedAtISO 8601 stringTimestamp of the scan
directorystringThe path that was analyzed
filesScannednumberTotal number of .sol files analyzed
totalFindingsnumberTotal number of findings across all files

Finding object

FieldTypeDescription
ruleIdstringUnique identifier for the rule that fired
severityenumCRITICAL | HIGH | MEDIUM | LOW | INFO
filestringRelative path to the Solidity file
linenumberLine number of the finding (1-indexed)
columnnumberColumn number of the finding (1-indexed)
messagestringShort, rule-level description of the issue
snippetstringThe relevant line of source code
suggestionstringRule-provided remediation guidance
explanationstring | nullAI-generated explanation (null if not requested)
docsstringURL to the rule documentation page

Output with AI explanations

When using openaudit-ai explain, the explanation field is populated with AI-generated context. All other fields remain identical.

finding with explanationjson
{
  "ruleId": "reentrancy-guard",
  "severity": "CRITICAL",
  "file": "contracts/Token.sol",
  "line": 147,
  "column": 12,
  "message": "External call precedes state update",
  "snippet": "  (bool success, ) = msg.sender.call{value: amount}(\"\");",
  "suggestion": "Move all state updates before external calls.",
  "explanation": "The withdraw() function sends ETH to msg.sender before zeroing the user's balance. A malicious contract can implement a fallback function that re-calls withdraw() before the balance is updated, draining the contract. This is a classic reentrancy attack. Fix by updating balances[msg.sender] = 0 before the external .call(), or adding a ReentrancyGuard modifier.",
  "docs": "https://github.com/NeuroForgeLabs/openaudit-ai/docs/rules/reentrancy-guard"
}
Important: The explanation field is generated by a language model and is informational only. Security decisions are always based on the deterministic ruleId, severity, and message fields.

Severity levels

LevelMeaning
CRITICALExploitable vulnerability with direct fund loss potential
HIGHSerious issue that should be fixed before deployment
MEDIUMIssue that can cause problems under specific conditions
LOWMinor issue or best-practice deviation
INFOInformational note, no immediate action required