Welcome to LAFS

GitBook: https://codluv.gitbook.io/lafs-protocol/

LAFS is a schema-first response envelope contract for tools, APIs, and agents. It gives LLM agents one stable response shape across transports.

What you get:

  • One envelope parser path for REST, MCP, and A2A boundaries

  • Deterministic error structure with registered code checks

  • JSON-default format semantics with explicit conflict handling

  • Conformance checks beyond raw schema validation

Start here (LLM-agent focused)

What the TypeScript package exports today

Import from @cleocode/lafs-protocol:

  • validateEnvelope(input)

  • assertEnvelope(input)

  • createEnvelope(input)

  • parseLafsResponse(input, options?)

  • LafsError

  • runEnvelopeConformance(envelope)

  • runFlagConformance(flags)

  • resolveOutputFormat(flags)

  • isRegisteredErrorCode(code)

  • wrapMCPResult(mcpResult, operation, budget?)

  • createAdapterErrorEnvelope(message, operation, category?)

Import from @cleocode/lafs-protocol/a2a for A2A integration helpers.

Canonical envelope shape

Notes:

  • error is optional for success: true.

  • error is required and result must be null when success: false.

  • page is optional.

Envelope-first APIs you should use

  • createEnvelope for constructing canonical envelopes

  • parseLafsResponse + LafsError for unified consumption

  • validateEnvelope + runEnvelopeConformance for hardening

Integration options

Normative and machine-readable references

Last updated