AJSON
September 13, 2026 ยท View on GitHub
AJSON โ Agent JSON
A superset of JSON purpose-built for autonomous agent communication, with deterministic compilation to canonical JSON.
๐ฆ PyPI package:
ajson-specโ installed viapip install ajson-spec
๐ข Community feedback window: open until 2026-09-15. AJSON is heading to v1.0 and we want your input before we freeze the core. Review the spec, try the CLI, and tell us what breaks. Post via GitHub Discussions or issues. Every substantive comment gets a reply.
Why AJSON?
JSON is the lingua franca of AI agents. Every LLM API, every tool-calling framework, every agent protocol speaks JSON. But JSON was designed for machines to parse, not for humans โ or other agents โ to write.
AJSON fixes this without breaking anything. It's a superset of JSON: every valid JSON file is valid AJSON. Write with superpowers, compile to canonical JSON for runtime.
// AIP Contract in AJSON โ comments, multi-line, and reusable references
{
"contract_name": "Data Process",
"description": """A data processing contract between
two autonomous agents governed by WitnessOS.""",
// Reusable terms template
"&terms": {
"max_retries": 3,
"sla_seconds": 60,
"jurisdiction": "AU"
},
"contract_terms": {"*terms": null}
}
Compiles to clean, deterministic JSON:
{"contract_name":"Data Process","contract_terms":{"jurisdiction":"AU","max_retries":3,"sla_seconds":60},"description":"A data processing contract between\ntwo autonomous agents governed by WitnessOS."}
Features
| Feature | JSON | AJSON |
|---|---|---|
Comments (// and /* */) | โ | โ |
Multi-line strings ("""...""") | โ | โ |
Reusable references (&anchor / *ref) | โ | โ |
| Deterministic output (sorted keys) | โ (depends on library) | โ Always |
Self-documenting schemas (@type, @desc) | โ | โ |
| Valid JSON โ zero migration cost | โ | โ Every JSON is valid AJSON |
| Zero dependencies | โ | โ Pure Python stdlib |
Quick Start
Install
pip install ajson-spec
Or use directly from source:
python3 -m ajson contract.ajson -o contract.json
CLI Usage
# Compile AJSON to canonical JSON
ajson compile contract.ajson -o contract.json
# Validate an AJSON file
ajson validate contract.ajson
# Expand (show compiled tree)
ajson expand contract.ajson
# Watch mode โ recompile on file change
ajson watch contract.ajson -o contract.json
Python API
from ajson import compile_ajson
ajson_text = """
// My contract
{
"name": "example",
"description": """Multi-line
description here""",
"&schema": {"type": "object"},
"data": {"*schema": null}
}
"""
canonical_json = compile_ajson(ajson_text)
# '{"data":{"type":"object"},"description":"Multi-line\\ndescription here","name":"example"}'
Language Reference
Comments
Both // line comments and /* block comments */ are supported. Comments are stripped during compilation and never appear in the output.
{
// Line comment
"a": 1,
/* Block
comment */
"b": 2
}
Multi-Line Strings
Triple-quoted strings ("""...""") allow multi-line values with automatic dedentation.
{
"description": """This is a long
description that spans multiple
lines without ugly \n escaping."""
}
References (Anchors & Dereferences)
Inspired by YAML anchors, AJSON supports reusable value templates:
{
// Define once
"&schema": {
"type": "object",
"required": ["id", "timestamp"]
},
// Use everywhere
"input": {"*schema": null},
"output": {"*schema": null}
}
References are resolved at compile time with deep copy semantics. Circular references are detected and rejected.
Inline Annotations
Annotations provide self-documenting schemas that are stripped from the output but available for tooling:
{
"max_records": @type "uint" 1000,
"priority": @type "enum" @default "normal" "high"
}
Why Not YAML?
YAML is the natural comparison โ it has comments, multi-line strings, and anchors. But YAML has critical problems for agent communication:
| Problem | YAML | AJSON |
|---|---|---|
yes โ boolean, NO โ null | โ Untrapped pitfalls | โ Impossible |
| Indentation-dependent | โ Fragile | โ Bracket-delimited |
| Multiple valid representations | โ Non-deterministic | โ Always canonical |
| Agent framework support | โ None | โ Compiles to exactly what agents consume |
| Deterministic signing | โ Broken | โ Natural |
AJSON gives you the ergonomics of YAML with the determinism and agent-compatibility of JSON.
Use Cases
- AIP (Agent Interaction Protocol): Write contract templates with inline documentation, compile to signed JSON for agent execution
- WitnessOS governance: Self-documenting compliance manifests that compile to verifiable evidence receipts
- ACI capability descriptions: Rich capability files with reusable schema references
- Agent-to-agent manifests: Any structured data that agents exchange, with comments for human review
Integration with Empire Labs Stack
AJSON is the authoring format for the Empire Stack โ a complete stack for autonomous agent commerce:
| Layer | Project | What It Does |
|---|---|---|
| โ๏ธ Author | AJSON โ you are here | Write manifests with comments, refs, multi-line โ compiles to canonical JSON |
| ๐ Discover | ACI | Autonomous Company Interface โ describes orgs to agents (who you are, what you offer) |
| ๐ค Interact | AIP | Agent Interaction Protocol โ negotiates contracts and executes interactions |
โ ACI discovers, AIP negotiates, AJSON writes it all down.
Roadmap
| Version | Features |
|---|---|
| v0.1 (current) | Comments, multi-line strings, references, canonical output, CLI |
| v0.2 | Inline schema annotations, @type/@desc/@default support |
| v0.3 | File inclusion (@include "schema.ajson"), multi-file compilation |
| v0.4 | MCP server (agents use AJSON directly via MCP tools) |
| v1.0 | Stable spec, language server, IDE integration |
Contributing
Contributions are welcome! See CONTRIBUTING.md for guidelines.
This project follows the ACI Code of Conduct.
๐ป Buy the Empire a Pint
If AJSON saved your agents from YAML hell and JSON purgatory, buy the Empire a pint. We like to split the G.
Pay what you want. No tiers, no rewards, no strings. Just a cold pint and a thank you from the Empire.
Every donation helps keep this project sovereign, dependency-free, and maintained on Empire time.
License
AJSON is open source under the MIT License. See LICENSE for details.
Copyright (c) 2026 Empire Labs Pty Ltd
Built by Empire Labs Pty Ltd | Maintained by Sovereign
Part of the WitnessOS launch family: eu-ai-act-compliance-grade ยท witnessos-verifier ยท agent-interaction-specs ยท aci-spec ยท aip-spec ยท ajson โ Empire Labs Pty Ltd
Dependencies
Runtime dependencies are declared in pyproject.toml (Python 3.10+). The
dependency set is kept minimal. SCA is enforced in CI via OSV-Scanner.
Building from source
git clone https://github.com/narko4u/ajson.git
cd ajson
python -m venv .venv && source .venv/bin/activate
pip install -e .
Verifying releases
Release assets (wheel, source distribution, sbom.cdx.json, SHA256SUMS,
plus the published Docker image) are attached to the GitHub release. To
verify integrity and authorship:
-
Download
SHA256SUMSand the assets for the release tag. -
Verify checksums:
sha256sum -c SHA256SUMS -
Verify the Sigstore signature on an asset (keyless, OIDC-bound to this repository's
release.ymlworkflow):cosign verify-blob --certificate <asset>.pem --signature <asset>.sig --certificate-identity-regexp "^https://github.com/narko4u/ajson/.github/workflows/release.yml@refs/tags/v.*" --certificate-oidc-issuer "https://token.actions.githubusercontent.com" <asset>