> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reilabs.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Discover predictive structure

> Discover predictive fields, combinations, and temporal relationships from eligible evidence.

Use this when eligible fields, combinations, or temporal relationships should form from evidence. Declare the observable target before sending completed events.

Structure Discovery lets Adapt-1 form useful predictive structure from evidence. It can discover relevant fields, combinations, and bounded temporal relationships, then expose the resulting rules with supporting and contradicting evidence.

Autonomous structure learning answers a different question from transition projection:

```text theme={null}
which observable conditions support a target outcome?
```

The application declares the target and event boundary. Adapt-1 discovers useful structure from the eligible fields and exposes the result through `induced_structure` and `learning_state`.

## Minimal configuration

```json theme={null}
{
  "domain_id": "case-structure-demo",
  "session_id": "ignored",
  "description": "Discover observable structure associated with case outcomes.",
  "schema": {
    "event_types": ["resolved_case"]
  },
  "learning": {
    "enabled": true,
    "structure": {
      "enabled": true,
      "event_types": ["resolved_case"],
      "feature_paths": [],
      "targets": [
        {
          "path": "values.outcome",
          "type": "categorical"
        }
      ],
      "representation": {
        "enabled": true,
        "maximum_order": 2,
        "maximum_lag": 3,
        "minimum_support": 12,
        "episode_path": "metadata.episode_id"
      }
    }
  }
}
```

An empty `feature_paths` list enables discovery from eligible scalar fields. The target, text, timestamps, identifier-like fields, and most metadata are excluded from automatic raw features.

## What Discovery can form

Structure Discovery can use current fields, combinations of fields, and bounded temporal relationships when those patterns are useful for the declared target.

The public controls you usually need are:

| Field             | Meaning                                                                 |
| ----------------- | ----------------------------------------------------------------------- |
| `maximum_order`   | Bounds how many fields can participate in one discovered combination    |
| `maximum_lag`     | Bounds how far back Discovery can inspect within one episode            |
| `minimum_support` | Requires enough compatible evidence before discovered structure is used |
| `episode_path`    | Separates independent temporal histories                                |

Start with the example defaults. Increase order or lag only when the task actually requires more complex combinations or longer temporal context.

<Info>
  Structure Discovery selects predictive structure from the observations you provide. It does not define the target, invent unavailable observations, or decide the application objective.
</Info>

## Event shape

```bash theme={null}
curl -sS -X POST \
  "https://rei-neuroadapt-api.reilabs.org/api/v1/domains/case-structure-demo/events" \
  -H "Authorization: Bearer $ADAPT1_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "ignored",
    "event_type": "resolved_case",
    "values": {
      "signal_a": true,
      "signal_b": 0.42,
      "noise_probe": 7,
      "outcome": "accept"
    },
    "metadata": {
      "episode_id": "case-stream-001",
      "step": 14
    }
  }'
```

The `episode_id` prevents temporal candidates from crossing independent sequences. Use a stable step order inside each episode. If events are independent, assign separate episode IDs or disable temporal representation discovery by omitting `representation`.

## Inspect event admission

The event response includes `structure_eligibility`. Check whether the event was accepted, whether the sample count changed, which feature and target paths were admitted, and whether representation discovery is ready.

The exact selected paths depend on observed evidence. Treat them as learned state, not fixed example output.

## Query induced structure

```bash theme={null}
curl -sS -X POST \
  "https://rei-neuroadapt-api.reilabs.org/api/v1/domains/case-structure-demo/query" \
  -H "Authorization: Bearer $ADAPT1_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "ignored",
    "question": "What outcome is supported by this case?",
    "context": {
      "values": {
        "signal_a": true,
        "signal_b": 0.38,
        "noise_probe": 2
      },
      "metadata": {
        "episode_id": "evaluation-001",
        "step": 0
      }
    },
    "return_fields": ["induced_structure", "learning_state"],
    "update_memory_state": false,
    "allow_exploration": false
  }'
```

`induced_structure` can expose the current hypotheses, their conditions and predictions, and the evidence that supports or contradicts them.

Representation state is available at:

```text theme={null}
learning_state
  .subsystems
  .autonomous_structure
  .representation
```

For normal use, inspect readiness, selected paths, active representations, model version, and the supporting or contradicting evidence attached to the current result.

## Explicit versus discovered features

If `feature_paths` is non-empty, those base paths define the authoritative feature surface. Representation discovery can still evaluate combinations and lags derived from those fields.

```json theme={null}
{
  "feature_paths": [
    "values.signal_a",
    "values.signal_b"
  ],
  "representation": {
    "enabled": true,
    "maximum_order": 2,
    "maximum_lag": 2
  }
}
```

Use this mixed mode after reviewing automatic discovery or when governance requires an approved input list.

## Prevent accidental leakage

Before relying on induced structure:

1. Confirm the target is absent from query context.
2. Remove target-derived scores, post-outcome flags, evaluator labels, and correct-action fields.
3. Partition train and evaluation by entity or episode, not only by row.
4. Freeze updates before scoring held-out data.
5. Compare against a simple single-field or best-feature selector.
6. Inspect whether a suspicious identifier or timestamp became predictive.
7. Repeat across seeds or independent streams when reporting performance.

<Warning>
  A discovered association is not automatically causal. Use intervention evidence and causal diagnostics only when the application can supply a valid intervention protocol.
</Warning>

## When to pin the structure

Keep discovery active while the feature surface is intentionally open and monitored. Pin base paths when:

* The Domain enters a regulated or audited workflow.
* Field semantics are versioned by an upstream contract.
* Availability changes should fail explicitly rather than trigger rediscovery.
* A frozen evaluation requires a stable representation.

The active rules can continue updating from evidence even when the permitted base paths are explicit.

<CardGroup cols={2}>
  <Card title="Discovery overview" href="/docs/neuroadapt/discovery">
    Review the three Discovery paths, boundaries, and lifecycle.
  </Card>

  <Card title="Transition Discovery" href="/docs/neuroadapt/discovery-transition-projection">
    Discover executable input projections and compatible causal bindings.
  </Card>

  <Card title="Sequential Discovery" href="/docs/neuroadapt/discovery-sequential">
    Discover state-dependent action values and delayed credit across episodes.
  </Card>

  <Card title="Complete examples" href="/docs/neuroadapt/discovery-examples">
    Run transition, structural, sequential, and mixed workflows.
  </Card>
</CardGroup>
