Metadata-Version: 2.4
Name: chaincompiler-accc
Version: 0.3.4
Summary: Attention-Chain Compiler-Compiler — the atom of the cognition-chain stack
License-Expression: MIT
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: chaincompiler==0.3.4
Requires-Dist: honeyc==0.3.4
Requires-Dist: rulecatcher==0.3.4
Requires-Dist: click
Dynamic: license-file

# ACCC — Attention-Chain Compiler-Compiler

The **atom** of the cognition-chain stack: `ACCC → CORCC → SCCC`.

An **attention chain (AC)** is **inner** — not necessarily spoken. The model uses
it as a *template for a section* of its output, or as a *thinking scaffold*: a
silent sequence of attention foci converging on a held focus. (Contrast CORCC's
CoR, which is the **outer** paragraph the model must *say* and is gauged for
persona-melt.) Written in Dense Rune-Chain so HoneyC compiles it and rulecatcher
catches its grammar:

```txt
[Focus_1] ⇒ [Focus_2] ⇒ ... ⇒ |Held|
```

ACCC is a **compiler-compiler**, not a compiler: `forge()` mints a *new* AC
language for a task/domain (it doesn't just compile one chain). Each forged
language is a rulecatcher scope holding the ratified grammar; `gate()` enforces
it; `prime()` emits the re-injectable block.

## The stack it sits in

| layer | chain of… | each node expands to… | package |
|------|-----------|-----------------------|-------|
| **ACCC** | attention foci | — (the atom) | `chaincompiler-accc` |
| CORCC | reasoning steps | a forged **AC** | [`corcc`](https://pypi.org/project/corcc/) |
| SCCC | skills | a **CoR** (+ can forge new languages) | [`sccc`](https://pypi.org/project/sccc/) |

Composition is HoneyC scope/drilldown: a CoR step `[Frame]:{ <ac> }` *contains*
the attention chain that powers it.

## Built on

- **rulecatcher** — catches + gates the emergent grammar (`learn`, `lint`, the
  `orthogonal`/`syntax_break` verdict).
- **HoneyC** — compiles the Dense Rune-Chain notation.
- **chaincompiler** — the generic `learn → gate → compile → prime` loop. ACCC is
  the first domain layer on it.

## Install

```bash
pip install chaincompiler-accc
```

Import it as `accc`. It installs the `accc` command and brings [`chaincompiler`](https://pypi.org/project/chaincompiler/),
[`honeyc`](https://pypi.org/project/honeyc/) and [`rulecatcher`](https://pypi.org/project/rulecatcher/) at the same
release. It is one of the fifteen packages of [ChainCompiler](https://github.com/sancovp/chaincompiler); to work on it,
clone the repository and run `./install.sh`, which installs all fifteen editable.

## Run

```bash
accc demo                                          # forge 2 AC languages, gate, prime
accc forge debug examples/debug.ac --strict        # mint a domain AC language (examples/ is in a clone of the repository)
pytest                                             # from a clone: 6 tests
```

## What the demo shows

1. **forge** `generic` (shape-only) and `debug` (strict, vocabulary-pinned) — two
   distinct attention-chain languages, induced from examples.
2. **prime** the debug language → grammar + a compiled attention block.
3. **gate** a valid debug AC → `clean ✓`.
4. **gate** an off-domain chain (`[Goal] ⇒ …` in the debug language) → rejected
   with verdict **`orthogonal`** (valid identifier, wrong vocabulary → steerable),
   fix: insert `Symptom`.

## API (what CORCC consumes)

```python
from accc import forge, gate, prime, attention_block, parse_ac

lang = forge("debug", debug_examples, db=".accc.db", strict=True)
violations, fixes = gate(lang, "[Symptom] ⇒ [Repro] ⇒ |Localize|")
block = attention_block("debug", "[Symptom] ⇒ [Repro] ⇒ |Localize|")
foci, held = parse_ac("[Symptom] ⇒ [Repro] ⇒ |Localize|")
```
