# `semantic.ai_field_unmarked`

A marked field's value is stored in a field without its marks.

Area 21, [AI](../topics/ai.md); not declinable; the next step is usually the agent's.

A field that stores a marked field's value keeps its marks: each
category, from `personal:` or the field's type, and `to_models: false`.
Whatever reads the field later, a prompt among them, sends what it
holds, so a copy into a field without them would reach a model unchecked. A value one decided, under an `if` or
a `match`, is stored with it too:




```jadpo
use clinic/types { ClinicalNote }

/// A patient of the clinic.
entity Patient {
    id: Uuid
    notes: ClinicalNote {
        personal: PersonalData.health
    }
    handover_remark: ClinicalNote?

    policy: {
        read: [Access.authenticated]
        update: [Access.authenticated]
    }
}
```

```jadpo
use clinic/entities { Patient, PatientNotFound }

/// Copies a patient's notes into the remark the next clinician reads.
action remark_on_notes(patient_id: Patient.id) fails PatientNotFound -> Patient {
    var patient: Patient = attempt Patient.get(patient_id)
    return Patient.update(patient) {
        set: {
            handover_remark: patient.notes
        }
    }
}
```

```text
error: `Patient.notes` is stored in `Patient.handover_remark`, which isn't marked `health`
 --> domains/clinic/actions/remark_on_notes.jadpo:8:30
  |
8 |             handover_remark: patient.notes
  |                              ^^^^^^^^^^^^^ holds `Patient.notes`
  reason: `Patient.notes` is marked `personal: PersonalData.health`, a sensitive category. Whatever reads `Patient.handover_remark` later, a prompt among them, sends what it holds, so a field that stores a marked value keeps its marks: each category it is, in `personal:` or its type, and `to_models: false`.
  next: Give `handover_remark` `personal: PersonalData.health`, or leave `Patient.notes` out of it (agent)
  rule: semantic.ai_field_unmarked
  help: https://jadpo.dev/docs/errors/semantic.ai_field_unmarked

check failed: 1 error, 5 files
```

A model's answer carries what its prompt was built from, so a field read
off it is checked like those fields when it is stored or sent again: the summary of a patient's notes is `health` wherever it
is kept.









```jadpo
use clinic/entities { Patient, PatientNotFound }
use clinic/types { ClinicalNote, HandoverSummary }
use clinic/failures { SummaryUnavailable }
use clinic/prompts { SummariseNotes }

/// Keeps a summary of a patient's notes as the next clinician's remark.
action keep_handover(patient_id: Patient.id) fails PatientNotFound, SummaryUnavailable -> Patient {
    var patient: Patient = attempt Patient.get(patient_id)
    var handover: HandoverSummary = attempt ai.generate(
        SummariseNotes {
            notes: patient.notes
        },
        as: HandoverSummary
    ) {
        refused: SummaryUnavailable
        malformed: SummaryUnavailable
        timed_out: SummaryUnavailable
        over_budget: SummaryUnavailable
        too_long: SummaryUnavailable
    }
    return Patient.update(patient) {
        set: {
            handover_remark: ClinicalNote(handover.summary)
        }
    }
}
```

```text
error: `Patient.notes` is stored in `Patient.handover_remark`, which isn't marked `health`
 --> domains/clinic/actions/keep_handover.jadpo:23:30
   |
23 |             handover_remark: ClinicalNote(handover.summary)
   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ holds `Patient.notes`
  reason: `Patient.notes` is marked `personal: PersonalData.health`, a sensitive category. Whatever reads `Patient.handover_remark` later, a prompt among them, sends what it holds, so a field that stores a marked value keeps its marks: each category it is, in `personal:` or its type, and `to_models: false`.
  next: Give `handover_remark` `personal: PersonalData.health`, or leave `Patient.notes` out of it (agent)
  rule: semantic.ai_field_unmarked
  help: https://jadpo.dev/docs/errors/semantic.ai_field_unmarked

check failed: 1 error, 8 files
```
