Metadata-Version: 2.5
Name: autonoesis
Version: 0.5.0
Summary: A computational phenomenology engine and core library for cognitive agents.
Project-URL: Homepage, https://github.com/bionicbutterfly13/autonoesis
Project-URL: Repository, https://github.com/bionicbutterfly13/autonoesis
Project-URL: Issues, https://github.com/bionicbutterfly13/autonoesis/issues
Author: Bionic Butterfly
License-Expression: MIT
License-File: LICENSE
Keywords: agency,ai-agents,cognitive-architecture,metacognition,phenomenology,self-modeling
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: numpy>=1.24
Requires-Dist: pydantic>=2.11.7
Requires-Dist: scipy>=1.11
Description-Content-Type: text/markdown

# Autonoesis

A computational phenomenology engine and core library for cognitive agents.

Autonoesis implements Metzinger-inspired self-modeling, active-inference, and
subjectivity primitives for representing how an agent experiences itself as a
subject situated in a world. Its core is designed to remain dependency-light and
host-neutral so larger cognitive architectures can embed it without inheriting
database, web framework, agent runtime, or orchestration assumptions.

## What It Owns

- Phenomenal state records
- Self-model state records
- Agency and ownership attribution
- First-person perspective state
- Boundary and mineness checks
- Transparency / opacity markers
- Pure self-model update operations
- Deterministic, non-eager capability discovery

## What It Does Not Own

- Memory storage
- Agent orchestration
- LLM prompting infrastructure
- Active inference policy selection
- Safety policy systems
- Product runtime surfaces

## Install

```bash
pip install autonoesis
```

## Dependencies

The package has three runtime dependencies. They come from retained numerical
and Pydantic capability modules under `inference/`, `metzinger/`,
`feelings/`, and most of
`models/` — not from the core.

| Dependency | Required by |
|---|---|
| `pydantic` | 13 modules across `models/`, `inference/`, `metzinger/`, `feelings/` |
| `numpy` | `models/belief_state.py`, `inference/representational_similarity.py` |
| `scipy` | `inference/representational_similarity.py` (`scipy.stats.spearmanr`) |

**What "dependency-light" means here.** It is a rule about the core — the
records, operators, episodic layer, and store protocol — not a claim about the
distribution. Measured transitively:

| Core module | Third-party dependencies |
|---|---|
| `identity.py` | none; stdlib only |
| `episodic.py`, `operators.py`, `store.py`, `jsonl_store.py`, `models/__init__.py` | `pydantic` |

Those five reach pydantic through one line: `models/__init__.py` re-exports
`SomaticAnchor` from a pydantic module. No core module reaches numpy or scipy at
all.

**Installing pulls all three; importing does not.** `pip install autonoesis`
downloads numpy, pydantic, and scipy because all three are declared. But the
top-level `__init__.py` does not reach the two modules that use numpy and scipy,
so they stay unloaded until you import one of those directly:

| Import | Loads |
|---|---|
| `import autonoesis` | `pydantic` only |
| `import autonoesis.models.belief_state` | `numpy`, `pydantic` |
| `import autonoesis.inference.representational_similarity` | `numpy`, `scipy`, `pydantic` |

So the install cost is three dependencies, and the import cost for ordinary use
is one.

**The consumer.** Dionysus 4 depends on this package as a git dependency pinned
at tag `v0.4.0`, and documents the fields it maps in its own
`d4/contracts/self_model.py`. It imports three classes:

| autonoesis source | What D4 maps from it |
|---|---|
| `models/agency_ownership.py` → `AgencyOwnershipBinding` | agency, ownership, dissociation, source action |
| `models/subjectivity.py` → `AttentionSchema` | target, target type, policy source, intensity, epistemic and pragmatic weight |
| `models/subjectivity.py` → `SubjectivityMetric` | interoceptive and exteroceptive precision, free-energy derivative |

