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

# Create a Policy Project with an AI Agent

> Guide an AI coding agent through creating and testing a Credible Layer assertion project

Use `pcl-assertion-workflow` to create and test an assertion project in your protocol repository.

## Prerequisites

* Completed the [AI agent setup](https://docs.phylax.systems/credible/agentic-pcl.md)
* [`pcl` installed](./credible-install)
* A Foundry-based protocol repository
* Agreed policy requirements and review responsibilities

## 1. Start the agent in the protocol repository

Give the agent access to the repository that contains the protocol contracts. Do not give it deployment credentials for this task; project creation and testing are local operations.

Ask it to inspect the existing Foundry configuration, dependency layout, contracts, tests, and invariant documentation before proposing changes.

## 2. Request the project

Use a prompt like this:

```text theme={null}
Use the pcl-assertion-workflow skill to create a Credible Layer assertion
project in this repository.

The policy requirements approved by our team are in: <path>
The protected contracts are: <contract paths or names>

Before editing:
1. Inspect the repository and current Foundry configuration.
2. Explain which invariants are suitable for external-state assertions.
3. Propose the smallest project structure and test plan.
4. Ask before making any choice that changes the intended invariant.

Create the assertion contracts, focused positive and negative tests, required
Foundry profiles, remappings, and assertions/credible.toml. Run the relevant
pcl tests and report the exact results.

Do not authenticate, create platform resources, or deploy anything.
```

## 3. Review the proposed invariants

Before allowing implementation, confirm that each proposed assertion:

* Protects a security-relevant property
* Observes external state rather than duplicating a local `require`
* Names the contracts and state transitions it covers
* Has a narrow trigger strategy
* Can be exercised by both passing and failing tests

If an invariant is ambiguous, refine it before the agent writes Solidity.

## 4. Review the generated project

Follow the host repository structure. A typical project contains:

```text theme={null}
assertions/
├── credible.toml
├── src/
│   └── ExampleAssertion.a.sol
└── test/
    └── ExampleAssertion.t.sol
```

The agent may also update `foundry.toml`, `remappings.txt`, or dependency files. Review those changes for overlap with existing profiles and remappings.

## 5. Verify the project

Give the agent this verification prompt:

```text theme={null}
Run the complete assertion test suite through pcl, not Forge alone. Report the
exact command, exit status, passing and failing tests, and any warnings. Do not
continue to deployment.
```

Review the test output and ask the agent to summarize:

* Which assertion functions executed
* Which protected calls were tested
* How each negative test proves the assertion invalidates a transaction
* Any invariant or execution path that remains untested

> [!WARNING]
>
> Passing tests do not prove that the chosen invariant is correct or complete. Review the assertion logic and threat model before moving to deployment.

## 6. Prepare for deployment

Review the implementation and test evidence against your requirements. Before deployment:

* Commit or otherwise preserve the reviewed local changes
* Confirm that `assertions/credible.toml` names every protected contract and assertion
* Decide on alerting or production
* Identify the target chain and protocol manager wallet

Continue with [Deploy Policies with an AI Agent](https://docs.phylax.systems/credible/agentic-pcl-deploy.md).


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