-
Notifications
You must be signed in to change notification settings - Fork 0
AI Assistant Commands
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/chat_test.go
- cmd/axis/command_surface_test.go
- cmd/axis/cortex.go
- cmd/axis/dashboard_test.go
- cmd/axis/doctor.go
- cmd/axis/doctor_test.go
- cmd/axis/llm.go
- cmd/axis/llm_test.go
- cmd/axis/mcp.go
- cmd/axis/mesh.go
- cmd/axis/mesh_test.go
- internal/chat/client.go
- internal/chat/models.go
- internal/chat/models_test.go
- internal/chat/wave1_test.go
- internal/cortex/client.go
- internal/cortex/client_test.go
- internal/llmrouter/cloud.go
- internal/llmrouter/cloud_test.go
- internal/llmrouter/models.go
- internal/llmrouter/models_test.go
- internal/llmrouter/registry.go
The Advisory Layer (Layer 5) of the AXIS architecture provides interactive, cluster-aware assistance through a suite of AI-powered commands. These surfaces consume cluster state—such as hardware facts, task history, and placement logic—to provide advisory guidance, natural language interaction, and autonomous problem-solving without ever overriding the underlying "Truth Rule" of the cluster.
The AI surfaces bridge the gap between Natural Language Space and Code Entity Space by integrating with the core AXIS subsystems.
The following diagram illustrates how a user prompt moves through the system to interact with specific code entities.
AI Command Execution Flow
graph TD
User["User Prompt"] -- "axis chat / axis agent" --> CLI["cmd/axis/chat.go / cmd/axis/agent.go"]
CLI -- "InferRequirements()" --> Inf["internal/placement/requirements.go"]
Inf -- "Classify()" --> Router["internal/llmrouter/engine.go"]
Router -- "SelectBestNode()" --> Placement["internal/placement/pipeline.go"]
subgraph "Advisory Plane"
CLI -- "NewConversation()" --> Conv["internal/chat/conversation.go"]
CLI -- "NewClient()" --> Ollama["internal/chat/client.go"]
end
subgraph "Code Entity Space"
Placement -- "uses" --> Snapshot["models.ClusterSnapshot"]
Placement -- "uses" --> State["models.NodeState"]
end
Ollama -- "SSH Tunnel (ForwardLocal)" --> Remote["Remote Node (Ollama API)"]
Sources: cmd/axis/chat.go:81-101, cmd/axis/llm.go:57-71, internal/chat/client.go:1-20
axis chat provides a cluster-aware REPL (Read-Eval-Print Loop) for interacting with local Large Language Models (LLMs). It features intelligent auto-routing, where inference is transparently tunneled to the most capable node in the cluster.
-
Auto-Routing: The command uses
placement.SelectBestNodeto find a node capable of running the requested chat model. If the best node is remote, it establishes an SSH tunnel usingexecutor.ForwardLocalto the remote Ollama API (typically port 11434) cmd/axis/chat.go:81-101. -
Context Injection: It builds a
ClusterSummaryForPromptwhich injects a condensed version of theClusterSnapshotinto the system prompt, allowing the LLM to answer questions about cluster health and topology cmd/axis/chat.go:75-78. -
Slash Commands: Supports in-session commands like
/status,/facts, and/modelto interact with the cluster or change settings without exiting the REPL cmd/axis/chat.go:52-58.
AXIS maintains a hierarchy for selecting models:
-
Explicit Flag:
--modeloverride. -
Configuration:
chat.default_modelinnodes.yaml. -
Discovery:
chat.ResolveDefaultModelprobes the local Ollama instance for installed models and matches them againstrecommendedLocalModels(e.g.,qwen3.5:4b,llama3.1:8b) internal/chat/models.go:52-60, internal/chat/models.go:30-37.
Sources: cmd/axis/chat.go:33-101, internal/chat/models.go:1-60
The axis agent command initializes an autonomous agent.Agent capable of tool-calling. Unlike chat, the agent can execute read-only queries and guarded shell commands to fulfill complex instructions.
The agent uses a ToolRegistry to interact with the cluster. Shell/cluster tools (run_shell, run_on_node, axis_run_task, remote run_background) go through Layer-4 RunGuarded after agent confirmation; file mutations use agent confirmation and a CWD path sandbox. When present, the nearest AGENTS.md is injected into the system prompt as repository instructions.
| Tool Category | Code Entity / Package | Purpose |
|---|---|---|
| Cluster Facts | internal/knowledge |
Access hardware telemetry and node status. |
| Placement | internal/placement |
Explain why a task would run on a specific node. |
| Persistence | internal/chat |
Load/Save conversation history. |
| External | internal/mcpclient |
Connect to third-party Model Context Protocol servers. |
Sources: cmd/axis/agent.go:128-172, cmd/axis/agent.go:174-185
The axis llm command is the entry point for the Semantic Router. It classifies a natural language prompt into a WorkloadClass and derives hardware requirements (TaskRequirements) for the placement engine.
The command uses the llmrouter.Engine to perform classification cmd/axis/llm.go:122-131.
-
Semantic Mode: Uses a local lightweight model (default:
granite3.1-moe:1b) to parse intent cmd/axis/llm.go:107-108. - Reflex Mode: If the LLM is unreachable or times out (default 150ms), it falls back to a deterministic string-matching "reflex" engine cmd/axis/llm.go:113-114, cmd/axis/llm.go:175.
- Cloud Fallback: If configured, AXIS can prompt the user to use a cloud provider (e.g., OpenAI, Anthropic) if local classification fails cmd/axis/llm.go:141.
Sources: cmd/axis/llm.go:93-183, cmd/axis/llm.go:57-71
axis cortex interacts with the Cortex Cluster Brain, an optional coordination layer typically hosted on a node named "foundry" cmd/axis/cortex.go:21-28.
- Distributed Vector Memory: Uses a Qdrant backend to store and "Recall" semantic memories across the cluster internal/cortex/client.go:153-165.
-
Event Bus: Provides a central bus for publishing and retrieving cluster events (e.g.,
test_failure,deploy_start) internal/cortex/client.go:169-200. -
Distributed Locking: Implements
AcquireLockandReleaseLockvia the Cortex MCP server to prevent agent collisions during multi-node operations internal/cortex/client.go:206-210.
Cortex Integration Architecture
graph LR
subgraph "AXIS Node"
Cmd["axis cortex"] -- "JSON-RPC 2.0" --> Client["internal/cortex/Client"]
end
subgraph "Foundry Node (Cortex)"
Client -- "Port 8200" --> MCPServer["Cortex MCP Server"]
MCPServer -- "Recall" --> Qdrant["Qdrant (Port 6333)"]
MCPServer -- "Events" --> Bus["Event Store"]
MCPServer -- "Locking" --> Lock["Lock Manager"]
end
Sources: internal/cortex/client.go:22-62, cmd/axis/cortex.go:44-64
The axis mcp command group allows AXIS to act as either an MCP (Model Context Protocol) server or client.
-
axis mcp serve: Exposes AXIS cluster primitives (snapshot, placement, execution) as tools to external AI editors (like Claude Desktop or Cursor) cmd/axis/command_surface_test.go:137-154. -
Client Integration: The
axis agentcan connect to external MCP servers defined innodes.yamlto extend its own capabilities (e.g., connecting to a GitHub or Google Maps MCP) cmd/axis/agent.go:174-185.
Sources: cmd/axis/command_surface_test.go:54, cmd/axis/agent.go:174-185