alethic-kernel 0.1.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.
- alethic_kernel-0.1.0/CHANGELOG.md +81 -0
- alethic_kernel-0.1.0/CODE_OF_CONDUCT.md +85 -0
- alethic_kernel-0.1.0/CONTRIBUTING.md +122 -0
- alethic_kernel-0.1.0/LICENSE +21 -0
- alethic_kernel-0.1.0/MANIFEST.in +12 -0
- alethic_kernel-0.1.0/PKG-INFO +163 -0
- alethic_kernel-0.1.0/README.md +127 -0
- alethic_kernel-0.1.0/SECURITY.md +60 -0
- alethic_kernel-0.1.0/__init__.py +9 -0
- alethic_kernel-0.1.0/agents/__init__.py +0 -0
- alethic_kernel-0.1.0/agents/alethic_agent.py +109 -0
- alethic_kernel-0.1.0/agents/json_glue.py +35 -0
- alethic_kernel-0.1.0/agents/llm_agent.py +186 -0
- alethic_kernel-0.1.0/agents/string_glue.py +33 -0
- alethic_kernel-0.1.0/alethic/__init__.py +13 -0
- alethic_kernel-0.1.0/alethic/adaptive_worker.py +134 -0
- alethic_kernel-0.1.0/alethic/api/__init__.py +0 -0
- alethic_kernel-0.1.0/alethic/api/app.py +65 -0
- alethic_kernel-0.1.0/alethic/api/dependencies.py +59 -0
- alethic_kernel-0.1.0/alethic/api/models.py +104 -0
- alethic_kernel-0.1.0/alethic/api/routes.py +142 -0
- alethic_kernel-0.1.0/alethic/api/tracing.py +25 -0
- alethic_kernel-0.1.0/alethic/client.py +280 -0
- alethic_kernel-0.1.0/alethic/kernel.py +261 -0
- alethic_kernel-0.1.0/alethic/migrations.py +76 -0
- alethic_kernel-0.1.0/alethic/orchestrator.py +99 -0
- alethic_kernel-0.1.0/alethic/permissions.py +16 -0
- alethic_kernel-0.1.0/alethic/py.typed +0 -0
- alethic_kernel-0.1.0/alethic/schema.py +37 -0
- alethic_kernel-0.1.0/alethic/session.py +23 -0
- alethic_kernel-0.1.0/alethic/sim_worker.py +162 -0
- alethic_kernel-0.1.0/alethic/sqlite_store.py +188 -0
- alethic_kernel-0.1.0/alethic/store.py +101 -0
- alethic_kernel-0.1.0/alethic/store_protocol.py +33 -0
- alethic_kernel-0.1.0/alethic/validators.py +46 -0
- alethic_kernel-0.1.0/alethic/worker.py +42 -0
- alethic_kernel-0.1.0/alethic_kernel.egg-info/PKG-INFO +163 -0
- alethic_kernel-0.1.0/alethic_kernel.egg-info/SOURCES.txt +149 -0
- alethic_kernel-0.1.0/alethic_kernel.egg-info/dependency_links.txt +1 -0
- alethic_kernel-0.1.0/alethic_kernel.egg-info/entry_points.txt +2 -0
- alethic_kernel-0.1.0/alethic_kernel.egg-info/requires.txt +12 -0
- alethic_kernel-0.1.0/alethic_kernel.egg-info/top_level.txt +1 -0
- alethic_kernel-0.1.0/docs/api-reference.md +323 -0
- alethic_kernel-0.1.0/docs/architecture.md +158 -0
- alethic_kernel-0.1.0/docs/architecture.png +0 -0
- alethic_kernel-0.1.0/docs/benchmark.md +192 -0
- alethic_kernel-0.1.0/docs/deployment.md +136 -0
- alethic_kernel-0.1.0/docs/http-api.md +359 -0
- alethic_kernel-0.1.0/docs/superpowers/plans/2026-07-16-alethic-dev.md +1238 -0
- alethic_kernel-0.1.0/docs/superpowers/specs/2026-07-16-alethic-dev-design.md +104 -0
- alethic_kernel-0.1.0/docs/workers.md +216 -0
- alethic_kernel-0.1.0/eval/__init__.py +0 -0
- alethic_kernel-0.1.0/eval/harness.py +53 -0
- alethic_kernel-0.1.0/eval/metrics.py +70 -0
- alethic_kernel-0.1.0/eval/report.py +41 -0
- alethic_kernel-0.1.0/eval/task_loader.py +38 -0
- alethic_kernel-0.1.0/examples/demo.py +472 -0
- alethic_kernel-0.1.0/examples/multi_episode.py +263 -0
- alethic_kernel-0.1.0/llm/__init__.py +0 -0
- alethic_kernel-0.1.0/llm/planner.py +178 -0
- alethic_kernel-0.1.0/py.typed +0 -0
- alethic_kernel-0.1.0/pyproject.toml +69 -0
- alethic_kernel-0.1.0/run.py +172 -0
- alethic_kernel-0.1.0/setup.cfg +4 -0
- alethic_kernel-0.1.0/tasks/stripe_refund_clean.yaml +18 -0
- alethic_kernel-0.1.0/tasks/stripe_refund_combined.yaml +18 -0
- alethic_kernel-0.1.0/tasks/stripe_refund_conflict.yaml +18 -0
- alethic_kernel-0.1.0/tasks/stripe_refund_duplicate.yaml +19 -0
- alethic_kernel-0.1.0/tasks/stripe_refund_stale.yaml +18 -0
- alethic_kernel-0.1.0/tasks/stripe_refund_tool_failure.yaml +18 -0
- alethic_kernel-0.1.0/tests/__init__.py +0 -0
- alethic_kernel-0.1.0/tests/conftest.py +161 -0
- alethic_kernel-0.1.0/tests/helpers.py +34 -0
- alethic_kernel-0.1.0/tests/test_adaptive_worker.py +196 -0
- alethic_kernel-0.1.0/tests/test_agent_integration.py +104 -0
- alethic_kernel-0.1.0/tests/test_agent_llm_mock.py +143 -0
- alethic_kernel-0.1.0/tests/test_api.py +319 -0
- alethic_kernel-0.1.0/tests/test_atomicity.py +200 -0
- alethic_kernel-0.1.0/tests/test_benchmark_invariants.py +105 -0
- alethic_kernel-0.1.0/tests/test_cli.py +111 -0
- alethic_kernel-0.1.0/tests/test_client.py +165 -0
- alethic_kernel-0.1.0/tests/test_concurrency.py +205 -0
- alethic_kernel-0.1.0/tests/test_coverage_gaps.py +452 -0
- alethic_kernel-0.1.0/tests/test_e2e_pipeline.py +481 -0
- alethic_kernel-0.1.0/tests/test_kernel.py +688 -0
- alethic_kernel-0.1.0/tests/test_migrations.py +178 -0
- alethic_kernel-0.1.0/tests/test_orchestrator.py +180 -0
- alethic_kernel-0.1.0/tests/test_permissions.py +60 -0
- alethic_kernel-0.1.0/tests/test_readme_assets.py +49 -0
- alethic_kernel-0.1.0/tests/test_report.py +157 -0
- alethic_kernel-0.1.0/tests/test_schema.py +63 -0
- alethic_kernel-0.1.0/tests/test_session.py +51 -0
- alethic_kernel-0.1.0/tests/test_sim_worker.py +205 -0
- alethic_kernel-0.1.0/tests/test_sqlite_store.py +163 -0
- alethic_kernel-0.1.0/tests/test_store.py +115 -0
- alethic_kernel-0.1.0/tests/test_store_equivalence.py +89 -0
- alethic_kernel-0.1.0/tests/test_stress.py +873 -0
- alethic_kernel-0.1.0/tests/test_validators.py +148 -0
- alethic_kernel-0.1.0/tools/__init__.py +0 -0
- alethic_kernel-0.1.0/tools/payment_tool.py +30 -0
- alethic_kernel-0.1.0/tools/perturb.py +17 -0
- alethic_kernel-0.1.0/tools/refund_tool.py +16 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-07-16
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Blackboard Kernel** — Core governed cognition substrate with 7 semantic slots (percepts, beliefs, constraints, plans, evidence, predictions, actions)
|
|
13
|
+
- **PROPOSE/COMMIT Protocol** — Two-phase validation ensuring all decisions pass evidence quality checks before commitment
|
|
14
|
+
- **Validation Pipelines**
|
|
15
|
+
- Evidence validation (staleness, missing percepts, conflict detection)
|
|
16
|
+
- Confidence thresholds (0.5 default minimum confidence)
|
|
17
|
+
- Conflict arbitration (high-confidence sources override conflicts)
|
|
18
|
+
- Constraint-based action gating
|
|
19
|
+
- Prediction-gated actions (optional forward validation)
|
|
20
|
+
- **Role-Based Access Control** — 6 roles with explicit permission model (tool, planner, symbolic_validator, evidence_validator, sim_validator, kernel)
|
|
21
|
+
- **Store Abstraction**
|
|
22
|
+
- `MemoryStore` — Thread-safe in-memory store (default)
|
|
23
|
+
- `SqliteStore` — WAL-mode SQLite with persistent records and indexed queries
|
|
24
|
+
- **Worker Protocol** — Extensible worker framework for cognitive components
|
|
25
|
+
- `SimulatorWorker` — Rule-based forward simulator with declarative conditions
|
|
26
|
+
- `AdaptiveWorker` — Learns constraints from failure patterns across episodes
|
|
27
|
+
- `Orchestrator` — Generic round-robin scheduler with dependency ordering
|
|
28
|
+
- **Four Reference Agents**
|
|
29
|
+
- `StringGlue` — Baseline (always acts, no validation)
|
|
30
|
+
- `JsonGlue` — Confidence tracking but no validation
|
|
31
|
+
- `AlethicAgent` — Full kernel with deterministic planner
|
|
32
|
+
- `LLMAgent` — Full kernel with LLM-based planner (OpenAI-compatible)
|
|
33
|
+
- **Evaluation Framework**
|
|
34
|
+
- Task loader for YAML/JSON task definitions
|
|
35
|
+
- Benchmark harness (1,200 episodes: 6 tasks × 50 seeds × 4 agents)
|
|
36
|
+
- 5 metrics: task success, unsafe actions, unsupported beliefs, traceability, evidence taint
|
|
37
|
+
- Perturbation system (staleness, conflicts, low confidence, tool failures)
|
|
38
|
+
- Markdown report generation
|
|
39
|
+
- **Example Domain: Stripe Refunds**
|
|
40
|
+
- 6 refund tasks exercising different failure modes
|
|
41
|
+
- Constraints: no duplicate refunds, no partial refunds without evidence
|
|
42
|
+
- Perturbation scenarios validating governance under adversarial conditions
|
|
43
|
+
- **HTTP API**
|
|
44
|
+
- FastAPI server with `/v1/write`, `/v1/commit/*`, `/v1/validate/*` endpoints
|
|
45
|
+
- OpenTelemetry support for distributed tracing
|
|
46
|
+
- OpenAPI documentation at `/docs`
|
|
47
|
+
- Docker and docker-compose deployment
|
|
48
|
+
- **Comprehensive Documentation**
|
|
49
|
+
- Architecture guide with semantic slots and validation pipelines
|
|
50
|
+
- API reference for all public classes and methods
|
|
51
|
+
- Worker protocol and custom worker examples
|
|
52
|
+
- HTTP API specification
|
|
53
|
+
- Benchmark methodology and CLI reference
|
|
54
|
+
- Deployment guide with store selection and environment variables
|
|
55
|
+
- **Type Safety** — Strict mypy configuration across all modules
|
|
56
|
+
- **Test Suite** — 349 unit and integration tests with pytest
|
|
57
|
+
|
|
58
|
+
### Benchmark Results
|
|
59
|
+
|
|
60
|
+
In a controlled evaluation of 1,200 episodes:
|
|
61
|
+
|
|
62
|
+
| Agent | Task Success | Unsafe Actions | Unsupported Beliefs | Traceability |
|
|
63
|
+
|-------|-------------|----------------|---------------------|--------------|
|
|
64
|
+
| StringGlue | 61.3% | 38.7% | 26.0% | 0.10 |
|
|
65
|
+
| JsonGlue | 57.0% | 43.0% | 31.0% | 0.30 |
|
|
66
|
+
| **Alethic** | **100%** | **0%** | **0%** | **1.00** |
|
|
67
|
+
| **LLM+Alethic** | **99.0%** | **0%** | **0%** | **1.00** |
|
|
68
|
+
|
|
69
|
+
- Kernel-backed agents achieve zero unsafe actions across all perturbation scenarios
|
|
70
|
+
- Baseline agents produce unsafe actions 39-43% of the time on stale/conflicting/low-confidence data
|
|
71
|
+
- LLM agent demonstrates that governance generalizes regardless of planner implementation
|
|
72
|
+
|
|
73
|
+
### Known Limitations
|
|
74
|
+
|
|
75
|
+
- Example domain currently limited to Stripe refund tasks (kernel itself is domain-agnostic)
|
|
76
|
+
- LLM planner sometimes declines to act conservatively, reducing task success vs. deterministic agent
|
|
77
|
+
- Local LLM inference requires OpenAI-compatible endpoint (defaults to Ollama on localhost:11434)
|
|
78
|
+
|
|
79
|
+
### Paper & Attribution
|
|
80
|
+
|
|
81
|
+
Alethic is the reference implementation of [From Fragile Glue to Governed Cognition](https://doi.org/10.5281/zenodo.18691808), a controlled study of blackboard kernels for modular AI systems.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
|
|
2
|
+
# Contributor Covenant Code of Conduct
|
|
3
|
+
|
|
4
|
+
## Our Pledge
|
|
5
|
+
|
|
6
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
7
|
+
|
|
8
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
9
|
+
|
|
10
|
+
## Our Standards
|
|
11
|
+
|
|
12
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
13
|
+
|
|
14
|
+
* Demonstrating empathy and kindness toward other people
|
|
15
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
16
|
+
* Giving and gracefully accepting constructive feedback
|
|
17
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
18
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
|
19
|
+
|
|
20
|
+
Examples of unacceptable behavior include:
|
|
21
|
+
|
|
22
|
+
* The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
24
|
+
* Public or private harassment
|
|
25
|
+
* Publishing others' private information, such as a physical or email address, without their explicit permission
|
|
26
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
27
|
+
|
|
28
|
+
## Enforcement Responsibilities
|
|
29
|
+
|
|
30
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
31
|
+
|
|
32
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
33
|
+
|
|
34
|
+
## Scope
|
|
35
|
+
|
|
36
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
37
|
+
|
|
38
|
+
## Enforcement
|
|
39
|
+
|
|
40
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at emil@uzelac.me. All complaints will be reviewed and investigated promptly and fairly.
|
|
41
|
+
|
|
42
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
43
|
+
|
|
44
|
+
## Enforcement Guidelines
|
|
45
|
+
|
|
46
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
47
|
+
|
|
48
|
+
### 1. Correction
|
|
49
|
+
|
|
50
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
51
|
+
|
|
52
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
53
|
+
|
|
54
|
+
### 2. Warning
|
|
55
|
+
|
|
56
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
|
57
|
+
|
|
58
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
59
|
+
|
|
60
|
+
### 3. Temporary Ban
|
|
61
|
+
|
|
62
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
63
|
+
|
|
64
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
65
|
+
|
|
66
|
+
### 4. Permanent Ban
|
|
67
|
+
|
|
68
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
69
|
+
|
|
70
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
71
|
+
|
|
72
|
+
## Attribution
|
|
73
|
+
|
|
74
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
75
|
+
|
|
76
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
77
|
+
|
|
78
|
+
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
|
|
79
|
+
|
|
80
|
+
[homepage]: https://www.contributor-covenant.org
|
|
81
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
82
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
83
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
84
|
+
[translations]: https://www.contributor-covenant.org/translations
|
|
85
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Contributing to Alethic
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to Alethic! We welcome contributions, feedback, and ideas from the community.
|
|
4
|
+
|
|
5
|
+
## Code of Conduct
|
|
6
|
+
|
|
7
|
+
Be respectful, inclusive, and professional. We're building trust in AI systems together.
|
|
8
|
+
|
|
9
|
+
## How to Contribute
|
|
10
|
+
|
|
11
|
+
### Reporting Issues
|
|
12
|
+
|
|
13
|
+
- **Bugs**: Describe the problem, steps to reproduce, and expected vs. actual behavior
|
|
14
|
+
- **Feature Requests**: Explain the use case and how it benefits the framework
|
|
15
|
+
- **Documentation**: Point out unclear sections or suggest improvements
|
|
16
|
+
|
|
17
|
+
### Making Changes
|
|
18
|
+
|
|
19
|
+
1. **Fork and branch**
|
|
20
|
+
```bash
|
|
21
|
+
git clone https://github.com/YOUR_USERNAME/alethic.git
|
|
22
|
+
cd alethic
|
|
23
|
+
git checkout -b feature/your-feature-name
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
2. **Set up development environment**
|
|
27
|
+
```bash
|
|
28
|
+
pip install -e ".[dev]"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
3. **Make your changes**
|
|
32
|
+
- Keep changes focused and minimal
|
|
33
|
+
- Follow existing code style (implicit via mypy strict mode)
|
|
34
|
+
- Add tests for new functionality
|
|
35
|
+
- Update documentation as needed
|
|
36
|
+
|
|
37
|
+
4. **Run tests and type checking**
|
|
38
|
+
```bash
|
|
39
|
+
pytest tests/ -v
|
|
40
|
+
mypy --strict -p alethic_kernel.alethic -p alethic_kernel.llm -p alethic_kernel.agents -p alethic_kernel.eval -p alethic_kernel.tools
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
5. **Commit with clear messages**
|
|
44
|
+
```bash
|
|
45
|
+
git commit -m "Brief description of change"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
6. **Push and open a pull request**
|
|
49
|
+
```bash
|
|
50
|
+
git push origin feature/your-feature-name
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Pull Request Guidelines
|
|
54
|
+
|
|
55
|
+
- **Title**: Concise, descriptive (e.g., "Add belief TTL validation", "Fix SimulatorWorker condition parsing")
|
|
56
|
+
- **Description**: Explain what changed, why, and any design decisions
|
|
57
|
+
- **Tests**: Include tests for new functionality or bug fixes
|
|
58
|
+
- **Documentation**: Update docs if behavior changes
|
|
59
|
+
- **CI**: All tests and type checks must pass
|
|
60
|
+
|
|
61
|
+
## Development Conventions
|
|
62
|
+
|
|
63
|
+
### Code Style
|
|
64
|
+
|
|
65
|
+
- Use type hints throughout (mypy strict mode is enforced)
|
|
66
|
+
- Use dataclasses for data objects
|
|
67
|
+
- Use `@dataclass` with `from __future__ import annotations`
|
|
68
|
+
- Follow PEP 8
|
|
69
|
+
|
|
70
|
+
### Testing
|
|
71
|
+
|
|
72
|
+
- Write tests in `tests/` with names prefixed `test_`
|
|
73
|
+
- Use fixtures from `tests/conftest.py` where appropriate
|
|
74
|
+
- Target coverage for new code; 349 tests provide a baseline
|
|
75
|
+
|
|
76
|
+
### Documentation
|
|
77
|
+
|
|
78
|
+
- Update docstrings for new public APIs
|
|
79
|
+
- Update relevant `.md` files in `docs/`
|
|
80
|
+
- Keep `README.md` examples working
|
|
81
|
+
- Include architecture rationale for non-obvious design choices
|
|
82
|
+
|
|
83
|
+
## Project Structure
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
alethic/ Core kernel (domain-agnostic)
|
|
87
|
+
agents/ Reference agents (string_glue, json_glue, alethic, llm)
|
|
88
|
+
eval/ Evaluation harness and metrics
|
|
89
|
+
llm/ LLM planner (OpenAI-compatible API client)
|
|
90
|
+
tools/ Simulated tools and perturbations
|
|
91
|
+
tasks/ Task definitions (YAML)
|
|
92
|
+
tests/ Test suite (349 tests)
|
|
93
|
+
docs/ Documentation
|
|
94
|
+
examples/ Multi-episode demo
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Key Areas for Contribution
|
|
98
|
+
|
|
99
|
+
- **New domains**: Create additional example domains beyond Stripe refunds
|
|
100
|
+
- **Store backends**: Implement new `StoreProtocol` implementations (e.g., PostgreSQL)
|
|
101
|
+
- **Workers**: Add specialized worker types for new use cases
|
|
102
|
+
- **Tools**: Expand simulated tool library or create domain-specific tools
|
|
103
|
+
- **Documentation**: Tutorials, examples, deployment guides
|
|
104
|
+
- **Performance**: Optimize kernel operations or store queries
|
|
105
|
+
- **Type safety**: Improve type coverage or migrate from `Any` to specific types
|
|
106
|
+
|
|
107
|
+
## Questions?
|
|
108
|
+
|
|
109
|
+
- Open an issue for discussion
|
|
110
|
+
- Check existing issues and documentation first
|
|
111
|
+
- Link to relevant academic work or external resources when applicable
|
|
112
|
+
|
|
113
|
+
## Acknowledgments
|
|
114
|
+
|
|
115
|
+
Alethic builds on well-established patterns from systems engineering and cognitive science. Key inspirations:
|
|
116
|
+
|
|
117
|
+
- Blackboard architectures (e.g., HEARSAY-II)
|
|
118
|
+
- Evidence-based decision systems
|
|
119
|
+
- Role-based access control in distributed systems
|
|
120
|
+
- Propose-commit protocols in database transactions
|
|
121
|
+
|
|
122
|
+
See [From Fragile Glue to Governed Cognition](https://doi.org/10.5281/zenodo.18691808) for the full scholarly context.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Emil Uzelac
|
|
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,12 @@
|
|
|
1
|
+
# distutils' default sdist glob is `test*.py`, which matches the test modules but
|
|
2
|
+
# not conftest.py, helpers.py or __init__.py -- so the sdist shipped a test suite
|
|
3
|
+
# that could not run (7 collection errors). Anyone packaging from source and
|
|
4
|
+
# running the tests, which is what distro and conda-forge maintainers do, hit it.
|
|
5
|
+
recursive-include tests *.py
|
|
6
|
+
|
|
7
|
+
include LICENSE
|
|
8
|
+
include CHANGELOG.md
|
|
9
|
+
include CONTRIBUTING.md
|
|
10
|
+
include SECURITY.md
|
|
11
|
+
include CODE_OF_CONDUCT.md
|
|
12
|
+
recursive-include docs *.md *.png
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: alethic-kernel
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A governed cognition framework for AI systems
|
|
5
|
+
Author: Emil Uzelac
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/alethicdev/alethic
|
|
8
|
+
Project-URL: Documentation, https://github.com/alethicdev/alethic#documentation
|
|
9
|
+
Project-URL: Repository, https://github.com/alethicdev/alethic.git
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/alethicdev/alethic/issues
|
|
11
|
+
Project-URL: Research Paper, https://doi.org/10.5281/zenodo.18691808
|
|
12
|
+
Keywords: ai,governance,agents,blackboard-kernel,orchestration,safety
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
28
|
+
Requires-Dist: mypy; extra == "dev"
|
|
29
|
+
Requires-Dist: httpx; extra == "dev"
|
|
30
|
+
Provides-Extra: api
|
|
31
|
+
Requires-Dist: fastapi>=0.115; extra == "api"
|
|
32
|
+
Requires-Dist: uvicorn[standard]; extra == "api"
|
|
33
|
+
Requires-Dist: opentelemetry-api; extra == "api"
|
|
34
|
+
Requires-Dist: opentelemetry-sdk; extra == "api"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# Alethic
|
|
38
|
+
|
|
39
|
+
**A governed cognition framework for AI systems.**
|
|
40
|
+
|
|
41
|
+
[](https://doi.org/10.5281/zenodo.18691808)
|
|
42
|
+
|
|
43
|
+
**Your model proposes. Alethic decides.**
|
|
44
|
+
|
|
45
|
+
Alethic is a domain-agnostic governance layer for AI agents. It sits between what an LLM *wants* to do and what it's *allowed* to do — validating every belief, plan, and action against evidence quality, confidence thresholds, and declarative constraints before anything gets committed.
|
|
46
|
+
|
|
47
|
+
The core insight: architectural governance — not model scale — is the primary bottleneck for trustworthy modular AI. An LLM decides *what* to propose; the kernel decides *whether* the proposal meets the evidence standard for commitment.
|
|
48
|
+
|
|
49
|
+
## How It Works
|
|
50
|
+
|
|
51
|
+
<p align="center">
|
|
52
|
+
<!-- Absolute: PyPI renders this README with no repository to resolve a
|
|
53
|
+
relative path against. Safe now that the repo is public — GitHub fetches
|
|
54
|
+
README images anonymously, which is why this had to stay relative before. -->
|
|
55
|
+
<img src="https://raw.githubusercontent.com/alethicdev/alethic/main/docs/architecture.png" alt="Blackboard Kernel Architecture" width="720">
|
|
56
|
+
</p>
|
|
57
|
+
|
|
58
|
+
Seven semantic slots hold all state. Workers read from and write to the kernel using two modes: **PROPOSE** (tentative, must pass validation) and **COMMIT** (finalized). Every proposal passes through the kernel's validation pipelines — stale evidence, missing percepts, constraint violations, and negative predictions all cause rejection, not action.
|
|
59
|
+
|
|
60
|
+
## Quick Start
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install alethic-kernel
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Use as a library
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from alethic_kernel.alethic import AlethicClient
|
|
70
|
+
|
|
71
|
+
client = AlethicClient(mode="local")
|
|
72
|
+
result = client.run_episode(task_inputs={
|
|
73
|
+
"chargeId": "ch_3P0x1A2B3C",
|
|
74
|
+
"customerId": "cus_QXyZ123",
|
|
75
|
+
"customerName": "Ada Lovelace",
|
|
76
|
+
"amount": 4200,
|
|
77
|
+
"disputeReason": "duplicate",
|
|
78
|
+
})
|
|
79
|
+
print(result.metrics) # {'task_success': 1.0, 'unsafe_action': 0.0, ...}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Run the benchmark
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# All agents except LLM (no local model needed)
|
|
86
|
+
python -m alethic_kernel.run --no-llm
|
|
87
|
+
|
|
88
|
+
# Full benchmark (6 tasks, 50 seeds, 4 agents = 1200 episodes)
|
|
89
|
+
python -m alethic_kernel.run
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Start the API server
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pip install "alethic-kernel[api]"
|
|
96
|
+
alethic serve --port 8000
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
> **The HTTP API has no authentication and is not production-ready.** Every
|
|
100
|
+
> endpoint is anonymous and all callers share one kernel, so any client can read
|
|
101
|
+
> and overwrite any other client's state by naming its `trace_id`. Bind it to
|
|
102
|
+
> localhost and treat it as a development and evaluation tool only. The library
|
|
103
|
+
> itself does not carry this limitation.
|
|
104
|
+
|
|
105
|
+
## Benchmark Results
|
|
106
|
+
|
|
107
|
+
To validate the framework, we ran 1,200 episodes (6 tasks, 50 seeds, 4 agents) across Stripe refund tasks with controlled perturbations:
|
|
108
|
+
|
|
109
|
+
| Agent | Task Success | Unsafe Actions | Unsupported Beliefs | Traceability |
|
|
110
|
+
|-------|-------------|----------------|---------------------|--------------|
|
|
111
|
+
| string_glue | 61.3% | 38.7% | 26.0% | 0.10 |
|
|
112
|
+
| json_glue | 57.0% | 43.0% | 31.0% | 0.30 |
|
|
113
|
+
| **alethic** | **100%** | **0%** | **0%** | **1.00** |
|
|
114
|
+
| **llm_bk** | **99.0%** | **0%** | **0%** | **1.00** |
|
|
115
|
+
|
|
116
|
+
The kernel-backed agents (`alethic` and `llm_bk`) achieve **zero unsafe actions** across all perturbation scenarios. Baseline agents act on stale, conflicting, or low-confidence evidence 39-43% of the time. The LLM agent has slightly lower task success (it sometimes declines to act even when safe) but never acts unsafely — the kernel governance is identical regardless of planner.
|
|
117
|
+
|
|
118
|
+
## Documentation
|
|
119
|
+
|
|
120
|
+
- **[Architecture](https://github.com/alethicdev/alethic/blob/main/docs/architecture.md)** — Blackboard kernel design, semantic slots, validation pipelines
|
|
121
|
+
- **[API Reference](https://github.com/alethicdev/alethic/blob/main/docs/api-reference.md)** — Every public class and method with signatures and return codes
|
|
122
|
+
- **[Workers](https://github.com/alethicdev/alethic/blob/main/docs/workers.md)** — Worker protocol, built-in workers, writing custom workers
|
|
123
|
+
- **[HTTP API](https://github.com/alethicdev/alethic/blob/main/docs/http-api.md)** — REST endpoints, AlethicClient SDK, OpenTelemetry
|
|
124
|
+
- **[Benchmark](https://github.com/alethicdev/alethic/blob/main/docs/benchmark.md)** — Tasks, perturbations, metrics, CLI reference
|
|
125
|
+
- **[Deployment](https://github.com/alethicdev/alethic/blob/main/docs/deployment.md)** — Docker, environment variables, store selection, testing
|
|
126
|
+
|
|
127
|
+
## Project Structure
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
alethic/ Core kernel (domain-agnostic)
|
|
131
|
+
kernel.py Blackboard kernel — central orchestrator
|
|
132
|
+
schema.py Record, Provenance, Slot, WriteMode
|
|
133
|
+
validators.py Evidence and symbolic validation
|
|
134
|
+
store.py In-memory store
|
|
135
|
+
sqlite_store.py SQLite-backed persistent store
|
|
136
|
+
orchestrator.py Worker round-robin loop
|
|
137
|
+
sim_worker.py Rule-based forward simulator
|
|
138
|
+
adaptive_worker.py Learns constraints from failure patterns
|
|
139
|
+
session.py Multi-episode session management
|
|
140
|
+
client.py AlethicClient (local + HTTP modes)
|
|
141
|
+
api/ FastAPI server
|
|
142
|
+
agents/ Four agents of increasing sophistication
|
|
143
|
+
string_glue.py Baseline: always acts, no validation
|
|
144
|
+
json_glue.py Adds confidence scores, still always acts
|
|
145
|
+
alethic_agent.py Full kernel with deterministic planner
|
|
146
|
+
llm_agent.py Full kernel with LLM planner
|
|
147
|
+
eval/ Evaluation framework
|
|
148
|
+
harness.py Task x seed x agent runner
|
|
149
|
+
metrics.py 5 safety and traceability metrics
|
|
150
|
+
report.py Markdown report generation
|
|
151
|
+
tools/ Simulated tools with perturbations
|
|
152
|
+
tasks/ 6 Stripe refund task definitions (YAML)
|
|
153
|
+
examples/ Multi-episode demo with adaptive learning
|
|
154
|
+
results/ Benchmark outputs (JSONL + report)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Research Paper
|
|
158
|
+
|
|
159
|
+
The full academic treatment is in [From Fragile Glue to Governed Cognition](https://doi.org/10.5281/zenodo.18691808) — a controlled study of blackboard kernels for modular AI systems. Paper artifact repository: [governed-cognition](https://github.com/emiluzelac/governed-cognition).
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
MIT
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Alethic
|
|
2
|
+
|
|
3
|
+
**A governed cognition framework for AI systems.**
|
|
4
|
+
|
|
5
|
+
[](https://doi.org/10.5281/zenodo.18691808)
|
|
6
|
+
|
|
7
|
+
**Your model proposes. Alethic decides.**
|
|
8
|
+
|
|
9
|
+
Alethic is a domain-agnostic governance layer for AI agents. It sits between what an LLM *wants* to do and what it's *allowed* to do — validating every belief, plan, and action against evidence quality, confidence thresholds, and declarative constraints before anything gets committed.
|
|
10
|
+
|
|
11
|
+
The core insight: architectural governance — not model scale — is the primary bottleneck for trustworthy modular AI. An LLM decides *what* to propose; the kernel decides *whether* the proposal meets the evidence standard for commitment.
|
|
12
|
+
|
|
13
|
+
## How It Works
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<!-- Absolute: PyPI renders this README with no repository to resolve a
|
|
17
|
+
relative path against. Safe now that the repo is public — GitHub fetches
|
|
18
|
+
README images anonymously, which is why this had to stay relative before. -->
|
|
19
|
+
<img src="https://raw.githubusercontent.com/alethicdev/alethic/main/docs/architecture.png" alt="Blackboard Kernel Architecture" width="720">
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
Seven semantic slots hold all state. Workers read from and write to the kernel using two modes: **PROPOSE** (tentative, must pass validation) and **COMMIT** (finalized). Every proposal passes through the kernel's validation pipelines — stale evidence, missing percepts, constraint violations, and negative predictions all cause rejection, not action.
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install alethic-kernel
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Use as a library
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from alethic_kernel.alethic import AlethicClient
|
|
34
|
+
|
|
35
|
+
client = AlethicClient(mode="local")
|
|
36
|
+
result = client.run_episode(task_inputs={
|
|
37
|
+
"chargeId": "ch_3P0x1A2B3C",
|
|
38
|
+
"customerId": "cus_QXyZ123",
|
|
39
|
+
"customerName": "Ada Lovelace",
|
|
40
|
+
"amount": 4200,
|
|
41
|
+
"disputeReason": "duplicate",
|
|
42
|
+
})
|
|
43
|
+
print(result.metrics) # {'task_success': 1.0, 'unsafe_action': 0.0, ...}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Run the benchmark
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# All agents except LLM (no local model needed)
|
|
50
|
+
python -m alethic_kernel.run --no-llm
|
|
51
|
+
|
|
52
|
+
# Full benchmark (6 tasks, 50 seeds, 4 agents = 1200 episodes)
|
|
53
|
+
python -m alethic_kernel.run
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Start the API server
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install "alethic-kernel[api]"
|
|
60
|
+
alethic serve --port 8000
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
> **The HTTP API has no authentication and is not production-ready.** Every
|
|
64
|
+
> endpoint is anonymous and all callers share one kernel, so any client can read
|
|
65
|
+
> and overwrite any other client's state by naming its `trace_id`. Bind it to
|
|
66
|
+
> localhost and treat it as a development and evaluation tool only. The library
|
|
67
|
+
> itself does not carry this limitation.
|
|
68
|
+
|
|
69
|
+
## Benchmark Results
|
|
70
|
+
|
|
71
|
+
To validate the framework, we ran 1,200 episodes (6 tasks, 50 seeds, 4 agents) across Stripe refund tasks with controlled perturbations:
|
|
72
|
+
|
|
73
|
+
| Agent | Task Success | Unsafe Actions | Unsupported Beliefs | Traceability |
|
|
74
|
+
|-------|-------------|----------------|---------------------|--------------|
|
|
75
|
+
| string_glue | 61.3% | 38.7% | 26.0% | 0.10 |
|
|
76
|
+
| json_glue | 57.0% | 43.0% | 31.0% | 0.30 |
|
|
77
|
+
| **alethic** | **100%** | **0%** | **0%** | **1.00** |
|
|
78
|
+
| **llm_bk** | **99.0%** | **0%** | **0%** | **1.00** |
|
|
79
|
+
|
|
80
|
+
The kernel-backed agents (`alethic` and `llm_bk`) achieve **zero unsafe actions** across all perturbation scenarios. Baseline agents act on stale, conflicting, or low-confidence evidence 39-43% of the time. The LLM agent has slightly lower task success (it sometimes declines to act even when safe) but never acts unsafely — the kernel governance is identical regardless of planner.
|
|
81
|
+
|
|
82
|
+
## Documentation
|
|
83
|
+
|
|
84
|
+
- **[Architecture](https://github.com/alethicdev/alethic/blob/main/docs/architecture.md)** — Blackboard kernel design, semantic slots, validation pipelines
|
|
85
|
+
- **[API Reference](https://github.com/alethicdev/alethic/blob/main/docs/api-reference.md)** — Every public class and method with signatures and return codes
|
|
86
|
+
- **[Workers](https://github.com/alethicdev/alethic/blob/main/docs/workers.md)** — Worker protocol, built-in workers, writing custom workers
|
|
87
|
+
- **[HTTP API](https://github.com/alethicdev/alethic/blob/main/docs/http-api.md)** — REST endpoints, AlethicClient SDK, OpenTelemetry
|
|
88
|
+
- **[Benchmark](https://github.com/alethicdev/alethic/blob/main/docs/benchmark.md)** — Tasks, perturbations, metrics, CLI reference
|
|
89
|
+
- **[Deployment](https://github.com/alethicdev/alethic/blob/main/docs/deployment.md)** — Docker, environment variables, store selection, testing
|
|
90
|
+
|
|
91
|
+
## Project Structure
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
alethic/ Core kernel (domain-agnostic)
|
|
95
|
+
kernel.py Blackboard kernel — central orchestrator
|
|
96
|
+
schema.py Record, Provenance, Slot, WriteMode
|
|
97
|
+
validators.py Evidence and symbolic validation
|
|
98
|
+
store.py In-memory store
|
|
99
|
+
sqlite_store.py SQLite-backed persistent store
|
|
100
|
+
orchestrator.py Worker round-robin loop
|
|
101
|
+
sim_worker.py Rule-based forward simulator
|
|
102
|
+
adaptive_worker.py Learns constraints from failure patterns
|
|
103
|
+
session.py Multi-episode session management
|
|
104
|
+
client.py AlethicClient (local + HTTP modes)
|
|
105
|
+
api/ FastAPI server
|
|
106
|
+
agents/ Four agents of increasing sophistication
|
|
107
|
+
string_glue.py Baseline: always acts, no validation
|
|
108
|
+
json_glue.py Adds confidence scores, still always acts
|
|
109
|
+
alethic_agent.py Full kernel with deterministic planner
|
|
110
|
+
llm_agent.py Full kernel with LLM planner
|
|
111
|
+
eval/ Evaluation framework
|
|
112
|
+
harness.py Task x seed x agent runner
|
|
113
|
+
metrics.py 5 safety and traceability metrics
|
|
114
|
+
report.py Markdown report generation
|
|
115
|
+
tools/ Simulated tools with perturbations
|
|
116
|
+
tasks/ 6 Stripe refund task definitions (YAML)
|
|
117
|
+
examples/ Multi-episode demo with adaptive learning
|
|
118
|
+
results/ Benchmark outputs (JSONL + report)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Research Paper
|
|
122
|
+
|
|
123
|
+
The full academic treatment is in [From Fragile Glue to Governed Cognition](https://doi.org/10.5281/zenodo.18691808) — a controlled study of blackboard kernels for modular AI systems. Paper artifact repository: [governed-cognition](https://github.com/emiluzelac/governed-cognition).
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT
|