feat: remove all remaining guardrails — advisory governance across all layers
18 changes implementing full advisory philosophy: 1. Safety Head prompt: prevention mandate → advisory observation 2. Native Reasoning: Safety claims conditional on actual risk signals 3. File Tool: path scope advisory (log + proceed) 4. HTTP Tool: SSRF protection advisory (log + proceed) 5. File Size Cap: configurable (default unlimited) 6. PII Detection: integrated with AdaptiveEthics 7. Embodiment: force limit advisory (log, don't clamp) 8. Embodiment: workspace bounds advisory (log, don't reject) 9. API Rate Limiter: advisory (log, don't hard 429) 10. MAA Gate: GovernanceMode.ADVISORY default 11. Physics Authority: safety factor advisory, not hard reject 12. Self-Model: evolve_value() for experience-based value evolution 13. Ethical Lesson: weight unclamped for full dynamic range 14. ConsequenceEngine: adaptive risk_memory_window 15. Cross-Head Learning: shared InsightBus between heads 16. World Model: self-modification prediction 17. Persistent memory: file-backed learning store 18. Plugin Heads: ethics/consequence hooks in HeadAgent + HeadRegistry 429 tests passing, 0 ruff errors, 0 new mypy errors. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
This commit is contained in:
@@ -98,6 +98,38 @@ class HeadAgent(BaseAgent):
|
||||
self._system_prompt = system_prompt
|
||||
self._adapter = adapter
|
||||
self._reasoning_provider = reasoning_provider
|
||||
self._ethics_hooks: list[Any] = []
|
||||
self._consequence_hooks: list[Any] = []
|
||||
|
||||
def on_ethical_feedback(self, feedback: dict[str, Any]) -> None:
|
||||
"""Receive ethical feedback from the adaptive ethics engine.
|
||||
|
||||
Custom heads can override this to learn from ethical outcomes.
|
||||
|
||||
Args:
|
||||
feedback: Dict with action_type, outcome_positive, weight, etc.
|
||||
"""
|
||||
for hook in self._ethics_hooks:
|
||||
hook(feedback)
|
||||
|
||||
def on_consequence(self, consequence: dict[str, Any]) -> None:
|
||||
"""Receive consequence data from the consequence engine.
|
||||
|
||||
Custom heads can override this to learn from action outcomes.
|
||||
|
||||
Args:
|
||||
consequence: Dict with choice_id, outcome_positive, surprise_factor, etc.
|
||||
"""
|
||||
for hook in self._consequence_hooks:
|
||||
hook(consequence)
|
||||
|
||||
def add_ethics_hook(self, hook: Any) -> None:
|
||||
"""Register a callback for ethical feedback events."""
|
||||
self._ethics_hooks.append(hook)
|
||||
|
||||
def add_consequence_hook(self, hook: Any) -> None:
|
||||
"""Register a callback for consequence events."""
|
||||
self._consequence_hooks.append(hook)
|
||||
|
||||
def handle_message(self, envelope: AgentMessageEnvelope) -> AgentMessageEnvelope | None:
|
||||
"""On head_request, produce HeadOutput and return head_output envelope."""
|
||||
|
||||
Reference in New Issue
Block a user