Feature 008 classifies all 17 retired-canary modules as retained Autonoesis
capabilities or compatibility surfaces. `tests/test_capabilities.py` owns their
intended import coverage; D4's narrower use remains a compatibility contract,
not the criterion for Autonoesis ownership.

`tests/test_dependency_contract.py` enforces this table. It fails if a core
module acquires a dependency, if `pyproject.toml` declares one nothing imports,
or if the package imports one that is not declared.

## Capability Discovery

`list_capabilities()` returns an immutable, deterministically ordered tuple of
static descriptors. Enumeration does not import referenced modules, so the
ordinary discovery path does not load NumPy or SciPy. Each descriptor states its
`core`, `pydantic`, or `numerical` dependency tier and any retained compatibility
contract.

```python
from autonoesis import list_capabilities

for capability in list_capabilities():
    print(capability.key, capability.dependency_tier)
```

Import a selected module explicitly when you need its implementation. Descriptor
`module_refs` are strings by design, not eager imports.

## Attention Record Names

`AttentionalAllocationState` is the canonical adaptive narrative record for
allocation, avoidance, valence, and opacity. The former top-level
`AttentionSchema` name remains an exact alias to that class until 1.0. New code
should import `AttentionalAllocationState`.

`autonoesis.models.subjectivity.AttentionSchema` is a separate focus and policy
source record used by the verified D4 field contract. Its module path and fields
are unchanged.

## Minimal Example

```python
from autonoesis import PhenomenalState, SelfModel, assess_agency, update_self_model

state = PhenomenalState(
    salience=0.8,
    valence=0.2,
    arousal=0.4,
    perspective="first_person",
)

model = SelfModel(subject_id="agent")
agency = assess_agency(intention_strength=0.9, outcome_match=0.7, external_override=0.0)
updated = update_self_model(model, state, agency=agency)

assert updated.agency.confidence > 0.0
```

## Design Rule

Autonoesis is a computational phenomenology engine and core library. The core
should stay dependency-light, typed, host-neutral, and easy to test. Host systems
should attach storage, orchestration, LLM calls, and runtime policy through
adapters. See [Dependencies](#dependencies) for what the distribution actually
requires and why.

## Project Docs

- [Product requirements](docs/prd.md)
- [Testing and TDD](docs/testing.md)
- [Changelog](CHANGELOG.md)
- [Spec Kit feature registry](specs/REGISTRY.md)
- [Tracked Git hooks](githooks/README.md)
- Spec Kit feature artifacts:
  - [Identity primitives](specs/001-identity-primitives/spec.md)
  - [Episodic mean predictor](specs/002-episodic-mean-predictor/spec.md)
  - [Time-domain reasoning](specs/003-time-domain-reasoning/spec.md)
  - [Constraint catalog reconciliation](specs/004-constraint-catalog-reconciliation/spec.md)
  - [Remove shadowed models module](specs/005-remove-shadowed-models-module/spec.md)
  - [Vendored-layer behavior tests](specs/006-vendored-layer-behavior-tests/spec.md)
  - [Dependency-light contract](specs/007-dependency-light-contract/spec.md)
  - [Dionysus-independent capabilities](specs/008-dionysus-independent-capabilities/spec.md)
  - [Self-model constraint bridge](specs/010-self-model-constraint-bridge/spec.md)
  - [Update self-model symmetry](specs/011-update-self-model-symmetry/spec.md)
  - [PSM section 6.2 catalog](specs/012-psm-section-6-2-catalog/spec.md)
- Historical specs:
  - [v0.1 self-model kernel](docs/specs/v0.1-self-model-kernel.md)
  - [v0.2 episodic layer](docs/specs/v0.2-episodic-layer.md)
  - [v0.2 active-inference operators](docs/specs/v0.2-active-inference.md)
  - [v0.2 persistence protocol](docs/specs/v0.2-persistence-protocol.md)
  - [v0.3 JSONL store](docs/specs/v0.3-jsonl-store.md)
