Skip to main content

Yarrow

When a language-model agent is allowed to act, nothing in the usual stack records how it is approaching the situation, or stops it acting before a decision exists. Hexis proposes a fixed sixty-four-state structure for that: eight configurations of planning, monitoring and recall on the agent side, paired with eight descriptions of what the situation already supplies, with typed relations between states and a boundary between deciding and executing.

Yarrow is the open-source part of that programme. Version 0.1 ships yarrow.hexmath, the exact arithmetic of the structure, so anyone can check the paper's structural results and build on the same definitions.

Paper: Herko, S. and Pidcock, C. (2026). Hexis: a fixed 64-state structure for governing cognitive disposition in language-model agents — definitions, structural results and a pre-registered programme. Version 1.0. Zenodo. https://doi.org/10.5281/zenodo.23393632

Status

Component State
yarrow.hexmath v0.1, released here. Representation, King Wen lookup, the 32/32 canon partition, transformations, the three trigram arrangements, the fit rule, relation typing and the cast distributions, with tests.
tools/check_structure.py The standalone checker that accompanies the paper (also deposited with it on Zenodo).
yarrow.schema, yarrow.seal, yarrow.escalate Planned (paper, chapter L5).
yarrow-s1 (router), yarrow-tai (instrument) Planned; each ships only after it passes its registered gate.

Nothing in this repository is a result of running an agent. The behavioural claims in the paper are registered tests that have not yet been run.

Install

pip install yarrow-ai          # once published; until then:
git clone https://github.com/siho-herko/yarrow && cd yarrow && pip install .

Python 3.9 or later; no dependencies.

Use

from yarrow import hexmath as H

# A state is (inner, outer): the agent's trigram and the context's trigram, as Fuxi indices 0–7.
tai = (7, 0)                      # ☰ Heaven [111] over ☷ Earth [000]
H.kingwen(*tai)                   # 11
H.canon(tai)                      # 'upper'  — a decision state: no tool may execute
H.executable(6, 1)                # True     — 41, an execution state
H.fit(*tai)[1]                    # Fraction(7, 1) at the default centrality weight

# Standpoint transitions must cite a route-valid relation.
H.route_valid(0, 7, "inner_complement")   # True
H.route_valid(0, 7, "inversion")          # False: inversion is reading-only
H.relation((0, 0), (5, 0))                # every tabled relation from 2 to 36

Verify

python -m unittest discover -s tests -t . -v   # unit, regeneration and mutation tests
python tools/check_structure.py                # the paper's standalone checker
python tools/regenerate.py --check             # committed tables equal a fresh regeneration

The mutation tests feed a wrong King Wen table, a flipped line order and a corrupted relation table to hexmath.verify() and require each to fail. The tables in yarrow/canon/ are generated, never edited by hand.

What is deliberately not here

Thresholds, the read-path rule that decides when a state change is warranted, calibration procedures and any learned parameter. In the programme these are sealed configuration: committed by hash before a test is read and revealed afterwards (paper, chapter L2). hexmath holds structure only; it carries no interpretation of the figures beyond trigram names and glyphs, and no I Ching text.

The Jeongyeok circle is taken from a secondary source and will be checked against a pinned scholarly edition before hexmath reaches v1.0.

Contributing

Issues and pull requests are welcome. Contributions are accepted under Apache 2.0 with a Developer Certificate of Origin sign-off on each commit (git commit -s); see CONTRIBUTING.md. Changes to the relation table follow the programme's rule: they come from an ablation result and a recorded ruling, not from preference.

Licence and citation

Code: Apache License 2.0 (see LICENSE and NOTICE). The paper is CC BY 4.0. Please cite the paper; CITATION.cff gives both the paper and this software.

Contact: Simon Herko, simon.herko@trigrammatic.com.

Metadata

Release files for yarrow-ai 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yarrow-ai 0.1.0
File Size Uploaded Provenance Actions
yarrow_ai-0.1.0.tar.gz 19.9 kB Without provenance Details for yarrow_ai-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yarrow-ai 0.1.0
File Interpreter ABI Platform Actions
yarrow_ai-0.1.0-py3-none-any.whl Python 3 none any Details for yarrow_ai-0.1.0-py3-none-any.whl

Total release size: 37.1 kB

Release files / yarrow_ai-0.1.0.tar.gz

Download URL yarrow_ai-0.1.0.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2a79d7241bc553f02ee3c9534c417c17d11e2db69706e217f3c42840002ed776
BLAKE2b-256 checksum
How to use checksums
d4cf1e381259b8af42b934c907cfe3e9a93a3116d214e9714d3bc8b75bc1cbd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / yarrow_ai-0.1.0-py3-none-any.whl

Download URL yarrow_ai-0.1.0-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0bd35f90332522d39bfe9ba78caa47f495900a53913faf58f2337ac74f488106
BLAKE2b-256 checksum
How to use checksums
61c14294f9338786110750320180802f89266c3df30b7a831e48d3cabb620615
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for yarrow-ai 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page