What is TXG?
Text Graph (TXG) is a plain-text description of the steps, resources, and control flow of an AI agent skill. A flow.txg file typically sits next to SKILL.md, which remains the instruction file.
[tool: ...] node is a declaration. The compiler does not run its shell command, invoke an agent, or authorize access to tools.TXG Core is designed for parsing, static analysis, diagnostics, and visualization. An optional, separately authorized runtime is a future direction, not part of this playground.
Your first workflow
Create flow.txg next to your skill:
@txg: 0.2
@skill: code-review
@entry: "Review a code change"
start: [Read the proposed changes]
diff: [tool: bash("git diff")]
done: [halt: "Review complete"]
start -> diff -> done
Compile it locally using the experimental v0.2 Python implementation:
python txg.py flow.txg --json
Or paste it into the web playground and select Compile to inspect diagnostics and the parsed Abstract Syntax Tree (AST).
The local compiler uses Python's standard library. The web service additionally depends on Flask, Flask-CORS and gunicorn.
Syntax at a glance
| Element | Example | Meaning |
|---|---|---|
| Directive | @txg: 0.2 | Declares the draft language version. |
| Named step | check: [Inspect files] | Declares a workflow node. |
| Normal transition | check -> done | Describes the next successful step. |
| Fallback transition | check -!> failed | Describes an alternate failure path. |
| File resource | [file: references/rubric.md] | References a file used by the skill. |
| Tool description | [tool: bash("npm test")] | Names a potential tool invocation, never executes it. |
| Terminal step | [halt: "Finished"] | Marks an intended endpoint. |
| Input request | [ask: "Approve?"] | Describes a human-input point. |
Forks and fallback arms
@txg: 0.2
@skill: smoke-test
check: [tool: bash("npm test")]
check -> ? exit {
0 => done: [halt: "Passed"]
_ => failed: [halt: "Failed"]
}
An ? exit fork describes outcomes of the preceding tool. A ? judge "..." fork describes a model-judgment decision. A _ arm provides a fallback.
Loops and resource reads
In the v0.2 draft, annotations such as (loop max 3) appear at loop headers. Separate reads: relationships document resources loaded into context; they are not normal control-flow arrows. See the historical v0.1.1 specification for its different loop-bound syntax.
AST and diagnostics
The compiler first tokenizes source text, then parses it into an Abstract Syntax Tree (AST). Static checks examine references, branches, loops and linked resources. Diagnostics are reported with an identifier, severity and source position.
{
"parse_ok": true,
"diagnostics": [],
"ast": { "...": "parsed TXG structure" }
}
This is an illustrative response shape, not a frozen AST schema. Error diagnostics can make parse_ok false and the returned AST null.
The active experimental compiler recognizes diagnostic families through TXG025; conformance remains incomplete. The compatibility review documents important gaps. Diagnostics differ across historical versions.
Web API and skill bundles
Run the local application with:
python -m pip install -r requirements.txt
python app.py
The JSON compile endpoint is POST /api/compile. It accepts a code string and optional vfs map of relative resource paths to UTF-8 strings.
curl -X POST http://localhost:5000/api/compile \
-H "Content-Type: application/json" \
-d '{"code":"@txg: 0.2\n@skill: demo\nstart: [halt]\nstart"}'
The bundle endpoint, POST /api/validate-bundle, accepts a multipart ZIP file under the bundle field, with an optional code override. Bundle contents are inspected as data, not extracted as executable content.
v0.1.1 and v0.2.0
The project preserves Claude's original v0.1.1 specification, Python and JavaScript implementations, examples and 39 fixtures at heritage/v0.1.1/. The root compiler and playground represent the later experimental v0.2.0 line.
Loop annotations, diagnostic IDs and AST structures differ between these versions. Passing the original 39-case suite does not establish v0.2 conformance or cross-language parity. For project background read the encyclopedia-style overview.
What TXG doesn't promise
- No execution: successful compilation does not run described commands or tools.
- No runtime budget guarantee: token/context budgeting is a static estimate, not enforced consumption.
- No trust grant: a
SKILL.mdpermission declaration is metadata, not authorization from the host. - No finalized standard: v0.2 entry/reachability behavior and other semantics remain under review.
- No deployment certification: playground results do not establish the safety of a real deployment.
Learn more
- Source repository
- README and installation guide
- Text Graph history and reference article
- Security assessment
- MIT license