Companion proposal · AFSL · AFSC · Draft 0.1

Standards should not be authored as prose. They should be compiled from a typed model.

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.

5
Source layers
6
Checkability levels
12
AFSC standard tests
8+
Generated outputs
§ 1 · The current model

Today's standards leave agents doing extraction work.

Prose-first authoring
HTML prose
  → find normative sentence
    → infer target
      → infer condition
        → infer testability
          → map to examples
            → map to behavior
Model-first authoring
AFSL 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.

§ 5 · Source layers

Five layers, separated by purpose.

§ 5.1

Vocabulary

Terms, roles, classes, IRIs. Exports to JSON-LD, RDF, OWL, SKOS.

§ 5.2

Shape

Structural constraints. JSON Schema for documents, SHACL/ShEx for graphs.

§ 5.3

Requirement

Typed normative obligations with modality, subject, target, and assertion.

§ 5.4

Algorithm

Inputs, outputs, steps, and failure modes. Translatable to executable code.

§ 5.5

Test

Fixtures and expected results, linked back to requirement IDs.

orchestration

Backends, not replacements

AFSL does not replace JSON Schema, SHACL, OpenAPI, or formal methods. It orchestrates them behind one source of truth.

§ 2 · The requirement object

A normative sentence becomes a typed object.

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.

Normative. Every normative statement in an AFSL document MUST be expressible as a requirement object with a stable ID and a declared checkability level.
standard.afsl.yamlYAML
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"
§ 7 · Compile AFSL

Edit a requirement. Watch prose, schema, and tests regenerate.

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.

requirement.afsl.yaml
YAML · editable
Markdown
§ 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
status
ok
modality
MUST
checkability
machine_checkable
vectors
3

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.

§ 8 · Conformance matrix

Every requirement, mapped to its targets and checkability.

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.

5 of 5 requirements
IDTitleModalityCheckabilityDocumentIssuerVerifierVectors
VC-DM-4.3-R001
A VerifiableCredential MUST have a @contextMUSTmachine_checkable2
VC-DM-4.3-R002
The base VC context is firstMUSTmachine_checkable2
VC-DM-5.4-R001
Validity periods should be appropriateSHOULDpolicy_judgment0
VC-DM-5.5-R001
issuer MUST resolve to a URIMUSTmachine_checkable1
MDL-VALIDITY-R001
profile · mobile-driving-license-profile
mDL validity period MUST NOT exceed 8 yearsMUSTmachine_checkable1
filtered
5
MUST
4
machine_checkable
4
Document
3
Issuer
3
Verifier
2
§ 3 · Ambiguity classes

Make ambiguity explicit, typed, and bounded.

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.levelMeaning
machine_checkableStatically verifiable from a document or graph.
test_checkableVerifiable by executing a test against an implementation.
implementation_observableVerifiable by observing runtime behavior.
human_review_requiredRequires a domain expert to assess evidence.
policy_judgmentRequires an external profile or governance policy.
informative_onlyExplanatory; not part of conformance.
§ 3.1 · Checkability classes

Six levels — and exactly what each one generates.

Callout · why this matters

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.

LevelCompiler emitsHow it's testedConformance 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.
Example · machine_checkable
@context[0] == "https://www.w3.org/ns/credentials/v2"
Example · test_checkable
Issuer MUST reject a credential with expired status list.
Example · implementation_observable
Verifier MUST refresh status list at most every 15 minutes.
Example · human_review_required
Privacy considerations MUST be documented per § 8.2.
Example · policy_judgment
Issuers SHOULD use cryptographically agile signature suites.
Example · informative_only
"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.

§ 4 · Conformance targets

Documents, issuers, verifiers — first-class objects.

conforming_document
kind: artifact

A produced artifact that conforms to the data model.

conforming_issuer
kind: implementation

Software that produces conforming artifacts.

conforming_verifier
kind: implementation

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.

§ 6 · Backends

AFSL orchestrates the standards you already use.

JSON Schema
Document shape and validation.
SHACL / ShEx
RDF graph constraints.
OpenAPI
HTTP API surfaces.
AsyncAPI
Event-driven channels.
WebIDL
Browser interface definitions.
Rego / OPA
Conditional policy obligations.
TLA+ / Alloy
State machines and protocol invariants.
ReSpec / Bikeshed
Generated human prose.
§ 9 · AFSC

