Repository navigation
docs(chit): CHIT_INTEGRATION contract for the PMOVES.AI Geometry Bus #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
POWERFULMOVES
merged 3 commits into
PMOVES.AI-Edition-Hardened
from
docs/chit-integration
Nov 8, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
b25ff87
docs(chit): CHIT_INTEGRATION contract — subjects, payloads, validatio…
POWERFULMOVES 9729f13
docs(chit): link AGNOTE4482 corpus, signoff gate, FloO$ flow, and int…
POWERFULMOVES bf87094
docs(chit): address review threads — schema-valid examples, spec enum…
POWERFULMOVES File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,225 @@ | ||
| # CHIT Integration | ||
|
|
||
| > Contract for publishing CHIT geometry/attribution events from PMOVES-ToKenism-Multi onto the PMOVES.AI Geometry Bus (NATS). This document is referenced by the parent `POWERFULMOVES/PMOVES.AI` repo's NATS subject catalog (`pmoves/.claude/context/geometry-nats-subjects.md`). | ||
|
|
||
| ## Overview | ||
|
|
||
| ToKenism runs weekly economic simulations whose attribution outcomes are exported as **CHIT geometry documents (CGP)** and broadcast on the shared PMOVES.AI NATS bus. The integration is publish-only from this repo's simulation side; parent services (publisher-discord, Hi-RAG v2, Shape Store, consciousness service) consume the events. | ||
|
|
||
| **Wiring status:** the publisher is fully implemented and test-covered, but has **no production call site yet** — `CHITNATSPublisher` is currently exercised only by tests and re-exports. Simulator wiring is planned; until then treat these subjects as the forward contract for consumers. | ||
|
|
||
| Implementation lives in: | ||
|
|
||
| - `integrations/contracts/chit/chit-nats-publisher.ts` — validated publisher (`CHITNATSPublisher`) | ||
| - `integrations/contracts/chit/cgp-generator.ts` — CGP document generation | ||
| - `integrations/nats/nats-client.ts` — connection/reconnect handling | ||
| - `contracts/schemas/tokenism/*.v1.schema.json` — JSON Schemas (AJV-validated) | ||
|
|
||
| ## NATS Subjects | ||
|
|
||
| All subjects are published (not subscribed) by this repo and match the parent Geometry Bus subject catalog exactly: | ||
|
|
||
| | Subject | Trigger | Required payload keys | Key optional keys | | ||
| |---|---|---|---| | ||
| | `tokenism.swarm.population.v1` | Per-generation swarm progress during CGP optimization | `namespace, modality, pack_id, status, timestamp` | `population_id, generation, best_fitness, metrics` | | ||
| | `tokenism.attribution.recorded.v1` | Per-member CHIT attribution recorded in a simulation week | `chit_id, address, action, amount, week, timestamp` | `category, merkle_root` | | ||
| | `tokenism.cgp.weekly.v1` | Weekly CGP export (end-of-week attribution summary) | `week, cgp, super_node_count, total_attributions, cgp_spec` | `gini, poverty_rate` | | ||
| | `tokenism.cgp.ready.v1` | CGP document ready for downstream consumption (also used by parent research services: DeepResearch / SupaSerch CGP publish) | `cgp, super_node_count, source, cgp_spec, timestamp` | `week` | | ||
|
|
||
| The CGP document embedded in `cgp` follows the spec versions accepted by the bus — per the `spec` enum in `contracts/schemas/geometry/cgp.v1.schema.json`, that is `chit.cgp.v0.2` (current weekly export) or `chit.cgp.v1.0`. Anything else is rejected before publication. | ||
|
|
||
| ## Payload Reference | ||
|
|
||
| ### `tokenism.cgp.weekly.v1` | ||
|
|
||
| ```json | ||
| { | ||
| "week": 12, | ||
| "cgp": { | ||
| "spec": "chit.cgp.v0.2", | ||
| "summary": "ToKenism Week 12 Economic Simulation", | ||
| "created_at": "2026-01-05T12:00:00Z", | ||
| "updated_at": "2026-01-05T12:00:00Z", | ||
| "super_nodes": [ | ||
| { | ||
| "id": "grotoken-week-12", | ||
| "label": "GroToken Distribution", | ||
| "summary": "GroToken rewards issued in week 12", | ||
| "x": 0.0, | ||
| "y": 0.0, | ||
| "r": 0.3, | ||
| "constellations": [ | ||
| { | ||
| "id": "attr-week-12", | ||
| "summary": "Week 12 attribution cluster", | ||
| "points": [ | ||
| { | ||
| "id": "attr-grotoken-week-12-0001", | ||
| "modality": "economic-sim", | ||
| "ref_id": "member-001", | ||
| "summary": "GroToken reward for cooperative purchase", | ||
| "x": 0.2, | ||
| "y": 0.2, | ||
| "conf": 0.98 | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "meta": { | ||
| "attribution": { | ||
| "total_attributions": 1240 | ||
| } | ||
| } | ||
| }, | ||
| "super_node_count": 1, | ||
| "total_attributions": 1240, | ||
| "cgp_spec": "chit.cgp.v0.2", | ||
| "gini": 0.34, | ||
| "poverty_rate": 0.11 | ||
| } | ||
| ``` | ||
|
|
||
| ### `tokenism.attribution.recorded.v1` | ||
|
|
||
| ```json | ||
| { | ||
| "chit_id": "chit-2026-w12-000123", | ||
| "address": "0xabc...def", | ||
| "action": "grotoken_reward", | ||
| "amount": 12.5, | ||
| "week": 12, | ||
| "category": "grotoken_reward", | ||
| "merkle_root": "0xa3f19c8ea3f19c8ea3f19c8ea3f19c8ea3f19c8ea3f19c8ea3f19c8ea3f19c8e", | ||
| "timestamp": "2026-01-05T12:00:00Z" | ||
| } | ||
| ``` | ||
|
|
||
| ### `tokenism.swarm.population.v1` | ||
|
|
||
| ```json | ||
| { | ||
| "namespace": "tokenism", | ||
| "modality": "economic-sim", | ||
| "pack_id": "grotoken-week-12", | ||
| "status": "active", | ||
| "population_id": "pop-001", | ||
| "generation": 42, | ||
| "best_fitness": 0.87, | ||
| "metrics": { | ||
| "gini": 0.34, | ||
| "poverty_rate": 0.11 | ||
| }, | ||
| "timestamp": "2026-01-05T12:00:00Z" | ||
| } | ||
| ``` | ||
|
|
||
| ### `tokenism.cgp.ready.v1` | ||
|
|
||
| ```json | ||
| { | ||
| "cgp": { | ||
| "spec": "chit.cgp.v0.2", | ||
| "summary": "ToKenism Week 12 Economic Simulation", | ||
| "created_at": "2026-01-05T12:00:00Z", | ||
| "updated_at": "2026-01-05T12:00:00Z", | ||
| "super_nodes": [ | ||
| { | ||
| "id": "grotoken-week-12", | ||
| "label": "GroToken Distribution", | ||
| "summary": "GroToken rewards issued in week 12", | ||
| "x": 0.0, | ||
| "y": 0.0, | ||
| "r": 0.3, | ||
| "constellations": [ | ||
| { | ||
| "id": "attr-week-12", | ||
| "summary": "Week 12 attribution cluster", | ||
| "points": [ | ||
| { | ||
| "id": "attr-grotoken-week-12-0001", | ||
| "modality": "economic-sim", | ||
| "ref_id": "member-001", | ||
| "summary": "GroToken reward for cooperative purchase", | ||
| "x": 0.2, | ||
| "y": 0.2, | ||
| "conf": 0.98 | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "meta": { | ||
| "attribution": { | ||
| "total_attributions": 1240 | ||
| } | ||
| } | ||
| }, | ||
| "super_node_count": 1, | ||
| "week": 12, | ||
| "source": "tokenism-simulator", | ||
| "cgp_spec": "chit.cgp.v0.2", | ||
| "timestamp": "2026-01-05T12:00:00Z" | ||
| } | ||
| ``` | ||
|
|
||
| ## Validation & Publishing Guarantees | ||
|
|
||
| - Every payload is **AJV-validated** against its JSON Schema **before** publish. The geometry CGP schema is registered alongside the tokenism schemas so nested `cgp` objects validate against `contracts/schemas/geometry/cgp.v1.schema.json`. | ||
| - **Two publish modes** — constructor option `strictPublish` (default `false`): | ||
| - **Default (lenient):** a schema-invalid payload or publish error is logged (`[CHIT] Failed to publish <subject>: <reason>`) and the method returns `false` — nothing is published, but the caller keeps running. | ||
| - **Strict (`strictPublish: true`):** the same conditions **throw** — use for lanes where silent drops are unacceptable. | ||
| - In **both** modes an invalid payload is never published. | ||
| - Successful publishes log `[CHIT] Published <subject>: <pack_id>`. | ||
| - A subject with no registered validator throws regardless of mode (programming error, not data error). | ||
|
|
||
| ## Connection | ||
|
|
||
| - Client: `integrations/nats/nats-client.ts` | ||
| - URL resolution order: explicit config → `NATS_URL` env → default `nats://nats:pmoves@nats:4222` | ||
| - Reconnect handling and drain-on-shutdown are built in; subscription drain logs `[NATS] Drained subscription: <subject>`. | ||
|
|
||
| ## Consumers (Parent Side) | ||
|
|
||
| | Service | Subjects | Behavior | | ||
| |---|---|---| | ||
| | Publisher Discord | `tokenism.*` | Formats events as Discord embeds | | ||
| | Hi-RAG Gateway v2 | `tokenism.cgp.ready.v1`, `geometry.*` | `POST /geometry/event` ingestion | | ||
| | Shape Store | `geometry.event.v1` | Persistence layer | | ||
| | Consciousness Service | `tokenism.cgp.ready.v1` | Always-on consumer | | ||
|
|
||
| Parent-side enablement flags (from the parent catalog): `DEEPRESEARCH_CGP_PUBLISH`, `SUPASERCH_CGP_PUBLISH` (research-produced CGPs → `tokenism.cgp.ready.v1`), `CHIT_VOICE_ATTRIBUTION` (`tokenism.geometry.event.v1`, voice events). | ||
|
|
||
| ## Corpus & Integration Links | ||
|
|
||
| This integration is governed by the AGNOTE4482 corpus and PMOVESCHIT doctrine in the parent monorepo: | ||
|
|
||
| | Document | Link | Relevance | | ||
| |---|---|---| | ||
| | AGNOTE4482 (main corpus) | [pmoves/docs/AGENTS/AGNOTE4482.md](https://github.com/POWERFULMOVES/PMOVES.AI/blob/main/pmoves/docs/AGENTS/AGNOTE4482.md) | Canonical convergence record; agents claim work here before edits | | ||
| | AGNOTE4482 Signoff Checklist | [AGNOTE4482_SIGNOFF_CHECKLIST.md](https://github.com/POWERFULMOVES/PMOVES.AI/blob/main/pmoves/docs/AGENTS/AGNOTE4482_SIGNOFF_CHECKLIST.md) | Shared multi-agent merge-signoff gate | | ||
| | AGNOTE4482.FlOO$ (PR review flow) | [AGNOTE4482.FlOO$.md](https://github.com/POWERFULMOVES/PMOVES.AI/blob/main/pmoves/docs/AGENTS/AGNOTE4482.FlOO$.md) | Sanctioned merge chain: validate → resolve → run-dry → chit-packet → strict | | ||
| | pr-monitor skill | [pr-monitor-skill/SKILL.md](https://github.com/POWERFULMOVES/PMOVES.AI/blob/main/pmoves/skills/pr-monitor-skill/SKILL.md) | Retry discipline, learning taxonomy, strict gate behavior | | ||
| | Geometry Bus NATS Subject Catalog | [geometry-nats-subjects.md](https://github.com/POWERFULMOVES/PMOVES.AI/blob/main/pmoves/.claude/context/geometry-nats-subjects.md) | The subject catalog this document fulfills | | ||
| | Three-Body Doctrine | [THREE_BODY_DOCTRINE.md](https://github.com/POWERFULMOVES/PMOVES.AI/blob/main/pmoves/docs/PMOVESCHIT/THREE_BODY_DOCTRINE.md) | Foundational Human/AI/System stabilization layer behind CHIT geometry | | ||
| | CHIT Flow Index | [CHIT_FLOW_INDEX.md](https://github.com/POWERFULMOVES/PMOVES.AI/blob/main/pmoves/docs/PMOVESCHIT/CHIT_FLOW_INDEX.md) | CHIT pipeline flow index (run-dry → chit-packet chain) | | ||
|
|
||
| Integrating repositories and services: | ||
|
|
||
| | Repo / Service | Role | | ||
| |---|---| | ||
| | [POWERFULMOVES/PMOVES.AI](https://github.com/POWERFULMOVES/PMOVES.AI) | Parent monorepo; consumes this repo as a core submodule tracking `PMOVES.AI-Edition-Hardened`; builds GHCR images from it | | ||
| | [POWERFULMOVES/PMOVES-Wealth](https://github.com/POWERFULMOVES/PMOVES-Wealth) | Submodule sibling — wealth/finance lane; Firefly III settlement bridge feeds it | | ||
| | [POWERFULMOVES/PMOVES-DoX](https://github.com/POWERFULMOVES/PMOVES-DoX) | Submodule sibling — Agent Zero MCP tool for standalone mode | | ||
| | Pmoves-hyperdimensions (parent) | Three.js CHIT geometry visualizer — consumes CGP documents | | ||
| | publisher-discord (parent service) | Consumes `tokenism.*` → Discord embeds | | ||
| | Hi-RAG Gateway v2 (parent service) | Consumes `tokenism.cgp.ready.v1`, `geometry.*` → `POST /geometry/event` | | ||
| | Shape Store (parent service) | Persistence for `geometry.event.v1` | | ||
| | Consciousness Service (parent service) | Always-on consumer of `tokenism.cgp.ready.v1` | | ||
|
|
||
| ## Monitoring | ||
|
|
||
| - Grep targets: `[CHIT] Published`, `[CHIT] Failed to publish`, `[NATS] Connecting`, `[NATS] Drained subscription` | ||
| - Schema validation errors include subject name and AJV error list in the failure log line. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A repo-wide search for all four publish methods finds no production call site: outside tests,
CHITNATSPublisheris only re-exported fromintegrations/contracts/chit/index.ts. Consequently, running this repo's weekly simulation does not currently publish any of these subjects, so deployments relying on this statement will monitor events that never occur; describe this as an opt-in publisher API or identify and wire the actual simulation entry point.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in bf87094: Overview now carries a Wiring status paragraph stating plainly that CHITNATSPublisher has no production call site yet (tests/re-exports only) and that subjects are a forward contract until simulator wiring lands.