autonoesis 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- autonoesis-0.2.0/.github/ISSUE_TEMPLATE/bug.md +23 -0
- autonoesis-0.2.0/.github/ISSUE_TEMPLATE/feature.md +27 -0
- autonoesis-0.2.0/.github/pull_request_template.md +14 -0
- autonoesis-0.2.0/.github/workflows/ci.yml +39 -0
- autonoesis-0.2.0/.gitignore +12 -0
- autonoesis-0.2.0/CHANGELOG.md +54 -0
- autonoesis-0.2.0/LICENSE +21 -0
- autonoesis-0.2.0/PKG-INFO +85 -0
- autonoesis-0.2.0/README.md +64 -0
- autonoesis-0.2.0/docs/prd.md +66 -0
- autonoesis-0.2.0/docs/specs/v0.1-self-model-kernel.md +164 -0
- autonoesis-0.2.0/docs/specs/v0.2-active-inference.md +103 -0
- autonoesis-0.2.0/docs/specs/v0.2-episodic-layer.md +101 -0
- autonoesis-0.2.0/docs/specs/v0.2-persistence-protocol.md +78 -0
- autonoesis-0.2.0/docs/testing.md +60 -0
- autonoesis-0.2.0/pyproject.toml +57 -0
- autonoesis-0.2.0/src/autonoesis/__init__.py +57 -0
- autonoesis-0.2.0/src/autonoesis/episodic.py +111 -0
- autonoesis-0.2.0/src/autonoesis/models.py +126 -0
- autonoesis-0.2.0/src/autonoesis/operators.py +161 -0
- autonoesis-0.2.0/src/autonoesis/py.typed +0 -0
- autonoesis-0.2.0/src/autonoesis/store.py +64 -0
- autonoesis-0.2.0/tests/test_active_inference.py +100 -0
- autonoesis-0.2.0/tests/test_autonoesis.py +115 -0
- autonoesis-0.2.0/tests/test_episodic.py +151 -0
- autonoesis-0.2.0/tests/test_store.py +116 -0
- autonoesis-0.2.0/uv.lock +108 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug
|
|
3
|
+
about: Report incorrect kernel behavior
|
|
4
|
+
title: ""
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Behavior
|
|
10
|
+
|
|
11
|
+
What happened?
|
|
12
|
+
|
|
13
|
+
## Expected
|
|
14
|
+
|
|
15
|
+
What should have happened?
|
|
16
|
+
|
|
17
|
+
## Reproduction
|
|
18
|
+
|
|
19
|
+
Minimal code or test case.
|
|
20
|
+
|
|
21
|
+
## Contract
|
|
22
|
+
|
|
23
|
+
Which spec, record, or operator contract is violated?
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature
|
|
3
|
+
about: Propose a kernel feature or public API addition
|
|
4
|
+
title: ""
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
What cognitive responsibility should this add or clarify?
|
|
12
|
+
|
|
13
|
+
## Public Surface
|
|
14
|
+
|
|
15
|
+
What records, operators, or protocols would change?
|
|
16
|
+
|
|
17
|
+
## Spec Impact
|
|
18
|
+
|
|
19
|
+
Which spec file needs to be added or updated?
|
|
20
|
+
|
|
21
|
+
## Tests
|
|
22
|
+
|
|
23
|
+
What tests should fail before implementation and pass after?
|
|
24
|
+
|
|
25
|
+
## Non-Goals
|
|
26
|
+
|
|
27
|
+
What should stay out of scope?
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
-
|
|
4
|
+
|
|
5
|
+
## Spec / Docs
|
|
6
|
+
|
|
7
|
+
- [ ] Relevant spec updated or no spec impact
|
|
8
|
+
- [ ] README/docs updated or no user-facing impact
|
|
9
|
+
|
|
10
|
+
## Tests
|
|
11
|
+
|
|
12
|
+
- [ ] `uv run pytest -q`
|
|
13
|
+
- [ ] `uv run ruff check .`
|
|
14
|
+
- [ ] `python -m compileall -q src tests`
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
name: Python ${{ matrix.python-version }}
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.11", "3.12"]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up uv
|
|
22
|
+
uses: astral-sh/setup-uv@v5
|
|
23
|
+
|
|
24
|
+
- name: Set up Python
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: ${{ matrix.python-version }}
|
|
28
|
+
|
|
29
|
+
- name: Install package
|
|
30
|
+
run: uv sync --group dev
|
|
31
|
+
|
|
32
|
+
- name: Lint
|
|
33
|
+
run: uv run ruff check .
|
|
34
|
+
|
|
35
|
+
- name: Test
|
|
36
|
+
run: uv run pytest -q
|
|
37
|
+
|
|
38
|
+
- name: Compile
|
|
39
|
+
run: python -m compileall -q src tests
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Autonoesis are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
Breaking changes are allowed before `1.0.0` and will always be called out
|
|
9
|
+
explicitly under a `Breaking` heading.
|
|
10
|
+
|
|
11
|
+
## [Unreleased]
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
## [0.2.0] - 2026-05-11
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- `SelfModelEpisode`: frozen, append-only sequence of `SelfModel` snapshots
|
|
24
|
+
with strict per-subject revision monotonicity.
|
|
25
|
+
- `episode_summary`: read-only mapping over an episode's history (length,
|
|
26
|
+
mean salience, mean arousal, peak arousal, transparent fraction).
|
|
27
|
+
- `predict_next`: v0.2 baseline predictor that returns the last snapshot.
|
|
28
|
+
- `surprise`: clamped `[0, 1]` distance between two `SelfModel` snapshots
|
|
29
|
+
combining phenomenal and attribution components.
|
|
30
|
+
- `update_precision`: pure precision/confidence update under observation,
|
|
31
|
+
exponential-moving-average flavor, clamped to `[0, 1]`.
|
|
32
|
+
- `update_attribution_from_observation`: successor `AgencyAttribution`
|
|
33
|
+
with `confidence` revised via `update_precision`.
|
|
34
|
+
- `update_ownership_from_observation`: successor `OwnershipAttribution`
|
|
35
|
+
with `confidence` revised via `update_precision`.
|
|
36
|
+
- `surprise_to_observation_match`: default mapping from `surprise` output
|
|
37
|
+
to `observation_match` input.
|
|
38
|
+
- `SelfModelStore`: `@runtime_checkable` Protocol describing the
|
|
39
|
+
journaling adapter contract (`save` / `load_latest` / `load_history`)
|
|
40
|
+
with strict per-subject revision monotonicity.
|
|
41
|
+
- `InMemorySelfModelStore`: stdlib-only reference adapter used by the
|
|
42
|
+
test suite.
|
|
43
|
+
|
|
44
|
+
## [0.1.0] - 2026-05-09
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
|
|
48
|
+
- Frozen records: `PhenomenalState`, `AgencyAttribution`, `OwnershipAttribution`,
|
|
49
|
+
`BoundaryState`, `PerspectiveState`, `SelfModel`.
|
|
50
|
+
- Pure operators: `assess_agency`, `assess_ownership`, `boundary_integrity`,
|
|
51
|
+
`transparency_audit`, `update_self_model`.
|
|
52
|
+
- `TransparencyLevel` string enum.
|
|
53
|
+
- `update_self_model` accepts an optional `perspective` argument and threads
|
|
54
|
+
it into the successor `SelfModel`.
|
autonoesis-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bionic Butterfly
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: autonoesis
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A self-modeling and phenomenology kernel for cognitive agents.
|
|
5
|
+
Project-URL: Homepage, https://github.com/bionicbutterfly13/autonoesis
|
|
6
|
+
Project-URL: Repository, https://github.com/bionicbutterfly13/autonoesis
|
|
7
|
+
Project-URL: Issues, https://github.com/bionicbutterfly13/autonoesis/issues
|
|
8
|
+
Author: Bionic Butterfly
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agency,ai-agents,cognitive-architecture,metacognition,phenomenology,self-modeling
|
|
12
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# Autonoesis
|
|
23
|
+
|
|
24
|
+
A self-modeling and phenomenology kernel for cognitive agents.
|
|
25
|
+
|
|
26
|
+
Autonoesis provides small, typed primitives for representing and updating an
|
|
27
|
+
agent's model of itself as a subject situated in a world. It is designed to be
|
|
28
|
+
embedded inside larger cognitive architectures without bringing a database, web
|
|
29
|
+
framework, agent runtime, or storage backend.
|
|
30
|
+
|
|
31
|
+
## What It Owns
|
|
32
|
+
|
|
33
|
+
- Phenomenal state records
|
|
34
|
+
- Self-model state records
|
|
35
|
+
- Agency and ownership attribution
|
|
36
|
+
- First-person perspective state
|
|
37
|
+
- Boundary and mineness checks
|
|
38
|
+
- Transparency / opacity markers
|
|
39
|
+
- Pure self-model update operations
|
|
40
|
+
|
|
41
|
+
## What It Does Not Own
|
|
42
|
+
|
|
43
|
+
- Memory storage
|
|
44
|
+
- Agent orchestration
|
|
45
|
+
- LLM prompting infrastructure
|
|
46
|
+
- Active inference policy selection
|
|
47
|
+
- Safety policy systems
|
|
48
|
+
- Product runtime surfaces
|
|
49
|
+
|
|
50
|
+
## Install
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install autonoesis
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Minimal Example
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from autonoesis import PhenomenalState, SelfModel, assess_agency, update_self_model
|
|
60
|
+
|
|
61
|
+
state = PhenomenalState(
|
|
62
|
+
salience=0.8,
|
|
63
|
+
valence=0.2,
|
|
64
|
+
arousal=0.4,
|
|
65
|
+
perspective="first_person",
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
model = SelfModel(subject_id="agent")
|
|
69
|
+
agency = assess_agency(intention_strength=0.9, outcome_match=0.7, external_override=0.0)
|
|
70
|
+
updated = update_self_model(model, state, agency=agency)
|
|
71
|
+
|
|
72
|
+
assert updated.agency.confidence > 0.0
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Design Rule
|
|
76
|
+
|
|
77
|
+
Autonoesis is a kernel. It should stay pure, typed, dependency-light, and easy to
|
|
78
|
+
test. Host systems should attach storage, orchestration, LLM calls, and runtime
|
|
79
|
+
policy through adapters.
|
|
80
|
+
|
|
81
|
+
## Project Docs
|
|
82
|
+
|
|
83
|
+
- [Product requirements](docs/prd.md)
|
|
84
|
+
- [v0.1 self-model kernel spec](docs/specs/v0.1-self-model-kernel.md)
|
|
85
|
+
- [Testing and TDD](docs/testing.md)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Autonoesis
|
|
2
|
+
|
|
3
|
+
A self-modeling and phenomenology kernel for cognitive agents.
|
|
4
|
+
|
|
5
|
+
Autonoesis provides small, typed primitives for representing and updating an
|
|
6
|
+
agent's model of itself as a subject situated in a world. It is designed to be
|
|
7
|
+
embedded inside larger cognitive architectures without bringing a database, web
|
|
8
|
+
framework, agent runtime, or storage backend.
|
|
9
|
+
|
|
10
|
+
## What It Owns
|
|
11
|
+
|
|
12
|
+
- Phenomenal state records
|
|
13
|
+
- Self-model state records
|
|
14
|
+
- Agency and ownership attribution
|
|
15
|
+
- First-person perspective state
|
|
16
|
+
- Boundary and mineness checks
|
|
17
|
+
- Transparency / opacity markers
|
|
18
|
+
- Pure self-model update operations
|
|
19
|
+
|
|
20
|
+
## What It Does Not Own
|
|
21
|
+
|
|
22
|
+
- Memory storage
|
|
23
|
+
- Agent orchestration
|
|
24
|
+
- LLM prompting infrastructure
|
|
25
|
+
- Active inference policy selection
|
|
26
|
+
- Safety policy systems
|
|
27
|
+
- Product runtime surfaces
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install autonoesis
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Minimal Example
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from autonoesis import PhenomenalState, SelfModel, assess_agency, update_self_model
|
|
39
|
+
|
|
40
|
+
state = PhenomenalState(
|
|
41
|
+
salience=0.8,
|
|
42
|
+
valence=0.2,
|
|
43
|
+
arousal=0.4,
|
|
44
|
+
perspective="first_person",
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
model = SelfModel(subject_id="agent")
|
|
48
|
+
agency = assess_agency(intention_strength=0.9, outcome_match=0.7, external_override=0.0)
|
|
49
|
+
updated = update_self_model(model, state, agency=agency)
|
|
50
|
+
|
|
51
|
+
assert updated.agency.confidence > 0.0
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Design Rule
|
|
55
|
+
|
|
56
|
+
Autonoesis is a kernel. It should stay pure, typed, dependency-light, and easy to
|
|
57
|
+
test. Host systems should attach storage, orchestration, LLM calls, and runtime
|
|
58
|
+
policy through adapters.
|
|
59
|
+
|
|
60
|
+
## Project Docs
|
|
61
|
+
|
|
62
|
+
- [Product requirements](docs/prd.md)
|
|
63
|
+
- [v0.1 self-model kernel spec](docs/specs/v0.1-self-model-kernel.md)
|
|
64
|
+
- [Testing and TDD](docs/testing.md)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Product Requirements: Autonoesis
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Autonoesis is a self-modeling and phenomenology kernel for cognitive agents.
|
|
6
|
+
It provides typed records and pure operators for representing an agent's model
|
|
7
|
+
of itself as a subject situated in a world.
|
|
8
|
+
|
|
9
|
+
The package exists so cognitive computing developers can reuse self-modeling
|
|
10
|
+
primitives without adopting a full agent runtime, database, orchestration
|
|
11
|
+
framework, or product stack.
|
|
12
|
+
|
|
13
|
+
## Users
|
|
14
|
+
|
|
15
|
+
- Developers building cognitive architectures and agent runtimes.
|
|
16
|
+
- Researchers prototyping self-modeling, agency, ownership, and perspective
|
|
17
|
+
mechanisms.
|
|
18
|
+
- Maintainers extracting reusable kernels from larger systems.
|
|
19
|
+
|
|
20
|
+
## Problem
|
|
21
|
+
|
|
22
|
+
Self-modeling concepts often get embedded directly inside host runtimes. That
|
|
23
|
+
makes them hard to test, hard to reuse, and hard to distinguish from storage,
|
|
24
|
+
prompting, policy, and orchestration code.
|
|
25
|
+
|
|
26
|
+
Autonoesis separates the self-modeling kernel from the host substrate.
|
|
27
|
+
|
|
28
|
+
## v0.1 Scope
|
|
29
|
+
|
|
30
|
+
Autonoesis v0.1 provides:
|
|
31
|
+
|
|
32
|
+
- Frozen records for phenomenal state, agency attribution, ownership
|
|
33
|
+
attribution, boundary state, perspective state, and self-model snapshots.
|
|
34
|
+
- Pure operators for agency scoring, ownership scoring, boundary integrity,
|
|
35
|
+
transparency audit, and self-model successor updates.
|
|
36
|
+
- A typed public API exported from `autonoesis`.
|
|
37
|
+
- Unit tests for every public operator and core invariant.
|
|
38
|
+
|
|
39
|
+
## Non-Goals
|
|
40
|
+
|
|
41
|
+
Autonoesis v0.1 does not provide:
|
|
42
|
+
|
|
43
|
+
- Memory persistence.
|
|
44
|
+
- LLM prompting.
|
|
45
|
+
- Agent orchestration.
|
|
46
|
+
- Active inference policy selection.
|
|
47
|
+
- Safety or governance policy.
|
|
48
|
+
- FastAPI, CLI, database, queue, or product runtime surfaces.
|
|
49
|
+
|
|
50
|
+
## Public API Promise
|
|
51
|
+
|
|
52
|
+
The core package should remain dependency-light and host-neutral. Public records
|
|
53
|
+
and operators should be small enough to embed inside other systems without
|
|
54
|
+
pulling in storage or runtime assumptions.
|
|
55
|
+
|
|
56
|
+
Breaking changes before `1.0` are allowed, but every change to public records or
|
|
57
|
+
operators must be captured in a spec update and covered by tests.
|
|
58
|
+
|
|
59
|
+
## Success Criteria
|
|
60
|
+
|
|
61
|
+
- A developer can install the package and construct/update a self-model without
|
|
62
|
+
configuring any external service.
|
|
63
|
+
- Public records are immutable by default.
|
|
64
|
+
- Public operators are deterministic for the same inputs.
|
|
65
|
+
- Every public operator has direct tests.
|
|
66
|
+
- The package imports on supported Python versions in CI.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Spec: v0.1 Self-Model Kernel
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Draft for v0.1.
|
|
6
|
+
|
|
7
|
+
## Goal
|
|
8
|
+
|
|
9
|
+
Define the first stable Autonoesis kernel surface: self-model records and pure
|
|
10
|
+
operators for agency, ownership, boundary integrity, transparency, and successor
|
|
11
|
+
state updates.
|
|
12
|
+
|
|
13
|
+
## Public Records
|
|
14
|
+
|
|
15
|
+
### `PhenomenalState`
|
|
16
|
+
|
|
17
|
+
Represents a compact phenomenal field summary.
|
|
18
|
+
|
|
19
|
+
Required invariants:
|
|
20
|
+
|
|
21
|
+
- `salience` is clamped to `[0.0, 1.0]`.
|
|
22
|
+
- `valence` is clamped to `[-1.0, 1.0]`.
|
|
23
|
+
- `arousal` is clamped to `[0.0, 1.0]`.
|
|
24
|
+
- `metadata` is copied into a read-only mapping.
|
|
25
|
+
- The record is frozen.
|
|
26
|
+
|
|
27
|
+
### `AgencyAttribution`
|
|
28
|
+
|
|
29
|
+
Represents confidence that an event or action is controlled by the subject.
|
|
30
|
+
|
|
31
|
+
Required invariants:
|
|
32
|
+
|
|
33
|
+
- `confidence`, `intention_strength`, `outcome_match`, and `external_override`
|
|
34
|
+
are clamped to `[0.0, 1.0]`.
|
|
35
|
+
- The record is frozen.
|
|
36
|
+
|
|
37
|
+
### `OwnershipAttribution`
|
|
38
|
+
|
|
39
|
+
Represents confidence that a state, action, or representation is "mine."
|
|
40
|
+
|
|
41
|
+
Required invariants:
|
|
42
|
+
|
|
43
|
+
- `confidence`, `continuity`, `source_alignment`, and `alienation` are clamped
|
|
44
|
+
to `[0.0, 1.0]`.
|
|
45
|
+
- The record is frozen.
|
|
46
|
+
|
|
47
|
+
### `BoundaryState`
|
|
48
|
+
|
|
49
|
+
Represents subject/world boundary estimates.
|
|
50
|
+
|
|
51
|
+
Required invariants:
|
|
52
|
+
|
|
53
|
+
- `self_world_separation`, `tool_incorporation`, and `social_permeability` are
|
|
54
|
+
clamped to `[0.0, 1.0]`.
|
|
55
|
+
- The record is frozen.
|
|
56
|
+
|
|
57
|
+
### `PerspectiveState`
|
|
58
|
+
|
|
59
|
+
Represents vantage and temporal continuity.
|
|
60
|
+
|
|
61
|
+
Required invariants:
|
|
62
|
+
|
|
63
|
+
- `temporal_continuity` is clamped to `[0.0, 1.0]`.
|
|
64
|
+
- The record is frozen.
|
|
65
|
+
|
|
66
|
+
### `SelfModel`
|
|
67
|
+
|
|
68
|
+
Represents a compact phenomenal self-model snapshot.
|
|
69
|
+
|
|
70
|
+
Required invariants:
|
|
71
|
+
|
|
72
|
+
- The record is frozen.
|
|
73
|
+
- `metadata` is copied into a read-only mapping.
|
|
74
|
+
- `evolved(**changes)` returns a successor with `revision + 1`.
|
|
75
|
+
- `evolved(**changes)` never mutates the source record.
|
|
76
|
+
|
|
77
|
+
## Public Operators
|
|
78
|
+
|
|
79
|
+
### `assess_agency(...)`
|
|
80
|
+
|
|
81
|
+
Inputs:
|
|
82
|
+
|
|
83
|
+
- `intention_strength`
|
|
84
|
+
- `outcome_match`
|
|
85
|
+
- `external_override`
|
|
86
|
+
|
|
87
|
+
Behavior:
|
|
88
|
+
|
|
89
|
+
- Returns `AgencyAttribution`.
|
|
90
|
+
- Higher intention and outcome match increase confidence.
|
|
91
|
+
- Higher external override decreases confidence.
|
|
92
|
+
- Output values are clamped.
|
|
93
|
+
- Same inputs produce the same output.
|
|
94
|
+
|
|
95
|
+
### `assess_ownership(...)`
|
|
96
|
+
|
|
97
|
+
Inputs:
|
|
98
|
+
|
|
99
|
+
- `continuity`
|
|
100
|
+
- `source_alignment`
|
|
101
|
+
- `alienation`
|
|
102
|
+
|
|
103
|
+
Behavior:
|
|
104
|
+
|
|
105
|
+
- Returns `OwnershipAttribution`.
|
|
106
|
+
- Higher continuity and source alignment increase confidence.
|
|
107
|
+
- Higher alienation decreases confidence.
|
|
108
|
+
- Output values are clamped.
|
|
109
|
+
- Same inputs produce the same output.
|
|
110
|
+
|
|
111
|
+
### `boundary_integrity(boundary)`
|
|
112
|
+
|
|
113
|
+
Behavior:
|
|
114
|
+
|
|
115
|
+
- Returns a compact `[0.0, 1.0]` boundary integrity score.
|
|
116
|
+
- Higher self/world separation increases integrity.
|
|
117
|
+
- Higher social permeability and tool incorporation reduce integrity in the
|
|
118
|
+
conservative default formula.
|
|
119
|
+
- Same inputs produce the same output.
|
|
120
|
+
|
|
121
|
+
### `transparency_audit(state)`
|
|
122
|
+
|
|
123
|
+
Behavior:
|
|
124
|
+
|
|
125
|
+
- Returns `TransparencyLevel`.
|
|
126
|
+
- High salience plus high arousal returns `OPAQUE`.
|
|
127
|
+
- Moderate load returns `PARTLY_OPAQUE`.
|
|
128
|
+
- Low load returns `TRANSPARENT`.
|
|
129
|
+
- Same inputs produce the same output.
|
|
130
|
+
|
|
131
|
+
### `update_self_model(...)`
|
|
132
|
+
|
|
133
|
+
Behavior:
|
|
134
|
+
|
|
135
|
+
- Returns a successor `SelfModel`.
|
|
136
|
+
- Does not mutate the input `SelfModel`.
|
|
137
|
+
- Increments `revision` by one.
|
|
138
|
+
- Updates phenomenal state and any provided attribution, boundary, or
|
|
139
|
+
perspective records.
|
|
140
|
+
- If phenomenal transparency is still `PARTLY_OPAQUE`, applies
|
|
141
|
+
`transparency_audit()`.
|
|
142
|
+
|
|
143
|
+
## Acceptance Tests
|
|
144
|
+
|
|
145
|
+
The v0.1 test suite must prove:
|
|
146
|
+
|
|
147
|
+
- Records are frozen.
|
|
148
|
+
- Metadata cannot be mutated through the source mapping.
|
|
149
|
+
- Agency confidence decreases under external override.
|
|
150
|
+
- Ownership confidence decreases under alienation.
|
|
151
|
+
- Boundary integrity responds to boundary components.
|
|
152
|
+
- Transparency audit marks high-load states opaque.
|
|
153
|
+
- Self-model updates return successors and increment revision.
|
|
154
|
+
- Operators are deterministic for repeated calls with the same inputs.
|
|
155
|
+
|
|
156
|
+
## Non-Goals
|
|
157
|
+
|
|
158
|
+
This spec does not include:
|
|
159
|
+
|
|
160
|
+
- Persistence adapters.
|
|
161
|
+
- Prompt templates.
|
|
162
|
+
- Agent loops.
|
|
163
|
+
- Active inference policies.
|
|
164
|
+
- Runtime configuration.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Spec: v0.2 Active-Inference Operators
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Draft for v0.2.
|
|
6
|
+
|
|
7
|
+
## Goal
|
|
8
|
+
|
|
9
|
+
Provide pure, deterministic operators for revising attribution confidences
|
|
10
|
+
under observation. The kernel does not pick policies, decide when to update,
|
|
11
|
+
or represent free energy. It exposes a small, composable precision-update
|
|
12
|
+
seam that hosts can drive however they like (including with the `surprise`
|
|
13
|
+
operator from `v0.2-episodic-layer.md`).
|
|
14
|
+
|
|
15
|
+
The active-inference layer is additive. v0.1 records and operators are not
|
|
16
|
+
changed.
|
|
17
|
+
|
|
18
|
+
## Public Operators
|
|
19
|
+
|
|
20
|
+
### `update_precision(prior, observation_match, learning_rate=0.2)`
|
|
21
|
+
|
|
22
|
+
Inputs:
|
|
23
|
+
|
|
24
|
+
- `prior`: prior precision/confidence in `[0.0, 1.0]`.
|
|
25
|
+
- `observation_match`: how well the observation supports the prior, in
|
|
26
|
+
`[0.0, 1.0]`. `1.0` means the observation fully confirms the prior;
|
|
27
|
+
`0.0` means it fully contradicts.
|
|
28
|
+
- `learning_rate`: weight on the observation, in `[0.0, 1.0]`.
|
|
29
|
+
Default `0.2`.
|
|
30
|
+
|
|
31
|
+
Behavior:
|
|
32
|
+
|
|
33
|
+
- Returns a `float` in `[0.0, 1.0]`.
|
|
34
|
+
- Pure formula:
|
|
35
|
+
`clamp(prior + learning_rate * (observation_match - prior))`.
|
|
36
|
+
- All inputs are clamped before use.
|
|
37
|
+
- `learning_rate == 0.0` returns the (clamped) prior unchanged.
|
|
38
|
+
- `learning_rate == 1.0` returns the (clamped) observation_match.
|
|
39
|
+
- For fixed `prior` and `learning_rate`, the result is monotonically
|
|
40
|
+
non-decreasing in `observation_match`.
|
|
41
|
+
- Same inputs produce the same output.
|
|
42
|
+
|
|
43
|
+
### `update_attribution_from_observation(attr, observation_match, learning_rate=0.2)`
|
|
44
|
+
|
|
45
|
+
Inputs:
|
|
46
|
+
|
|
47
|
+
- `attr`: an `AgencyAttribution`.
|
|
48
|
+
- `observation_match` and `learning_rate` as above.
|
|
49
|
+
|
|
50
|
+
Behavior:
|
|
51
|
+
|
|
52
|
+
- Returns a successor `AgencyAttribution`.
|
|
53
|
+
- `confidence` is updated via `update_precision`.
|
|
54
|
+
- `intention_strength`, `outcome_match`, and `external_override` are
|
|
55
|
+
preserved unchanged on the successor.
|
|
56
|
+
- Does not mutate the input record.
|
|
57
|
+
- Same inputs produce the same output.
|
|
58
|
+
|
|
59
|
+
### `update_ownership_from_observation(attr, observation_match, learning_rate=0.2)`
|
|
60
|
+
|
|
61
|
+
Symmetric to `update_attribution_from_observation` but for
|
|
62
|
+
`OwnershipAttribution`. `continuity`, `source_alignment`, and `alienation`
|
|
63
|
+
are preserved unchanged on the successor; only `confidence` is updated.
|
|
64
|
+
|
|
65
|
+
### `surprise_to_observation_match(surprise_value)`
|
|
66
|
+
|
|
67
|
+
Inputs:
|
|
68
|
+
|
|
69
|
+
- `surprise_value`: a `float`. Clamped to `[0.0, 1.0]`.
|
|
70
|
+
|
|
71
|
+
Behavior:
|
|
72
|
+
|
|
73
|
+
- Returns `1.0 - clamp(surprise_value)`.
|
|
74
|
+
- Documented as a default mapping from `surprise` (see
|
|
75
|
+
`v0.2-episodic-layer.md`) to `observation_match`. Hosts may use any other
|
|
76
|
+
mapping.
|
|
77
|
+
|
|
78
|
+
## Acceptance Tests
|
|
79
|
+
|
|
80
|
+
The v0.2 active-inference test suite must prove:
|
|
81
|
+
|
|
82
|
+
- `update_precision` is monotonic non-decreasing in `observation_match`.
|
|
83
|
+
- `update_precision` returns the prior when `learning_rate == 0`.
|
|
84
|
+
- `update_precision` returns `observation_match` when `learning_rate == 1`.
|
|
85
|
+
- `update_precision` clamps under negative or above-1 inputs.
|
|
86
|
+
- `update_attribution_from_observation` returns a new `AgencyAttribution`,
|
|
87
|
+
leaves the source unchanged, and updates only `confidence`.
|
|
88
|
+
- `update_ownership_from_observation` behaves analogously for
|
|
89
|
+
`OwnershipAttribution`.
|
|
90
|
+
- `surprise_to_observation_match` inverts the unit interval and clamps
|
|
91
|
+
out-of-range inputs.
|
|
92
|
+
- All four operators are deterministic for repeated calls with the same
|
|
93
|
+
inputs.
|
|
94
|
+
|
|
95
|
+
## Non-Goals
|
|
96
|
+
|
|
97
|
+
This spec does not include:
|
|
98
|
+
|
|
99
|
+
- Free-energy minimization or KL-divergence policies.
|
|
100
|
+
- Choice of when to update (scheduling, eligibility, gating).
|
|
101
|
+
- Multi-modal precision priors over more than one attribution at a time.
|
|
102
|
+
- Persistence of updated attributions (covered by
|
|
103
|
+
`v0.2-persistence-protocol.md`).
|