You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A layered decision architecture for intelligent behavior in a real-time 3D world.
10
10
11
+
> Compass is a cleaned public case study of a real autonomous agent architecture originally developed against a legacy 3D MMORPG emulator.
12
+
>
13
+
> This repository is intentionally published as an architecture reference and proof of work, not as a turnkey botting tool, live client integration package, or runnable game-automation release. The focus here is the system design: perception, decision-making, routines, navigation, learning, observability, and real session telemetry.
14
+
15
+
## What This Repo Is
16
+
17
+
- A modern Python implementation of a layered real-time agent architecture
18
+
- A systems case study built against a noisy, high-pressure 3D sandbox
19
+
- A reference for control-loop design, rule systems, utility scoring, GOAP planning, navigation, and learned adaptation
20
+
- A record of real decision traces, forensics, plans, and session outputs from the underlying private system
21
+
22
+
## What This Repo Is Not
23
+
24
+
- A ready-to-run bot
25
+
- A packaged live integration for the target game client
26
+
- A dump of private configs, assets, or operational glue
27
+
- A turnkey automation release intended for direct operational use
28
+
29
+
Compass treats a legacy MMORPG as a demanding autonomy sandbox rather than as the point of the project. The interesting problem is not the game itself; it is the combination of partial observability, noisy state, real-time interruption, 3D navigation, competing goals, social threat, and long-horizon autonomy.
30
+
31
+
The public release preserves the architecture, model code, test strategy, and representative telemetry from that system. It is meant to be read, inspected, and evaluated as a systems architecture project.
- Read [docs/architecture.md](docs/architecture.md) for the execution model and subsystem boundaries
40
+
- Read [docs/design-decisions.md](docs/design-decisions.md) for the rationale behind the main architectural choices
41
+
- Browse [docs/samples/](docs/samples/) for real decision traces, GOAP plans, forensics dumps, and session telemetry
42
+
- Run `just check` to verify the public codebase, tests, typing, and linting
43
+
- Start with [`src/perception/state.py`](src/perception/state.py), [`src/brain/decision.py`](src/brain/decision.py), and [`src/brain/runner/loop.py`](src/brain/runner/loop.py) to understand the core loop
44
+
15
45
Compass defines a control architecture for agents that must perceive, decide, and navigate a 3D open world in real time. Live world state flows through a forward-only pipeline that separates perception, decision-making, routines, and movement, while a typed world model gives each layer a shared view of the world.
16
46
17
47
Decision-making is layered by design. Priority rules enforce the safety envelope, utility scoring ranks immediate choices, and goal-oriented planning coordinates multi-step behavior across time. Routines execute those decisions without blocking and remain interruptible under threat. Encounter history, spatial memory, and navigation over parsed world geometry help the agent adapt and plan in an unpredictable environment.
18
48
19
49
A legacy 3D MMORPG emulator provided the demanding sandbox that forced this architecture to evolve: partial observability, noisy state, spatial hazard, resource pressure, and constant interruption. What began as reactive rules and state-machine routines grew into a layered system that preserves survival guarantees while adding learned adaptation and anticipatory planning. The result is an architecture shaped by the demands of the world it was built in.
20
50
21
-
The system operates autonomously in multi-hour sessions. In [recorded sessions](docs/samples/learned-encounter-data.md), average fight duration for a given entity type dropped from 29.5s to 15.9s as encounter history accumulated, session grades improved from B to A, and operational parameters auto-tuned from defaults. See [docs/samples/](docs/samples/) for full session telemetry: [decision traces](docs/samples/decision-trace.md), [GOAP plans with cost tracking](docs/samples/goap-planner.md), [forensic ring buffer dumps](docs/samples/forensics-ring-buffer.md), and [4-tier log output](docs/samples/session-tiers.md) from live sessions.
51
+
In the underlying private system, this architecture operated autonomously in multi-hour sessions. In [recorded sessions](docs/samples/learned-encounter-data.md), average fight duration for a given entity type dropped from 29.5s to 15.9s as encounter history accumulated, session grades improved from B to A, and operational parameters auto-tuned from defaults. See [docs/samples/](docs/samples/) for full session telemetry: [decision traces](docs/samples/decision-trace.md), [GOAP plans with cost tracking](docs/samples/goap-planner.md), [forensic ring buffer dumps](docs/samples/forensics-ring-buffer.md), and [4-tier log output](docs/samples/session-tiers.md) from live sessions.
A legacy 3D MMORPG emulator concentrates most of the hard problems in autonomous agent design into a single domain:
225
255
@@ -236,7 +266,7 @@ A legacy 3D MMORPG emulator concentrates most of the hard problems in autonomous
236
266
237
267
## Reading the Code
238
268
239
-
Start with [`perception/state.py`](src/perception/state.py): the frozen `GameState`and `SpawnData` dataclasses that every layer depends on. Then [`brain/decision.py`](src/brain/decision.py): the coordinator that evaluates rules and manages routine lifecycles. Pick any rule module in [`brain/rules/`](src/brain/rules/) to see how conditions and score functions are written. The GOAP planner lives in [`brain/goap/planner.py`](src/brain/goap/planner.py). Combat strategies are in [`routines/strategies/`](src/routines/strategies/).
269
+
After the top-level overview, read by subsystem. Start with any rule module in [`brain/rules/`](src/brain/rules/) to see how conditions and score functions are written. Then inspect [`brain/goap/planner.py`](src/brain/goap/planner.py) for goal-directed sequencing, [`brain/world/model.py`](src/brain/world/model.py) for derived world intelligence, and [`brain/runner/loop.py`](src/brain/runner/loop.py) for the 10 Hz execution path. Combat strategies live in [`routines/strategies/`](src/routines/strategies/).
240
270
241
271
For architecture details beyond the README, see [`docs/architecture.md`](docs/architecture.md). For design rationale, [`docs/design-decisions.md`](docs/design-decisions.md). For the full evolutionary arc, [`docs/evolution.md`](docs/evolution.md).
> **Note:** This repository is an architecture and implementation reference. Running the full system requires the target environment and supporting assets described in the docs. This is a cleaned extraction from a private working repo; the evolution described in [docs/evolution.md](docs/evolution.md) reflects the actual development arc, published here as a single snapshot.
272
-
273
-
---
274
-
275
301
Built with Python 3.14, zero runtime dependencies, and the standard library. See [docs/testing.md](docs/testing.md) for the test strategy and coverage philosophy.
Copy file name to clipboardExpand all lines: docs/retrospective.md
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,8 +97,6 @@ The emulator was the concrete proof point, but this architecture applies to any
97
97
98
98
-**Other game environments**: any application with readable process memory can be perceived the same way. The perception layer is the only part that changes.
99
99
100
-
-**Robotics control loops**: perception -> decision -> action -> motor is the standard robotics architecture. The 10 Hz priority-rule engine, the non-blocking tick contract, and the hysteresis patterns apply directly. GOAP planning with learned cost functions is directly applicable to warehouse robots, delivery drones, and autonomous vehicles.
101
-
102
100
-**Autonomous testing agents**: navigating complex UIs, handling error states, recovering from unexpected conditions. The routine state machine pattern handles multi-step UI flows cleanly.
103
101
104
102
-**Any long-running autonomous system**: the 4-tier logging pipeline, the forensic buffer, and the scorecard system are useful wherever an agent operates unattended and needs post-hoc debugging.
Coverage is measured in CI with `pytest-cov` and enforced with a `fail_under` floor in `pyproject.toml`. The measured surface is ~17.7K of ~22K total source lines (80% of the codebase). Only 7 files are omitted; all require a live game client or game asset files.
20
+
Coverage is measured in CI with `pytest-cov` and enforced with a `fail_under` floor in `pyproject.toml`. The measured surface is the full 20.5K source lines with zero omissions.
19
21
20
22
### What is covered
21
23
@@ -48,21 +50,17 @@ set_backend(recorder)
48
50
49
51
This makes every routine testable without mocking, monkeypatching, or environment access. Tests assert on `recorder.actions` to verify motor commands.
50
52
51
-
### What is omitted (and why)
53
+
### Previously omitted modules
52
54
53
-
The `[tool.coverage.run] omit` list in `pyproject.toml` excludes only modules that require external hardware or binary assets:
55
+
Seven modules that were previously excluded from coverage measurement are now fully measured and tested via mock-based testing:
54
56
55
-
| Omitted path | Reason |
56
-
|---|---|
57
-
|`src/perception/*`| Win32 `ReadProcessMemory`: requires a live game client process |
These 7 files (~4K lines) are validated through runtime invariants, the forensics ring buffer, and session-level observability.
61
+
### Compensating controls for deeply-coupled code
64
62
65
-
### Compensating controls for omitted code
63
+
The remaining uncovered lines are concentrated in multi-phase routine tick handlers (motor-coupled state machines) and the 10 Hz brain runner loop (threading, I/O). These are validated through:
66
64
67
65
1.**Runtime invariants** (`src/util/invariants.py`): assertions that fire during operation and flush diagnostics on violation
68
66
2.**Forensics buffer** (`src/util/forensics.py`): 300-tick ring buffer that dumps to disk on death or crash, providing post-hoc debugging for the perception/routine layers
0 commit comments