> For the complete documentation index, see [llms.txt](https://docs.neko.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.neko.fun/architecture/core-architecture.md).

# Core Architecture

{% stepper %}
{% step %}

### The Coordination Layer (Orchestrator Agent)

* Sitting at the heart of the swarm, the **Neko Orchestrator Agent** acts as the central brain. It receives parsed user intent from the Interaction Layer and formulates a strategic plan for execution.
* It coordinates tasks, manages state, and delegates specific actions to specialized agents within the Execution Layer. It also interfaces with external partner APIs like **Hypurr Bot** or **pvp.trade** where necessary.
  {% endstep %}

{% step %}

### The Intelligence Layer (AI Core)

This layer provides the cognitive power enabling Neko’s intelligent decision-making. It comprises:

* **Advanced Context Engineering:** the multi-agent system gets both historical and real-time market data from third-party protocols via a combination of proprietary subgraphs, APIs, and the cadence mechanism. This allows the agent to execute upon financial alpha as actionable signals populate into the context window of the multi-agent system.
* **AI Memory & Retrieval (RAG/CAG):** Neko utilizes **Retrieval-Augmented Generation (RAG)** to fetch real-time data, contextual information, and semantic knowledge from vector databases (Vector DB / Semantic Memory). **Cache-Augmented Generation (CAG)** leverages heuristics and frequently accessed data (like agent transaction history or optimized parameters) for efficient decision-making. This allows agents to recall past actions and learn effective strategies. *(Refer to Image 2 for AI Agent System detail).*
* **Proprietary Models:** Machine Learning models (e.g., **LSTM, ARIMA, Prophet, GNNs**) analyze market data, predict trends, assess risk, and optimize strategies.
  * Future Development
* **Reinforcement Learning (RL):** Models are continuously refined through feedback loops (potentially using techniques like DPO), allowing the system to adapt and improve its execution and risk management over time.
  * Future Development
    {% endstep %}

{% step %}

### The Execution Layer (DeFi Multiagent System & Contracts)

* This layer translates the Orchestrator’s plan into on-chain actions.
* **Specialized Agents (Architect Agents / RIG Agents / Neko Bots):** These agents possess specific capabilities, such as executing trades via optimal routing (Shogun architecture), managing assets within yield vaults (**Neko Vaults**), handling complex collateralization for perpetuals, or interacting directly with specific HyperEVM protocols (**LST, Lending, CDP, AMMs**) and the Hyperliquid L1 orderbook via their respective APIs. They employ multi-step workflows involving planning and tool-calling.
* **Smart Contracts:** Secure and audited smart contracts form the bedrock for holding user assets and executing specific, predefined DeFi logic on HyperEVM.
  * The `Vault` & `VaultFactory` contracts are derived from Morpho Vault V2 and are identical in the implementation
  * `UniversalAdapter` & `UniversalAdapterFactory` are custom contracts to enhance programability and flexibility of the vault contracts. Read (audits) to read the security reviews.
    {% endstep %}

{% step %}

### The Interaction Layer (Social Agents) — Future Development

* This is the primary user touchpoint. Users interact with Neko via simple commands or natural language mentions on familiar social platforms like **X, Discord, and Telegram**.
* This social agent is an Eliza Agent and will serve as an alpha distillation agent (think AIXBT for Hyperliquid) as well as an ad network.

Example social action:

* Compose this tweet: @neko\_hl gneko — this will send a link to the application for users to start trading
  {% endstep %}
  {% endstepper %}
