Classify and enrich atoms
Interpret input, plan provider work, and preserve evidence without silently rewriting an atom's identity.
Prompt for your agentBuild an offline parse, classify and enrich pipeline
Goal: build an offline pipeline that parses, classifies and plans enrichment for my inputs while keeping evidence separate from identity.
Read https://docs.intuition.systems/docs/build/classify-enrich.md, https://docs.intuition.systems/docs/concepts/atom-classification.md and https://docs.intuition.systems/docs/concepts/enrichment.md.
Use exact package versions from https://docs.intuition.systems/intuition-release.json and public entry points only.
Input: a fixture file of [my labels, URLs or IIDs].
Use an injected local provider fixture. Make no provider or network requests.
For each input, return the parse result, the proposed classification, the planned capabilities and any field results, with the provenance of each field.
Keep partial results and unknown classifications as explicit outcomes. Never rewrite atom identity bytes with enriched data.
Add a test that runs the fixture end to end.
Report the checks you actually ran and anything you could not verify.
Paste this into your coding agent. It points the agent at the Markdown version of each page and leaves every signature to you.
Before you start
Start with atom parsing and atom classification. Use installation and these direct dependencies:
npm install --save-exact @0xintuition/atom-parser@0.1.1 @0xintuition/atom-classification@0.1.1 @0xintuition/atom-enrichment@0.1.1 @0xintuition/iid-registry@0.1.1 viem@2.31.4
The complete processing source uses fixed synthetic input and an injected local provider fixture. It performs no provider request. Installing a provider, returning a plan, fetching an artifact, and accepting a field are separate decisions.
Steps
1. Parse without remote inspection
parseAtom detects structure. With remoteFetch: false, URI inspection is disabled. Invalid IID-shaped input remains an IID parse result with valid: false; it must not silently become ordinary text. Bound external request bytes and collection sizes before package parsing, not only inside a schema validator.
2. Classify and plan locally
import { parseAtom } from '@0xintuition/atom-parser';
import {
createClientEngine,
createPlainTextPlugin,
createTypeProfilesPlugin,
} from '@0xintuition/atom-classification';
import {
classificationForIid,
identifierHintsForIid,
providersForIid,
} from '@0xintuition/iid-registry';
const rawInput = 'int:mbid:recording:b1a9c0e9-d987-4042-ae91-78d6a3267d69';
// Apply transport byte/count limits before passing external input to parsers.
if (Buffer.byteLength(rawInput, 'utf8') > 4_096)
throw new Error('Input too large');
const parsed = await parseAtom(rawInput, { remoteFetch: false });
if (parsed.kind !== 'iid' || !parsed.valid || !parsed.canonicalIid) {
throw new Error('Expected a valid recording IID');
}
const iid = parsed.canonicalIid;
const classification = classificationForIid(iid);
const plan = providersForIid(iid);
const classifier = createClientEngine({
plugins: [createTypeProfilesPlugin(), createPlainTextPlugin()],
});
const ambiguous = await classifier.classify({
input: 'One More Time',
mode: 'client-only',
classificationSessionId: 'catalog-text',
});
console.log({
classification,
plan,
nameOnly: ambiguous.resolved?.classifications,
});
The synthetic typed recording IID maps to music-recording. providersForIid returns ordered capability names without fetching, credentials, or cache access. A valid bare int:wd:Q42 has no inferred classification. A name such as “One More Time” is ambiguous: this explicit plain-text plugin set returns a generic Thing, not a verified recording match.
Classification engines return canonical envelopes in resolved.classifications and an identity-oriented projection in resolved.publishable. Runtime categories such as song are distinct from catalog slugs such as music-recording. For a production classification handoff, toClassifiedAtomInput from @0xintuition/atom-enrichment/handoff preserves accepted identity and hints, or returns null when the result is unusable. Inspect that outcome before enrichment.
3. Execute only selected capabilities
The full source defines fixtureProvider, a local adapter with one fixed synthetic recording response. It emits the registered musicbrainz artifact shape but marks its provider as local-synthetic-fixture and its source URL under example.org. It does not pretend that MusicBrainz verified the record. The registry plan is displayed separately; it does not select or run this fixture adapter automatically.
import {
createEnrichmentEngine,
type ClassifiedAtomInput,
} from '@0xintuition/atom-enrichment';
import { extractClassificationFields } from '@0xintuition/atom-enrichment/extraction';
// fixtureProvider is the local adapter defined in the full source.
// The registry's plan does not automatically install or execute providers.
const input: ClassifiedAtomInput = {
atomType: 'song',
jsonLd: { '@context': 'https://schema.org/', '@type': 'MusicRecording' },
hints: { identifiers: identifierHintsForIid(iid) },
source: {
classificationEngine: 'docs-fixture',
classifiedAt: '2026-01-01T00:00:00.000Z',
},
};
const engine = createEnrichmentEngine({
plugins: [fixtureProvider],
now: () => '2026-01-01T00:00:00.000Z',
});
const enriched = await engine.enrich({
runtime: 'server',
input,
concurrency: 1,
timeoutMs: 1_000,
});
const fields = await extractClassificationFields({
classification: 'music-recording',
artifacts: enriched.artifacts,
fetcher: async () => {
throw new Error('Remote extraction disabled for this fixture');
},
});
console.log({
status: enriched.status,
artifacts: enriched.artifacts,
errors: enriched.errors,
skipped: enriched.skipped,
values: fields.values,
provenance: fields.fields,
missingRequired: fields.missingRequired,
});
Use this region with the preceding region and the fixture definition in the full source. Real adapters need explicit runtime selection, configured credentials where required, bounded concurrency, cancellation, and a network policy. Custom transports must preserve the library's address validation and redirect restrictions. Do not expose provider secrets in a client bundle.
4. Retain provenance and partial outcomes
An artifact carries its provider, plugin, fetch time, and optional source URL. Field extraction is a separate operation that may make additional requests; the example injects a transport that rejects those requests. Preserve fields, missingRequired, and droppedFields alongside accepted values. Evidence from a provider is not independent verification of a claim.
This pinned extractor does not map the fixture's MusicBrainz artifact into recording fields: it returns empty values and reports missing name. That is a useful partial outcome, not permission to invent extracted fields. Keep the artifact and its provenance available for review. Updating display metadata does not require replacing the canonical bytes of an existing atom.
Check the result
Run node src/processing.ts from the full source's music-catalog directory after installing examples/v2. The fixture emits one artifact with no engine errors, while an input with no matching identifier emits zero artifacts and a skipped-provider reason. Its final line is:
Fixture enrichment: 1 artifact; unmatched input: 0 artifacts
Troubleshooting
| Outcome | Response |
|---|---|
| Invalid parse | Correct input before retrying. |
| No classification or usable handoff | Retain diagnostics and request more precise identity evidence. |
| Empty provider plan | Keep the valid identity; no lookup capability is currently planned. |
| Partial result or missing fields | Preserve useful artifacts, errors, and provenance without promising completion. |
| Timeout, unavailable credential, or incompatible runtime | Cancel bounded work and configure or disable the affected provider. |
Related
Build a music catalog, classification plugins, atom enrichment, and Query a Core node. Processing alone does not persist graph records.
Sources: canonical classification output, IID registry planning, enrichment engine, and field extraction.
Applies to V2 · @0xintuition/atom-classification 0.1.1 · @0xintuition/atom-enrichment 0.1.1 · @0xintuition/iid-registry 0.1.1