> For the complete documentation index, see [llms.txt](https://docs.mozark.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mozark.ai/mcp/mozark-mcp-docs/reference/workflow-rules.md).

# Workflow rules

Required procedures that keep Mozark workflows reliable.

The Mozark server ships **mandatory workflow rules** that any AI assistant retrieves before starting a task (`get_workflow_rules`). They exist to keep runs reliable and to stop the assistant from guessing. If the assistant seems to be asking a lot of questions, this is why.

## Context

* Resolve organisation / project / app once per session, before any project-scoped tool.
* If only an account-wide default is available and you belong to several organisations, confirm before proceeding.
* Any change you request in conversation is applied by actually calling the switch tool — a spoken "OK" doesn't change anything on its own.

## Test generation

* Always ask whether to use the existing knowledge base or add material first.
* Always ask test type, polarity and feature name — never auto-select.
* Always search the knowledge base before generating.
* Never save unless you explicitly ask.

## Test plans

* List existing plans first; consult the Planner Agent alone; show matches before asking new-vs-existing; never create or update without confirmation.

## Optics (device execution)

* Pick a device from the free list; ask about capture options before starting (they can't be added later).
* Never guess an app package — ask, or read it from the device.
* Ask for the locator fallback order (text → XPath → AI fallback recommended) after probing the screen.
* Inspect the screen before every step; narrate action, result, observation, expected result and next.
* Verify each step with `assert_presence`; never claim a pass without screenshot evidence.
* On failure, work down the ladder before reporting; never silently skip a step.
* Export text-locator YAML with an assertion after every action; release the device.

## Appium

* List free devices and start sessions automatically — never ask you for a session ID.
* Upload local builds via the streaming curl command; install by `mzfile://` ID; never base64 a binary.
* Stop the session when done unless you ask to keep it open.

## Test runs (Optics or Appium)

* Start the test case in the run before step 1; mark every step; attach evidence on failures; finish the run with a terminal status.


---

# 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 dynamically by asking a question.

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

```
GET https://docs.mozark.ai/mcp/mozark-mcp-docs/reference/workflow-rules.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
