> For the complete documentation index, see [llms.txt](https://carec.gitbook.io/carec-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://carec.gitbook.io/carec-docs/documentation/simulation/scenario-specification-and-assertions.md).

# Scenario Specification and Assertions

Every named scenario should be runnable locally and in CI from one declarative specification.

```yaml
id: SIM-PERSON-01
world: school_corridor_v1
seed: 1042
initial_pose: {x: 1.0, y: 2.0, yaw: 0.0}
mode: autonomous
goal: {x: 8.0, y: 2.0, yaw: 0.0}
events:
  - at: 4.0
    action: spawn_crossing_actor
    parameters: {speed: 1.0}
assertions:
  - type: minimum_clearance
    value_m: TBD
  - type: maximum_stop_latency
    value_s: TBD
  - type: final_state
    value: stopped_or_replanned
artifacts: [events, diagnostics, trajectory, metrics, rosbag]
```

`TBD` thresholds must be replaced by approved engineering requirements before a scenario becomes a release gate.

## Required assertions

* No collision and no entry into defined keep-out regions.
* Velocity and acceleration stay within the active mode limits.
* Stop, mode transition, and fault responses meet their time bounds.
* Minimum clearance and localization confidence remain within requirements.
* Expected explanations and diagnostics are emitted.
* The test ends in a known state and never resumes motion after restart.

## Result bundle

Store scenario and software versions, seed, pass/fail assertions, time-series metrics, event timeline, trajectory, selected screenshots, logs, and bag-file manifest. Retain failed-run artifacts long enough for diagnosis.


---

# 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://carec.gitbook.io/carec-docs/documentation/simulation/scenario-specification-and-assertions.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.
