> ## 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 transition inputs

> Discover transition inputs, inspect admission, and query with the target withheld.

Use this when the target is known and Adapt-1 should discover eligible transition inputs. For a complete runnable example, start with [First learned result](/docs/neuroadapt/first-learned-result).

Transition Discovery forms the executable input projection from eligible events while the target remains explicit. It can also discover compatible before/after causal bindings in a mixed setup where the transition inputs themselves stay authored.

Transition projection applies to a declared relationship:

1. observable fields available before the result
2. observable numeric, categorical, boolean, or set target

The application declares the target. Core observes eligible events, identifies stable scalar paths, rebuilds buffered evidence when the projection changes, and exposes the discovered contract in learner state.

## Configuration

```json theme={null}
{
  "learning": {
    "enabled": true,
    "transition": {
      "enabled": true,
      "event_types": ["observation"],
      "input_paths": [],
      "targets": [
        {
          "path": "values.process.output",
          "type": "number"
        }
      ],
      "required_support": 3,
      "autonomous_projection": {
        "enabled": true,
        "minimum_observations": 3,
        "minimum_availability": 0.8,
        "maximum_input_paths": 8,
        "discover_causal_bindings": true,
        "minimum_causal_variables": 2
      }
    }
  }
}
```

### Projection fields

For normal use, configure the fields shown in the production examples:

| Field                      | Meaning                                                                           |
| -------------------------- | --------------------------------------------------------------------------------- |
| `enabled`                  | Enables autonomous transition projection                                          |
| `minimum_observations`     | Controls how much complete evidence is required before discovery can become ready |
| `minimum_availability`     | Prevents sparse fields from entering the discovered projection too easily         |
| `maximum_input_paths`      | Bounds the discovered input surface                                               |
| `discover_causal_bindings` | Enables automatic before/after binding discovery when causal learning is used     |
| `minimum_causal_variables` | Requires enough shared numeric variables for a causal binding                     |

`learning.transition.targets` remains required. If `input_paths` is empty, autonomous projection must be enabled. A non-empty `input_paths` list remains authoritative.

<Warning>
  Keep post-outcome measurements and target-derived values out of the pre-outcome learner view. Discovery can only work with the evidence boundary you provide.
</Warning>

## Ingest events

```bash theme={null}
curl -sS -X POST \
  "https://rei-neuroadapt-api.reilabs.org/api/v1/domains/process-output-demo/events" \
  -H "Authorization: Bearer $ADAPT1_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "ignored",
    "event_type": "observation",
    "values": {
      "process": {
        "temperature": 24.5,
        "pressure": 1.2,
        "output": 52.6
      }
    },
    "metadata": {
      "episode_id": "setup-001",
      "step": 1
    }
  }'
```

Storage and learner admission are separate. Check `learner_eligibility` on every write.

| Response                                                       | Meaning                                                             |
| -------------------------------------------------------------- | ------------------------------------------------------------------- |
| `accepted: false`, `rejection_reason: projection_accumulating` | Event is buffered while no stable projection exists                 |
| `schema_changed: true`                                         | The discovered projection changed and buffered evidence was rebuilt |
| `input_source: discovered`                                     | Current paths came from autonomous projection                       |
| `input_source: declared`                                       | Current paths were explicitly configured                            |
| `sample_count_delta > 1`                                       | A projection revision admitted buffered events together             |

## Inspect state

Request `learning_state` on `/query` or `/explain`:

```json theme={null}
{
  "return_fields": [
    "learning_state",
    "transition_prediction"
  ]
}
```

The projection state is available at:

```text theme={null}
learning_state
  .subsystems
  .structured_transition
  .autonomous_projection
```

Useful fields:

| Field                      | Interpretation                                       |
| -------------------------- | ---------------------------------------------------- |
| `status`                   | `disabled`, `accumulating`, or `ready`               |
| `revision`                 | Number of discovered schema revisions                |
| `buffered_events`          | Raw events available for rediscovery and rebuild     |
| `input_paths`              | Current executable transition inputs                 |
| `input_source`             | `declared` or `discovered`                           |
| `causal_binding_source`    | `declared` or `discovered`                           |
| `causal_intervention_path` | Current intervention field for causal observations   |
| `causal_variables`         | Variable names bound across before and after records |

## Query rules

Pass the current values at the same paths Core discovered. Omit the withheld target.

```bash theme={null}
curl -sS -X POST \
  "https://rei-neuroadapt-api.reilabs.org/api/v1/domains/process-output-demo/query" \
  -H "Authorization: Bearer $ADAPT1_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "ignored",
    "question": "Predict the process output.",
    "context": {
      "values": {
        "process": {
          "temperature": 30,
          "pressure": 1.2
        }
      }
    },
    "return_fields": ["transition_prediction", "learning_state"],
    "update_memory_state": false,
    "allow_exploration": false
  }'
```

Possible abstention reasons include:

| Reason                       | Correct response                                                         |
| ---------------------------- | ------------------------------------------------------------------------ |
| `projection_accumulating`    | Send more complete eligible events, then inspect projection state        |
| Missing input paths          | Supply every discovered path in query context                            |
| `insufficient_support`       | Add compatible observations or lower support only with a measured reason |
| `no_matching_group`          | Check `group_by_paths` and current group values                          |
| Distance or model abstention | Inspect evidence geometry and avoid forcing a prediction                 |

## Categorical targets

Use `type: categorical` for labels with no numeric ordering:

```json theme={null}
{
  "targets": [
    {
      "path": "values.case.disposition",
      "type": "categorical"
    }
  ],
  "discrete_model": "auto",
  "autonomous_projection": {
    "enabled": true
  }
}
```

Do not encode categories as arbitrary numbers. Preserve their string or boolean semantics.

## Mixed causal discovery

For causal events, explicit pre-outcome inputs are often safer while before/after binding can remain automatic.

```json theme={null}
{
  "transition": {
    "enabled": true,
    "event_types": ["intervention_result"],
    "input_paths": [
      "values.before.temperature",
      "values.before.pressure",
      "values.intervention"
    ],
    "action_path": "values.intervention",
    "targets": [
      {
        "path": "values.after.output",
        "type": "number"
      }
    ],
    "autonomous_projection": {
      "enabled": true,
      "discover_causal_bindings": true,
      "minimum_causal_variables": 2
    },
    "causal_graph": {
      "enabled": true,
      "event_types": ["intervention_result"]
    }
  }
}
```

Each event should contain repeated numeric variable names under `before` and `after`, plus an intervention string matching one of those variable names. Core can discover the paired paths and intervention field while the declared transition inputs remain fixed.

<Info>
  Causal binding discovery identifies a compatible structured before/after contract. It does not prove causal identifiability, remove confounding, or replace an intervention protocol.
</Info>

## Move from discovery to a pinned contract

1. Run discovery on representative training data.
2. Read the discovered `input_paths` and causal bindings.
3. Check availability, semantics, leakage, stability across folds, and behavior under missing fields.
4. Create a new Domain or update learning configuration with approved explicit paths.
5. Evaluate frozen on held-out events.

Explicit paths prevent later projection changes. Keep automatic discovery enabled only for the portions that should continue adapting.

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

  <Card title="Structure Discovery" href="/docs/neuroadapt/discovery-structure">
    Discover useful fields, combinations, lags, and predictive rules.
  </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>
