/learn endpoint lets you feed corrections back into the NSP semantic engine. When the engine mislabels a state key — or surfaces it as an opaque unknown_0x... identifier — you can submit the correct label, type, and an optional note explaining the mapping. The daemon stores each correction in the per-application schema registry and applies it starting with the next probe cycle. Over time, a well-corrected schema reaches near-perfect confidence and produces cleaner, more predictable state maps for your agents.
Endpoint
Parameters
The OS process ID of the application whose schema you are correcting. Obtain this from
GET /apps.Request Fields
The
capture_id of the state snapshot on which you observed the keys you are correcting. This ties each correction to a specific point in time, which helps the semantic engine understand the runtime context of the correction.Array of label correction objects. Each object describes one key mapping to fix.
Category of feedback being submitted. One of:
The
schema_version value from the SubstrateState that contained the keys you are correcting. This prevents stale corrections from being applied on top of a newer schema version.Response Fields
Number of corrections successfully applied to the schema registry.
Number of corrections rejected. Corrections are rejected when the
observed_key no longer exists in the current schema, the schema_version does not match the current version, or the correct_label conflicts with an already-confirmed key.The schema version after applying all accepted corrections. If any corrections were accepted, this will be higher than the version you submitted.
Human-readable summary of the result, e.g.
"2 corrections applied. Schema updated to 1.4.4.".Examples
Example Response
When to Use This Endpoint
Unknown keys — The semantic engine surfaces opaque identifiers likeunknown_0x4a2f when it cannot confidently label a heap object. If you can identify what the field represents by correlating it with visible application data, submit a correction to name it permanently.
Type mismatches — If a field you expect to be a number is typed as a string (or vice versa), submit a type_correction. Wrong types break numeric comparison expressions in /verify and /action.
Action mapping errors — If an action in the schema is triggering the wrong runtime method, submit an action_correction with the correct method binding.
Improving confidence — A confidence score below 0.85 on GET /apps indicates the semantic engine is uncertain about some labels. Submitting corrections for the uncertain keys is the fastest way to raise confidence to >0.95.
Corrections take effect on the next probe cycle, which runs within 2 seconds by default. The schema version is bumped on every accepted correction — update any cached schema references in your agent after calling
/learn.