# bamr87/bashcrawl architecture

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

- Interactive diagram: https://gitdiagram.com/bamr87/bashcrawl
- Repository: https://github.com/bamr87/bashcrawl

## Overview

Bashcrawl teaches POSIX terminal skills through a filesystem dungeon, with a browser trainer documented as a second way to play. The tree exposes TermForge, the terminal framework behind the game and monitoring demos, plus a Python playtest harness that drives a real Bash session in a sandbox and scores content gaps. The browser application and dungeon content are not present in this tree, so their internal runtime stages cannot be mapped here; the documented browser capabilities are noted without inventing implementation links.

Main entry points: [`termforge/node/index.js`](https://github.com/bamr87/bashcrawl/blob/main/termforge/node/index.js) (Node framework API), [`termforge/core/shell.js`](https://github.com/bamr87/bashcrawl/blob/main/termforge/core/shell.js) (Shell kernel), [`src/playtest/harness.py`](https://github.com/bamr87/bashcrawl/blob/main/src/playtest/harness.py) (Playtest harness), [`termforge/node/host-tty.js`](https://github.com/bamr87/bashcrawl/blob/main/termforge/node/host-tty.js) (TTY host)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_apps["TermForge apps"]
  node_game["Bashcrawl game<br/>[bashcrawl.js]"]
  node_procwatch["Procwatch<br/>[index.js]"]
  node_agentwatch["Agentwatch<br/>[index.js]"]
  node_gem["Daemon Storm<br/>[gem.js]"]
end

subgraph group_runtime["Shell runtime"]
  node_kernel["Shell kernel<br/>[shell.js]"]
  node_parser["Command parser<br/>[parser.js]"]
  node_posix["POSIX commands<br/>[posix.js]"]
  node_state["Shell state<br/>[state.js]"]
  node_vfs["Virtual filesystem<br/>[vfs.js]"]
  node_hooks["Shell hooks<br/>[hooks.js]"]
  node_registry["Command registry<br/>[registry.js]"]
  node_art["Terminal art<br/>[art.js]"]
  node_motion["ASCII motion<br/>[ascii-motion.js]"]
  node_input["Input handling<br/>[input.js]"]
  node_session["Session controller<br/>[session.js]"]
end

subgraph group_hosts["Terminal hosts"]
  node_nodeapi["Node framework API<br/>[index.js]"]
  node_tty["TTY host<br/>[host-tty.js]"]
  node_telnet["Telnet host<br/>[host-telnet.js]"]
  node_tui["Terminal UI<br/>[tui.js]"]
  node_pixels["Pixel buffer<br/>[pixels.js]"]
end

subgraph group_playtest["Playtest harness"]
  node_bashsession["Bash session<br/>[bash_session.py]"]
  node_sandbox["Game sandbox<br/>[sandbox.py]"]
  node_harness["Playtest harness<br/>[harness.py]"]
  node_context["Play context<br/>[context.py]"]
  node_recorder["Event recorder<br/>[recorder.py]"]
  node_mcp["MCP server<br/>[mcp_server.py]"]
  node_scorer["Gap scorer<br/>[scorer.py]"]
end

node_player(("Player"))
node_agent(("AI playtest agent"))
node_browser["Browser trainer"]

node_player -->|"plays"| node_game
node_player -->|"plays"| node_browser
node_game -->|"creates sessions"| node_kernel
node_game -->|"loads framework"| node_nodeapi
node_procwatch -->|"creates shell"| node_nodeapi
node_agentwatch -->|"creates shell"| node_nodeapi
node_kernel -->|"parses commands"| node_parser
node_kernel -->|"uses filesystem"| node_vfs
node_kernel -->|"uses state"| node_state
node_kernel -->|"runs hooks"| node_hooks
node_kernel -->|"uses registry"| node_registry
node_kernel -->|"uses motion"| node_motion
node_kernel -->|"uses art"| node_art
node_posix -->|"parses input"| node_parser
node_nodeapi -->|"exports shell"| node_kernel
node_nodeapi -->|"exports commands"| node_posix
node_nodeapi -->|"exports state"| node_state
node_nodeapi -->|"exports filesystem"| node_vfs
node_nodeapi -->|"exports hooks"| node_hooks
node_nodeapi -->|"exports registry"| node_registry
node_nodeapi -->|"exports input"| node_input
node_nodeapi -->|"exports sessions"| node_session
node_tty -->|"loads framework"| node_nodeapi
node_tty -->|"uses interface"| node_tui
node_tty -->|"hosts game"| node_game
node_tty -->|"hosts monitor"| node_procwatch
node_tty -->|"hosts dashboard"| node_agentwatch
node_tui -->|"reads input"| node_input
node_gem -->|"renders pixels"| node_pixels
node_telnet -.->|"hosts apps"| node_nodeapi
node_agent -->|"plays through"| node_mcp
node_mcp -.->|"provides tools"| node_harness
node_harness -->|"creates sandbox"| node_sandbox
node_harness -->|"drives session"| node_bashsession
node_harness -->|"builds context"| node_context
node_harness -->|"records events"| node_recorder
node_bashsession -->|"runs in"| node_sandbox
node_harness -.->|"scores gaps"| node_scorer

click node_game "https://github.com/bamr87/bashcrawl/blob/main/termforge/apps/bashcrawl.js"
click node_procwatch "https://github.com/bamr87/bashcrawl/blob/main/termforge/apps/procwatch/index.js"
click node_agentwatch "https://github.com/bamr87/bashcrawl/blob/main/termforge/apps/agentwatch/index.js"
click node_gem "https://github.com/bamr87/bashcrawl/blob/main/termforge/node/gem.js"
click node_kernel "https://github.com/bamr87/bashcrawl/blob/main/termforge/core/shell.js"
click node_parser "https://github.com/bamr87/bashcrawl/blob/main/termforge/core/parser.js"
click node_posix "https://github.com/bamr87/bashcrawl/blob/main/termforge/core/packs/posix.js"
click node_state "https://github.com/bamr87/bashcrawl/blob/main/termforge/core/state.js"
click node_vfs "https://github.com/bamr87/bashcrawl/blob/main/termforge/core/vfs.js"
click node_hooks "https://github.com/bamr87/bashcrawl/blob/main/termforge/core/hooks.js"
click node_registry "https://github.com/bamr87/bashcrawl/blob/main/termforge/core/registry.js"
click node_art "https://github.com/bamr87/bashcrawl/blob/main/termforge/core/art.js"
click node_motion "https://github.com/bamr87/bashcrawl/blob/main/termforge/core/ascii-motion.js"
click node_input "https://github.com/bamr87/bashcrawl/blob/main/termforge/core/input.js"
click node_session "https://github.com/bamr87/bashcrawl/blob/main/termforge/core/session.js"
click node_nodeapi "https://github.com/bamr87/bashcrawl/blob/main/termforge/node/index.js"
click node_tty "https://github.com/bamr87/bashcrawl/blob/main/termforge/node/host-tty.js"
click node_telnet "https://github.com/bamr87/bashcrawl/blob/main/termforge/node/host-telnet.js"
click node_tui "https://github.com/bamr87/bashcrawl/blob/main/termforge/node/tui.js"
click node_pixels "https://github.com/bamr87/bashcrawl/blob/main/termforge/node/pixels.js"
click node_bashsession "https://github.com/bamr87/bashcrawl/blob/main/src/playtest/bash_session.py"
click node_sandbox "https://github.com/bamr87/bashcrawl/blob/main/src/playtest/sandbox.py"
click node_harness "https://github.com/bamr87/bashcrawl/blob/main/src/playtest/harness.py"
click node_context "https://github.com/bamr87/bashcrawl/blob/main/src/playtest/context.py"
click node_recorder "https://github.com/bamr87/bashcrawl/blob/main/src/playtest/recorder.py"
click node_mcp "https://github.com/bamr87/bashcrawl/blob/main/src/playtest/mcp_server.py"
click node_scorer "https://github.com/bamr87/bashcrawl/blob/main/src/playtest/scorer.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_game,node_procwatch,node_agentwatch,node_gem,node_browser toneBlue
class node_kernel,node_parser,node_posix,node_state,node_vfs,node_hooks,node_registry,node_art,node_motion,node_input,node_session toneAmber
class node_nodeapi,node_tty,node_telnet,node_tui,node_pixels toneMint
class node_bashsession,node_sandbox,node_harness,node_context,node_recorder,node_mcp,node_scorer toneRose
class node_player,node_agent toneIndigo
```

## Components

### TermForge apps

- [Bashcrawl game](https://github.com/bamr87/bashcrawl/blob/main/termforge/apps/bashcrawl.js): `termforge/apps/bashcrawl.js`
- [Procwatch](https://github.com/bamr87/bashcrawl/blob/main/termforge/apps/procwatch/index.js): `termforge/apps/procwatch/index.js`
- [Agentwatch](https://github.com/bamr87/bashcrawl/blob/main/termforge/apps/agentwatch/index.js): `termforge/apps/agentwatch/index.js`
- [Daemon Storm](https://github.com/bamr87/bashcrawl/blob/main/termforge/node/gem.js): `termforge/node/gem.js`

### Shell runtime

- [Shell kernel](https://github.com/bamr87/bashcrawl/blob/main/termforge/core/shell.js): `termforge/core/shell.js`
- [Command parser](https://github.com/bamr87/bashcrawl/blob/main/termforge/core/parser.js): `termforge/core/parser.js`
- [POSIX commands](https://github.com/bamr87/bashcrawl/blob/main/termforge/core/packs/posix.js): `termforge/core/packs/posix.js`
- [Shell state](https://github.com/bamr87/bashcrawl/blob/main/termforge/core/state.js): `termforge/core/state.js`
- [Virtual filesystem](https://github.com/bamr87/bashcrawl/blob/main/termforge/core/vfs.js): `termforge/core/vfs.js`
- [Shell hooks](https://github.com/bamr87/bashcrawl/blob/main/termforge/core/hooks.js): `termforge/core/hooks.js`
- [Command registry](https://github.com/bamr87/bashcrawl/blob/main/termforge/core/registry.js): `termforge/core/registry.js`
- [Terminal art](https://github.com/bamr87/bashcrawl/blob/main/termforge/core/art.js): `termforge/core/art.js`
- [ASCII motion](https://github.com/bamr87/bashcrawl/blob/main/termforge/core/ascii-motion.js): `termforge/core/ascii-motion.js`
- [Input handling](https://github.com/bamr87/bashcrawl/blob/main/termforge/core/input.js): `termforge/core/input.js`
- [Session controller](https://github.com/bamr87/bashcrawl/blob/main/termforge/core/session.js): `termforge/core/session.js`

### Terminal hosts

- [Node framework API](https://github.com/bamr87/bashcrawl/blob/main/termforge/node/index.js): `termforge/node/index.js`
- [TTY host](https://github.com/bamr87/bashcrawl/blob/main/termforge/node/host-tty.js): `termforge/node/host-tty.js`
- [Telnet host](https://github.com/bamr87/bashcrawl/blob/main/termforge/node/host-telnet.js): `termforge/node/host-telnet.js`
- [Terminal UI](https://github.com/bamr87/bashcrawl/blob/main/termforge/node/tui.js): `termforge/node/tui.js`
- [Pixel buffer](https://github.com/bamr87/bashcrawl/blob/main/termforge/node/pixels.js): `termforge/node/pixels.js`

### Playtest harness

- [Bash session](https://github.com/bamr87/bashcrawl/blob/main/src/playtest/bash_session.py): `src/playtest/bash_session.py`
- [Game sandbox](https://github.com/bamr87/bashcrawl/blob/main/src/playtest/sandbox.py): `src/playtest/sandbox.py`
- [Playtest harness](https://github.com/bamr87/bashcrawl/blob/main/src/playtest/harness.py): `src/playtest/harness.py`
- [Play context](https://github.com/bamr87/bashcrawl/blob/main/src/playtest/context.py): `src/playtest/context.py`
- [Event recorder](https://github.com/bamr87/bashcrawl/blob/main/src/playtest/recorder.py): `src/playtest/recorder.py`
- [MCP server](https://github.com/bamr87/bashcrawl/blob/main/src/playtest/mcp_server.py): `src/playtest/mcp_server.py`
- [Gap scorer](https://github.com/bamr87/bashcrawl/blob/main/src/playtest/scorer.py): `src/playtest/scorer.py`

### Other components

- **Player**
- **AI playtest agent**
- **Browser trainer**

## Connections

- Player → Bashcrawl game: plays (evidence: `README.md`)
- Player → Browser trainer: plays (evidence: `README.md`)
- Bashcrawl game → Shell kernel: creates sessions (evidence: `termforge/apps/bashcrawl.js`)
- Bashcrawl game → Node framework API: loads framework (evidence: `termforge/apps/bashcrawl.js`)
- Procwatch → Node framework API: creates shell (evidence: `termforge/apps/procwatch/index.js`)
- Agentwatch → Node framework API: creates shell (evidence: `termforge/apps/agentwatch/index.js`)
- Shell kernel → Command parser: parses commands (evidence: `termforge/core/shell.js`)
- Shell kernel → Virtual filesystem: uses filesystem (evidence: `termforge/core/shell.js`)
- Shell kernel → Shell state: uses state (evidence: `termforge/core/shell.js`)
- Shell kernel → Shell hooks: runs hooks (evidence: `termforge/core/shell.js`)
- Shell kernel → Command registry: uses registry (evidence: `termforge/core/shell.js`)
- Shell kernel → ASCII motion: uses motion (evidence: `termforge/core/shell.js`)
- Shell kernel → Terminal art: uses art (evidence: `termforge/core/shell.js`)
- POSIX commands → Command parser: parses input (evidence: `termforge/core/packs/posix.js`)
- Node framework API → Shell kernel: exports shell (evidence: `termforge/node/index.js`)
- Node framework API → POSIX commands: exports commands (evidence: `termforge/node/index.js`)
- Node framework API → Shell state: exports state (evidence: `termforge/node/index.js`)
- Node framework API → Virtual filesystem: exports filesystem (evidence: `termforge/node/index.js`)
- Node framework API → Shell hooks: exports hooks (evidence: `termforge/node/index.js`)
- Node framework API → Command registry: exports registry (evidence: `termforge/node/index.js`)
- Node framework API → Input handling: exports input (evidence: `termforge/node/index.js`)
- Node framework API → Session controller: exports sessions (evidence: `termforge/node/index.js`)
- TTY host → Node framework API: loads framework (evidence: `termforge/node/host-tty.js`)
- TTY host → Terminal UI: uses interface (evidence: `termforge/node/host-tty.js`)
- TTY host → Bashcrawl game: hosts game
- TTY host → Procwatch: hosts monitor
- TTY host → Agentwatch: hosts dashboard
- Terminal UI → Input handling: reads input (evidence: `termforge/node/tui.js`)
- Daemon Storm → Pixel buffer: renders pixels (evidence: `termforge/node/gem.js`)
- Telnet host → Node framework API: hosts apps (evidence: `README.md`)
- AI playtest agent → MCP server: plays through (evidence: `README.md`)
- MCP server → Playtest harness: provides tools (evidence: `README.md`)
- Playtest harness → Game sandbox: creates sandbox (evidence: `src/playtest/harness.py`)
- Playtest harness → Bash session: drives session (evidence: `src/playtest/harness.py`)
- Playtest harness → Play context: builds context (evidence: `src/playtest/harness.py`)
- Playtest harness → Event recorder: records events (evidence: `src/playtest/harness.py`)
- Bash session → Game sandbox: runs in (evidence: `src/playtest/bash_session.py`)
- Playtest harness → Gap scorer: scores gaps (evidence: `README.md`)
