-
Notifications
You must be signed in to change notification settings - Fork 0
Advisory Layer AI Surfaces
Relevant source files
The following files were used as context for generating this wiki page:
- .gitignore
- cmd/axis/agent.go
- cmd/axis/chat.go
- cmd/axis/command_surface_test.go
- internal/agent/agent.go
- internal/agent/agent_test.go
- internal/agent/confirm.go
- internal/agent/tools.go
- internal/chat/message.go
- internal/daemon/daemon.go
- internal/daemon/daemon_test.go
- internal/mcp/server.go
- internal/mcp/server_tools_test.go
The Advisory Layer (Layer 5) is the highest plane of the AXIS architecture. It provides AI-powered interfaces that consume cluster state to assist operators with inspection, debugging, and task automation.
In accordance with the Truth Rule, this layer is strictly advisory: AI components can read the fact plane and suggest actions, but they never possess inherent execution authority or the ability to override the deterministic state of the cluster internal/agent/agent.go:45-46. Shell and cluster execution tools (run_shell, run_on_node, axis_run_task, remote run_background) pass through the Execution Plane (Layer 4) for placement, reservation, safety scoring, and operator confirmation. File-edit tools use agent-level confirmation and path sandboxing but are not RunGuarded executions.
The Advisory Layer interacts with the system through three primary integration points:
-
Fact Consumption: Surfaces like
axis chatand theAgentconsumeClusterSnapshotandNodeFactsto provide context-aware answers cmd/axis/chat.go:75-78. -
Tooling: The
ToolRegistryprovides the LLM with capabilities to invoke AXIS commands (e.g.,axis_status,axis_place) and local system tools (e.g.,read_file,git_diff) internal/agent/tools.go:113-143. -
Guarded Execution: Approved
run_shell/run_on_node/axis_run_task(and remoterun_background) are routed throughexecution.RunGuarded(or daemon/run) with local or requested-node pin, matchingaxis task runsafety rules. Not every agent tool is a Layer-4 execution (e.g.write_fileuses confirm + sandbox only).
The following diagram bridges the natural language intent of the AI surfaces to the underlying code entities and data structures.
Diagram: Advisory Entity Mapping
graph TD
subgraph "Natural Language Space"
UserIntent["User: 'Why is node-alpha slow?'"]
AgentPrompt["System Prompt: 'You are an AXIS assistant...'"]
end
subgraph "Code Entity Space"
AgentStruct["Agent (internal/agent/agent.go)"]
ToolReg["ToolRegistry (internal/agent/tools.go)"]
Conv["Conversation (internal/chat/message.go)"]
subgraph "Tools"
StatusTool["axis_status (summarizeSnapshot)"]
PlaceTool["axis_place (SelectBestNode)"]
ShellTool["run_shell (RunGuarded)"]
end
end
UserIntent --> AgentStruct
AgentPrompt --> Conv
AgentStruct --> Conv
AgentStruct --> ToolReg
ToolReg --> StatusTool
ToolReg --> PlaceTool
ToolReg --> ShellTool
Sources: internal/agent/agent.go:46-80, internal/agent/tools.go:113-143, internal/chat/message.go:38-41
The Agent is a multi-turn tool-calling loop that orchestrates complex tasks. It manages a Conversation with token-budget awareness and uses a ToolRegistry to interact with the environment.
-
Autonomy Modes: Supports
default,edit, andfullmodes to control the breadth of auto-approval for tool calls internal/agent/agent.go:90. -
Safety Gating: Every risky tool call triggers a
ConfirmFunc, which can prompt the operator foryes/no/always/neverdecisions internal/agent/confirm.go:14-26. - Context Management: Implements "Context Compaction" to truncate old tool results, keeping the conversation within LLM context limits internal/chat/message.go:106-110.
For details, see Agent Framework.
Sources: internal/agent/agent.go:1-122, internal/agent/confirm.go:1-73
The axis chat command provides a cluster-aware REPL. It extends the basic LLM chat with AXIS-specific "Slash Commands" and intelligent networking.
- Intelligent Auto-Routing: Automatically detects if a model is better suited for a remote node and establishes an SSH Tunnel to route inference to that node's local Ollama instance cmd/axis/chat.go:81-97.
-
Slash Commands: Built-in commands like
/status,/facts, and/modelsallow the operator to bypass the LLM and query the fact plane directly cmd/axis/chat.go:52-58. -
Persistence: Conversations are saved to
~/.axis/history/chatto allow resuming sessions cmd/axis/chat.go:109-119.
For details, see Chat Interface.
Sources: cmd/axis/chat.go:33-158
AXIS implements the Model Context Protocol (MCP) to expose cluster state to external AI IDEs (like Cursor or Claude Desktop) and to consume tools from external MCP servers.
-
AXIS MCP Server: Exposes resources like
cluster://snapshotand tools likeplacement_decisionandssh_connectivity_testinternal/mcp/server.go:139-177. -
Event Notifications: Uses the AXIS internal event bus to send
notifications/resources/updatedto MCP clients when the cluster state changes internal/mcp/server.go:117-128. -
MCP Client: The
mcpclient.Registryallows the AXIS Agent to connect to external servers, expanding its toolset beyond the built-in AXIS tools internal/agent/agent.go:121-122.
For details, see MCP Server and Client.
Sources: internal/mcp/server.go:1-137, internal/agent/agent.go:174-185
The HTTP API is the programmatic gateway to the Advisory Layer, used by the axis CLI and external integrations to query the daemon.
-
V1/V2 Routes: Provides endpoints for raw state (
/v2/nodes), diagnostic checks (/doctor), and task execution (/run) internal/daemon/daemon.go:161. - Streaming: Supports NDJSON streaming for execution logs, allowing the Advisory Layer to display real-time progress of remote tasks cmd/axis/agent.go:41-42.
- Advisory Leases: Exposes the reservation ledger so external agents can see committed resources before suggesting new workloads internal/daemon/daemon.go:89.
For details, see HTTP API.
Sources: internal/daemon/daemon.go:159-169, cmd/axis/agent.go:39-47
The following diagram illustrates how a natural language request moves from the Advisory Layer down through the Execution Plane.
Diagram: Advisory Request Lifecycle
sequenceDiagram
participant U as Operator
participant A as Agent (Layer 5)
participant T as ToolRegistry
participant E as Execution Engine (Layer 4)
participant S as Snapshot (Layer 2)
U->>A: "Run a benchmark on the fastest node"
A->>T: call axis_place(description="benchmark")
T->>S: query NodeFacts
S-->>T: returns cluster state
T-->>A: suggests "node-gpu-01"
A->>U: Prompt: "Confirm run_shell on node-gpu-01?"
U->>A: "yes"
A->>E: RunGuarded("ssh node-gpu-01 '...'")
E-->>U: Stream results to terminal
Sources: internal/agent/agent.go:46-80, internal/agent/tools.go:226-250, internal/execution/guarded.go:1-50