The Agent-First Standards Language (AFSL) is a domain-specific language for authoring standards as structured data. Human prose, JSON Schemas, SHACL shapes, conformance tests, and agent manifests are generated outputs — not the source of truth.
HTML prose
→ find normative sentence
→ infer target
→ infer condition
→ infer testability
→ map to examples
→ map to behaviorAFSL source → generated W3C-style HTML → generated normative-requirement index → generated JSON Schemas → generated SHACL shapes → generated conformance test manifest → generated implementation report template → generated llms.txt / agent manifest
Specifications like the W3C Verifiable Credentials Data Model 2.0 embed normative meaning in prose. JSON-LD contexts, examples, and test suites help, but agents still reconstruct intent from paragraphs. AFSL inverts the pipeline: a single structured source generates the human document, schemas, tests, and agent manifests.
Terms, roles, classes, IRIs. Exports to JSON-LD, RDF, OWL, SKOS.
Structural constraints. JSON Schema for documents, SHACL/ShEx for graphs.
Typed normative obligations with modality, subject, target, and assertion.
Inputs, outputs, steps, and failure modes. Translatable to executable code.
Fixtures and expected results, linked back to requirement IDs.
AFSL does not replace JSON Schema, SHACL, OpenAPI, or formal methods. It orchestrates them behind one source of truth.
The basic unit of a standard is not a paragraph. It is a requirement object that carries its own ID, modality, subject, conformance target, assertion, checkability level, test vectors, error model, and a traceability link back to the source prose.
Agents consume the requirement directly. Humans review it. Test runners execute it. Generators produce the W3C-style HTML from the same source.
id: VC-DM-4.3-R002
section: "4.3"
title: The base VC context is first
normative:
modality: MUST
original_text: >
The value of the @context property MUST be an ordered set
where the first item is the URL
https://www.w3.org/ns/credentials/v2.
subjects: [VerifiableCredential, VerifiablePresentation]
conformance_targets:
- conforming_document
- conforming_issuer
- conforming_verifier
formalization:
language: afsl-expr
expression: >
first(normalize_context(document["@context"])) ==
"https://www.w3.org/ns/credentials/v2"
checkability:
level: machine_checkable
test_vectors:
positive: [tests/context-array-base-first.valid.json]
negative:
- tests/context-array-base-second.invalid.json
- tests/context-missing.invalid.json
failure:
expected_error:
code: VC_CONTEXT_INVALID
severity: error
retryable: false
traceability:
source_spec: vc-data-model-2.0
source_url: "https://www.w3.org/TR/vc-data-model-2.0/#contexts"
The same source object compiles to three artifacts on every keystroke: a paragraph for human review, a JSON Schema fragment for document validation, and a conformance test manifest for implementation runs. Edit the YAML on the left to see the outputs stay in lockstep on the right.
§ 4.3 — The base VC context is first This is a normative requirement (VC-DM-4.3-R002). It applies to VerifiableCredential, VerifiablePresentation and is binding on conforming_document, conforming_issuer, conforming_verifier. The value of the @context property MUST be an ordered set where the first item is the URL https://www.w3.org/ns/credentials/v2. Checkability is declared as machine_checkable. A formal expression is provided in afsl-expr for automated evaluation. Failures MUST be reported with error code VC_CONTEXT_INVALID. Source: https://www.w3.org/TR/vc-data-model-2.0/#contexts
This compiler runs entirely in your browser. It is intentionally minimal — a real AFSL toolchain emits SHACL, OpenAPI, ReSpec, agent manifests, and more from the same source.
A conformance matrix is the agent-friendly form of a standard's obligations. It answers, in one view: which requirements apply to which conformance targets, how each can be evaluated, and how much of the standard is mechanically verifiable. Filter by modality, checkability, or target.
| ID | Title | Modality | Checkability | Document | Issuer | Verifier | Vectors |
|---|---|---|---|---|---|---|---|
VC-DM-4.3-R001 | A VerifiableCredential MUST have a @context | MUST | machine_checkable | ● | — | — | 2 |
VC-DM-4.3-R002 | The base VC context is first | MUST | machine_checkable | ● | ● | ● | 2 |
VC-DM-5.4-R001 | Validity periods should be appropriate | SHOULD | policy_judgment | — | ● | — | 0 |
VC-DM-5.5-R001 | issuer MUST resolve to a URI | MUST | machine_checkable | ● | — | ● | 1 |
MDL-VALIDITY-R001 profile · mobile-driving-license-profile | mDL validity period MUST NOT exceed 8 years | MUST | machine_checkable | — | ● | — | 1 |
Not every standards statement can or should be fully formalized. AFSL classifies every requirement by checkability so that ambiguity is declared rather than hidden. The goal is not zero ambiguity — it is no hidden ambiguity.
| checkability.level | Meaning |
|---|---|
| machine_checkable | Statically verifiable from a document or graph. |
| test_checkable | Verifiable by executing a test against an implementation. |
| implementation_observable | Verifiable by observing runtime behavior. |
| human_review_required | Requires a domain expert to assess evidence. |
| policy_judgment | Requires an external profile or governance policy. |
| informative_only | Explanatory; not part of conformance. |
checkability.level is the single field that decides how a requirement is rendered, what artifacts the compiler emits, how it is tested, and how a failure is counted in a conformance report. Pick the wrong level and the requirement either becomes un-testable or generates noise.
| Level | Compiler emits | How it's tested | Conformance decision |
|---|---|---|---|
machine_checkable Closed-form predicate over the document. blocks conformance | JSON Schema / SHACL assertion + afsl-expr predicate. | Static positive + negative vectors run in CI. | Pass / fail is deterministic and binding. |
test_checkable Requires executing the implementation. blocks conformance | Conformance test manifest entry + harness hook. | Black-box request/response vectors against an SUT. | Pass / fail per implementation, recorded in AFPS report. |
implementation_observable Verifiable only by watching runtime behavior. warning | Probe / telemetry contract + expected event shape. | Trace-based assertions over an instrumented run. | Pass if observed within a bounded session; otherwise inconclusive. |
human_review_required Needs a domain expert to assess evidence. warning | Reviewer checklist item + evidence schema. | Manual attestation attached to the conformance report. | Counted as conformant only with signed attestation. |
policy_judgment Resolved by an external profile or governance body. deferred | Profile hook — refine / tighten / override / forbid. | No base test; profiles MUST supply one if they refine it. | Reported as deferred until a profile binds it. |
informative_only Explanatory text, not part of conformance. not scored | Prose paragraph in the rendered spec; no schema, no test. | None. Tools MUST NOT emit a vector. | Excluded from conformance scoring entirely. |
@context[0] == "https://www.w3.org/ns/credentials/v2"
Issuer MUST reject a credential with expired status list.
Verifier MUST refresh status list at most every 15 minutes.
Privacy considerations MUST be documented per § 8.2.
Issuers SHOULD use cryptographically agile signature suites.
"Note: implementations may cache the context document."
Profiles (§ 11) can refine a requirement to a stricter level — typically policy_judgment → machine_checkable — but they can never relax one. This monotonicity is what lets a deployment trust that "AFSC: pass" means the same thing across ecosystems.
A produced artifact that conforms to the data model.
Software that produces conforming artifacts.
Software that consumes and validates artifacts.
Every requirement attaches to one or more targets, so a verifier test suite knows precisely which obligations apply — and which to skip.
Agent-First Standards Conformance (AFSC) defines tests that a standards document itself must pass to claim agent-first status. A standards body can publish a machine-readable conformance score for the standard, the same way AFPS scores a project.
| ID | Test |
|---|---|
| AFS-STD-001 | Every normative requirement has a stable ID. |
| AFS-STD-002 | Every requirement has a conformance target. |
| AFS-STD-003 | Every MUST has a validation strategy. |
| AFS-STD-004 | Every SHOULD has exception guidance. |
| AFS-STD-005 | Every term resolves to a definition. |
| AFS-STD-006 | Every data structure has a shape or schema. |
| AFS-STD-007 | Every algorithm has inputs, outputs, and failure modes. |
| AFS-STD-008 | Every example is marked normative or non-normative. |
| AFS-STD-009 | Every test vector maps to requirement IDs. |
| AFS-STD-010 | Every requirement is classified by checkability. |
| AFS-STD-011 | Every conformance class has a test manifest. |
| AFS-STD-012 | Every privacy/security note is classified. |
A small, self-contained slice of a standard authored as AFSL. It carries the source layers, generated JSON Schema and SHACL shape, a domain profile, a conformance manifest, and four test vectors — three machine-checkable and one profile-refined.
Use it as a template for your own standard, as a fixture for an AFSL tool, or as a worked example when reading the specification.
afsl-example-bundle/
├── README.md
├── manifest.json
├── sources/
│ ├── vocabulary.afsl.yaml
│ ├── shapes.afsl.yaml
│ ├── requirements.afsl.yaml
│ ├── algorithms.afsl.yaml
│ └── tests.afsl.yaml
├── schemas/
│ └── verifiable-credential.schema.json
├── shapes/
│ └── verifiable-credential.shacl.ttl
├── profiles/
│ └── mdl.profile.afsl.yaml
├── tests/
│ ├── conformance-manifest.json
│ └── vectors/
│ ├── context-array-base-first.valid.json
│ ├── context-array-base-second.invalid.json
│ ├── context-missing.invalid.json
│ └── validity-period-mdl.valid.json
└── generated/
├── requirement-index.json
├── llms.txt
└── implementation-report.template.jsonA profile is a downstream document that extends a base standard for a specific domain. Profiles are first-class AFSL artifacts: they reference base requirements by ID and apply one of four operations — refine, tighten, override, or forbid — to turn ambiguous obligations into checkable ones.
| Operation | Effect on modality | Effect on checkability | When to use |
|---|---|---|---|
| refine | MAY → SHOULD or MUST | policy_judgment → machine_checkable | Replace a vague obligation with a typed assertion. |
| tighten | preserved | narrows existing assertion | Add bounds to an already-checkable rule. |
| override | any → any | any → any | Replace base rule entirely. MUST be declared explicitly. |
| forbid | → MUST NOT | any → machine_checkable | Disallow an option the base standard permits. |
requirement:
id: VC-DM-5.4-R001
section: "5.4"
title: Validity periods should be appropriate
normative:
modality: SHOULD
original_text: >
Validity periods should be appropriate
to the use case of the verifiable credential.
subjects: [VerifiableCredential]
conformance_targets: [conforming_issuer]
checkability:
level: policy_judgment
refinement_hint: >
Refine in a domain profile to a checkable
duration constraint.profile:
id: mobile-driving-license-profile
title: Mobile Driving License (mDL) Profile
version: 1.0.0
extends: vc-data-model-2.0
jurisdiction: ISO/IEC 18013-5
status: draft
requirements:
# 1. REFINE — turn policy_judgment into a checkable rule
- id: MDL-VALIDITY-R001
refines: VC-DM-5.4-R001
operation: refine
modality: MUST
title: mDL validity period MUST NOT exceed 8 years
formalization:
language: afsl-expr
expression: >
duration(validFrom, validUntil) <= P8Y
checkability: { level: machine_checkable }
failure:
expected_error:
code: MDL_VALIDITY_TOO_LONG
severity: error
retryable: false
test_vectors:
positive: [tests/mdl/validity-8y.valid.json]
negative: [tests/mdl/validity-10y.invalid.json]
# 2. TIGHTEN — narrow an already-checkable rule
- id: MDL-ISSUER-R001
tightens: VC-DM-5.5-R001
operation: tighten
modality: MUST
title: mDL issuer MUST be a registered issuing authority
formalization:
language: afsl-expr
expression: >
is_uri(issuer_id(document.issuer)) AND
issuer_id(document.issuer) IN registry("iaca")
checkability: { level: machine_checkable }
# 3. OVERRIDE — replace base behavior entirely
- id: MDL-CONTEXT-R001
overrides: VC-DM-4.3-R002
operation: override
rationale: >
mDL uses a domain-specific context bundle. The base context
MUST appear second, after the mDL context.
modality: MUST
formalization:
language: afsl-expr
expression: >
context[0] == "https://iso.org/mdl/v1" AND
context[1] == "https://www.w3.org/ns/credentials/v2"
checkability: { level: machine_checkable }
# 4. FORBID — disallow a permitted option
- id: MDL-NO-BBS-R001
forbids: VC-DM-PROOF-BBS
operation: forbid
modality: MUST_NOT
rationale: >
BBS+ proofs are not certified for mDL deployments
under ISO/IEC 18013-5.
checkability: { level: machine_checkable }An AFSL compiler resolves base + profile into a flat set of requirements. Every refinement carries a back-pointer to the base ID, so an agent can answer "why does this rule apply?" without reading prose.
| ID | Op | Base ID | Modality | Checkability shift |
|---|---|---|---|---|
| MDL-VALIDITY-R001 | refine | VC-DM-5.4-R001 | SHOULD → MUST | policy_judgment → machine_checkable |
| MDL-ISSUER-R001 | tighten | VC-DM-5.5-R001 | MUST → MUST | machine_checkable (narrowed) |
| MDL-CONTEXT-R001 | override | VC-DM-4.3-R002 | MUST → MUST | machine_checkable (replaced) |
| MDL-NO-BBS-R001 | forbid | VC-DM-PROOF-BBS | MAY → MUST NOT | informative_only → machine_checkable |
An agent MUST be able to identify, for every applicable obligation, exactly one resolved requirement and the chain of profile operations that produced it.
refine and tighten MUST NOT relax a base obligation. override MAY relax but MUST declare a rationale field.
Two profiles applied to the same base requirement that produce contradictory assertions MUST cause the compiler to fail.
An implementation report MUST cite the resolved requirement ID and the profile ID it conforms to.
The same triad runs top-to-bottom: a standard is authored in AFSL, audited by AFSC, and applied to implementations by AFPS. Each layer takes the previous layer's output as its input and emits its own generated artifacts.
How to express a standard as data.
How to test that a standard is itself agent-first.
How to test that an implementation conforms to a standard.
Each normative statement is a typed, traceable, test-linked object — and the human-readable specification is one of its generated outputs.