# Kontrol Example

## Create a new Foundry project

```bash
forge init kontrolexample
```

This command creates a new Foundry project that serves as an example. The project's structure is explained in detail in the [Foundry book](https://book.getfoundry.sh/projects/project-layout). Currently, we can only perform fuzzing on parametric tests because the project is not configured to support symbolic execution. We will discuss this topic later in [Property Verification using Kontrol](/kontrol/guides/kontrol-example/property-verification-using-kontrol.md). With the project created, we will install **Kontrol** cheatcodes and then begin editing the code.

### Install Kontrol cheatcodes

To use **Kontrol** cheatcodes, we need to install a [new Solidity library](https://github.com/runtimeverification/kontrol-cheatcodes/) required for symbolic execution. First, **navigate** into the project directory. Then you can install it with Foundry by running the following command:

```bash
forge install runtimeverification/kontrol-cheatcodes
```

These cheatcodes enable us to generalize the storage of an Ethereum account by making it symbolic or by allowing any type of call, such as a [`delegatecall`](https://www.evm.codes/#f4).

{% hint style="info" %}
A similar effect can be achieved by running `kontrol init` instead of `forge init`. This command initializes a new Foundry project with the **Kontrol** cheatcodes already installed and a `kontrol.toml` configuration file automatically created.

You can add a `kontrol.toml` file and Kontrol cheatcodes to an existing project by running `kontrol init --skip-forge`.
{% endhint %}

With the project created and the **Kontrol** cheatcodes installed we can begin editing the code.


---

# 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://docs.runtimeverification.com/kontrol/guides/kontrol-example.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.
