Aegis
Overview
Section titled “Overview”Aegis — trust and permissions engine for Nexus. Graduated 0.0-1.0 floating-point trust with asymmetric outcome adjustment. Trust tiers: OBSERVER, ADVISOR, MONITOR, EXECUTOR, AUTONOMOUS.
- Version:
0.1.0 - Class:
Aegis
set_pulse(self, pulse: Any) -> None
Section titled “set_pulse(self, pulse: Any) -> None”Attach the kernel Pulse bus so gate/trust events stream live.
Optional: when unset (CLI, unit tests) Aegis behaves exactly as before — Chronicle remains the durable record.
init_db(self) -> None
Section titled “init_db(self) -> None”set_policy(self, module: str, allowed: bool = True, network: bool = False, initial_trust: float | None = None) -> None
Section titled “set_policy(self, module: str, allowed: bool = True, network: bool = False, initial_trust: float | None = None) -> None”check(self, module: str, action: str) -> None
Section titled “check(self, module: str, action: str) -> None”is_network_allowed(self, module: str) -> bool
Section titled “is_network_allowed(self, module: str) -> bool”record_outcome(self, module: str, success: bool) -> float
Section titled “record_outcome(self, module: str, success: bool) -> float”Adjust trust based on outcome. Returns the new score.
get_trust(self, module: str) -> float
Section titled “get_trust(self, module: str) -> float”get_tier(self, module: str) -> str
Section titled “get_tier(self, module: str) -> str”revoke(self, module: str) -> None
Section titled “revoke(self, module: str) -> None”Immediately set trust to 0.0, drop every grant, and log the revocation.
This is the kill switch behind Settings -> Security. It collapses grants as
well as trust — without that, _decide_capability would keep allowing any
capability the agent already held a grant for, because grants are consulted
before trust is read.
get_trust_history(self, module: str, limit: int = 100) -> list[dict[str, Any]]
Section titled “get_trust_history(self, module: str, limit: int = 100) -> list[dict[str, Any]]”can_suggest(self, module: str) -> bool
Section titled “can_suggest(self, module: str) -> bool”can_monitor(self, module: str) -> bool
Section titled “can_monitor(self, module: str) -> bool”can_execute(self, module: str) -> bool
Section titled “can_execute(self, module: str) -> bool”is_autonomous(self, module: str) -> bool
Section titled “is_autonomous(self, module: str) -> bool”register_manifest(self, manifest: Manifest) -> None
Section titled “register_manifest(self, manifest: Manifest) -> None”Register an agent’s manifest so check_capability can read it.
get_manifest(self, slug: str) -> Manifest | None
Section titled “get_manifest(self, slug: str) -> Manifest | None”grant(self, agent_slug: str, capability: str, workspace_id: str | None = None) -> None
Section titled “grant(self, agent_slug: str, capability: str, workspace_id: str | None = None) -> None”Record an explicit user grant. workspace_id=None means global.
revoke_grant(self, agent_slug: str, capability: str | None = None, workspace_id: str | None = None) -> None
Section titled “revoke_grant(self, agent_slug: str, capability: str | None = None, workspace_id: str | None = None) -> None”Revoke one capability or, if capability is None, all grants for this agent in this scope.
Renamed from revoke to avoid colliding with the existing one-arg
revoke(module) which resets trust to 0.0.
set_trust(self, agent_slug: str, score: float) -> None
Section titled “set_trust(self, agent_slug: str, score: float) -> None”Set an agent’s trust score directly (admin/testing). Clamped to [0,1].
If the new score falls below 0.50, all in-memory grants for the
agent are revoked and a trust_collapse event is logged.
check_capability(self, agent_slug: str, capability: str, workspace_id: str | None = None) -> CapabilityDecision
Section titled “check_capability(self, agent_slug: str, capability: str, workspace_id: str | None = None) -> CapabilityDecision”Gate a capability and stream the resolution as a kernel.gate event.
fs(self, agent_slug: str, path)
Section titled “fs(self, agent_slug: str, path)”Mediated file access for an agent.
Returns an open file handle (context manager) or raises PermissionDenied. Logs every call to Chronicle.
set_rate_limit(self, agent_slug: str, per_minute: int) -> None
Section titled “set_rate_limit(self, agent_slug: str, per_minute: int) -> None”async network(self, agent_slug: str, url: str)
Section titled “async network(self, agent_slug: str, url: str)”Outbound HTTP for an agent. Returns an httpx.Response.
Raises PermissionDenied if the agent’s manifest doesn’t declare the URL’s domain, if the user hasn’t granted it, if the agent is over its rate limit, or if Aegis is otherwise denying.