Skip to main content

chaincompiler — the base the chain compilers are made from

chaincompiler is the base package of ChainCompiler, a compiler-compiler for cognition. A language model thinks in whatever notation it is given, so the useful machine is not one notation but a factory for them: ChainCompiler mints a notation from examples, gates text against it so a model cannot malform it, and compiles it into a skill (<name>/SKILL.md) that any agent loads. This package is the part of that factory every notation shares:

  • forge(kind, name, examples, db=…) learns a grammar from example chains into a named scope, <kind>:<name> — a forged language — and returns it as a Language;
  • gate_language(language, candidate) lints a candidate chain against that grammar and returns its violations and the fixes it suggests, so a model's output is checked against the language it was taught;
  • package_skill(name, body, out_dir=…, description=…) writes a compiled body as <name>/SKILL.md;
  • build_prime(...) renders the block that teaches a model the grammar and shows it one compiled example, so the model writes in shape and the gate catches drift;
  • compile_chain runs a chain through honeyc into its lenses.

The three chain compilers — chaincompiler-accc (attention chains), corcc (chains of reasoning) and sccc (skill chains) — are each made from this base by adding only their kind, their parser and their renderer. Every check it makes is about syntax and structure; it never judges whether a thought is good.

Install

pip install chaincompiler

It brings honeyc and rulecatcher at the same release, and agent-prompt-engineering and agent-skilltree from PyPI. It imports nothing else of the repository: the glyph-persona front end, which needs glyphsteer, is chainaios.persona (pip install "chainaios[legend]"). The chaincompiler command is installed by chainaios, the agent tier, not by this package.

To work on it, clone the repository and run ./install.sh, which installs all fifteen packages editable.

Use

from chaincompiler import forge, gate_language

lang = forge("ac", "triage", ["[Symptom] ⇒ [Scope] ⇒ |Severity|", "[Repro] ⇒ [Localize] ⇒ |Cause|"], db="cc.db")
violations, suggestions = gate_language(lang, "[Symptom] ⇒ [Scope] ⇒ |Severity|")
print(lang.scope, violations)        # ac:triage []

Its design

The repository's DESIGN.md §1 (the one type and the loop every constructor runs) and §4 (this package).

License

MIT.

Metadata

Release files for chaincompiler 0.6.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 chaincompiler 0.6.0
File Size Uploaded Provenance Actions
chaincompiler-0.6.0.tar.gz 9.7 kB Without provenance Details for chaincompiler-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chaincompiler 0.6.0
File Interpreter ABI Platform Actions
chaincompiler-0.6.0-py3-none-any.whl Python 3 none any Details for chaincompiler-0.6.0-py3-none-any.whl

Total release size: 18.1 kB

Release files / chaincompiler-0.6.0.tar.gz

Download URL chaincompiler-0.6.0.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6e5cee375d437a38753170ffa96eed0f57e9d7bff1d174d17aa433f28d0da8aa
BLAKE2b-256 checksum
How to use checksums
d98b4cab36a3ef4eceddd5673545d2f2ab58e7e82e0c94cc6b8753faf86f09b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.13

Release files / chaincompiler-0.6.0-py3-none-any.whl

Download URL chaincompiler-0.6.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb489dbc0447cb544c83b585610d72d5381ef1fbef7dc1e45ca4baeb2611c865
BLAKE2b-256 checksum
How to use checksums
0097ddbe392eb435cfe95070bffb80f6d5bfb8b3f37dfb7d162b8ee3e06f56fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.13

Security for chaincompiler 0.6.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.

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