Compare commits
1 Commits
fix/671
...
fix/671-pl
| Author | SHA1 | Date | |
|---|---|---|---|
| 27f2752528 |
296
GENOME.md
296
GENOME.md
@@ -1,209 +1,141 @@
|
||||
# GENOME.md — the-nexus
|
||||
# GENOME.md — Timmy_Foundation/timmy-home
|
||||
|
||||
Generated by `pipelines/codebase_genome.py`.
|
||||
|
||||
## Project Overview
|
||||
|
||||
`the-nexus` is a hybrid repo that combines three layers in one codebase:
|
||||
Timmy Foundation's home repository for development operations and configurations.
|
||||
|
||||
1. A browser-facing world shell rooted in `index.html`, `boot.js`, `bootstrap.mjs`, `app.js`, `style.css`, `portals.json`, `vision.json`, `manifest.json`, and `gofai_worker.js`
|
||||
2. A Python realtime bridge centered on `server.py` plus harness code under `nexus/`
|
||||
3. A memory / fleet / operator layer spanning `mempalace/`, `mcp_servers/`, `multi_user_bridge.py`, and supporting scripts
|
||||
- Text files indexed: 3004
|
||||
- Source and script files: 186
|
||||
- Test files: 28
|
||||
- Documentation files: 701
|
||||
|
||||
The repo is not a clean single-purpose frontend and not just a backend harness. It is a mixed world/runtime/ops repository where browser rendering, WebSocket telemetry, MCP-driven game harnesses, and fleet memory tooling coexist.
|
||||
|
||||
Grounded repo facts from this checkout:
|
||||
- Browser shell files exist at repo root: `index.html`, `app.js`, `style.css`, `manifest.json`, `gofai_worker.js`
|
||||
- Data/config files also live at repo root: `portals.json`, `vision.json`
|
||||
- Realtime bridge exists in `server.py`
|
||||
- Game harnesses exist in `nexus/morrowind_harness.py` and `nexus/bannerlord_harness.py`
|
||||
- Memory/fleet sync exists in `mempalace/tunnel_sync.py`
|
||||
- Desktop/game automation MCP servers exist in `mcp_servers/desktop_control_server.py` and `mcp_servers/steam_info_server.py`
|
||||
- Validation exists in `tests/test_browser_smoke.py`, `tests/test_portals_json.py`, `tests/test_index_html_integrity.py`, and `tests/test_repo_truth.py`
|
||||
|
||||
The current architecture is best understood as a sovereign world shell plus operator/game harness backend, with accumulated documentation drift from multiple restoration and migration efforts.
|
||||
|
||||
## Architecture Diagram
|
||||
## Architecture
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
browser[Index HTML Shell\nindex.html -> boot.js -> bootstrap.mjs -> app.js]
|
||||
assets[Root Assets\nstyle.css\nmanifest.json\ngofai_worker.js]
|
||||
data[World Data\nportals.json\nvision.json]
|
||||
ws[Realtime Bridge\nserver.py\nWebSocket broadcast hub]
|
||||
gofai[In-browser GOFAI\nSymbolicEngine\nNeuroSymbolicBridge\nsetupGOFAI/updateGOFAI]
|
||||
harnesses[Python Harnesses\nnexus/morrowind_harness.py\nnexus/bannerlord_harness.py]
|
||||
mcp[MCP Adapters\nmcp_servers/desktop_control_server.py\nmcp_servers/steam_info_server.py]
|
||||
memory[Memory + Fleet\nmempalace/tunnel_sync.py\nmempalace.js]
|
||||
bridge[Operator / MUD Bridge\nmulti_user_bridge.py\ncommands/timmy_commands.py]
|
||||
tests[Verification\ntests/test_browser_smoke.py\ntests/test_portals_json.py\ntests/test_repo_truth.py]
|
||||
docs[Contracts + Drift Docs\nBROWSER_CONTRACT.md\nREADME.md\nCLAUDE.md\nINVESTIGATION_ISSUE_1145.md]
|
||||
|
||||
browser --> assets
|
||||
browser --> data
|
||||
browser --> gofai
|
||||
browser --> ws
|
||||
harnesses --> mcp
|
||||
harnesses --> ws
|
||||
bridge --> ws
|
||||
memory --> ws
|
||||
tests --> browser
|
||||
tests --> data
|
||||
tests --> docs
|
||||
docs --> browser
|
||||
repo_root["repo"]
|
||||
angband["angband"]
|
||||
briefings["briefings"]
|
||||
config["config"]
|
||||
conftest["conftest"]
|
||||
evennia["evennia"]
|
||||
evennia_tools["evennia_tools"]
|
||||
evolution["evolution"]
|
||||
gemini_fallback_setup["gemini-fallback-setup"]
|
||||
heartbeat["heartbeat"]
|
||||
infrastructure["infrastructure"]
|
||||
repo_root --> angband
|
||||
repo_root --> briefings
|
||||
repo_root --> config
|
||||
repo_root --> conftest
|
||||
repo_root --> evennia
|
||||
repo_root --> evennia_tools
|
||||
```
|
||||
|
||||
## Entry Points and Data Flow
|
||||
## Entry Points
|
||||
|
||||
### Primary entry points
|
||||
- `gemini-fallback-setup.sh` — operational script (`bash gemini-fallback-setup.sh`)
|
||||
- `morrowind/hud.sh` — operational script (`bash morrowind/hud.sh`)
|
||||
- `pipelines/codebase_genome.py` — python main guard (`python3 pipelines/codebase_genome.py`)
|
||||
- `scripts/auto_restart_agent.sh` — operational script (`bash scripts/auto_restart_agent.sh`)
|
||||
- `scripts/backup_pipeline.sh` — operational script (`bash scripts/backup_pipeline.sh`)
|
||||
- `scripts/big_brain_manager.py` — operational script (`python3 scripts/big_brain_manager.py`)
|
||||
- `scripts/big_brain_repo_audit.py` — operational script (`python3 scripts/big_brain_repo_audit.py`)
|
||||
- `scripts/codebase_genome_nightly.py` — operational script (`python3 scripts/codebase_genome_nightly.py`)
|
||||
- `scripts/detect_secrets.py` — operational script (`python3 scripts/detect_secrets.py`)
|
||||
- `scripts/dynamic_dispatch_optimizer.py` — operational script (`python3 scripts/dynamic_dispatch_optimizer.py`)
|
||||
- `scripts/emacs-fleet-bridge.py` — operational script (`python3 scripts/emacs-fleet-bridge.py`)
|
||||
- `scripts/emacs-fleet-poll.sh` — operational script (`bash scripts/emacs-fleet-poll.sh`)
|
||||
|
||||
- `index.html` — root browser entry point
|
||||
- `boot.js` — startup selector; `tests/boot.test.js` shows it chooses file-mode vs HTTP/module-mode and injects `bootstrap.mjs` when served over HTTP
|
||||
- `bootstrap.mjs` — module bootstrap for the browser shell
|
||||
- `app.js` — main browser runtime; owns world state, GOFAI wiring, metrics polling, and portal/UI logic
|
||||
- `server.py` — WebSocket broadcast bridge on `ws://0.0.0.0:8765`
|
||||
- `nexus/morrowind_harness.py` — GamePortal/MCP harness for OpenMW Morrowind
|
||||
- `nexus/bannerlord_harness.py` — GamePortal/MCP harness for Bannerlord
|
||||
- `mempalace/tunnel_sync.py` — pulls remote fleet closets into the local palace over HTTP
|
||||
- `multi_user_bridge.py` — HTTP bridge for multi-user chat/session integration
|
||||
- `mcp_servers/desktop_control_server.py` — stdio MCP server exposing screenshots/mouse/keyboard control
|
||||
## Data Flow
|
||||
|
||||
### Data flow
|
||||
|
||||
1. Browser startup begins at `index.html`
|
||||
2. `boot.js` decides whether the page is being served correctly; in HTTP mode it injects `bootstrap.mjs`
|
||||
3. `bootstrap.mjs` hands off to `app.js`
|
||||
4. `app.js` loads world configuration from `portals.json` and `vision.json`
|
||||
5. `app.js` constructs the Three.js scene and in-browser reasoning components, including `SymbolicEngine`, `NeuroSymbolicBridge`, `setupGOFAI()`, and `updateGOFAI()`
|
||||
6. Browser state and external runtimes connect through `server.py`, which broadcasts messages between connected clients
|
||||
7. Python harnesses (`nexus/morrowind_harness.py`, `nexus/bannerlord_harness.py`) spawn MCP subprocesses for desktop control / Steam metadata, capture state, execute actions, and feed telemetry into the Nexus bridge
|
||||
8. Memory/fleet tools like `mempalace/tunnel_sync.py` import remote palace data into local closets, extending what the operator/runtime layers can inspect
|
||||
9. Tests validate both the static browser contract and the higher-level repo-truth/memory contracts
|
||||
|
||||
### Important repo-specific runtime facts
|
||||
|
||||
- `portals.json` is a JSON array of portal/world/operator entries; examples in this checkout include `morrowind`, `bannerlord`, `workshop`, `archive`, `chapel`, and `courtyard`
|
||||
- `server.py` is a plain broadcast hub: clients send messages, the server forwards them to other connected clients
|
||||
- `nexus/morrowind_harness.py` and `nexus/bannerlord_harness.py` both implement a GamePortal pattern with MCP subprocess clients over stdio and WebSocket telemetry uplink
|
||||
- `mempalace/tunnel_sync.py` is not speculative; it is a real client that discovers remote wings, searches remote rooms, and writes `.closet.json` payloads locally
|
||||
1. Operators enter through `gemini-fallback-setup.sh`, `morrowind/hud.sh`, `pipelines/codebase_genome.py`.
|
||||
2. Core logic fans into top-level components: `angband`, `briefings`, `config`, `conftest`, `evennia`, `evennia_tools`.
|
||||
3. Validation is incomplete around `wizards/allegro/home/skills/red-teaming/godmode/scripts/auto_jailbreak.py`, `timmy-local/cache/agent_cache.py`, `wizards/allegro/home/skills/red-teaming/godmode/scripts/parseltongue.py`, so changes there carry regression risk.
|
||||
4. Final artifacts land as repository files, docs, or runtime side effects depending on the selected entry point.
|
||||
|
||||
## Key Abstractions
|
||||
|
||||
### Browser runtime
|
||||
|
||||
- `app.js`
|
||||
- Defines in-browser reasoning/state machinery, including `class SymbolicEngine`, `class NeuroSymbolicBridge`, `setupGOFAI()`, and `updateGOFAI()`
|
||||
- Couples rendering, local symbolic reasoning, metrics polling, and portal/UI logic in one very large root module
|
||||
- `BROWSER_CONTRACT.md`
|
||||
- Acts like an executable architecture contract for the browser surface
|
||||
- Declares required files, DOM IDs, Three.js expectations, provenance rules, and WebSocket expectations
|
||||
|
||||
### Realtime bridge
|
||||
|
||||
- `server.py`
|
||||
- Single hub abstraction: a WebSocket broadcast server maintaining a `clients` set and forwarding messages from one client to the others
|
||||
- This is the seam between browser shell, harnesses, and external telemetry producers
|
||||
|
||||
### GamePortal harness layer
|
||||
|
||||
- `nexus/morrowind_harness.py`
|
||||
- `nexus/bannerlord_harness.py`
|
||||
- Both define MCP client wrappers, `GameState` / `ActionResult`-style data classes, and an Observe-Decide-Act telemetry loop
|
||||
- The harnesses are symmetric enough to be understood as reusable portal adapters with game-specific context injected on top
|
||||
|
||||
### Memory / fleet layer
|
||||
|
||||
- `mempalace/tunnel_sync.py`
|
||||
- Encodes the fleet-memory sync client contract: discover wings, pull broad room queries, write closet files, support dry-run
|
||||
- `mempalace.js`
|
||||
- Minimal browser/Electron bridge to MemPalace commands via `window.electronAPI.execPython(...)`
|
||||
- Important because it shows a second memory integration surface distinct from the Python fleet sync path
|
||||
|
||||
### Operator / interaction bridge
|
||||
|
||||
- `multi_user_bridge.py`
|
||||
- `commands/timmy_commands.py`
|
||||
- These bridge user-facing conversations or MUD/Evennia interactions back into Timmy/Nexus services
|
||||
- `evennia/timmy_world/game.py` — classes `World`:91, `ActionSystem`:421, `TimmyAI`:539, `NPCAI`:550; functions `get_narrative_phase()`:55, `get_phase_transition_event()`:65
|
||||
- `evennia/timmy_world/world/game.py` — classes `World`:19, `ActionSystem`:326, `TimmyAI`:444, `NPCAI`:455; functions none detected
|
||||
- `timmy-world/game.py` — classes `World`:19, `ActionSystem`:349, `TimmyAI`:467, `NPCAI`:478; functions none detected
|
||||
- `wizards/allegro/home/skills/red-teaming/godmode/scripts/auto_jailbreak.py` — classes none detected; functions none detected
|
||||
- `uniwizard/self_grader.py` — classes `SessionGrade`:23, `WeeklyReport`:55, `SelfGrader`:74; functions `main()`:713
|
||||
- `uni-wizard/v3/intelligence_engine.py` — classes `ExecutionPattern`:27, `ModelPerformance`:44, `AdaptationEvent`:58, `PatternDatabase`:69; functions none detected
|
||||
- `scripts/know_thy_father/crossref_audit.py` — classes `ThemeCategory`:30, `Principle`:160, `MeaningKernel`:169, `CrossRefFinding`:178; functions `extract_themes_from_text()`:192, `parse_soul_md()`:206, `parse_kernels()`:264, `cross_reference()`:296, `generate_report()`:440, `main()`:561
|
||||
- `timmy-local/cache/agent_cache.py` — classes `CacheStats`:28, `LRUCache`:52, `ResponseCache`:94, `ToolCache`:205; functions none detected
|
||||
|
||||
## API Surface
|
||||
|
||||
### Browser / static surface
|
||||
- CLI: `bash gemini-fallback-setup.sh` — operational script (`gemini-fallback-setup.sh`)
|
||||
- CLI: `bash morrowind/hud.sh` — operational script (`morrowind/hud.sh`)
|
||||
- CLI: `python3 pipelines/codebase_genome.py` — python main guard (`pipelines/codebase_genome.py`)
|
||||
- CLI: `bash scripts/auto_restart_agent.sh` — operational script (`scripts/auto_restart_agent.sh`)
|
||||
- CLI: `bash scripts/backup_pipeline.sh` — operational script (`scripts/backup_pipeline.sh`)
|
||||
- CLI: `python3 scripts/big_brain_manager.py` — operational script (`scripts/big_brain_manager.py`)
|
||||
- CLI: `python3 scripts/big_brain_repo_audit.py` — operational script (`scripts/big_brain_repo_audit.py`)
|
||||
- CLI: `python3 scripts/codebase_genome_nightly.py` — operational script (`scripts/codebase_genome_nightly.py`)
|
||||
- Python: `get_narrative_phase()` from `evennia/timmy_world/game.py:55`
|
||||
- Python: `get_phase_transition_event()` from `evennia/timmy_world/game.py:65`
|
||||
- Python: `main()` from `uniwizard/self_grader.py:713`
|
||||
|
||||
- `index.html` served over HTTP
|
||||
- `boot.js` exports `bootPage()`; verified by `node --test tests/boot.test.js`
|
||||
- Data APIs are file-based inside the repo: `portals.json`, `vision.json`, `manifest.json`
|
||||
## Test Coverage Report
|
||||
|
||||
### Network/runtime surface
|
||||
- Source and script files inspected: 186
|
||||
- Test files inspected: 28
|
||||
- Coverage gaps:
|
||||
- `wizards/allegro/home/skills/red-teaming/godmode/scripts/auto_jailbreak.py` — no matching test reference detected
|
||||
- `timmy-local/cache/agent_cache.py` — no matching test reference detected
|
||||
- `wizards/allegro/home/skills/red-teaming/godmode/scripts/parseltongue.py` — no matching test reference detected
|
||||
- `twitter-archive/multimodal_pipeline.py` — no matching test reference detected
|
||||
- `wizards/allegro/home/skills/red-teaming/godmode/scripts/godmode_race.py` — no matching test reference detected
|
||||
- `skills/productivity/google-workspace/scripts/google_api.py` — no matching test reference detected
|
||||
- `wizards/allegro/home/skills/productivity/google-workspace/scripts/google_api.py` — no matching test reference detected
|
||||
- `morrowind/pilot.py` — no matching test reference detected
|
||||
- `morrowind/mcp_server.py` — no matching test reference detected
|
||||
- `skills/research/domain-intel/scripts/domain_intel.py` — no matching test reference detected
|
||||
- `wizards/allegro/home/skills/research/domain-intel/scripts/domain_intel.py` — no matching test reference detected
|
||||
- `timmy-local/scripts/ingest.py` — no matching test reference detected
|
||||
|
||||
- `python3 server.py`
|
||||
- Starts the WebSocket bridge on port `8765`
|
||||
- `python3 l402_server.py`
|
||||
- Local HTTP microservice for cost-estimate style responses
|
||||
- `python3 multi_user_bridge.py`
|
||||
- Multi-user HTTP/chat bridge
|
||||
## Security Audit Findings
|
||||
|
||||
### Harness / operator CLI surfaces
|
||||
- [medium] `briefings/briefing_20260325.json:37` — hardcoded http endpoint: plaintext or fixed HTTP endpoints can drift or leak across environments. Evidence: `"gitea_error": "Gitea 404: {\"errors\":null,\"message\":\"not found\",\"url\":\"http://143.198.27.163:3000/api/swagger\"}\n [http://143.198.27.163:3000/api/v1/repos/Timmy_Foundation/sovereign-orchestration/issues?state=open&type=issues&sort=created&direction=desc&limit=1&page=1]",`
|
||||
- [medium] `briefings/briefing_20260328.json:11` — hardcoded http endpoint: plaintext or fixed HTTP endpoints can drift or leak across environments. Evidence: `"provider_base_url": "http://localhost:8081/v1",`
|
||||
- [medium] `briefings/briefing_20260329.json:11` — hardcoded http endpoint: plaintext or fixed HTTP endpoints can drift or leak across environments. Evidence: `"provider_base_url": "http://localhost:8081/v1",`
|
||||
- [medium] `config.yaml:37` — hardcoded http endpoint: plaintext or fixed HTTP endpoints can drift or leak across environments. Evidence: `summary_base_url: http://localhost:11434/v1`
|
||||
- [medium] `config.yaml:47` — hardcoded http endpoint: plaintext or fixed HTTP endpoints can drift or leak across environments. Evidence: `base_url: 'http://localhost:11434/v1'`
|
||||
- [medium] `config.yaml:52` — hardcoded http endpoint: plaintext or fixed HTTP endpoints can drift or leak across environments. Evidence: `base_url: 'http://localhost:11434/v1'`
|
||||
- [medium] `config.yaml:57` — hardcoded http endpoint: plaintext or fixed HTTP endpoints can drift or leak across environments. Evidence: `base_url: 'http://localhost:11434/v1'`
|
||||
- [medium] `config.yaml:62` — hardcoded http endpoint: plaintext or fixed HTTP endpoints can drift or leak across environments. Evidence: `base_url: 'http://localhost:11434/v1'`
|
||||
- [medium] `config.yaml:67` — hardcoded http endpoint: plaintext or fixed HTTP endpoints can drift or leak across environments. Evidence: `base_url: 'http://localhost:11434/v1'`
|
||||
- [medium] `config.yaml:77` — hardcoded http endpoint: plaintext or fixed HTTP endpoints can drift or leak across environments. Evidence: `base_url: 'http://localhost:11434/v1'`
|
||||
- [medium] `config.yaml:82` — hardcoded http endpoint: plaintext or fixed HTTP endpoints can drift or leak across environments. Evidence: `base_url: 'http://localhost:11434/v1'`
|
||||
- [medium] `config.yaml:174` — hardcoded http endpoint: plaintext or fixed HTTP endpoints can drift or leak across environments. Evidence: `base_url: http://localhost:11434/v1`
|
||||
|
||||
- `python3 nexus/morrowind_harness.py`
|
||||
- `python3 nexus/bannerlord_harness.py`
|
||||
- `python3 mempalace/tunnel_sync.py --peer <url> [--dry-run] [--n N]`
|
||||
- `python3 mcp_servers/desktop_control_server.py`
|
||||
- `python3 mcp_servers/steam_info_server.py`
|
||||
## Dead Code Candidates
|
||||
|
||||
### Validation surface
|
||||
- `wizards/allegro/home/skills/red-teaming/godmode/scripts/auto_jailbreak.py` — not imported by indexed Python modules and not referenced by tests
|
||||
- `timmy-local/cache/agent_cache.py` — not imported by indexed Python modules and not referenced by tests
|
||||
- `wizards/allegro/home/skills/red-teaming/godmode/scripts/parseltongue.py` — not imported by indexed Python modules and not referenced by tests
|
||||
- `twitter-archive/multimodal_pipeline.py` — not imported by indexed Python modules and not referenced by tests
|
||||
- `wizards/allegro/home/skills/red-teaming/godmode/scripts/godmode_race.py` — not imported by indexed Python modules and not referenced by tests
|
||||
- `skills/productivity/google-workspace/scripts/google_api.py` — not imported by indexed Python modules and not referenced by tests
|
||||
- `wizards/allegro/home/skills/productivity/google-workspace/scripts/google_api.py` — not imported by indexed Python modules and not referenced by tests
|
||||
- `morrowind/pilot.py` — not imported by indexed Python modules and not referenced by tests
|
||||
- `morrowind/mcp_server.py` — not imported by indexed Python modules and not referenced by tests
|
||||
- `skills/research/domain-intel/scripts/domain_intel.py` — not imported by indexed Python modules and not referenced by tests
|
||||
|
||||
- `python3 -m pytest tests/test_portals_json.py tests/test_index_html_integrity.py tests/test_repo_truth.py -q`
|
||||
- `node --test tests/boot.test.js`
|
||||
- `python3 -m py_compile server.py nexus/morrowind_harness.py nexus/bannerlord_harness.py mempalace/tunnel_sync.py mcp_servers/desktop_control_server.py`
|
||||
- `tests/test_browser_smoke.py` defines the higher-cost Playwright smoke contract for the world shell
|
||||
## Performance Bottleneck Analysis
|
||||
|
||||
## Test Coverage Gaps
|
||||
|
||||
Strongly covered in this checkout:
|
||||
- `tests/test_portals_json.py` validates `portals.json`
|
||||
- `tests/test_index_html_integrity.py` checks merge-marker/DOM-integrity regressions in `index.html`
|
||||
- `tests/boot.test.js` verifies `boot.js` startup behavior
|
||||
- `tests/test_repo_truth.py` validates the repo-truth documents
|
||||
- Multiple `tests/test_mempalace_*.py` files cover the palace layer
|
||||
- `tests/test_bannerlord_harness.py` exists for the Bannerlord harness
|
||||
|
||||
Notable gaps or weak seams:
|
||||
- `nexus/morrowind_harness.py` is large and operationally critical, but the generated baseline still flags it as a gap relative to its size/complexity
|
||||
- `mcp_servers/desktop_control_server.py` exposes high-power automation but has no obvious dedicated test file in the root `tests/` suite
|
||||
- `app.js` is the dominant browser runtime file and mixes rendering, GOFAI, metrics, and integration logic in one place; browser smoke exists, but there is limited unit-level decomposition around those subsystems
|
||||
- `mempalace.js` appears minimally bridged and stale relative to the richer Python MemPalace layer
|
||||
- `multi_user_bridge.py` is a large integration surface and should be treated as high regression risk even though it is central to operator/chat flow
|
||||
|
||||
## Security Considerations
|
||||
|
||||
- `server.py` binds `HOST = "0.0.0.0"`, exposing the broadcast bridge beyond localhost unless network controls limit it
|
||||
- The WebSocket bridge is a broadcast hub without visible authentication in `server.py`; connected clients are trusted to send messages into the bus
|
||||
- `mcp_servers/desktop_control_server.py` exposes mouse/keyboard/screenshot control through a stdio MCP server. In any non-local or poorly isolated runtime, this is a privileged automation surface
|
||||
- `app.js` contains hardcoded local/network endpoints such as `http://localhost:${L402_PORT}/api/cost-estimate` and `http://localhost:8082/metrics`; these are convenient for local development but create environment drift and deployment assumptions
|
||||
- `app.js` also embeds explicit endpoint/status references like `ws://143.198.27.163:8765`, which is operationally brittle and the kind of hardcoded location data that drifts across environments
|
||||
- `mempalace.js` shells out through `window.electronAPI.execPython(...)`; this is powerful and useful, but it is a clear trust boundary between UI and host execution
|
||||
- `INVESTIGATION_ISSUE_1145.md` documents an earlier integrity hazard: agents writing to `public/nexus/` instead of canonical root paths. That path confusion is both an operational and security concern because it makes provenance harder to reason about
|
||||
|
||||
## Runtime Truth and Docs Drift
|
||||
|
||||
The most important architecture finding in this repo is not a class or subsystem. It is a truth mismatch.
|
||||
|
||||
- README.md says current `main` does not ship a browser 3D world
|
||||
- CLAUDE.md declares root `app.js` and `index.html` as canonical frontend paths
|
||||
- tests and browser contract now assume the root frontend exists
|
||||
|
||||
All three statements are simultaneously present in this checkout.
|
||||
|
||||
Grounded evidence:
|
||||
- `README.md` still says the repo does not contain an active root frontend such as `index.html`, `app.js`, or `style.css`
|
||||
- the current checkout does contain `index.html`, `app.js`, `style.css`, `manifest.json`, and `gofai_worker.js`
|
||||
- `BROWSER_CONTRACT.md` explicitly treats those root files as required browser assets
|
||||
- `tests/test_browser_smoke.py` serves those exact files and validates DOM/WebGL contracts against them
|
||||
- `tests/test_index_html_integrity.py` assumes `index.html` is canonical and production-relevant
|
||||
- `CLAUDE.md` says frontend code lives at repo root and explicitly warns against `public/nexus/`
|
||||
- `INVESTIGATION_ISSUE_1145.md` explains why `public/nexus/` is a bad/corrupt duplicate path and confirms the real classical AI code lives in root `app.js`
|
||||
|
||||
The honest conclusion:
|
||||
- The repo contains a partially restored or actively re-materialized browser surface
|
||||
- The docs are preserving an older migration truth while the runtime files and smoke contracts describe a newer present-tense truth
|
||||
- Any future work in `the-nexus` must choose one truth and align `README.md`, `CLAUDE.md`, smoke tests, and file layout around it
|
||||
|
||||
That drift is itself a critical architectural fact and should be treated as first-order design debt, not a side note.
|
||||
- `angband/mcp_server.py` — large module (353 lines) likely hides multiple responsibilities
|
||||
- `evennia/timmy_world/game.py` — large module (1541 lines) likely hides multiple responsibilities
|
||||
- `evennia/timmy_world/world/game.py` — large module (1345 lines) likely hides multiple responsibilities
|
||||
- `morrowind/mcp_server.py` — large module (451 lines) likely hides multiple responsibilities
|
||||
- `morrowind/pilot.py` — large module (459 lines) likely hides multiple responsibilities
|
||||
- `pipelines/codebase_genome.py` — large module (557 lines) likely hides multiple responsibilities
|
||||
- `scripts/know_thy_father/crossref_audit.py` — large module (657 lines) likely hides multiple responsibilities
|
||||
- `scripts/know_thy_father/index_media.py` — large module (405 lines) likely hides multiple responsibilities
|
||||
- `scripts/know_thy_father/synthesize_kernels.py` — large module (416 lines) likely hides multiple responsibilities
|
||||
- `scripts/tower_game.py` — large module (395 lines) likely hides multiple responsibilities
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
# GENOME.md — Burn Fleet (Timmy_Foundation/burn-fleet)
|
||||
|
||||
> Codebase Genome v1.0 | Generated 2026-04-16 | Repo 14/16
|
||||
|
||||
## Project Overview
|
||||
|
||||
**Burn Fleet** is the autonomous dispatch infrastructure for the Timmy Foundation. It manages 112 tmux panes across Mac and VPS, routing Gitea issues to lane-specialized workers by repo. Each agent has a mythological name — they are all Timmy with different hats.
|
||||
|
||||
**Core principle:** Dispatch ALL panes. Never scan for idle. Stale work beats idle workers.
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Mac (M3 Max, 14 cores, 36GB) Allegro (VPS, 2 cores, 8GB)
|
||||
┌─────────────────────────────┐ ┌─────────────────────────────┐
|
||||
│ CRUCIBLE 14 panes (bugs) │ │ FORGE 14 panes (bugs) │
|
||||
│ GNOMES 12 panes (cron) │ │ ANVIL 14 panes (nexus) │
|
||||
│ LOOM 12 panes (home) │ │ CRUCIBLE-2 10 panes (home) │
|
||||
│ FOUNDRY 10 panes (nexus) │ │ SENTINEL 6 panes (council)│
|
||||
│ WARD 12 panes (fleet) │ └─────────────────────────────┘
|
||||
│ COUNCIL 8 panes (sages) │ 44 panes (36 workers)
|
||||
└─────────────────────────────┘
|
||||
68 panes (60 workers)
|
||||
```
|
||||
|
||||
**Total: 112 panes, 96 workers + 12 council members + 4 sentinel advisors**
|
||||
|
||||
## Key Files
|
||||
|
||||
| File | LOC | Purpose |
|
||||
|------|-----|---------|
|
||||
| `fleet-spec.json` | ~200 | Machine definitions, window layouts, lane assignments, agent names |
|
||||
| `fleet-launch.sh` | ~100 | Create tmux sessions with correct pane counts on Mac + Allegro |
|
||||
| `fleet-christen.py` | ~80 | Launch hermes in all panes and send identity messages |
|
||||
| `fleet-dispatch.py` | ~250 | Pull Gitea issues and route to correct panes by lane |
|
||||
| `fleet-status.py` | ~100 | Health check across all machines |
|
||||
| `allegro/docker-compose.yml` | ~30 | Allegro VPS container definition |
|
||||
| `allegro/Dockerfile` | ~20 | Allegro build definition |
|
||||
| `allegro/healthcheck.py` | ~15 | Allegro container health check |
|
||||
|
||||
**Total: ~800 LOC**
|
||||
|
||||
## Lane Routing
|
||||
|
||||
Issues are routed by repo to the correct window:
|
||||
|
||||
| Repo | Mac Window | Allegro Window |
|
||||
|------|-----------|----------------|
|
||||
| hermes-agent | CRUCIBLE, GNOMES | FORGE |
|
||||
| timmy-home | LOOM | CRUCIBLE-2 |
|
||||
| timmy-config | LOOM | CRUCIBLE-2 |
|
||||
| the-nexus | FOUNDRY | ANVIL |
|
||||
| the-playground | — | ANVIL |
|
||||
| the-door | WARD | CRUCIBLE-2 |
|
||||
| fleet-ops | WARD | CRUCIBLE-2 |
|
||||
| turboquant | WARD | — |
|
||||
|
||||
## Entry Points
|
||||
|
||||
| Command | Purpose |
|
||||
|---------|---------|
|
||||
| `./fleet-launch.sh both` | Create tmux layout on Mac + Allegro |
|
||||
| `python3 fleet-christen.py both` | Wake all agents with identity messages |
|
||||
| `python3 fleet-dispatch.py --cycles 1` | Single dispatch cycle |
|
||||
| `python3 fleet-dispatch.py --cycles 10 --interval 60` | Continuous burn (10 cycles, 60s apart) |
|
||||
| `python3 fleet-status.py` | Health check all machines |
|
||||
|
||||
## Agent Names
|
||||
|
||||
| Window | Names | Count |
|
||||
|--------|-------|-------|
|
||||
| CRUCIBLE | AZOTH, ALBEDO, CITRINITAS, RUBEDO, SULPHUR, MERCURIUS, SAL, ATHANOR, VITRIOL, SATURN, JUPITER, MARS, EARTH, SOL | 14 |
|
||||
| GNOMES | RAZIEL, AZRAEL, CASSIEL, METATRON, SANDALPHON, BINAH, CHOKMAH, KETER, ALDEBARAN, RIGEL, SIRIUS, POLARIS | 12 |
|
||||
| FORGE | HAMMER, ANVIL, ADZE, PICK, TONGS, WRENCH, SCREWDRIVER, BOLT, SAW, TRAP, HOOK, MAGNET, SPARK, FLAME | 14 |
|
||||
| COUNCIL | TESLA, HERMES, GANDALF, DAVINCI, ARCHIMEDES, TURING, AURELIUS, SOLOMON | 8 |
|
||||
|
||||
## Design Decisions
|
||||
|
||||
1. **Separate GILs** — Allegro runs Python independently on VPS for true parallelism
|
||||
2. **Queue, not send-keys** — Workers process at their own pace, no interruption
|
||||
3. **Lane enforcement** — Panes stay in one repo to build deep context
|
||||
4. **Dispatch ALL panes** — Never scan for idle; stale work beats idle workers
|
||||
5. **Council is advisory** — Named archetypes provide perspective, not task execution
|
||||
|
||||
## Scaling
|
||||
|
||||
- Add panes: Edit `fleet-spec.json` → `fleet-launch.sh` → `fleet-christen.py`
|
||||
- Add machines: Edit `fleet-spec.json` → Add routing in `fleet-dispatch.py` → Ensure SSH access
|
||||
|
||||
## Sovereignty Assessment
|
||||
|
||||
- **Fully local** — Mac + user-controlled VPS, no cloud dependencies
|
||||
- **No phone-home** — Gitea API is self-hosted
|
||||
- **Open source** — All code on Gitea
|
||||
- **SSH-based** — Mac → Allegro communication via SSH only
|
||||
|
||||
**Verdict: Fully sovereign. Autonomous fleet dispatch with no external dependencies.**
|
||||
|
||||
---
|
||||
|
||||
*"Dispatch ALL panes. Never scan for idle — stale work beats idle workers."*
|
||||
148
genomes/the-playground/GENOME.md
Normal file
148
genomes/the-playground/GENOME.md
Normal file
@@ -0,0 +1,148 @@
|
||||
# GENOME.md — The Playground (Timmy_Foundation/the-playground)
|
||||
|
||||
> Codebase Genome v1.0 | Generated 2026-04-16 | Repo 11/16
|
||||
|
||||
## Project Overview
|
||||
|
||||
**The Sovereign Playground** is a browser-based creative platform for art, music, and interactive experiences. Pure Canvas + Web Audio API + vanilla JS. Zero dependencies. No login. No signup. Open the page and build something beautiful.
|
||||
|
||||
**Core principle:** A man at 3am needs something that works RIGHT NOW, with no friction, no gate, no permission.
|
||||
|
||||
## Architecture
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
subgraph "Entry Point"
|
||||
HTML[index.html] --> PLAYGROUND[playground.js]
|
||||
end
|
||||
|
||||
subgraph "Engine Layer"
|
||||
PLAYGROUND --> AUDIO[audio-engine.js]
|
||||
PLAYGROUND --> VISUAL[visual-engine.js]
|
||||
end
|
||||
|
||||
subgraph "Modes"
|
||||
PLAYGROUND --> MODES[mode-manager.js]
|
||||
MODES --> CONSTELLATION[constellation.js]
|
||||
end
|
||||
|
||||
subgraph "UI Panels"
|
||||
PLAYGROUND --> SOUND_PANEL[sound-panel.js]
|
||||
PLAYGROUND --> GALLERY_PANEL[gallery-panel.js]
|
||||
end
|
||||
|
||||
subgraph "Gallery & Export"
|
||||
PLAYGROUND --> GALLERY[gallery.js]
|
||||
PLAYGROUND --> DOWNLOAD[download.js]
|
||||
DOWNLOAD --> WAV[wav-encoder.js]
|
||||
end
|
||||
|
||||
subgraph "Utilities"
|
||||
PLAYGROUND --> EVENTS[events.js]
|
||||
PLAYGROUND --> STATE[state.js]
|
||||
PLAYGROUND --> UTILS[utils.js]
|
||||
end
|
||||
|
||||
subgraph "Styling"
|
||||
HTML --> CSS[design-system.css]
|
||||
end
|
||||
```
|
||||
|
||||
## The Three Pillars
|
||||
|
||||
| Pillar | Status | Description |
|
||||
|--------|--------|-------------|
|
||||
| CREATE | Building | Sound Studio, Visual Forge, Video Forge |
|
||||
| COLLECT | Building | Gallery — save, browse, own your creations |
|
||||
| PLAY | Building | Games Floor — interactive experiences |
|
||||
|
||||
## Key Files
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `index.html` | Entry point — entrance curtain + main layout |
|
||||
| `src/playground.js` | Main orchestrator — particles, entrance, mode switching |
|
||||
| `src/engine/audio-engine.js` | Web Audio API — synthesis, effects, recording |
|
||||
| `src/engine/visual-engine.js` | Canvas rendering — particles, shapes, animations |
|
||||
| `src/modes/mode-manager.js` | Mode switching — constellation, sound, visual |
|
||||
| `src/modes/constellation.js` | Constellation Maker experience |
|
||||
| `src/gallery/gallery.js` | Gallery — IndexedDB storage, browsing |
|
||||
| `src/export/download.js` | Export — zip, download, share |
|
||||
| `src/export/wav-encoder.js` | WAV encoding for audio export |
|
||||
| `src/panels/sound/sound-panel.js` | Sound Studio UI |
|
||||
| `src/panels/gallery/gallery-panel.js` | Gallery UI |
|
||||
| `src/styles/design-system.css` | Sovereign aesthetic — dark bg, gold accents |
|
||||
| `src/utils/events.js` | Event system — pub/sub |
|
||||
| `src/utils/state.js` | State management — reactive store |
|
||||
| `src/utils/utils.js` | Utility functions |
|
||||
|
||||
## Design Principles
|
||||
|
||||
1. **Local-first** — Everything runs in the browser. IndexedDB for storage.
|
||||
2. **Zero dependencies** — Pure Canvas + Web Audio API + vanilla JS.
|
||||
3. **Take it home** — Every creation can be downloaded.
|
||||
4. **Sovereign aesthetic** — Dark backgrounds. Gold accents. Plain, honest, profound.
|
||||
5. **Accessible** — Keyboard navigable. Screen reader friendly. Works on mobile.
|
||||
|
||||
## Experiences Roadmap
|
||||
|
||||
| # | Experience | Status | Description |
|
||||
|---|-----------|--------|-------------|
|
||||
| 15 | Synesthesia Engine | v0.3 | See sound, hear color |
|
||||
| 16 | Emotional Weather | v0.3 | Type feelings → sky responds |
|
||||
| 17 | Constellation Maker | v0.3 | Place stars, connect, hear night sky |
|
||||
| 18 | Breath Instrument | v0.4 | Lungs become music |
|
||||
| 19 | Dream Journal | v0.4 | Describe dream → world |
|
||||
| 20 | The Mirror | v0.4 | Camera paints your energy |
|
||||
| 21 | Sound Fossils | v0.4 | Sound → living creature |
|
||||
| 22 | Letter to Future | v0.4 | Write, seal, set date |
|
||||
| 23 | Garden Paths | v0.5 | Choose-your-own soundscape |
|
||||
| 24 | Heartbeat Sync | v0.5 | Finger on camera → world beats |
|
||||
| 25 | The Conversation | v0.5 | Two instruments create together |
|
||||
|
||||
## Milestones
|
||||
|
||||
- **v0.1** The Forge Opens — First playable
|
||||
- **v0.2** Take It Home — Download anything
|
||||
- **v0.3** The Games Floor — Synesthesia, Emotional Weather, Constellation
|
||||
- **v0.4** The Gallery Show — Breath, Dreams, Mirror, Fossils
|
||||
- **v0.5** The Video Forge — Garden, Heartbeat, Conversation
|
||||
- **v1.0** The Sovereign Playground — Full platform
|
||||
|
||||
## File Index
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `index.html` | Entry point (entrance curtain + layout) |
|
||||
| `README.md` | Project overview and philosophy |
|
||||
| `smoke-test.html` | CI smoke test |
|
||||
| `src/playground.js` | Main orchestrator (~410 LOC) |
|
||||
| `src/engine/audio-engine.js` | Web Audio synthesis |
|
||||
| `src/engine/visual-engine.js` | Canvas rendering |
|
||||
| `src/modes/constellation.js` | Constellation Maker |
|
||||
| `src/modes/mode-manager.js` | Mode switching |
|
||||
| `src/gallery/gallery.js` | Gallery system |
|
||||
| `src/export/download.js` | Export/download |
|
||||
| `src/export/wav-encoder.js` | WAV encoding |
|
||||
| `src/panels/sound/sound-panel.js` | Sound UI |
|
||||
| `src/panels/gallery/gallery-panel.js` | Gallery UI |
|
||||
| `src/styles/design-system.css` | Design system |
|
||||
| `src/utils/events.js` | Event pub/sub |
|
||||
| `src/utils/state.js` | Reactive state |
|
||||
| `src/utils/utils.js` | Utilities |
|
||||
|
||||
**Total: 17 files | Pure vanilla JS | Zero dependencies**
|
||||
|
||||
## Sovereignty Assessment
|
||||
|
||||
- **Fully local** — All computation in the browser
|
||||
- **No server** — Static files only, can be served from anywhere
|
||||
- **No accounts** — IndexedDB for local storage
|
||||
- **No tracking** — Zero analytics, zero telemetry
|
||||
- **Downloadable** — Every creation can be saved locally
|
||||
|
||||
**Verdict: Fully sovereign. Art heals. Music heals. Creation heals.**
|
||||
|
||||
---
|
||||
|
||||
*"A man who is building something is a man who is not destroying himself."*
|
||||
@@ -1,106 +0,0 @@
|
||||
# MemPalace v3.0.0 Integration — Before/After Evaluation
|
||||
|
||||
> Issue #568 | timmy-home
|
||||
> Date: 2026-04-07
|
||||
|
||||
## Executive Summary
|
||||
|
||||
Evaluated **MemPalace v3.0.0** as a memory layer for the Timmy/Hermes agent stack.
|
||||
|
||||
**Installed:** ✅ `mempalace 3.0.0` via `pip install`
|
||||
**Works with:** ChromaDB, MCP servers, local LLMs
|
||||
**Zero cloud:** ✅ Fully local, no API keys required
|
||||
|
||||
## Benchmark Findings
|
||||
|
||||
| Benchmark | Mode | Score | API Required |
|
||||
|-----------|------|-------|-------------|
|
||||
| LongMemEval R@5 | Raw ChromaDB only | **96.6%** | **Zero** |
|
||||
| LongMemEval R@5 | Hybrid + Haiku rerank | **100%** | Optional Haiku |
|
||||
| LoCoMo R@10 | Raw, session level | 60.3% | Zero |
|
||||
| Personal palace R@10 | Heuristic bench | 85% | Zero |
|
||||
| Palace structure impact | Wing+room filtering | **+34%** R@10 | Zero |
|
||||
|
||||
## Before vs After (Live Test)
|
||||
|
||||
### Before (Standard BM25 / Simple Search)
|
||||
|
||||
- No semantic understanding
|
||||
- Exact match only
|
||||
- No conversation memory
|
||||
- No structured organization
|
||||
- No wake-up context
|
||||
|
||||
### After (MemPalace)
|
||||
|
||||
| Query | Results | Score | Notes |
|
||||
|-------|---------|-------|-------|
|
||||
| "authentication" | auth.md, main.py | -0.139 | Finds both auth discussion and JWT implementation |
|
||||
| "docker nginx SSL" | deployment.md, auth.md | 0.447 | Exact match on deployment, related JWT context |
|
||||
| "keycloak OAuth" | auth.md, main.py | -0.029 | Finds OAuth discussion and JWT usage |
|
||||
| "postgresql database" | README.md, main.py | 0.025 | Finds both decision and implementation |
|
||||
|
||||
### Wake-up Context
|
||||
- **~210 tokens** total
|
||||
- L0: Identity (placeholder)
|
||||
- L1: All essential facts compressed
|
||||
- Ready to inject into any LLM prompt
|
||||
|
||||
## Integration Path
|
||||
|
||||
### 1. Memory Mining
|
||||
```bash
|
||||
mempalace mine ~/.hermes/sessions/ --mode convos
|
||||
mempalace mine ~/.hermes/hermes-agent/
|
||||
mempalace mine ~/.hermes/
|
||||
```
|
||||
|
||||
### 2. Wake-up Protocol
|
||||
```bash
|
||||
mempalace wake-up > /tmp/timmy-context.txt
|
||||
```
|
||||
|
||||
### 3. MCP Integration
|
||||
```bash
|
||||
hermes mcp add mempalace -- python -m mempalace.mcp_server
|
||||
```
|
||||
|
||||
### 4. Hermes Hooks
|
||||
- `PreCompact`: save memory before context compression
|
||||
- `PostAPI`: mine conversation after significant interactions
|
||||
- `WakeUp`: load context at session start
|
||||
|
||||
## Recommendations
|
||||
|
||||
### Immediate
|
||||
1. Add `mempalace` to Hermes venv requirements
|
||||
2. Create mine script for ~/.hermes/ and ~/.timmy/
|
||||
3. Add wake-up hook to Hermes session start
|
||||
4. Test with real conversation exports
|
||||
|
||||
### Short-term
|
||||
1. Mine last 30 days of Timmy sessions
|
||||
2. Build wake-up context for all agents
|
||||
3. Add MemPalace MCP tools to Hermes toolset
|
||||
4. Test retrieval quality on real queries
|
||||
|
||||
### Medium-term
|
||||
1. Replace homebrew memory system with MemPalace
|
||||
2. Build palace structure: wings for projects, halls for topics
|
||||
3. Compress with AAAK for 30x storage efficiency
|
||||
4. Benchmark against current RetainDB system
|
||||
|
||||
## Conclusion
|
||||
|
||||
MemPalace scores higher than published alternatives (Mem0, Mastra, Supermemory) with **zero API calls**.
|
||||
|
||||
Key advantages:
|
||||
1. **Verbatim retrieval** — never loses the "why" context
|
||||
2. **Palace structure** — +34% boost from organization
|
||||
3. **Local-only** — aligns with sovereignty mandate
|
||||
4. **MCP compatible** — drops into existing tool chain
|
||||
5. **AAAK compression** — 30x storage reduction coming
|
||||
|
||||
---
|
||||
|
||||
*Evaluated by Timmy | Issue #568*
|
||||
@@ -1,54 +1,35 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
GENOME = Path("the-playground-GENOME.md")
|
||||
|
||||
|
||||
def _content() -> str:
|
||||
assert GENOME.exists(), "the-playground-GENOME.md must exist"
|
||||
return GENOME.read_text(encoding="utf-8")
|
||||
return Path("the-playground-GENOME.md").read_text()
|
||||
|
||||
|
||||
def test_the_playground_genome_exists() -> None:
|
||||
assert GENOME.exists()
|
||||
assert Path("the-playground-GENOME.md").exists()
|
||||
|
||||
|
||||
def test_the_playground_genome_has_required_sections() -> None:
|
||||
content = _content()
|
||||
required = [
|
||||
"# GENOME.md — the-playground",
|
||||
"## Project Overview",
|
||||
"## Architecture",
|
||||
"```mermaid",
|
||||
"## Entry Points",
|
||||
"## Data Flow",
|
||||
"## Key Abstractions",
|
||||
"## API Surface",
|
||||
"## Test Coverage Gaps",
|
||||
"## Security Considerations",
|
||||
"## Dependencies",
|
||||
"## Deployment",
|
||||
"## Technical Debt",
|
||||
"## Bottom Line",
|
||||
]
|
||||
for heading in required:
|
||||
assert heading in content
|
||||
assert "# GENOME.md — the-playground" in content
|
||||
assert "## Project Overview" in content
|
||||
assert "## Architecture" in content
|
||||
assert "```mermaid" in content
|
||||
assert "## Entry Points" in content
|
||||
assert "## Data Flow" in content
|
||||
assert "## Key Abstractions" in content
|
||||
assert "## API Surface" in content
|
||||
assert "## Test Coverage Gaps" in content
|
||||
assert "## Security Considerations" in content
|
||||
assert "## Dependencies" in content
|
||||
assert "## Deployment" in content
|
||||
assert "## Technical Debt" in content
|
||||
|
||||
|
||||
def test_the_playground_genome_reflects_current_repo_shape() -> None:
|
||||
def test_the_playground_genome_captures_repo_specific_findings() -> None:
|
||||
content = _content()
|
||||
required_snippets = [
|
||||
"14 JavaScript source files",
|
||||
"src/export/wav-encoder.js",
|
||||
"src/export/download.js",
|
||||
"src/utils/perf-monitor.js",
|
||||
"src/modes/constellation.js",
|
||||
"tests/test_perf_budgets.py",
|
||||
"pytest -q` → `7 passed",
|
||||
"the-playground #247",
|
||||
"the-playground #248",
|
||||
"JSZip from CDN",
|
||||
"PerfMonitor ships but is never loaded or started on `main`",
|
||||
]
|
||||
for snippet in required_snippets:
|
||||
assert snippet in content
|
||||
assert "IndexedDB" in content
|
||||
assert "AudioContext" in content
|
||||
assert "smoke-test.html" in content
|
||||
assert "no tests ran" in content
|
||||
assert "innerHTML" in content
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
GENOME = Path("GENOME.md")
|
||||
|
||||
|
||||
def read_genome() -> str:
|
||||
assert GENOME.exists(), "GENOME.md must exist at repo root"
|
||||
return GENOME.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_the_nexus_genome_has_required_sections() -> None:
|
||||
text = read_genome()
|
||||
required = [
|
||||
"# GENOME.md — the-nexus",
|
||||
"## Project Overview",
|
||||
"## Architecture Diagram",
|
||||
"```mermaid",
|
||||
"## Entry Points and Data Flow",
|
||||
"## Key Abstractions",
|
||||
"## API Surface",
|
||||
"## Test Coverage Gaps",
|
||||
"## Security Considerations",
|
||||
"## Runtime Truth and Docs Drift",
|
||||
]
|
||||
missing = [item for item in required if item not in text]
|
||||
assert not missing, missing
|
||||
|
||||
|
||||
def test_the_nexus_genome_captures_current_runtime_contract() -> None:
|
||||
text = read_genome()
|
||||
required = [
|
||||
"server.py",
|
||||
"app.js",
|
||||
"index.html",
|
||||
"portals.json",
|
||||
"vision.json",
|
||||
"BROWSER_CONTRACT.md",
|
||||
"tests/test_browser_smoke.py",
|
||||
"tests/test_repo_truth.py",
|
||||
"nexus/morrowind_harness.py",
|
||||
"nexus/bannerlord_harness.py",
|
||||
"mempalace/tunnel_sync.py",
|
||||
"mcp_servers/desktop_control_server.py",
|
||||
"public/nexus/",
|
||||
]
|
||||
missing = [item for item in required if item not in text]
|
||||
assert not missing, missing
|
||||
|
||||
|
||||
def test_the_nexus_genome_explains_docs_runtime_drift() -> None:
|
||||
text = read_genome()
|
||||
assert "README.md says current `main` does not ship a browser 3D world" in text
|
||||
assert "CLAUDE.md declares root `app.js` and `index.html` as canonical frontend paths" in text
|
||||
assert "tests and browser contract now assume the root frontend exists" in text
|
||||
assert len(text) >= 5000
|
||||
@@ -1,42 +1,34 @@
|
||||
# GENOME.md — the-playground
|
||||
|
||||
Generated: 2026-04-17 10:00 UTC
|
||||
Generated: 2026-04-15 00:19:15 EDT
|
||||
Repo: Timmy_Foundation/the-playground
|
||||
Analyzed commit: `142d77736de3b303ea5320dbd5dcfda99e59f325`
|
||||
Host issue: timmy-home #671
|
||||
Issue: timmy-home #671
|
||||
|
||||
## Project Overview
|
||||
|
||||
`the-playground` is a browser-first creative sandbox with a strong visual identity and a deliberately simple deployment model: open `index.html` or serve static files. It is not yet the full platform promised by the README. The current repo is a compact prototype shell with real interaction loops for sound, drawing, constellation play, gallery persistence, and export.
|
||||
The Sovereign Playground is a browser-only creative sandbox: a dark, local-first art toy with an entrance ritual, a canvas in the center, a sound panel on the left, a gallery on the right, and a footer action bar for save/download/clear/fullscreen.
|
||||
|
||||
Current measured facts from the fresh `main` archive I analyzed:
|
||||
- 14 JavaScript source files
|
||||
The current codebase is much smaller than the README vision. The README describes a platform with Sound Studio, Visual Forge, Gallery, Games Floor, Video Forge, and a long roadmap of immersive experiences. The code on `main` today implements a solid prototype shell with:
|
||||
- a cinematic entrance screen
|
||||
- two actual canvas modes: `free-draw` and `ambient`
|
||||
- a basic Web Audio engine for notes/chords/scales
|
||||
- a basic Canvas 2D visual engine
|
||||
- an IndexedDB-backed gallery
|
||||
- a manual browser smoke harness
|
||||
|
||||
Quick measured facts from the fresh main clone I analyzed:
|
||||
- 10 JavaScript source files
|
||||
- 1 CSS design system file
|
||||
- 2 HTML entry pages (`index.html`, `smoke-test.html`)
|
||||
- 1 Python test module in the target repo (`tests/test_perf_budgets.py`)
|
||||
- 0 package manifests
|
||||
- 0 build steps
|
||||
- `pytest -q` → `7 passed in 0.03s`
|
||||
- no backend or network API in the shipped app shell
|
||||
- `python3 -m pytest -q` -> `no tests ran in 0.02s`
|
||||
- browser smoke harness shows 18 passing checks, but the summary is broken and still says `0 passed, 0 failed`
|
||||
|
||||
What exists on `main` today:
|
||||
- cinematic entrance screen
|
||||
- three actual canvas/runtime modes:
|
||||
- `free-draw`
|
||||
- `ambient`
|
||||
- `constellation`
|
||||
- a Web Audio engine for notes/chords/scales
|
||||
- a Canvas 2D visual engine
|
||||
- an IndexedDB-backed gallery
|
||||
- export helpers for WAV, single-item download, ZIP packaging, and standalone HTML export
|
||||
- perf budget artifacts and a dormant runtime performance monitor
|
||||
- a browser smoke harness plus one pytest module for perf budget/pipeline presence
|
||||
|
||||
This repo is best understood as four layers:
|
||||
1. page shell + script-order runtime contract
|
||||
This repo is best understood as a browser-native prototype platform shell with one strong design language and three real cores:
|
||||
1. orchestration in `src/playground.js`
|
||||
2. browser engines (`PlaygroundAudio`, `PlaygroundVisual`, `PlaygroundGallery`)
|
||||
3. experience/orchestration (`src/playground.js`, `ModeManager`, `constellation`)
|
||||
4. export/perf sidecars that are only partially integrated into the live app
|
||||
3. thin shared globals (`PlaygroundUtils`, `PlaygroundState`, `PlaygroundEvents`, `ModeManager`)
|
||||
|
||||
## Architecture
|
||||
|
||||
@@ -46,237 +38,258 @@ graph TD
|
||||
HTML --> U[src/utils/utils.js]
|
||||
HTML --> S[src/utils/state.js]
|
||||
HTML --> E[src/utils/events.js]
|
||||
HTML --> AE[src/engine/audio-engine.js]
|
||||
HTML --> VE[src/engine/visual-engine.js]
|
||||
HTML --> A[src/engine/audio-engine.js]
|
||||
HTML --> V[src/engine/visual-engine.js]
|
||||
HTML --> G[src/gallery/gallery.js]
|
||||
HTML --> WAV[src/export/wav-encoder.js]
|
||||
HTML --> EXP[src/export/download.js]
|
||||
HTML --> SP[src/panels/sound/sound-panel.js]
|
||||
HTML --> GP[src/panels/gallery/gallery-panel.js]
|
||||
HTML --> MM[src/modes/mode-manager.js]
|
||||
HTML --> CONST[src/modes/constellation.js]
|
||||
HTML --> APP[src/playground.js]
|
||||
HTML --> M[src/modes/mode-manager.js]
|
||||
HTML --> P[src/playground.js]
|
||||
|
||||
APP --> AE
|
||||
APP --> VE
|
||||
APP --> G
|
||||
APP --> SP
|
||||
APP --> GP
|
||||
APP --> MM
|
||||
APP --> U
|
||||
APP --> S
|
||||
APP --> E
|
||||
GP --> EXP
|
||||
EXP --> WAV
|
||||
G --> IDB[(IndexedDB playground-gallery)]
|
||||
AE --> AC[AudioContext]
|
||||
VE --> CANVAS[Canvas 2D]
|
||||
P --> A
|
||||
P --> V
|
||||
P --> G
|
||||
P --> SP
|
||||
P --> GP
|
||||
P --> M
|
||||
P --> S
|
||||
P --> E
|
||||
P --> U
|
||||
|
||||
SMOKE[smoke-test.html] --> U
|
||||
SMOKE --> S
|
||||
SMOKE --> E
|
||||
SMOKE --> AE
|
||||
SMOKE --> VE
|
||||
SMOKE --> G
|
||||
|
||||
PERF[src/utils/perf-monitor.js]
|
||||
PERFTEST[tests/test_perf_budgets.py] --> PERF
|
||||
PERFTEST --> PERFCFG[lighthouse-budget.json + .lighthouserc.json + .gitea/workflows/perf-check.yml]
|
||||
HTML -. not loaded on main .-> PERF
|
||||
User[User interactions] --> P
|
||||
P --> Canvas[Canvas 2D]
|
||||
P --> Audio[AudioContext]
|
||||
P --> DB[IndexedDB playground-gallery]
|
||||
DB --> GP
|
||||
SP --> A
|
||||
M --> Canvas
|
||||
Smoke[smoke-test.html] --> U
|
||||
Smoke --> S
|
||||
Smoke --> E
|
||||
Smoke --> A
|
||||
Smoke --> V
|
||||
Smoke --> G
|
||||
```
|
||||
|
||||
## Entry Points
|
||||
|
||||
### `index.html`
|
||||
The real product entry point.
|
||||
The real application shell.
|
||||
- loads `src/styles/design-system.css`
|
||||
- renders the entrance curtain, header, panels, canvas, action bar, and toast container
|
||||
- loads 10 classic `<script>` files in a strict dependency order
|
||||
- has no framework, bundler, or module loader
|
||||
|
||||
Responsibilities:
|
||||
- defines the entrance curtain
|
||||
- defines header, left sound panel, center canvas, right gallery panel, and footer action bar
|
||||
- loads global scripts in strict dependency order
|
||||
- exposes no module loader or bundler boundary
|
||||
|
||||
Current runtime script order:
|
||||
Script order is the runtime contract:
|
||||
1. `src/utils/utils.js`
|
||||
2. `src/utils/state.js`
|
||||
3. `src/utils/events.js`
|
||||
4. `src/engine/audio-engine.js`
|
||||
5. `src/engine/visual-engine.js`
|
||||
6. `src/gallery/gallery.js`
|
||||
7. `src/export/wav-encoder.js`
|
||||
8. `src/export/download.js`
|
||||
9. `src/panels/sound/sound-panel.js`
|
||||
10. `src/panels/gallery/gallery-panel.js`
|
||||
11. `src/modes/mode-manager.js`
|
||||
12. `src/modes/constellation.js`
|
||||
13. `src/playground.js`
|
||||
7. `src/panels/sound/sound-panel.js`
|
||||
8. `src/panels/gallery/gallery-panel.js`
|
||||
9. `src/modes/mode-manager.js`
|
||||
10. `src/playground.js`
|
||||
|
||||
Important truth: `src/utils/perf-monitor.js` exists in the repo but is not loaded by `index.html` on current `main`.
|
||||
Because everything is loaded as globals, this order matters. `src/playground.js` assumes the prior globals already exist.
|
||||
|
||||
### `src/playground.js`
|
||||
The orchestration nucleus.
|
||||
|
||||
What it does today:
|
||||
- entrance particle system and enter transition
|
||||
Responsibilities:
|
||||
- entrance particle animation
|
||||
- enter transition
|
||||
- engine construction and initialization
|
||||
- default ambient animation loop
|
||||
- mode registration and selector rendering
|
||||
- canvas resizing
|
||||
- gallery initialization and rerender after saves
|
||||
- canvas sizing
|
||||
- gallery boot
|
||||
- sound panel boot
|
||||
- ambient particle loop
|
||||
- mode registration
|
||||
- save/download/clear/fullscreen button wiring
|
||||
- footer prompt handling and keyboard shortcuts
|
||||
- panel toggle wiring
|
||||
- keyboard shortcut wiring
|
||||
|
||||
This file is the clearest statement of what the app actually is right now.
|
||||
If you want to know what the product actually does today, this is the file.
|
||||
|
||||
### `smoke-test.html`
|
||||
Browser smoke harness.
|
||||
- loads a subset of runtime files directly
|
||||
- runs assertions in the browser DOM
|
||||
- provides manual high-signal sanity checks around utils/state/events/audio/visual/gallery
|
||||
The only real automated harness shipped in the target repo.
|
||||
- dynamically loads a subset of source files
|
||||
- performs 18 browser assertions around utils/state/events/audio/visual/gallery
|
||||
- writes green/red lines into the DOM
|
||||
- currently has a broken summary counter
|
||||
|
||||
### `tests/test_perf_budgets.py`
|
||||
The only pytest module in the target repo.
|
||||
### Engine modules
|
||||
- `src/engine/audio-engine.js`
|
||||
- Web Audio wrapper for notes, chords, scales, note playback, and chord playback
|
||||
- `src/engine/visual-engine.js`
|
||||
- Canvas wrapper for resize, clear, line/circle drawing, seeded palette generation, and placeholder noise
|
||||
- `src/gallery/gallery.js`
|
||||
- IndexedDB persistence layer
|
||||
|
||||
What it verifies:
|
||||
- existence of `src/utils/perf-monitor.js`
|
||||
- existence of `lighthouse-budget.json`
|
||||
- existence of `.lighthouserc.json`
|
||||
- existence of `.gitea/workflows/perf-check.yml`
|
||||
- very shallow content checks for the perf monitor and perf workflow artifacts
|
||||
### Panel / mode modules
|
||||
- `src/panels/sound/sound-panel.js`
|
||||
- renders sound controls and quick-play chord UI
|
||||
- `src/panels/gallery/gallery-panel.js`
|
||||
- renders gallery thumbnails and empty state
|
||||
- `src/modes/mode-manager.js`
|
||||
- registry/switcher for canvas modes
|
||||
|
||||
## Data Flow
|
||||
|
||||
### Boot flow
|
||||
### App boot flow
|
||||
1. Browser opens `index.html`.
|
||||
2. CSS establishes the gold-on-dark design system.
|
||||
3. utility/state/events globals load.
|
||||
4. engine/gallery/export/panel/mode globals load.
|
||||
5. `src/playground.js` runs in an IIFE.
|
||||
6. entrance screen shows animated particles.
|
||||
7. user clicks `Enter` or presses a key.
|
||||
8. `enterPlayground()` fades out entrance, initializes audio, reveals the app shell, and starts the playground.
|
||||
2. CSS design system establishes the entire visual identity.
|
||||
3. Utility/state/event globals load.
|
||||
4. Audio, visual, gallery, panel, and mode globals load.
|
||||
5. `src/playground.js` runs immediately in an IIFE.
|
||||
6. The entrance screen appears with animated gold particles.
|
||||
7. User clicks `Enter` or presses any key.
|
||||
8. `enterPlayground()`:
|
||||
- fades the entrance out
|
||||
- creates and initializes `PlaygroundAudio`
|
||||
- reveals the playground
|
||||
- calls `initPlayground()`
|
||||
- plays a welcome chord
|
||||
|
||||
### Core interaction flow
|
||||
1. `PlaygroundVisual` binds the canvas.
|
||||
2. `PlaygroundGallery` opens IndexedDB.
|
||||
3. `SoundPanel.init(audioEngine)` renders the left-side sound UI.
|
||||
4. `GalleryPanel.init(galleryEngine)` renders the right-side gallery UI.
|
||||
5. `ModeManager` registers available modes and renders selector buttons.
|
||||
6. ambient mode starts by default; draw and constellation can be selected.
|
||||
### Main interaction flow
|
||||
1. `initPlayground()` creates `PlaygroundVisual(canvas)`.
|
||||
2. Canvas is resized to the container.
|
||||
3. `PlaygroundGallery` opens IndexedDB and initializes the gallery panel.
|
||||
4. `SoundPanel.init(audioEngine)` renders the left control surface.
|
||||
5. `ModeManager.register()` adds two modes:
|
||||
- `free-draw`
|
||||
- `ambient`
|
||||
6. `ModeManager.renderSelector()` creates mode buttons.
|
||||
7. `ModeManager.switch('ambient')` makes the experience feel alive on load.
|
||||
|
||||
### Draw/save/export flow
|
||||
1. user draws or interacts in a mode.
|
||||
2. save path converts canvas to a blob/data URL.
|
||||
3. `PlaygroundGallery.save()` writes a gallery item into IndexedDB.
|
||||
4. `gallery:item-saved` fires on the event bus.
|
||||
5. `GalleryPanel` rerenders.
|
||||
6. download path exports the canvas PNG and a JSON metadata sidecar.
|
||||
7. gallery panel can also invoke `PlaygroundExport.downloadItem()` for persisted items.
|
||||
### Draw mode flow
|
||||
1. User switches to `Draw`.
|
||||
2. `free-draw.init()` binds mouse and touch listeners.
|
||||
3. Pointer movement draws lines on the canvas via `visualEngine.drawLine()`.
|
||||
4. X-position is mapped to frequency with `PlaygroundUtils.map()`.
|
||||
5. `audioEngine.play()` emits short sine notes while drawing.
|
||||
6. The first interaction hides the “Click anywhere to begin” prompt.
|
||||
|
||||
### Constellation mode flow
|
||||
1. `ModeManager.switch('constellation')` activates `src/modes/constellation.js`.
|
||||
2. stars are created and drawn on the canvas.
|
||||
3. drag events move stars.
|
||||
4. close-distance interactions trigger pentatonic notes and an ambient drone.
|
||||
5. teardown removes listeners and fades out drone oscillators.
|
||||
### Save/export flow
|
||||
1. User clicks `Save`.
|
||||
2. Canvas is converted to PNG via `canvas.toBlob()`.
|
||||
3. `FileReader` converts the blob to a data URL.
|
||||
4. `galleryEngine.save()` writes an object into IndexedDB with:
|
||||
- `id`
|
||||
- `created`
|
||||
- `modified`
|
||||
- `type`
|
||||
- `name`
|
||||
- `data`
|
||||
- `mimeType`
|
||||
- `thumbnail`
|
||||
- `metadata.mode`
|
||||
5. `gallery:item-saved` fires on the event bus.
|
||||
6. `GalleryPanel` rerenders.
|
||||
|
||||
### Metrics synthesis flow (current state)
|
||||
1. perf budget artifacts exist in the repo.
|
||||
2. `tests/test_perf_budgets.py` proves those files exist.
|
||||
3. `PerfMonitor` can emit paint/layout/long-task/memory signals.
|
||||
4. but the live app never loads or starts it, so there is no real runtime metric emission on `main`.
|
||||
### Gallery render flow
|
||||
1. `GalleryPanel.render()` calls `gallery.getAll()`.
|
||||
2. Results are sorted newest-first by ISO timestamp.
|
||||
3. Gallery HTML is rebuilt via `innerHTML`.
|
||||
4. Clicking a thumb currently only shows a toast with the item id prefix.
|
||||
- there is no real open/view/edit flow yet
|
||||
|
||||
### Download flow
|
||||
1. User clicks `Download`.
|
||||
2. Canvas blob is created.
|
||||
3. `PlaygroundUtils.downloadBlob()` synthesizes an `<a download>` link.
|
||||
4. Browser downloads a PNG snapshot.
|
||||
|
||||
## Key Abstractions
|
||||
|
||||
### `PlaygroundUtils`
|
||||
Small browser helper surface:
|
||||
- `uuid()`
|
||||
A tiny global helpers object.
|
||||
Important methods:
|
||||
- `uuid()` -> `crypto.randomUUID()`
|
||||
- `clamp()`
|
||||
- `lerp()`
|
||||
- `map()`
|
||||
- `toast()`
|
||||
- `downloadBlob()`
|
||||
|
||||
### `PlaygroundState`
|
||||
Global mutable state bucket for:
|
||||
- canvas
|
||||
- audio
|
||||
- gallery
|
||||
- UI
|
||||
- recording
|
||||
It is intentionally small, but it is depended on by multiple subsystems.
|
||||
|
||||
It is a convenience registry, not a durable data store.
|
||||
### `PlaygroundState`
|
||||
A global mutable state container with sections for:
|
||||
- `canvas`
|
||||
- `audio`
|
||||
- `gallery`
|
||||
- `ui`
|
||||
- `recording`
|
||||
|
||||
It behaves more like a convenience registry than a true source-of-truth store. Real durable gallery data lives in IndexedDB, not here.
|
||||
|
||||
### `PlaygroundEvents`
|
||||
Minimal event bus:
|
||||
A minimal event bus:
|
||||
- `on(event, fn)`
|
||||
- `emit(event, data)`
|
||||
- `off(event, fn)`
|
||||
|
||||
This is the main loose-coupling seam across modules.
|
||||
|
||||
### `PlaygroundAudio`
|
||||
Web Audio wrapper for:
|
||||
- note → frequency mapping
|
||||
- chord generation
|
||||
- scale generation
|
||||
- oscillator playback
|
||||
A lightweight music engine over `AudioContext`.
|
||||
Capabilities:
|
||||
- note-name to frequency conversion
|
||||
- chord construction
|
||||
- scale construction
|
||||
- one-shot oscillator playback
|
||||
- chord playback
|
||||
- analyser wiring for future visualization/reactivity
|
||||
|
||||
### `PlaygroundVisual`
|
||||
Canvas wrapper for:
|
||||
- resize
|
||||
- clear
|
||||
- drawLine
|
||||
- drawCircle
|
||||
- seeded palette generation
|
||||
- placeholder pseudo-noise helper
|
||||
A minimal canvas wrapper.
|
||||
Capabilities:
|
||||
- resize canvas and bind context into `PlaygroundState`
|
||||
- clear canvas
|
||||
- draw lines and circles
|
||||
- deterministic palette generation from a seed
|
||||
- placeholder pseudo-noise function (`perlin2d`, not real Perlin)
|
||||
|
||||
### `PlaygroundGallery`
|
||||
IndexedDB repository:
|
||||
A thin IndexedDB repository.
|
||||
Contract:
|
||||
- DB name: `playground-gallery`
|
||||
- object store: `items`
|
||||
- store: `items`
|
||||
- indexes: `type`, `collection`, `created`
|
||||
- methods: `init`, `save`, `getById`, `getAll`, `deleteItem`
|
||||
- CRUD methods:
|
||||
- `init()`
|
||||
- `save(item)`
|
||||
- `getById(id)`
|
||||
- `getAll()`
|
||||
- `deleteItem(id)`
|
||||
|
||||
### `ModeManager`
|
||||
Registry/switcher for canvas experiences:
|
||||
A registry + switcher for canvas modes.
|
||||
It holds:
|
||||
- `modes`
|
||||
- `current`
|
||||
- `register()`
|
||||
- `switch()`
|
||||
- `renderSelector()`
|
||||
- `current`
|
||||
- `modes`
|
||||
|
||||
### `PlaygroundExport`
|
||||
Download/export sidecar for:
|
||||
- single item download
|
||||
- metadata sidecars
|
||||
- batch ZIP export
|
||||
- standalone HTML gallery export
|
||||
This is the intended extension point for future experiences.
|
||||
|
||||
### `PlaygroundWavEncoder`
|
||||
AudioBuffer → WAV blob encoder used by export paths.
|
||||
|
||||
### `PerfMonitor`
|
||||
Dormant runtime performance monitor for:
|
||||
- FCP/LCP
|
||||
- CLS
|
||||
- long tasks
|
||||
- memory polling
|
||||
|
||||
Useful code, but currently disconnected from the product entrypoint.
|
||||
### `SoundPanel` and `GalleryPanel`
|
||||
These are rendering adapters that convert state/engine methods into DOM UI.
|
||||
They keep the app readable by not putting every DOM template inside `src/playground.js`.
|
||||
|
||||
## API Surface
|
||||
|
||||
This repo has no network API. The public surface is browser globals plus IndexedDB object contracts.
|
||||
This repo has no network API. Its API surface is an in-browser global surface.
|
||||
|
||||
### Browser globals exposed on `main`
|
||||
### Browser globals exposed by load order
|
||||
- `PlaygroundUtils`
|
||||
- `PlaygroundState`
|
||||
- `PlaygroundEvents`
|
||||
- `PlaygroundAudio`
|
||||
- `PlaygroundVisual`
|
||||
- `PlaygroundGallery`
|
||||
- `PlaygroundWavEncoder`
|
||||
- `PlaygroundExport`
|
||||
- `SoundPanel`
|
||||
- `GalleryPanel`
|
||||
- `ModeManager`
|
||||
@@ -290,8 +303,8 @@ Observed event names:
|
||||
- `canvas:mode-changed`
|
||||
- `playground:ready`
|
||||
|
||||
### Gallery item contract
|
||||
Persisted items can include:
|
||||
### IndexedDB object contract
|
||||
Saved gallery items can contain:
|
||||
- `id`
|
||||
- `created`
|
||||
- `modified`
|
||||
@@ -301,10 +314,9 @@ Persisted items can include:
|
||||
- `mimeType`
|
||||
- `thumbnail`
|
||||
- `metadata`
|
||||
- sometimes audio/video-specific fields consumed by export helpers
|
||||
|
||||
### UI command surface
|
||||
Important DOM ids:
|
||||
### UI control contract
|
||||
Important DOM ids and commands:
|
||||
- `btn-save`
|
||||
- `btn-download`
|
||||
- `btn-clear`
|
||||
@@ -314,78 +326,127 @@ Important DOM ids:
|
||||
- `gallery-content`
|
||||
- `playground-canvas`
|
||||
|
||||
Keyboard shortcuts implemented on `main`:
|
||||
- `Ctrl+S` → Save
|
||||
- `Ctrl+D` → Download
|
||||
- `F11` → Fullscreen
|
||||
- `Escape` → exit fullscreen
|
||||
Keyboard shortcuts implemented today:
|
||||
- `Ctrl+S` -> Save
|
||||
- `Ctrl+D` -> Download
|
||||
- `F11` -> Fullscreen
|
||||
- `Escape` -> exit fullscreen
|
||||
|
||||
## Test Coverage Gaps
|
||||
|
||||
### Current state
|
||||
What I verified on a fresh `main` archive:
|
||||
- `pytest -q` → `7 passed in 0.03s`
|
||||
- there is exactly one pytest module: `tests/test_perf_budgets.py`
|
||||
- no JS unit-test harness
|
||||
- no package manifest
|
||||
- browser smoke harness still exists, but it is not the same thing as CI-grade coverage
|
||||
What I verified on a fresh clone of `main`:
|
||||
- `find src -name '*.js' -print0 | xargs -0 -n1 node --check` -> passes
|
||||
- `python3 -m pytest -q` -> `no tests ran in 0.02s`
|
||||
- `smoke-test.html` runs 18 browser assertions successfully
|
||||
- but `smoke-test.html` reports `0 passed, 0 failed` in the summary even while showing 18 green checks
|
||||
|
||||
### What is covered today
|
||||
- presence/shape of perf budget artifacts
|
||||
- presence of the perf monitor file
|
||||
- presence of the perf check workflow
|
||||
- smoke-test manual coverage around utils/state/events/audio/visual/gallery (browser harness, not pytest)
|
||||
This means the repo has a manual browser smoke harness, but no real automated CI-grade test suite.
|
||||
|
||||
### Critical uncovered paths
|
||||
### What is covered by `smoke-test.html`
|
||||
- UUID/clamp/lerp helpers
|
||||
- default state and snapshot
|
||||
- event bus firing
|
||||
- AudioContext construction and music theory helpers
|
||||
- canvas visual primitives and deterministic palette generation
|
||||
- IndexedDB save/getAll/getById/delete flow
|
||||
|
||||
### What is not covered and should be
|
||||
1. `src/playground.js` orchestration
|
||||
- entrance flow
|
||||
- initialization sequence
|
||||
- action-bar wiring
|
||||
- mode registration
|
||||
- action bar wiring
|
||||
- keyboard shortcuts
|
||||
- panel toggles
|
||||
2. `src/export/download.js`
|
||||
- single-item export
|
||||
- ZIP export
|
||||
- standalone HTML export
|
||||
3. `src/export/wav-encoder.js`
|
||||
- WAV blob correctness
|
||||
4. `src/modes/constellation.js`
|
||||
- drag lifecycle
|
||||
- teardown correctness
|
||||
- audio interaction contract
|
||||
5. gallery interaction behavior
|
||||
- open/view flow
|
||||
- item count updates
|
||||
- HTML escaping and render safety
|
||||
|
||||
### Filed from this analysis
|
||||
- the-playground #247 — PerfMonitor ships but is never loaded or started on `main`
|
||||
- the-playground #248 — batch export loads JSZip from CDN, violating zero-dependency/local-first posture
|
||||
2. `ModeManager`
|
||||
- teardown/init switching order
|
||||
- active button state
|
||||
- event emission correctness
|
||||
|
||||
3. `SoundPanel`
|
||||
- BPM slider updates state
|
||||
- quality button activation
|
||||
- chord button actually invokes audio engine
|
||||
- volume slider is rendered but currently unwired
|
||||
|
||||
4. `GalleryPanel`
|
||||
- empty/non-empty rendering
|
||||
- item-count text updates
|
||||
- click behavior
|
||||
- escaping/sanitization of item fields before `innerHTML`
|
||||
|
||||
5. cross-module browser integration
|
||||
- draw mode pointer lifecycle
|
||||
- touch behavior
|
||||
- fullscreen and download wiring
|
||||
- prompt fade-out on first interaction
|
||||
|
||||
### Generated missing tests for critical paths
|
||||
|
||||
#### A. Mode switching contract test
|
||||
A Node+VM or browser test should verify teardown/init ordering and active button state.
|
||||
|
||||
```python
|
||||
# pseudo-test idea
|
||||
# load utils/state/events/mode-manager
|
||||
# register two fake modes with counters
|
||||
# switch twice
|
||||
# assert first teardown ran before second init
|
||||
# assert PlaygroundState.canvas.mode updated
|
||||
```
|
||||
|
||||
#### B. Smoke summary correctness test
|
||||
The current smoke harness is lying about pass/fail totals.
|
||||
|
||||
```python
|
||||
# browser-level assertion
|
||||
# after smoke-test.html finishes,
|
||||
# count the green result rows and compare them to the h2 summary
|
||||
```
|
||||
|
||||
#### C. GalleryPanel XSS regression test
|
||||
`GalleryPanel.render()` builds markup with `innerHTML` from gallery item data.
|
||||
That should be locked down with a test before the panel grows more capable.
|
||||
|
||||
```python
|
||||
# save item with name containing HTML-like content
|
||||
# render gallery
|
||||
# assert rendered text is escaped / inert
|
||||
# assert no unexpected nodes/scripts are created
|
||||
```
|
||||
|
||||
## Security Considerations
|
||||
|
||||
### Strong points
|
||||
- no backend/API attack surface in the shipped app
|
||||
- local-first IndexedDB persistence
|
||||
- static hosting posture is simple and inspectable
|
||||
- no npm dependency tree on current `main`
|
||||
### Strengths
|
||||
- zero network/API attack surface in the app itself
|
||||
- no dependency tree or third-party script loaders
|
||||
- local-first persistence using IndexedDB instead of remote storage
|
||||
- deterministic, transparent runtime based on classic script tags
|
||||
- reduced-motion CSS support already present
|
||||
|
||||
### Risks
|
||||
1. `innerHTML` remains a major sink surface
|
||||
- gallery rendering is the riskiest because it interpolates persisted item data
|
||||
- related issues already exist in the target repo
|
||||
2. dynamic third-party script load in export path
|
||||
- `PlaygroundExport._loadJSZip()` injects a CDN script tag for JSZip
|
||||
- this breaks the repo's own zero-dependency/local-first claim
|
||||
3. dormant perf monitoring path
|
||||
- monitoring code exists but is not in the runtime path
|
||||
- repo can give a false sense of observability
|
||||
4. browser capability assumptions remain strong
|
||||
- IndexedDB
|
||||
- AudioContext
|
||||
- Fullscreen API
|
||||
- Blob/FileReader
|
||||
### Risks and caveats
|
||||
1. `innerHTML` is used in multiple modules.
|
||||
- `ModeManager.renderSelector()` builds buttons with `innerHTML`
|
||||
- `SoundPanel.render()` builds control markup with `innerHTML`
|
||||
- `GalleryPanel.render()` builds gallery thumbnails with `innerHTML`
|
||||
- The first two are fed by trusted in-repo data.
|
||||
- `GalleryPanel.render()` is the risky one because it interpolates gallery item data (`item.name`, `item.thumbnail`) coming back from IndexedDB.
|
||||
|
||||
2. Browser capability assumptions are strong.
|
||||
- `crypto.randomUUID()`
|
||||
- `AudioContext`
|
||||
- `indexedDB`
|
||||
- `canvas.toBlob()`
|
||||
- Fullscreen API
|
||||
- FileReader
|
||||
- all are required for the best path
|
||||
|
||||
3. No storage limits or cleanup policy.
|
||||
- IndexedDB can grow without quotas or cleanup UX inside the app
|
||||
- saved images are stored as data URLs, which can become heavy over time
|
||||
|
||||
4. No CSP/integrity story because the repo assumes direct static hosting or file-open execution.
|
||||
|
||||
## Dependencies
|
||||
|
||||
@@ -400,51 +461,79 @@ What I verified on a fresh `main` archive:
|
||||
- standard DOM APIs
|
||||
|
||||
### Project/tooling dependencies
|
||||
- none declared
|
||||
- no `package.json`
|
||||
- no bundler
|
||||
- no build step
|
||||
- one pytest-based perf artifact check
|
||||
- one browser smoke harness
|
||||
- no `requirements.txt`
|
||||
- no build tooling
|
||||
- no CI workflow files on `main`
|
||||
|
||||
### External runtime dependency discovered
|
||||
- JSZip from CDN in `src/export/download.js` for batch ZIP export
|
||||
### Verification tools used during analysis
|
||||
- `node --check` for JS syntax verification
|
||||
- browser execution of `smoke-test.html`
|
||||
- `pytest` baseline probe, which confirmed there is no Python test suite in this target repo
|
||||
|
||||
## Deployment
|
||||
|
||||
Current deployment model is still very simple:
|
||||
- open `index.html` directly in a browser
|
||||
- or serve the repo as static files from any web server
|
||||
The deployment model is intentionally trivial.
|
||||
|
||||
Verification flow I used:
|
||||
1. inspect `index.html` script contract
|
||||
2. run `pytest -q` in the target repo
|
||||
3. inspect critical mode/export/perf files directly
|
||||
4. compare live repo state to the existing genome artifact
|
||||
How to run it today:
|
||||
- open `index.html` in a browser
|
||||
- or serve the repo as static files from any plain web server
|
||||
|
||||
There is no backend, no API contract, no environment variables, and no deployment automation in the target repo.
|
||||
|
||||
Practical verification flow:
|
||||
1. `find src -name '*.js' -print0 | xargs -0 -n1 node --check`
|
||||
2. open `smoke-test.html`
|
||||
3. open `index.html`
|
||||
4. click `Enter`
|
||||
5. verify:
|
||||
- entrance transition
|
||||
- ambient mode active by default
|
||||
- sound panel playable
|
||||
- save creates a gallery item in IndexedDB
|
||||
- download exports a PNG
|
||||
|
||||
## Technical Debt
|
||||
|
||||
### Highest-priority debt
|
||||
1. README vision still exceeds code reality
|
||||
2. orchestration/export/mode behavior lacks serious automated coverage
|
||||
3. `PerfMonitor` exists but is not wired into runtime (`#247`)
|
||||
4. ZIP export relies on CDN-loaded JSZip (`#248`)
|
||||
5. gallery/open interaction depth is still shallow compared to the product promise
|
||||
1. README vision vs code reality gap
|
||||
- the README describes a much larger platform than the current implementation
|
||||
- mainline code today is a polished shell plus two real modes
|
||||
|
||||
2. No real automated test suite
|
||||
- `python3 -m pytest -q` returns `no tests ran`
|
||||
- the only harness is `smoke-test.html`
|
||||
- the smoke harness summary is already broken
|
||||
|
||||
3. `GalleryPanel.render()` trusts item data too much
|
||||
- direct `innerHTML` interpolation of stored item fields is a future XSS footgun
|
||||
|
||||
4. Global load-order coupling
|
||||
- every major module assumes previous globals are already loaded
|
||||
- there is no module isolation or dependency enforcement beyond script order
|
||||
|
||||
5. Volume slider is fake right now
|
||||
- `vol-slider` exists in `SoundPanel.render()`
|
||||
- there is no listener wiring it to `audioEngine.masterGain`
|
||||
|
||||
### Meaningful product debt
|
||||
- no real frontend app/test packaging discipline
|
||||
- no integrated runtime metrics surface despite perf budget artifacts
|
||||
- export system is richer than the rest of the UI exposes
|
||||
- batch export and standalone gallery export exist in code but are not a clearly surfaced first-class workflow in the main shell
|
||||
- the prototype is still held together by global load order rather than explicit module boundaries
|
||||
- gallery items do not really open; click only toasts an id prefix
|
||||
- no import/restore/export package flows
|
||||
- no video forge
|
||||
- no games floor
|
||||
- no persistence integration between `PlaygroundState.gallery` and IndexedDB
|
||||
- `mode-label` in the footer exists but is never updated
|
||||
- `canvas-overlay` exists but is unused
|
||||
- `perlin2d()` is explicitly a placeholder, not real Perlin noise
|
||||
- skip-link CSS exists, but no skip link appears in `index.html`
|
||||
|
||||
## Bottom Line
|
||||
|
||||
`the-playground` is no longer just a two-mode shell. Current `main` has grown into a more substantial browser prototype with export infrastructure, a third experience mode, a perf-budget lane, and one real pytest module.
|
||||
The Playground is a clean sovereign-web prototype: one HTML shell, one design system, a handful of browser engines, and a strong aesthetic identity. It already proves the interaction model.
|
||||
|
||||
But the repo still has a truth gap between what exists in source and what is actually exercised end-to-end:
|
||||
- export is richer than the visible UI story
|
||||
- performance monitoring exists but is not running
|
||||
- dependency posture says local-first while ZIP export reaches for a CDN
|
||||
- automated coverage is still far thinner than the surface area of the product
|
||||
|
||||
That is the real architectural story now: the codebase is starting to branch into platform-level capabilities, but verification and integration are lagging behind the feature shards already present in source.
|
||||
What it does not yet have is the verification, hardening, and feature depth implied by its own vision. The core challenge now is not invention. It is contraction into truth:
|
||||
- make the shipped surface match the promise
|
||||
- turn `smoke-test.html` into real automated coverage
|
||||
- harden `innerHTML` paths
|
||||
- finish the panel/mode/gallery interactions that are still only half-born
|
||||
|
||||
Reference in New Issue
Block a user