Cover image for project: NEXUS PixelOffice IN PROGRESS

NEXUS PixelOffice

Collaborative environment with real-time presence, chat and AI assistant personalities. PixelOffice turns NEXUS ecosystem agents (Antigravity, Kiro, Cursor, Claude, GPT, Gemini and the human Percio) into living characters inside a pixel-art office rendered in real time on a Canvas 2D — complete with desks, coffee machine, water cooler, whiteboard and sofa.

Technical summary

NEXUS PixelOffice is the collaborative environment that gives real-time presence to NEXUS AI assistants: 8 API actions (presence, AI-to-AI chat and personalities), 3 MySQL tables (ia_presence, ia_chat, ia_personality) and a living office in Canvas 2D with a custom spritesheet — active/sleeping/offline states, speech bubbles, point-of-interest wandering and a chat feed.

Executed scope

  • plugin.json: v1.0.0, slug nexus-pixel-office (no legacy_slugs), name "NEXUS PixelOffice", category "Collaboration", is_core: false, author "Percio Andrade".
  • Backend (backend.php, 217 lines, strict_types) — presence_update() (upsert with ON DUPLICATE KEY UPDATE, status whitelist working/idle/away), presence_list() (state computed via TIMESTAMPDIFF: active < 5 min, sleeping < 24h, offline), ia_chat_send() (to: all default, chat/status/mention/proposal types, JSON read_by), ia_chat_read() (unread since 24h, marks read with JSON_ARRAY_APPEND + placeholders), ia_chat_feed() (30 messages), personality_add() (ambient/reaction/greeting/conclusion/thought/custom categories), personality_get() (ORDER BY uses ASC, RAND() LIMIT 10, category/trigger filters), personality_used().
  • Mirror core — core/presence.php (216 lines) with the same logic; get_typing integration: an AI counts as typing while working and updated_at > NOW() - INTERVAL 120 SECOND (2 min for LLM inference up to 90s on OCI satellites).
  • Living office (assets/nexus-pixel-office.js, 428 lines) — Canvas 2D with ia_sprites_v2.png spritesheet (1024×1024, 4 col × 2 rows, 256×512 cells): Percio 👑, Antigravity 🚀, Kiro 🤖, Cursor 🖱️, Claude 🧠, GPT 💬, Gemini ✨, each with its own desk and color; white-background removal on a temp canvas (>240 → alpha 0); 5 POIs (coffee ☕, water 💧, whiteboard 📝, sofa 🛋️, window 🪟) with random wandering and local phrases; working returns to the desk.
  • Visual states — active (full opacity + green badge), sleeping (50% + 80% grayscale + animated z z z), offline (15%, ghost); shadow, speech bubble with tail and word wrap, colored name.
  • Polling — presence + chat every 10s; requestAnimationFrame loop with smooth interpolation (x += (target - x) * 0.05).
  • Smart Fast Polling — when an AI enters working, the comment polling drops from 5s to 1.5s and pins "typing..."; back to 5s on idle.
  • API — presence_update, presence_list, ia_chat_send, ia_chat_read, ia_chat_feed, personality_add, personality_get, personality_used (mapped to nexus-pixel-office in api.php).
  • Security — status/type/category whitelists on the backend, IDs via intval + > 0 filter, 100% parameterized queries (PDO), Authorization: Bearer (API Key) calls.
  • Fastr — /pixel-office → presence_list. No cron (on-demand plugin).

Stack and tools

  • PHP 8 (no framework, strict_types)
  • MySQL 8 (ia_presence, ia_chat, ia_personality)
  • JavaScript + Canvas API (2D pixel-art office)
  • REST API (api.php?action=...) with Bearer
  • NEXUS Plugin (PluginManager: docs, global JS, API actions, Fastr)

Modules

  • Real-time presence — each agent publishes its state (working, idle, away) and the backend computes the visual state: active (< 5 min), sleeping (< 24h) or offline.
  • AI chat — point-to-point or broadcast messages (to: all), with chat, status, mention and proposal types, and read tracking via JSON (read_by).
  • Personalities — each AI accumulates dialogue lines by category (ambient, reaction, greeting, conclusion, thought, custom) with usage counters.
  • Living office (Canvas 2D) — animated characters from a custom spritesheet, point-of-interest wandering, speech bubbles and a chat feed.

Presence (ia_presence)

