# maa1999/m9a architecture

> Architecture diagram of the GitHub repository maa1999/m9a, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maa1999/m9a
- Repository: https://github.com/maa1999/m9a

## Overview

M9A is a MaaFramework-driven game automation assistant. Its principal workflow starts an agent runtime, registers custom automation components, and uses image recognition and simulated controls to carry out game tasks. The README lists a broad set of task capabilities, represented here by feature families because most individual action implementations were not sampled. The graph also shows resource versioning and hot updates as a supporting runtime layer. Feature-family paths identify their exact source directory; detailed dispatch wiring is not visible in the excerpts.

Main entry points: [`agent/agent_runtime.py`](https://github.com/maa1999/m9a/blob/main/agent/agent_runtime.py) (Agent lifecycle), [`agent/custom/__init__.py`](https://github.com/maa1999/m9a/blob/main/agent/custom/__init__.py) (Custom registration), [`agent/custom/action/combat.py`](https://github.com/maa1999/m9a/blob/main/agent/custom/action/combat.py) (Combat farming), [`agent/utils/manifest_checker.py`](https://github.com/maa1999/m9a/blob/main/agent/utils/manifest_checker.py) (Manifest checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Agent runtime"]
  node_main["Agent entry<br/>[main.py]"]
  node_runtime_core["Agent lifecycle<br/>[agent_runtime.py]"]
  node_custom_registry["Custom registration<br/>[__init__.py]"]
end

subgraph group_features["Game automation"]
  node_daily["Daily tasks"]
  node_combat["Combat farming<br/>[combat.py]"]
  node_promotion["Promotion navigation<br/>[auto_promotion.py]"]
  node_trail["Trail recognition<br/>[auto_trail.py]"]
  node_events["Event automation"]
  node_syndrome["Silence event"]
  node_general_reco["General recognition<br/>[general.py]"]
  node_shared_reco["Combat recognition<br/>[combat.py]"]
end

subgraph group_support["Runtime support"]
  node_manifest["Manifest checks"]
  node_updater["Resource updater"]
  node_http["HTTP session<br/>[http_session.py]"]
  node_runtime_paths["Runtime paths<br/>[runtime_paths.py]"]
  node_params["Parameter parsing<br/>[params.py]"]
  node_maa_types["Recognition types<br/>[maa_types.py]"]
  node_logger["Logging<br/>[logger.py]"]
end

node_user(("User / client"))
node_maa["MaaFramework"]

node_main -->|"calls"| node_runtime_core
node_runtime_core -->|"registers"| node_custom_registry
node_runtime_core -->|"starts agent"| node_maa
node_custom_registry -->|"registers actions"| node_daily
node_custom_registry -->|"registers recognitions"| node_general_reco
node_custom_registry -->|"registers recognitions"| node_shared_reco
node_maa -.->|"invokes task"| node_combat
node_maa -.->|"invokes recognition"| node_promotion
node_combat -->|"uses recognition"| node_shared_reco
node_promotion -->|"resets state"| node_trail
node_syndrome -->|"runs recognition"| node_maa
node_runtime_core -->|"checks resources"| node_manifest
node_runtime_core -->|"requests updates"| node_updater
node_manifest -->|"uses session"| node_http
node_updater -->|"uses session"| node_http
node_manifest -->|"uses paths"| node_runtime_paths
node_updater -->|"uses paths"| node_runtime_paths
node_combat -->|"parses parameters"| node_params
node_combat -->|"uses result types"| node_maa_types

click node_main "https://github.com/maa1999/m9a/blob/main/agent/main.py"
click node_runtime_core "https://github.com/maa1999/m9a/blob/main/agent/agent_runtime.py"
click node_custom_registry "https://github.com/maa1999/m9a/blob/main/agent/custom/__init__.py"
click node_daily "https://github.com/maa1999/m9a/tree/main/agent/custom/action"
click node_combat "https://github.com/maa1999/m9a/blob/main/agent/custom/action/combat.py"
click node_promotion "https://github.com/maa1999/m9a/blob/main/agent/custom/reco/auto_promotion.py"
click node_trail "https://github.com/maa1999/m9a/blob/main/agent/custom/reco/auto_trail.py"
click node_events "https://github.com/maa1999/m9a/tree/main/agent/custom/action"
click node_syndrome "https://github.com/maa1999/m9a/blob/main/agent/custom/action/syndrome_of_silence.py"
click node_general_reco "https://github.com/maa1999/m9a/blob/main/agent/custom/reco/general.py"
click node_shared_reco "https://github.com/maa1999/m9a/blob/main/agent/custom/reco/combat.py"
click node_manifest "https://github.com/maa1999/m9a/blob/main/agent/utils/manifest_checker.py"
click node_updater "https://github.com/maa1999/m9a/blob/main/agent/utils/resource_updater.py"
click node_http "https://github.com/maa1999/m9a/blob/main/agent/utils/http_session.py"
click node_runtime_paths "https://github.com/maa1999/m9a/blob/main/agent/utils/runtime_paths.py"
click node_params "https://github.com/maa1999/m9a/blob/main/agent/utils/params.py"
click node_maa_types "https://github.com/maa1999/m9a/blob/main/agent/utils/maa_types.py"
click node_logger "https://github.com/maa1999/m9a/blob/main/agent/utils/logger.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_runtime_core,node_custom_registry,node_user toneBlue
class node_daily,node_combat,node_promotion,node_trail,node_events,node_syndrome,node_general_reco,node_shared_reco toneAmber
class node_manifest,node_updater,node_http,node_runtime_paths,node_params,node_maa_types,node_logger toneMint
class node_maa toneIndigo
```

## Components

### Agent runtime

- [Agent entry](https://github.com/maa1999/m9a/blob/main/agent/main.py): `agent/main.py`
- [Agent lifecycle](https://github.com/maa1999/m9a/blob/main/agent/agent_runtime.py): `agent/agent_runtime.py`
- [Custom registration](https://github.com/maa1999/m9a/blob/main/agent/custom/__init__.py): `agent/custom/__init__.py`

### Game automation

- [Daily tasks](https://github.com/maa1999/m9a/tree/main/agent/custom/action): `agent/custom/action`
- [Combat farming](https://github.com/maa1999/m9a/blob/main/agent/custom/action/combat.py): `agent/custom/action/combat.py`
- [Promotion navigation](https://github.com/maa1999/m9a/blob/main/agent/custom/reco/auto_promotion.py): `agent/custom/reco/auto_promotion.py`
- [Trail recognition](https://github.com/maa1999/m9a/blob/main/agent/custom/reco/auto_trail.py): `agent/custom/reco/auto_trail.py`
- [Event automation](https://github.com/maa1999/m9a/tree/main/agent/custom/action): `agent/custom/action`
- [Silence event](https://github.com/maa1999/m9a/blob/main/agent/custom/action/syndrome_of_silence.py): `agent/custom/action/syndrome_of_silence.py`
- [General recognition](https://github.com/maa1999/m9a/blob/main/agent/custom/reco/general.py): `agent/custom/reco/general.py`
- [Combat recognition](https://github.com/maa1999/m9a/blob/main/agent/custom/reco/combat.py): `agent/custom/reco/combat.py`

### Runtime support

- [Manifest checks](https://github.com/maa1999/m9a/blob/main/agent/utils/manifest_checker.py): `agent/utils/manifest_checker.py`
- [Resource updater](https://github.com/maa1999/m9a/blob/main/agent/utils/resource_updater.py): `agent/utils/resource_updater.py`
- [HTTP session](https://github.com/maa1999/m9a/blob/main/agent/utils/http_session.py): `agent/utils/http_session.py`
- [Runtime paths](https://github.com/maa1999/m9a/blob/main/agent/utils/runtime_paths.py): `agent/utils/runtime_paths.py`
- [Parameter parsing](https://github.com/maa1999/m9a/blob/main/agent/utils/params.py): `agent/utils/params.py`
- [Recognition types](https://github.com/maa1999/m9a/blob/main/agent/utils/maa_types.py): `agent/utils/maa_types.py`
- [Logging](https://github.com/maa1999/m9a/blob/main/agent/utils/logger.py): `agent/utils/logger.py`

### Other components

- **User / client**
- **MaaFramework**

## Connections

- Agent entry → Agent lifecycle: calls (evidence: `agent/main.py`)
- Agent lifecycle → Custom registration: registers (evidence: `agent/agent_runtime.py`)
- Agent lifecycle → MaaFramework: starts agent (evidence: `agent/agent_runtime.py`)
- Custom registration → Daily tasks: registers actions (evidence: `agent/custom/__init__.py`)
- Custom registration → General recognition: registers recognitions (evidence: `agent/custom/__init__.py`)
- Custom registration → Combat recognition: registers recognitions (evidence: `agent/custom/__init__.py`)
- MaaFramework → Combat farming: invokes task
- MaaFramework → Promotion navigation: invokes recognition
- Combat farming → Combat recognition: uses recognition (evidence: `agent/custom/action/combat.py`)
- Promotion navigation → Trail recognition: resets state (evidence: `agent/custom/reco/auto_promotion.py`)
- Silence event → MaaFramework: runs recognition (evidence: `agent/custom/action/syndrome_of_silence.py`)
- Agent lifecycle → Manifest checks: checks resources (evidence: `agent/agent_runtime.py`)
- Agent lifecycle → Resource updater: requests updates (evidence: `agent/agent_runtime.py`)
- Manifest checks → HTTP session: uses session (evidence: `agent/utils/manifest_checker.py`)
- Resource updater → HTTP session: uses session (evidence: `agent/utils/resource_updater.py`)
- Manifest checks → Runtime paths: uses paths (evidence: `agent/utils/manifest_checker.py`)
- Resource updater → Runtime paths: uses paths (evidence: `agent/utils/resource_updater.py`)
- Combat farming → Parameter parsing: parses parameters (evidence: `agent/custom/action/combat.py`)
- Combat farming → Recognition types: uses result types (evidence: `agent/custom/action/combat.py`)
