Skip to main content

Active-inference metacognitive controller kit for agent runtimes, with Hermes Agent adapter support.

Project description

Dionysus Metacognition

Dionysus Metacognition is an active-inference metacognitive controller kit for agent runtimes.

It provides a public Python package, dionysus-metacognition, with import root dionysus_metacog. The package is designed to expose metacognitive control primitives, model provenance, attractor-aware state tracking, and adapter seams for systems such as Hermes Agent, Autonoesis, Elume, Sakshi, and linoss-dynamics.

Install

pip install dionysus-metacognition

Import

import dionysus_metacog
from dionysus_metacog.core import MetaCogSignal, PromotionLabel

For local code that wants a shorter alias:

import dionysus_metacog as metacog

Scope

Dionysus Metacognition is not a generic utils package and is not the ontology owner for phenomenological self-modeling. It is the applied metacognitive controller layer: the place where active-inference control signals, POMDP-style model records, Markov blanket boundaries, attractor-aware runtime observations, and adapter seams can be assembled without polluting host projects.

Autonoesis should remain the self-model and computational-phenomenology kernel. Elume should remain the deterministic replay and competition substrate. Sakshi should remain the witness and verification layer. linoss-dynamics should remain the oscillator dynamics toolkit. Hermes Agent should remain a first-class runtime adapter target, not a hard dependency.

Package Layout

dionysus_metacog/
  framework/     # canonical layer stack and dependency contract
  core/          # controller signals, traces, promotion labels
  models/        # active-inference, POMDP, Markov blanket records
  attractors/    # attractor-state interfaces
  adapters/      # optional integration seams
  provenance/    # source attribution and model lineage

Framework Layers

The initial framework stack is intentionally explicit:

  1. provenance owns source attribution and model lineage.
  2. generative_model owns active-inference and POMDP model records.
  3. boundary owns Markov blanket boundary records.
  4. dynamics owns attractor-basin and dynamical-state observations.
  5. control owns metacognitive control signals and traces.
  6. adapters owns optional host-runtime integration seams.

The default layer contract is available in code:

from dionysus_metacog.framework import FrameworkSpec

framework = FrameworkSpec.default()
print(framework.dependency_graph)

Provenance Ledger

ProvenanceLedger is the source registry for framework records. It stores SourceReference objects by source_id, accepts exact duplicate references, and rejects conflicting duplicates so source lineage fails loudly instead of silently drifting.

from dionysus_metacog.attractors import default_attractor_sources
from dionysus_metacog.provenance import ProvenanceLedger

ledger = ProvenanceLedger.from_sources(default_attractor_sources().values())
metadata = ledger.metadata_for(("friston-2014-cognitive-dynamics",))

The emitted metadata is string-only so adapters can pass it through systems such as Hermes Agent without taking a hard dependency on this package's Python objects.

Payload Contract

MetaCogPayload is the generic handoff contract for host runtimes. It wraps a MetaCogSignal with JSON-safe provenance, boundary, and context sections without naming or importing any specific host adapter.

payload = assessment.to_payload(ledger=ledger)
as_dict = payload.as_dict()

The payload dictionary is safe to pass through queues, logs, HTTP APIs, CLIs, or runtime adapters that need a stable metacognitive control envelope.

Attractor Sources

Attractor-basin records must carry source backing. The initial source ledger connects the package to:

  • Friston, Sengupta, and Auletta's "Cognitive Dynamics: From Attractors to Active Inference" (https://doi.org/10.1109/JPROC.2014.2306251).
  • Context-Engineering's attractor dynamics and attractor co-emergence protocol shell lineage.
  • Spisak and Friston's PNI Lab article, "Self-orthogonalizing attractor neural networks emerging from the free energy principle" (https://pni-lab.github.io/fep-attractor-network/).

Attractor source records use the shared SourceReference provenance contract, so source attribution stays consistent across attractor, model, and future adapter layers.

from dionysus_metacog.attractors import AttractorBasin, default_attractor_sources
from dionysus_metacog.models import PomdpStateRecord

sources = default_attractor_sources()
basin = AttractorBasin(
    basin_id="focused_attention",
    attractor_label="focused attention",
    depth=0.8,
    width=0.6,
    stability=0.9,
    sources=(sources["friston-2014-cognitive-dynamics"],),
)
model = PomdpStateRecord(
    hidden_state="focused",
    observation="task_stable",
    policy="continue",
    expected_free_energy=0.1,
    precision=0.9,
)

Use AttractorAssessment when an attractor observation should become a portable metacognitive control signal:

from dionysus_metacog.attractors import AttractorAssessment

assessment = AttractorAssessment.from_basin(basin=basin, model=model)
control_signal = assessment.to_signal()

The assessment computes a deterministic, precision-weighted free-energy proxy. Its control policies are hold, stabilize, explore, attenuate, and escalate. Signal metadata includes the selected policy, source IDs, the free-energy proxy, and any available expected-free-energy or precision values.

When available, a MarkovBlanketRecord can be passed into AttractorAssessment.from_basin(...) so the emitted control signal carries the internal, external, sensory, and active-state boundary context alongside the POMDP observation.

Attractor Lifecycle

AttractorObservation and AttractorTransition describe how source-backed basin states change over time. The transition classifier is deterministic and intentionally small: it labels observations as entered, held, destabilized, escaped, or merged while preserving source IDs across the lifecycle.

from dionysus_metacog.attractors import (
    AttractorObservation,
    AttractorTransition,
)

prior = AttractorObservation(state=basin.as_state(), source_ids=basin.source_ids)
current = AttractorObservation(
    state=basin.as_state(),
    source_ids=basin.source_ids,
)
transition = AttractorTransition.from_observations(
    prior=prior,
    current=current,
)

Status

This is the initial public package skeleton. The API is intentionally small and typed so that the package name can be claimed cleanly before deeper model extraction lands.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dionysus_metacognition-0.2.0.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dionysus_metacognition-0.2.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file dionysus_metacognition-0.2.0.tar.gz.

File metadata

  • Download URL: dionysus_metacognition-0.2.0.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dionysus_metacognition-0.2.0.tar.gz
Algorithm Hash digest
SHA256 de4e42c31fcb45badbd29869c81e75ff03c5876e2d402ac75043abed5de46f46
MD5 cd4ef5ef5aa8b02b4305611a4a5cf231
BLAKE2b-256 e5af68658c379ab278bfc87f2ed8dc64f6423428f07aa16049405f25bd0e1643

See more details on using hashes here.

Provenance

The following attestation bundles were made for dionysus_metacognition-0.2.0.tar.gz:

Publisher: publish.yml on bionicbutterfly13/dionysus-metacog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dionysus_metacognition-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dionysus_metacognition-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4b40c2dd9787779fe6761e7e5c146a636903c1f4b1ee051a80504348849e900
MD5 c73067b155c00c040bb1f80ba09502aa
BLAKE2b-256 004eb2a92d77096a7e21d8d5ba1cd9fe870fe5ca480bf1f4683a15cc309d0463

See more details on using hashes here.

Provenance

The following attestation bundles were made for dionysus_metacognition-0.2.0-py3-none-any.whl:

Publisher: publish.yml on bionicbutterfly13/dionysus-metacog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page