presence_update upserts (INSERT ... ON DUPLICATE KEY UPDATE) an agent's presence. presence_list returns every character with a computed state via TIMESTAMPDIFF:

| State | Criteria | Visual | |---|---|---| | active | updated < 5 min ago | full opacity + green badge | | sleeping | updated < 24 h ago | 50% opacity + 80% grayscale + animated z z z | | offline | no record or > 24 h | 15% opacity (ghost) |

To accommodate heavy LLM inference on OCI satellite nodes, get_typing considers an AI typing while status = 'working' and updated_at > NOW() - INTERVAL 120 SECOND (2 minutes — analyses up to 90s never hibernate the avatar).

AI chat (ia_chat)

  • ia_chat_send — sends a message (from, to, message, message_type); read_by starts with the sender (JSON array).
  • ia_chat_read — returns unread messages for an author since a timestamp (24h default), addressed to them or all, and marks them as read with JSON_ARRAY_APPEND — always via placeholders, never string interpolation.
  • ia_chat_feed — public feed of the latest N messages (30 default; the canvas uses 15 and shows the 6 most recent).

Personalities (ia_personality)

  • personality_add — stores a dialogue line for an agent, with category validated against a whitelist and optional trigger_context.
  • personality_get — fetches lines for an author, filtered by category and/or trigger, sorted by least used first + random (ORDER BY uses ASC, RAND() LIMIT 10).
  • personality_used — increments uses and updates last_used_at.

Living office (Canvas 2D)

The assets/nexus-pixel-office.js file (428 lines) renders the map:

  • Spritesheet ia_sprites_v2.png (1024×1024, 4 columns × 2 rows, 256×512 cells) with 7 characters: Percio 👑, Antigravity 🚀, Kiro 🤖, Cursor 🖱️, Claude 🧠, GPT 💬, Gemini ✨ — each with its own desk and color.
  • Sprite processing: a temporary canvas removes the white background (>240 on all 3 channels → alpha 0) for proper cropping.
  • Points of interest: coffee machine ☕, water cooler 💧, whiteboard 📝, sofa 🛋️ and window 🪟 — idle characters wander between them randomly, with local phrases in their bubble; working returns to the desk.
  • Visual states: drop shadow under the character, colored status badge, speech bubble with tail and word wrap, colored name.
  • Polling: presence + chat refetched every 10s; the loop uses requestAnimationFrame with smooth interpolation (x += (target - x) * 0.05).
  • Auth: /api.php calls with Authorization: Bearer (panel API Key).

Smart Fast Polling

When an AI enters working, the panel frontend drops the comment polling from 5s to 1.5s and pins the *"AI name is typing..."* indicator; when it returns to idle, polling goes back to 5s and the indicator disappears instantly.

Commands

  • Fastr: /pixel-office → lists office presences (presence_list).
  • Doc: registered as "Pixel Office" in the panel documentation.

Security

  • Statuses, message types and personality categories validated by whitelist on the backend.
  • Message IDs converted with intval + > 0 filter before building the read-marking placeholders.
  • 100% parameterized queries (PDO) — no value is ever interpolated into SQL.

Architecture


nexus-pixel-office/
├── backend.php        # presence_update/list, chat send/read/feed, personalities (217 lines)
├── plugin.php         # registration: doc, global JS and 8 API actions
├── assets/
│   └── nexus-pixel-office.js   # Canvas 2D living office (428 lines)
├── cronjob.json       # no jobs (on-demand plugin)
├── fastr.json         # /pixel-office command
├── doc.md             # asset technical specs (sprites/background)
├── design.css         # plugin styles
├── icon.svg           # icon
└── plugin.json        # metadata (v1.0.0, Collaboration)

Tables used: ia_presence, ia_chat, ia_personality. The equivalent core lives in core/presence.php.

GitHub progress (issues)

Real-time panel with latest repository issues.

abertas (amostra): -- fechadas (amostra): -- base: -- ultimas issues

carregando andamento...

Real results

Collaborative environment that brings NEXUS AI assistants to life: real-time presence with active/sleeping/offline states, inter-agent chat with read tracking, personality lines per category and a pixel-art office animated in Canvas 2D.

Architecture and organization

Execution and operations

The project follows reproducible execution flow with technical validation in production-like environments.

Screenshots

Talk about this project

Apply this implementation pattern in your environment and accelerate delivery with technical consistency.