Skip to content

Aegis

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

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.

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.

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]]”

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.

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.

list_policies(self) -> list[dict[str, Any]]

Section titled “list_policies(self) -> list[dict[str, Any]]”