|
| 1 | +[](https://github.com/sponsors/hyperpolymath) |
| 2 | + |
| 3 | +// SPDX-License-Identifier: MPL-2.0 |
| 4 | += a2ml-rs |
| 5 | +Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> |
| 6 | +:toc: |
| 7 | +:toc-placement: preamble |
| 8 | + |
| 9 | +Rust parser and renderer for A2ML (Attested Markup Language) — the |
| 10 | +structured markup format used across the hyperpolymath estate for AI-agent |
| 11 | +communication, machine state files, and provenance-tracked documentation. |
| 12 | + |
| 13 | +== Overview |
| 14 | + |
| 15 | +A2ML extends a Markdown-like surface syntax with two first-class constructs: |
| 16 | + |
| 17 | +* `@directives` — single-line machine-readable metadata prefixed with `@` |
| 18 | +* `!attest` blocks — record identity, role, and trust-level on any piece |
| 19 | + of content, enabling provenance tracking across AI-agent and human review chains |
| 20 | + |
| 21 | +`a2ml-rs` implements: |
| 22 | + |
| 23 | +* `src/parser.rs` — line-oriented state machine: headings, directives, |
| 24 | + attestation blocks, fenced code, block quotes, ordered/unordered lists. |
| 25 | + Entry points: `parse()` and `parse_file()`. |
| 26 | +* `src/renderer.rs` — serialises a `Document` AST back to canonical A2ML, |
| 27 | + making round-trips deterministic. |
| 28 | +* `src/types.rs` — core types: `Document`, `Block`, `Inline`, `Directive`, |
| 29 | + `Attestation`, `TrustLevel` (Unverified → Automated → Reviewed → Verified), |
| 30 | + `Manifest`. |
| 31 | +* `src/error.rs` — `A2mlError`: `ParseError`, `Io`, `RenderError`. |
| 32 | + |
| 33 | +The crate root is `#![forbid(unsafe_code)]`. Dependencies: `serde`/`serde_derive` |
| 34 | +for serialisation, `thiserror` for error types, `criterion` for benchmarks only. |
| 35 | + |
| 36 | +== Usage |
| 37 | + |
| 38 | +[source,rust] |
| 39 | +---- |
| 40 | +use a2ml::{parse, render}; |
| 41 | + |
| 42 | +let doc = parse(input_str)?; |
| 43 | +let output = render(&doc)?; |
| 44 | +---- |
| 45 | + |
| 46 | +== Attestation Trust Levels |
| 47 | + |
| 48 | +[cols="1,3"] |
| 49 | +|=== |
| 50 | +| Level | Meaning |
| 51 | + |
| 52 | +| `Unverified` | No review — raw agent or tool output |
| 53 | +| `Automated` | Processed by a pipeline without human review |
| 54 | +| `Reviewed` | Human-reviewed (claimed, not cryptographically proved) |
| 55 | +| `Verified` | Formally verified or cryptographically attested |
| 56 | +|=== |
| 57 | + |
| 58 | +Attestations are syntactic declarations, not cryptographic signatures. |
| 59 | +Signature verification belongs in the Groove protocol stack. |
| 60 | + |
| 61 | +== Related |
| 62 | + |
| 63 | +* link:https://github.com/hyperpolymath/pandoc-a2ml[pandoc-a2ml] — Pandoc reader/writer for A2ML |
| 64 | +* link:https://github.com/hyperpolymath/a2ml-haskell[a2ml-haskell] — Haskell implementation |
| 65 | + |
| 66 | +== License |
| 67 | + |
| 68 | +MPL-2.0. See link:LICENSE[LICENSE]. |
0 commit comments