Some checks failed
Choice → Consequence → Learning: - ConsequenceEngine tracks every decision point with alternatives, risk/reward estimates, and actual outcomes - Consequences feed into AdaptiveEthics for experience-based learning - FusionAGILoop now wires ethics + consequences into task lifecycle Causal World Model: - CausalWorldModel learns state-transition patterns from execution history - Predicts outcomes based on observed action→effect patterns - Uncertainty estimates decrease as more evidence accumulates Metacognition: - assess_head_outputs() evaluates reasoning quality from head outputs - Detects knowledge gaps, measures head agreement, identifies uncertainty - Actively recommends whether to seek more information Interpretability: - ReasoningTracer captures full prompt→answer reasoning traces - Each step records stage, component, input/output, timing - explain() generates human-readable reasoning explanations Claim Verification: - ClaimVerifier cross-checks claims for evidence, consistency, grounding - Flags high-confidence claims lacking evidence support - Detects contradictions between claims from different heads 325 tests passing, 0 ruff errors, 0 mypy errors. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
57 lines
1.7 KiB
Python
57 lines
1.7 KiB
Python
"""Audit log schemas for AGI governance."""
|
|
|
|
from datetime import datetime, timezone
|
|
from enum import Enum
|
|
from typing import Any
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
def _utc_now() -> datetime:
|
|
return datetime.now(timezone.utc)
|
|
|
|
|
|
class GovernanceMode(str, Enum):
|
|
"""Governance enforcement mode.
|
|
|
|
ENFORCING: Hard blocks — denied actions are prevented (legacy default).
|
|
ADVISORY: Soft warnings — all actions proceed, violations are logged as
|
|
advisories for learning. The system sees the warning, considers
|
|
it, and makes its own decision. Mistakes become training data.
|
|
"""
|
|
|
|
ENFORCING = "enforcing"
|
|
ADVISORY = "advisory"
|
|
|
|
|
|
class AuditEventType(str, Enum):
|
|
"""Type of auditable event."""
|
|
|
|
DECISION = "decision"
|
|
TOOL_CALL = "tool_call"
|
|
DATA_SOURCE = "data_source"
|
|
STATE_CHANGE = "state_change"
|
|
TASK_SUBMIT = "task_submit"
|
|
TASK_COMPLETE = "task_complete"
|
|
OVERRIDE = "override"
|
|
POLICY_CHECK = "policy_check"
|
|
ADVISORY = "advisory"
|
|
SELF_IMPROVEMENT = "self_improvement"
|
|
ETHICAL_LEARNING = "ethical_learning"
|
|
CHOICE = "choice"
|
|
CONSEQUENCE = "consequence"
|
|
OTHER = "other"
|
|
|
|
|
|
class AuditEntry(BaseModel):
|
|
"""Single audit log entry: every material decision, tool call, source, outcome."""
|
|
|
|
entry_id: str = Field(..., min_length=1)
|
|
event_type: AuditEventType = Field(default=AuditEventType.OTHER)
|
|
actor: str = Field(default="", description="Agent or system component")
|
|
task_id: str | None = Field(default=None)
|
|
action: str = Field(default="")
|
|
payload: dict[str, Any] = Field(default_factory=dict)
|
|
outcome: str = Field(default="")
|
|
timestamp: datetime = Field(default_factory=_utc_now)
|