# Wake Framework as engine for AI

The Wake Framework serves as the **foundation for Wakehacker's AI capabilities**, providing **comprehensive smart contract analysis** through multiple approaches:

## Core Capabilities

* **Testing Framework**: Python-based testing environment with **fast execution** ([Testing Framework Overview](https://ackee.xyz/wake/docs/latest/testing-framework/overview/))
* **Static Analysis**: Vulnerability detection with focus on **minimizing false positives** ([Built-in Detectors](https://ackee.xyz/wake/docs/latest/static-analysis/using-detectors/))
* **Fuzzing Framework**: Advanced testing methodology including **Manually Guided Fuzzing** ([Fuzzing Documentation](https://ackee.xyz/wake/docs/latest/testing-framework/fuzzing/), [Manually Guided Fuzzing](https://ackee.xyz/blog/introducing-manually-guided-fuzzing-a-new-approach-in-smart-contract-testing/))

## Internal Representation (IR)

Wake's IR model provides **deep understanding** of smart contracts ([Working with IR](https://ackee.xyz/wake/docs/latest/static-analysis/working-with-ir/)):

* **Complete control flow graph (CFG)** analysis
* **Data dependency graph (DDG)** tracking
* **Cross-contract** relationships
* **Storage layout** verification ([Storage Layout Printer](https://ackee.xyz/wake/docs/latest/static-analysis/printers/storage-layout/))
* **Function call** hierarchies ([Control Flow Graph](https://ackee.xyz/wake/docs/latest/static-analysis/printers/control-flow-graph/))

## Precision-First Approach

Wake prioritizes **precision over recall** in its analysis:

* **Condition-based detection** rather than heuristics
* **Minimizes false positives** through precise pattern matching
* Provides **detailed context** for each detection
* Enables **efficient verification** of findings

### Measured Performance

Recent experiments comparing Wake's write-after-write detector with Slither (a widely-used heuristic-based analyzer) demonstrate its precision across two controlled studies:

**Study 1: Controlled Test Suite**\
Analysis of 34 purpose-built smart contracts containing both simple and edge cases:

| Metric    | Wake   | Slither |
| --------- | ------ | ------- |
| Precision | 100%   | 86.36%  |
| Recall    | 76.19% | 33.33%  |
| F1-Score  | 86.59% | 50%     |

**Study 2: Production Contracts**\
Analysis of 50 randomly selected smart contracts from a dataset of 9,388 production contracts:

| Metric    | Wake   | Slither |
| --------- | ------ | ------- |
| Precision | 100%   | 86.36%  |
| Recall    | 94.74% | 50%     |
| F1-Score  | 97.29% | 63.33%  |

These results demonstrate Wake's detection capabilities through its condition-based approach rather than heuristic methods, particularly in minimizing false positives while maintaining high recall rates. **While these measurements focus on a single detector type, they illustrate the framework's potential when precise condition-based analysis is applied rather than heuristic approaches like those used in Slither.**

These findings were presented at the 2024 TUM Blockchain Conference ["Ethereum Vulnerability Detectors"](https://www.youtube.com/watch?v=EXtKn6XEOVU).

## AI Integration

Wake's architecture enables AI enhancements through:

* **Structured IR data** perfect for LLM consumption
* **Context-aware** output slicing
* **Relationship mapping** for complex analysis

By providing exact information in the right context, Wake enables AI models to:

1. Understand complex contract relationships
2. Provide extended vulnerability descriptions
3. Explain potential impact and remediation
4. Verify mathematical calculations
5. Reduce false positive detections


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wakehacker.gitbook.io/wakehacker/agentic-security-model/wake-framework.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
