> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwedai.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# QWED GitHub Action

> Integrate QWED neurosymbolic verification into CI/CD pipelines. Verify math calculations, logical reasoning, and code patterns in pull requests automatically.

**Neurosymbolic verification for your CI/CD pipeline**

<Info>
  [QWED Security](https://github.com/marketplace/qwed-security) is a **Verified Publisher** on GitHub Marketplace. Install the GitHub App to auto-verify every PR with deterministic math, logic, and security checks — no workflow file needed. See the [GitHub App docs](/advanced/github-app) for details.
</Info>

## What is QWED?

QWED combines **Neural Networks** (LLMs) with **Symbolic Reasoning** (SymPy, Z3) to provide deterministic verification of AI outputs.

**Use cases:**

* ✅ Verify mathematical calculations in PRs
* ✅ Check logical reasoning in documentation
* ✅ Detect unsafe code patterns
* ✅ Validate LLM outputs before deployment

## Quick start

Add this to your `.github/workflows/verify.yml`:

```yaml theme={null}
name: Verify with QWED

on: [push, pull_request]

jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - name: Verify Calculation
        uses: QWED-AI/qwed-verification@v7.1.0
        with:
          api_key: ${{ secrets.QWED_API_KEY }}
          action: verify
          engine: math
          query: "x**2 + 2*x + 1 = (x+1)**2"
```

## Extension GitHub Actions

Use these extension-specific actions when you want domain-focused checks in your pipeline.

| Icon | Action | Description |
| - | - | - |
| 💰 | [QWED Finance Guard](https://github.com/marketplace/actions/qwed-finance-guard) | Verify financial calculations and compliance signals before merging. |
| ⚖️ | [QWED Legal Verification](https://github.com/marketplace/actions/qwed-legal-verification) | Validate legal reasoning, deadlines, citations, and clause consistency. |
| 🧾 | [QWED Protocol Verification](https://github.com/marketplace/actions/qwed-protocol-verification) | Verify protocol-level logic and deterministic rule conformance. |
| 🛒 | [QWED Commerce Auditor](https://github.com/marketplace/actions/qwed-commerce-auditor) | Audit checkout math, pricing, and transaction integrity in commerce flows. |

## Inputs

| Input | Description | Required | Default |
| - | - | - | - |
| `api_key` | QWED API key (optional for local mode) | No | - |
| `action` | Action type: `verify`, `scan-secrets`, `scan-code`, `verify-shell` | No | `verify` |
| `provider` | LLM provider (`openai`, `anthropic`, `gemini`) | No | - |
| `model` | Model name (e.g., `gpt-4o`, `claude-sonnet-4-20250514`) | No | - |
| `mask_pii` | Mask PII in inputs and outputs | No | `false` |
| `query` | The user query (e.g., "Derivative of x^2"). Required for `math` and `logic` engines. | Conditional | - |
| `llm_output` | The LLM output to verify. Required for the `code` engine. | Conditional | - |
| `engine` | Verification engine: `math`, `logic`, `code`, `sql`, `shell` | No | `math` |
| `paths` | Glob patterns for files to scan (e.g., `**/*.py,**/*.env`) | No | `.` |
| `output_format` | Output format: `text`, `json`, `sarif`, `verification-context` | No | `text` |
| `fail_on_findings` | Fail the action if security issues are found | No | `true` |

<Note>
  Each engine requires different inputs:

  * **math** — requires `query` (passed as the expression to verify)
  * **logic** — requires `query`
  * **code** — requires `llm_output` (passed as the code to analyze)
</Note>

### Provider and model selection

<Info>New in v5.0.0</Info>

You can now specify which LLM provider and model the action uses. When you pass `api_key`, QWED automatically maps it to the correct provider-specific environment variable (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, or `GOOGLE_API_KEY`) based on your `provider` selection.

```yaml theme={null}
- name: Verify with Claude
  uses: QWED-AI/qwed-verification@v7.1.0
  with:
    api_key: ${{ secrets.ANTHROPIC_API_KEY }}
    provider: anthropic
    model: claude-sonnet-4-20250514
    action: verify
    engine: math
    query: "sqrt(144) = 12"
```

### PII masking

Set `mask_pii: "true"` to automatically redact personally identifiable information (email addresses, phone numbers, SSNs) from inputs and outputs before they reach the LLM.

```yaml theme={null}
- name: Verify with PII masking
  uses: QWED-AI/qwed-verification@v7.1.0
  with:
    api_key: ${{ secrets.QWED_API_KEY }}
    mask_pii: "true"
    action: verify
    engine: logic
    query: "User john@example.com claims order total is correct"
```

## Outputs

| Output | Description |
| - | - |
| `verified` | `true` if verification passed or no issues found |
| `explanation` | Detailed proof or error explanation |
| `findings_count` | Number of security issues found (for scan modes) |
| `badge_url` | URL for QWED verified badge |
| `sarif_file` | Path to SARIF output file (if `output_format=sarif`) |
| `verdict` | [Verification Context v1.0](/specs/verification-context) verdict: `VERIFIED`, `UNVERIFIABLE`, or `BLOCKED` (v7.1.0) |
| `admission` | Safe-to-run decision: `ADMIT` or `DENY`. Gate downstream steps on this, not on `verified` alone (v7.1.0) |
| `proof_ref` | `sha256:<64-hex>` evidence commitment. Set only when `verdict` is `VERIFIED`; empty otherwise (v7.1.0) |
| `verification_context` | Full Verification Context v1.0 document as compact JSON. Emitted only when `output_format` is `json` or `verification-context` (v7.1.0) |

### Verification Context outputs

<Info>New in v7.1.0</Info>

Every action mode (`verify`, `scan-secrets`, `scan-code`, `verify-shell`) emits [Verification Context v1.0](/specs/verification-context) outputs alongside the legacy `verified` flag. The invariants are fail-closed: `proof_ref` is set only on a `VERIFIED` verdict, and non-verified verdicts always carry `admission: DENY`.

```yaml theme={null}
- name: Verify math
  id: qwed
  uses: QWED-AI/qwed-verification@v7.1.0
  with:
    action: verify
    engine: math
    query: "sqrt(144) = 12"
    output_format: json

- name: Gate on admission
  if: steps.qwed.outputs.admission == 'ADMIT'
  run: echo "proof_ref=${{ steps.qwed.outputs.proof_ref }}"
```

## Examples

### Verify math in PRs

```yaml theme={null}
- name: Check Math
  uses: QWED-AI/qwed-verification@v7.1.0
  with:
    api_key: ${{ secrets.QWED_API_KEY }}
    action: verify
    engine: math
    query: "2**10 = 1024"
```

### Verify logic

```yaml theme={null}
- name: Check Logic
  uses: QWED-AI/qwed-verification@v7.1.0
  with:
    api_key: ${{ secrets.QWED_API_KEY }}
    action: verify
    engine: logic
    query: "(AND (GT x 5) (LT x 10))"
```

### Check code security

```yaml theme={null}
- name: Security Check
  uses: QWED-AI/qwed-verification@v7.1.0
  with:
    api_key: ${{ secrets.QWED_API_KEY }}
    action: verify
    engine: code
    llm_output: "eval(user_input)"
```

### Scan files with SARIF output

```yaml theme={null}
- name: Scan Code
  uses: QWED-AI/qwed-verification@v7.1.0
  with:
    api_key: ${{ secrets.QWED_API_KEY }}
    action: scan-code
    paths: "**/*.py"
    output_format: sarif
    fail_on_findings: "true"
```

## Privacy and security

* 🔒 **PII Masking**: Automatically mask sensitive data (emails, SSNs, credit cards)
* 🏠 **Local Option**: Use local LLMs (Ollama) for zero cloud exposure
* 🔐 **API Keys**: Use GitHub Secrets for secure credential management
* ✅ **Open Source**: Full transparency, no black boxes

## How it works

```text theme={null}
Your Query
    ↓
LLM Response (GPT-4, Claude, etc.)
    ↓
Symbolic Verification (SymPy, Z3, AST)
    ↓
✅ Deterministic Proof or ❌ Verification Failure
```

**Example:**

* Query: "What is the derivative of x^2?"
* LLM says: "2x"
* SymPy computes: `diff(x**2, x) = 2*x`
* QWED: ✅ MATCH! Verified with 100% confidence

## Requirements

**API keys** (select one):

* OpenAI: `OPENAI_API_KEY`
* Anthropic: `ANTHROPIC_API_KEY`
* Google: `GOOGLE_API_KEY`

**Or use local LLMs** (Ollama) for free!

## Documentation

* [**Full Documentation**](https://github.com/QWED-AI/qwed-verification/blob/main/README.md)
* [**PII Masking Guide**](https://github.com/QWED-AI/qwed-verification/blob/main/docs/PII_MASKING.md)
* [**LLM Configuration**](https://github.com/QWED-AI/qwed-verification/blob/main/docs/LLM_CONFIGURATION.md)
* [**Python SDK**](https://github.com/QWED-AI/qwed-verification/blob/main/docs/QWED_LOCAL.md)

## Support

* **Issues**: [GitHub Issues](https://github.com/QWED-AI/qwed-verification/issues)
* **PyPI**: [qwed](https://pypi.org/project/qwed/)
* **Twitter**: [@rahuldass29](https://x.com/rahuldass29)

## License

Apache 2.0 - See [LICENSE](https://github.com/QWED-AI/qwed-verification/blob/main/LICENSE)

***

[**Made with 💜 by QWED-AI**](https://github.com/QWED-AI)


## Related topics

- [QWED Security GitHub App: deterministic PR verification](/advanced/github-app.md)
- [Changelog](/changelog.md)
- [QWED UCP: transaction verification for AI commerce](/ucp/overview.md)
- [QWED Protocol releases: SDK versions and installs](/releases.md)
- [QWED Security rule catalog](/advanced/qwed-security-rule-catalog.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.