Getting Started
aglang is a verifiable specification language for agents and humans. You write or review architecture.ag; aglc compiles it into artifacts that agents, engineers, and CI can use without guessing the intended architecture.
Install
npm install -g @collivity/aglangnpx @collivity/aglang add .npm install github:collivity/aglangRequirements:
- Node.js ≥ 18 — nodejs.org
- A git repository
The solver ships via the
z3-solvernpm package (WebAssembly) — no system install needed.
Quick setup — agent-assisted discovery
aglc request-scan --project /path/to/your/projectThis writes .aglang/tasks/architecture-discovery.json, a machine-readable task packet for an agent. The agent should inspect the repo semantically and propose architecture artifacts for review. aglc does not infer architecture intent automatically.
The approved flow is:
- Request discovery with
aglc request-scan - Agent proposes
architecture.proposed.ag, optional.agq.ymlqueries, and review notes - Human approves architecture intent
- Compile approved
architecture.agtoarchitecture.o - Emit
skill.jsonso AI agents understand your architectural rules
aglc add and aglc generate remain available as legacy deterministic draft helpers, but their output is not architecture truth until reviewed.
Add your first rule
Use a planning or design session to review the generated architecture.ag and any imported component files, then refine the intended invariants. A first rule might look like:
invariant NoDirectDBAccess {
deny flow PublicAPI -> Database
}After the architecture change is approved, recompile:
aglc compile architecture.agFrom now on, aglc check --arch architecture.o --project . --all reports any direct path from PublicAPI to Database with a precise error message and proof details. Run the same command locally or in CI.
How it works
Your codebase Your .ag spec
│ │
▼ ▼
[Git Diff Extractor] + [Architecture Compiler]
│ │
└──────────── Z3 Solver ────────┘
│
SAT → check passes ✓
UNSAT → check fails with proof ✗- You write an
architecture.agfile describing components and invariants aglc compiletranslates it to SMT-LIB and emitsarchitecture.oaglc checkchecks extracted code facts against the compiled rules —SATmeans the facts are consistent with the architecture, andUNSATmeans a violation was proven
Designed for AI Agents
AI coding agents can operate autonomously for long stretches. aglang gives them a shared, verifiable specification: the agent reads generated context, edits code within component boundaries, and validates work against the same compiled artifact that humans and CI use.
aglc request-scanasks an agent to propose architecture artifacts;aglc addremains a legacy draft helper- Agents read
AGENTS.md(generated byaglc emit-context) to understand boundaries before they start - Humans, agents, and CI can run the same
aglc checkgate
See the AI Agents guide for the full integration workflow.