> For the complete documentation index, see [llms.txt](https://dambio.gitbook.io/dambi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dambio.gitbook.io/dambi/undefined-2/editor.md). Agents can also search and read this documentation through its [MCP server](https://dambio.gitbook.io/dambi/~gitbook/mcp).

# 에디터로 정책 만들기

문장형 폼·Cedar 텍스트·LLM 초안으로 정책 만들기

DAMBI 에디터는 Cedar를 몰라도 **문장형 폼**으로 정책을 만들 수 있게 해줍니다. 복잡한 규칙은 Cedar 텍스트를 직접 쓸 수도 있어요.

## 세 가지 작성 방식

| 방식               | 언제 쓰나                               |
| ---------------- | ----------------------------------- |
| **문장형 폼 (Form)** | 대부분의 정책: 도메인·조건·값·강도를 폼으로 선택        |
| **Cedar 텍스트**    | 폼으로 표현하기 어려운 복잡한 규칙                 |
| **LLM 초안**       | 자연어로 설명하면 AI가 폼 모델 초안을 생성 (검토 후 사용) |

## 문장형 폼에서 정하는 것

폼으로 정책을 만들 때 채우는 항목:

1. **도메인 & 액션** | Token / AMM / Lending / Perp … 중 도메인을 고르고, 그 안의 구체 액션(swap, approve, borrow …)을 선택 ([액션 종류](https://dambio.gitbook.io/dambi/undefined-2/action-types.md))
2. **조건 (when / unless)**
   * `when` | 어떤 조건일 때 금지할지 (AND/OR 조합)
   * `unless` | 예외 (금지하되 이 경우는 제외)
   * 연산자: `==` `!=` `<` `<=` `>` `>=` `contains` `notContains` `in` `notIn` (각 조건마다 주어지는 연산자가 다름)
3. **값 (parameter)**
   * 조건에서 비교할 값을 입력하는 부분입니다. 각 필드는 정해진 **형식(타입)** 을 가집니다: 문자열(String), 숫자(Long/Decimal), 주소, 불리언(Bool), 여러 값을 담는 목록(Set) 등.
   * **선택한 액션(tag)에 따라 사용할 수 있는 필드와 그 형식이 달라집니다.** 액션에 맞는 필드만 폼에 나타나고, 각 필드의 형식에 맞는 입력칸이 표시됩니다. (예: 스왑에는 금액·토큰·슬리피지, 승인에는 스펜더·한도 필드)
   * 형식별 입력 예: 금액·수치는 숫자(`context.amount >= 100000`), 주소·토큰은 문자열, 허용/차단 목록은 주소 목록(`context.spender in [0x…, 0x…]`), 평판·상태 검사는 enrichment로 채워진 값(`context.custom.spenderReputation > 50`)
4. **강도(severity)** | `deny` / `warn` / `info`
5. **이유(reason) & 경고(warnings)** | 정책이 걸렸을 때 사용자에게 보여줄 설명

<figure><img src="https://2239293212-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4tJvLlfkuv4N3G94bjFr%2Fuploads%2FOokfsghUEK2cB7uonKAm%2Fimage.png?alt=media&amp;token=949fed12-c68a-4e05-8a77-8647de5c1c8b" alt="" width="563"><figcaption></figcaption></figure>

## LLM 초안 (선택)

자연어로 "Hyperliquid에서 레버리지 20배 넘으면 경고" 같이 설명하면, LLM이 후보 액션을 고르고 폼 모델 초안을 만들어줍니다. 프로필에서 OPENAPI api key를 입력해야 합니다.

* 생성된 초안은 **WASM Cedar 엔진으로 검증**됩니다 (LLM이 만든 Cedar를 그대로 쓰지 않음).

<figure><img src="https://2239293212-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4tJvLlfkuv4N3G94bjFr%2Fuploads%2FltD1TkxPSQHK3HjAfZ7t%2Fimage.png?alt=media&amp;token=fdaa887d-8bd6-457e-aaf5-4ec65257cb1a" alt="" width="563"><figcaption></figcaption></figure>

## 문서 탭 (정의/범위/대상/데이터)

정책에 사람이 읽을 설명을 붙입니다. 정책 허브에 올릴 때 그대로 노출돼요.

* **정의** | 이 정책이 무엇을 하는가
* **범위** | 어디까지 적용되는가
* **대상** | 누구를 위한 것인가
* **데이터** | 어떤 데이터를 쓰는가 (enrichment 등)

## 저장 & 게시

* **저장** | 정책을 로컬에 저장. 바로 내 지갑에 적용 가능.
* **게시(Publish)** | 정책 허브에 올리기. 빈칸(hole) 처리·미리보기 후 버전과 함께 게시. → [정책 허브에 배포하기](https://dambio.gitbook.io/dambi/undefined-2/publishing.md)

## 다음 단계

* 막을 수 있는 행동 전체 → [액션 종류](https://dambio.gitbook.io/dambi/undefined-2/action-types.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://dambio.gitbook.io/dambi/undefined-2/editor.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