Conformance tests for standards themselves.

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.

IDTest
AFS-STD-001Every normative requirement has a stable ID.
AFS-STD-002Every requirement has a conformance target.
AFS-STD-003Every MUST has a validation strategy.
AFS-STD-004Every SHOULD has exception guidance.
AFS-STD-005Every term resolves to a definition.
AFS-STD-006Every data structure has a shape or schema.
AFS-STD-007Every algorithm has inputs, outputs, and failure modes.
AFS-STD-008Every example is marked normative or non-normative.
AFS-STD-009Every test vector maps to requirement IDs.
AFS-STD-010Every requirement is classified by checkability.
AFS-STD-011Every conformance class has a test manifest.
AFS-STD-012Every privacy/security note is classified.
§ 10 · Reference bundle

Download a runnable AFSL example bundle.

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.

Download bundle (.zip)v0.1.0 · ~12 KB · CC0-1.0
afsl-example-bundle/tree
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.json
4
Requirements
4
Test vectors
1
Profile
3
Generated artifacts
§ 11 · Profiles

Domain profiles refine ambiguous requirements.

A 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.

OperationEffect on modalityEffect on checkabilityWhen to use
refineMAY → SHOULD or MUSTpolicy_judgment → machine_checkableReplace a vague obligation with a typed assertion.
tightenpreservednarrows existing assertionAdd bounds to an already-checkable rule.
overrideany → anyany → anyReplace base rule entirely. MUST be declared explicitly.
forbid→ MUST NOTany → machine_checkableDisallow an option the base standard permits.
Base standardpolicy_judgment
vc-data-model-2.0.afsl.yamlYAML
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.
Profilemachine_checkable
profiles/mobile-driving-license.profile.afsl.yamlYAML
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 }
§ 11.4 · Resolution

Resolved view, after profile composition.

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.

IDOpBase IDModalityCheckability shift
MDL-VALIDITY-R001refineVC-DM-5.4-R001SHOULD → MUSTpolicy_judgment → machine_checkable
MDL-ISSUER-R001tightenVC-DM-5.5-R001MUST → MUSTmachine_checkable (narrowed)
MDL-CONTEXT-R001overrideVC-DM-4.3-R002MUST → MUSTmachine_checkable (replaced)
MDL-NO-BBS-R001forbidVC-DM-PROOF-BBSMAY → MUST NOTinformative_only → machine_checkable
Single-source rule

An agent MUST be able to identify, for every applicable obligation, exactly one resolved requirement and the chain of profile operations that produced it.

Monotonicity

refine and tighten MUST NOT relax a base obligation. override MAY relax but MUST declare a rationale field.

Conflict detection

Two profiles applied to the same base requirement that produce contradictory assertions MUST cause the compiler to fail.

Conformance reporting

An implementation report MUST cite the resolved requirement ID and the profile ID it conforms to.

§ 12 · Positioning

AFSL · AFSC · AFPS — three layers, one ecosystem.

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.

Layer 1 · Authoring
Language
AFSL

How to express a standard as data.

Input
Standards editor + domain model
Generates
  • Generated prose
    ReSpec / Bikeshed HTML rendered from requirement objects.
  • Generated schemas
    JSON Schema, SHACL, OpenAPI emitted per requirement.
  • Generated test manifest
    Vector index linking IDs to fixtures.
Layer 2 · Auditing
Conformance for standards
AFSC

How to test that a standard is itself agent-first.

Input
An AFSL package
Generates
  • Standards-conformance report
    AFS-STD-001 … 012 pass / fail.
  • Coverage matrix
    Requirements without tests, IDs, or targets.
  • Profile lint
    Monotonicity and conflict diagnostics.
Layer 3 · Applying
Conformance for projects
AFPS

How to test that an implementation conforms to a standard.

Input
AFSL package + system under test
Generates
  • Implementation report
    Per-requirement pass / fail / deferred.
  • Evidence bundle
    Vectors, traces, signed attestations.
  • Agent instructions
    Machine-readable remediation hints.
AFSL output → AFSC input
The .afsl package is the artifact AFSC audits.
AFSC output → AFPS input
Only AFSC-passing standards drive AFPS reports.
AFPS output → ecosystem
Per-implementation conformance, machine-readable.
§ 17 · One-line definition

Each normative statement is a typed, traceable, test-linked object — and the human-readable specification is one of its generated outputs.