> For the complete documentation index, see [llms.txt](https://robodex.gitbook.io/robodex-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://robodex.gitbook.io/robodex-docs/research/creative-qd-v2.md).

# Creative QD V2 Loop

`creative_qd_v2` lives in:

```
packages/research/agent_loops/creative_qd_v2_loop.py
```

It wraps `grammar_v2` with a lightweight quality-diversity search.

## Purpose

The loop tries to avoid returning only the most obvious morphology. It explores candidate variations, measures their structural differences, and selects a useful candidate while preserving the same app-compatible HITL shape.

## Proposal modes

The loop can propose variants using modes such as:

* analogy,
* mutation,
* novelty,
* constraint inversion,
* exploit.

These modes alter the prompt or candidate framing before calling `grammar_v2`.

## Seed ideas

The current loop includes seed concepts such as:

* goat-like,
* inchworm-like,
* tank-tread-like,
* rock-climber brace.

Those seeds provide diversity pressure before the grammar compiler validates and lowers the final result.

## Archive behavior

The loop computes structural features for candidates and inserts them into a quality-diversity archive. It tracks morphology identity and physics-inspired features so candidates are not treated as interchangeable if their bodies differ meaningfully.

## Relationship to grammar V2

`creative_qd_v2` does not replace the grammar compiler. It calls `grammar_v2` for each candidate proposal and then chooses among the resulting HITL payloads.

That means the selected candidate still follows the same derivation-first body-generation path:

```
proposal prompt -> grammar_v2 -> RobotDesignProgram -> expanded graph -> component program -> HITL
```

## Product behavior

The workspace SDK prefers `creative_qd_v2` when it is registered. If it is unavailable, product generation falls back to `grammar_v2`.

The selected HITL payload can include a `creative_qd` block with archive and selection metadata.


---

# 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://robodex.gitbook.io/robodex-docs/research/creative-qd-v2.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.
