docs(minecraft): update README to reflect current perception pipeline and cognitive architecture

Replaces outdated attention-detector/buffer references with EventRegistry + RuleEngine pipeline. Updates Conscious layer to Brain/JS-planner/Query-DSL. Clarifies Action layer components (TaskExecutor, ActionRegistry, Tool Catalog). Revises project structure to match current codebase organization.
This commit is contained in:
Rin
2026-02-18 11:14:46 +08:00
committed by Neko Ayaka
parent aa2d7af17c
commit fca2f9a244
+38 -34
View File
@@ -52,18 +52,18 @@ graph TB
**Location**: `src/cognitive/perception/` **Location**: `src/cognitive/perception/`
The perception layer acts as the sensory input hub, collecting raw signals from Mineflayer and turning them into higher-level, rate-limited perception events. The perception layer acts as the sensory input hub, collecting raw Mineflayer signals and translating them into typed events/signals through an event registry + rule engine pipeline.
**Pipeline**: **Pipeline**:
- Mineflayer listeners collect **raw perception events** (sight/hearing/felt), including distance and line-of-sight when applicable. - Event definitions in `events/definitions/*` bind Mineflayer events to normalized raw events.
- Raw events are queued in a buffer and drained on the cognitive tick. - `EventRegistry` emits `raw:<modality>:<kind>` events to the Cognitive EventBus.
- An attention detector aggregates events via leaky buckets and emits attention/perception events **only on threshold crossing** (e.g. sustained movement, punching, teabagging, interesting sounds). - `RuleEngine` evaluates YAML rules and emits derived `signal:*` events consumed by Reflex/Conscious layers.
**Key files**: **Key files**:
- `mineflayer-perception-collector.ts` - `events/index.ts`
- `raw-events.ts` - `events/definitions/*`
- `raw-event-buffer.ts` - `rules/engine.ts`
- `attention-detector.ts` - `rules/*.yaml`
- `pipeline.ts` - `pipeline.ts`
### Layer B: Reflex ### Layer B: Reflex
@@ -83,10 +83,10 @@ The reflex layer handles immediate, instinctive reactions. It operates on a fini
The conscious layer handles complex reasoning, planning, and high-level decision-making. No physical execution happens here anymore. The conscious layer handles complex reasoning, planning, and high-level decision-making. No physical execution happens here anymore.
**Components**: **Components**:
- **Orchestrator**: Coordinates "Thinking" vs "Chatting" tasks. - **Brain** (`brain.ts`): Event queue orchestration, LLM turn lifecycle, safety/budget guards, debug REPL integration.
- **Task Manager**: Manages concurrent Primary (Physical) and Secondary (Mental) tasks. - **JavaScript Planner** (`js-planner.ts`): Sandboxed planning/runtime execution against exposed tools/globals.
- **Planning Agent**: pure LLM reasoning to generate plans. - **Query Runtime** (`query-dsl.ts`): Read-only world/inventory/entity query helpers for planner scripts.
- **Chat Agent**: Generates natural language responses. - **Task State** (`task-state.ts`): Cancellation token and task lifecycle primitives used by action execution.
### Layer D: Action ### Layer D: Action
@@ -95,8 +95,9 @@ The conscious layer handles complex reasoning, planning, and high-level decision
The action layer is responsible for the actual execution of tasks in the world. It isolates "Doing" from "Thinking". The action layer is responsible for the actual execution of tasks in the world. It isolates "Doing" from "Thinking".
**Components**: **Components**:
- **Task Executor**: Receives a `Plan` and executes it step-by-step. Handles retry logic and errors. - **Task Executor** (`task-executor.ts`): Runs normalized action instructions and emits action lifecycle events.
- **Action Agent**: The interface to low-level Mineflayer skills (move, place, break). - **Action Registry** (`action-registry.ts`): Validates params and dispatches tool calls.
- **Tool Catalog** (`llm-actions.ts`): Action/tool definitions and schemas bound to mineflayer skills.
### 🔄 Event Flow Example ### 🔄 Event Flow Example
@@ -109,11 +110,11 @@ Player: "build a house"
[Conscious] Architect plans the structure [Conscious] Architect plans the structure
[Action] Executor takes the plan and manages the construction loop: [Action] Executor takes the plan and manages the construction loop:
- Step 1: Collect wood (calls ActionAgent) - Step 1: Collect wood (calls ActionRegistry tool)
- Step 2: Craft planks - Step 2: Craft planks
- Step 3: Build walls - Step 3: Build walls
[Conscious] ChatAgent confirms completion: "House is ready!" [Conscious] Brain confirms completion: "House is ready!"
``` ```
### 📁 Project Structure ### 📁 Project Structure
@@ -121,41 +122,44 @@ Player: "build a house"
``` ```
src/ src/
├── cognitive/ # 🧠 Perception → Reflex → Conscious → Action ├── cognitive/ # 🧠 Perception → Reflex → Conscious → Action
│ ├── perception/ # Event ingestion │ ├── perception/ # Event definitions + rule evaluation
│ │ ├── mineflayer-perception-collector.ts │ │ ├── events/
│ │ ├── raw-events.ts │ │ │ ├── index.ts
│ │ ├── raw-event-buffer.ts │ │ │ └── definitions/*
│ │ ├── attention-detector.ts │ │ ├── rules/
│ │ │ ├── *.yaml
│ │ │ ├── engine.ts
│ │ │ ├── loader.ts
│ │ │ └── matcher.ts
│ │ └── pipeline.ts │ │ └── pipeline.ts
│ ├── reflex/ # Fast, rule-based reactions │ ├── reflex/ # Fast, rule-based reactions
│ │ ── reflex-manager.ts │ │ ── reflex-manager.ts
│ │ ├── runtime.ts
│ │ ├── context.ts
│ │ └── behaviors/idle-gaze.ts
│ ├── conscious/ # LLM-powered reasoning │ ├── conscious/ # LLM-powered reasoning
│ │ ├── blackboard.ts # Shared working memory
│ │ ├── brain.ts # Core reasoning loop/orchestration │ │ ├── brain.ts # Core reasoning loop/orchestration
│ │ ├── completion.ts # LLM completion helper │ │ ├── js-planner.ts # JS planning sandbox
│ │ ├── handler.ts # Routes stimuli into the brain │ │ ├── query-dsl.ts # Read-only query runtime
│ │ ├── task-manager.ts # Manages concurrent tasks │ │ ├── llm-log.ts # Turn/log query helpers
│ │ ├── task-state.ts # Task lifecycle enums/helpers │ │ ├── task-state.ts # Task lifecycle enums/helpers
│ │ └── prompts/ # Prompt definitions (e.g., brain-prompt.ts) │ │ └── prompts/ # Prompt definitions (e.g., brain-prompt.ts)
│ ├── action/ # Task execution layer │ ├── action/ # Task execution layer
│ │ ├── task-executor.ts # Executes planned steps with retries │ │ ├── task-executor.ts # Executes actions and emits lifecycle events
│ │ ├── action-registry.ts # Tool dispatch + schema validation
│ │ ├── llm-actions.ts # Tool catalog
│ │ └── types.ts │ │ └── types.ts
│ ├── os/ # EventBus + tracing core
│ ├── container.ts # Dependency injection wiring │ ├── container.ts # Dependency injection wiring
│ ├── index.ts # Cognitive system entrypoint │ ├── index.ts # Cognitive system entrypoint
│ └── types.ts # Shared cognitive types │ └── types.ts # Shared cognitive types
├── agents/ # Specialized agents
│ ├── action/ # Low-level actuator bridge
│ ├── planning/ # Goal planner (LLM)
│ ├── chat/ # Conversational responses
│ └── memory/ # Memory-related helpers
├── libs/ ├── libs/
│ └── mineflayer/ # Mineflayer bot wrapper/adapters │ └── mineflayer/ # Mineflayer bot wrapper/adapters
├── skills/ # Atomic bot capabilities ├── skills/ # Atomic bot capabilities
├── composables/ # Reusable functions (config, etc.) ├── composables/ # Reusable functions (config, etc.)
├── plugins/ # Mineflayer/bot plugins ├── plugins/ # Mineflayer/bot plugins
├── web/ # Debug web dashboard ├── debug/ # Debug web dashboard + MCP bridge
├── utils/ # Helpers ├── utils/ # Helpers
├── debug-server.ts # Local debug server entry
└── main.ts # Bot entrypoint └── main.ts # Bot entrypoint
``` ```