TRUGS — Traceable Recursive Universal Graph Specification (spec-only since 2.0; install `trugs-tools` for the `trug` language CLI)
Project description
TRUGS — Traceable Recursive Universal Graph Specification
Maintained by: TRUGS LLC
What is TRUGS?
TRUGS is a JSON graph specification for representing structured information. A TRUG is a JSON file with three components:
- Nodes — typed things (functions, pages, chapters, tasks, parties)
- Edges — named relationships between things (feeds, governs, depends_on)
- Hierarchy — organization via parent/child containment using metric levels
CORE + BRANCH = Complete TRUG. CORE defines the universal structure every TRUG must satisfy. BRANCHES define domain-specific vocabularies.
flowchart LR
S["TRUG/L sentence<br/>(233 words)"] <-->|compile/decompile| G["TRUG graph<br/>(nodes · edges · hierarchy)"]
G -.validates against.-> C["CORE<br/>(7 boundaries · 16 rules)"]
G -.extends.-> B["BRANCH<br/>(domain vocabulary)"]
The sentence IS the program. The graph IS the AST. Every valid TRUG/L sentence compiles to a graph losslessly, and every graph decompiles back to a sentence.
Install
pip install trugs
As of 2.0.0 (breaking), trugs ships the specification only — no CLIs. Spec content (CORE, TRL vocabulary, reference papers) is packaged as data. The 2.0.0 release also adds 21 SI level prefixes (YOTTA…YOCTO) as a new part of speech for hierarchy transition markers — see SPEC_vocabulary.md §9. For the tg CLI and all tooling, install the sibling package:
pip install trugs-tools # provides the `tg` binary (36 operations)
tg --help
See TRUGS-LLC/TRUGS-TOOLS for the unified tg CLI — validation, memory, compliance, AAA protocol, and more.
Migrating from trugs 1.x? The pre-2.0 package shipped tg validate, tg memory, etc. as entry points. In 2.0.0 those move to trugs-tools. Migration is one additional install: pip install trugs-tools and every tg <op> command works identically.
TRUGS Language
TRUGS includes a formalized subset of English — 233 words drawn from computation, law, and SI prefixes — where every valid sentence compiles to a TRUG graph and every graph decompiles back to a sentence. Losslessly.
PARTY system SHALL FILTER ALL ACTIVE RECORD
THEN SORT RESULT
THEN WRITE RESULT TO ENDPOINT output
OR RETRY BOUNDED 3 WITHIN 60s.
Every word is from the vocabulary. The sentence IS the program. The graph IS the AST.
See TRUGS_LANGUAGE/ for the complete specification.
Specification
| Document | Description |
|---|---|
| CORE.md | 7 boundaries, 10 primitive classes (~131 primitives), 16 validation rules, composition type system |
| BRANCHES.md | Domain-specific vocabularies (Python, Web, Writer, Knowledge, etc.) |
| SPEC_fundamentals.md | Core concepts and structure |
| SPEC_validation.md | Validation rules with implementations |
| SCHEMA.md | JSON schema reference |
Language
| Document | Description |
|---|---|
| SPEC_vocabulary.md | 233 words, 9 parts of speech, formal definitions |
| SPEC_grammar.md | BNF grammar, composition rules, 12 validation rules |
| SPEC_examples.md | 30 parsed examples across 13 patterns |
| language.trug.json | The opening TRUG — the language defining itself |
Tools — via trugs-tools
All operations below use the unified tg CLI from the sibling trugs-tools package (pip install trugs-tools). 36 operations under 21 top-level verbs + 3 sub-namespaces.
| Verb | Usage | Description |
|---|---|---|
tg validate |
tg validate <file> |
Enforces all 16 CORE rules |
tg validate |
tg validate --all <dir> |
Batch validation |
tg get |
tg get <file> <node_id> |
Read a node |
tg update |
tg update <file> <node_id> --set key=value |
Update a node |
tg delete |
tg delete <file> <node_id> |
Delete a node and its edges |
tg unlink |
tg unlink <file> --from X --to Y |
Remove an edge |
See SPEC_cli.md in the trugs-tools repo for the full command surface.
Legacy (trugs 1.2.x only): the same operations are available as python tools/validate.py, python tools/tget.py, etc. in this repo's tools/ directory. That directory disappears at trugs 2.0.0.
Examples
The EXAMPLES/ directory contains sample TRUGs for 6 domains at varying complexity levels. All 19 examples pass validation.
This repo, as a TRUG
This repository describes itself as a TRUG. folder.trug.json at the repo root is the machine-readable index — every top-level folder, every reference document, every public tool has a node, with typed edges to the specs and standards it implements or describes.
# What's in this repo?
tg ls folder.trug.json
# What does the compliance checker depend on?
tg get folder.trug.json tools_compliance_check --edges
# Does the graph match the filesystem?
tg check .
CI runs tg check on every PR — this README's section list, the spec index, the tool table above all correspond to nodes you can traverse programmatically. When the TRUG drifts from the prose or the filesystem, CI fails. We dogfood our own dogfood.
Use It
TRUGS-AGENT — copy one file into your project and your LLM speaks TRL, follows a 9-phase development protocol, tracks projects as graphs, and maintains persistent memory. Seven standalone components:
| Component | What It Does |
|---|---|
| FOLDER | Machine-readable filesystem index — one JSON graph per folder |
| AAA | 9-phase development protocol — plan before code, audit before ship |
| EPIC | Portfolio tracker as a traversable graph |
| MEMORY | Persistent context across sessions |
| TRUGGING | Methodology for describing a codebase with TRUGs and TRL |
| WEB_HUB | Curated web resource graph |
| NDA | Complete example — all systems applied to a mutual NDA |
Building on TRUGS
CORE and Language are maintained by TRUGS LLC. The 233-word vocabulary, grammar, and validation rules are the specification — they don't change without a spec revision.
Branches are where the community builds. If your domain needs vocabulary that doesn't exist (medical, financial, legal, robotics, etc.), build a branch:
- Define your domain's node types and edge relations
- Use CORE primitives as your foundation
- Add domain-specific words to your opening TRUG
- Validate your TRUGs against CORE
You don't need permission. Build it, use it, share it. Once enough people are using a branch in the same domain, we'll work with the community to formalize it into the specification.
Implementations are welcome. Build tools that read, write, validate, or execute TRUGs in any language. The spec is the contract — implement it however you want.
License
The TRUGS specification and reference tools are released under the Apache License 2.0. Anyone may implement the standard.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trugs-2.0.0.tar.gz.
File metadata
- Download URL: trugs-2.0.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b17202543a8a23ba6c4f39d0519f9743caefc21b8ee09de358eb1dd80d65e97
|
|
| MD5 |
a884b6f3de371d3e88013e7fa402ccfe
|
|
| BLAKE2b-256 |
a396c47d631cb0615289de93d92aace42ccf2b257dbfc15e5e473fc64eb1664c
|
File details
Details for the file trugs-2.0.0-py3-none-any.whl.
File metadata
- Download URL: trugs-2.0.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbc8cfc20e97c8c36e16e9b6d68859852bdcca32da09f8f8aa2b32459b0c9271
|
|
| MD5 |
a25b73fc91d39f7ed17d7b78d1592b3a
|
|
| BLAKE2b-256 |
1f8053d6fcd7f24c9eeec680fe3415e771c092e08d22099b34151af633026596
|