# Contextual Apps

Contextual apps allow you start any app (workflow) from an existing image ( [image-comtext-menu](https://docs.cushystudio.com/getting-started/cushy-interface/image-comtext-menu "mention")) or selection ([unified-canvas](https://docs.cushystudio.com/getting-started/unified-canvas "mention"))

## Make your app compatible

1. Add canStartFromImage

```typescript
app({
   ...
   canStartFromImage: true,
})
```

2. update  your `run` handler to take a third param

```typescript
    //                  👇👇👇👇👇
    run: async (run, ui, startImg) => {
```

## Add new entries to the image context menu

once your **CushyApp** is *start-from-image* enabled, you can just create new drafts of your app.

Every draft will show as a new menu entry

## Support both beeing run as context action or standalone

Supporting both is easy.

```typescript
    run: async (run, ui, startImg) => {
        //  if  startImg is null, it will take ui.startImage instead
        let img = startImg ?? ui.startImage
    }
```

## Built-in examples to look at

look at the `library/quick-actions/*`

* library/built-in/quick-actions/quick-dispace.ts
* library/built-in/quick-actions/quick-refine.ts
* ...


---

# 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.cushystudio.com/going-further/creating-apps/contextual-apps.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.
