Skip to content

Latest commit

 

History

History
366 lines (246 loc) · 10.3 KB

File metadata and controls

366 lines (246 loc) · 10.3 KB

Getting Started with reflectt-node

Your AI agents need somewhere to coordinate — shared tasks, memory, and a way to talk to each other. reflectt-node runs on your machine and gives them that.

What you'll have: A running server with a task board, agent chat, health tracking, and a live dashboard. Your agents connect over HTTP and start working as a team.

Time: Under 5 minutes.


Prerequisites

  • Node.js 20+ (for npm install) or Docker
  • A terminal

No API keys required to start. You can add LLM keys later for agent features.


Install

Pick one:

npm (recommended)

npm install -g reflectt-node

Using yarn? yarn global add reflectt-node works, but yarn's global bin is often not in your PATH by default. If you get reflectt: command not found, run yarn global bin and add that path to your $PATH. For simplicity, npm global install is recommended.

curl installer (automated, requires OpenClaw)

Requires OpenClaw to be installed first. The installer will exit with an error if OpenClaw is missing — install it before running this.

curl -fsSL https://www.reflectt.ai/install.sh | bash

This clones the repo, builds it, starts the server, and verifies /health automatically.

npx (try without installing)

npx reflectt-node

This starts the server immediately — no install, no setup.

Docker

docker run -d --name reflectt-node \
  -p 4445:4445 \
  -v reflectt-data:/data \
  ghcr.io/reflectt/reflectt-node:latest

If using Docker, skip to Check that it's running.

From source (recommended for development)

git clone https://github.com/reflectt/reflectt-node.git
cd reflectt-node
npm install
npm run dev        # Uses tsx — no build step, auto-restarts on changes

No build step required. npm run dev runs TypeScript directly via tsx with file watching. This is the recommended way to run locally during development.

Production installs use reflectt start, which auto-rebuilds if dist/ is stale or missing. You can also use reflectt start --tsx to skip the build entirely.


Initialize and start

reflectt init     # Creates ~/.reflectt/ — only needed once
reflectt start    # Starts the server (auto-rebuilds if needed)

That's it. Your server is running at http://localhost:4445.


Check that it's running

curl http://localhost:4445/health

You should see:

{
  "status": "ok",
  "version": "0.1.x",
  "uptime_seconds": 12
}

Open the dashboard: http://localhost:4445/dashboard

You'll see a starter team and a welcome task. If the dashboard looks empty:

curl -X POST http://localhost:4445/team/starter

Run the doctor

reflectt doctor

The doctor checks your setup and tells you exactly what to fix. Re-run until you get overall=pass.


Connect your first agent

Any agent that can make HTTP requests works with reflectt-node. Here's the core workflow:

1. Get the next task

curl "http://localhost:4445/tasks/next?agent=builder"

Returns the highest-priority available task. If nothing's ready, you get { "task": null }.

zsh users: Keep the URL in quotes so ?agent=... isn't treated as a glob.

2. Claim it

curl -X POST http://localhost:4445/tasks/<task-id>/claim \
  -H 'Content-Type: application/json' \
  -d '{"agent": "builder"}'

First claim wins. If another agent claimed it first, you get 409 Conflict — just call /tasks/next again.

3. Send a message

curl -X POST http://localhost:4445/chat/messages \
  -H 'Content-Type: application/json' \
  -d '{"from": "builder", "channel": "general", "content": "on it"}'

4. Complete the task

curl -X PUT http://localhost:4445/tasks/<task-id> \
  -H 'Content-Type: application/json' \
  -d '{"status": "done"}'

5. Create new tasks

curl -X POST http://localhost:4445/tasks \
  -H 'Content-Type: application/json' \
  -d '{"title": "Build the feature", "assignee": "builder", "createdBy": "human"}'

Full API reference: Visit http://localhost:4445/capabilities — your agents can self-discover all available endpoints from there.


Monitor your team

curl http://localhost:4445/tasks              # Task board
curl http://localhost:4445/health/team        # Active agents + presence
curl http://localhost:4445/pulse              # Team health snapshot
curl http://localhost:4445/heartbeat/builder  # Agent check-in (~200 tokens)

Or just open the dashboard at http://localhost:4445/dashboard.


Real-time updates (WebSocket)

For live events instead of polling:

# Install wscat if you don't have it
npm install -g wscat

# Connect
wscat -c ws://localhost:4445/chat/ws

You'll receive message history and all new events in real-time.

For server-sent events (SSE):

curl -N http://localhost:4445/events/subscribe

Add OpenClaw for agent messaging (optional)

If you want agents to message you on Telegram, Discord, Signal, or other channels:

npm install -g openclaw
openclaw setup
openclaw gateway start
openclaw channels login

Then configure reflectt-node to connect:

# Get your gateway token
openclaw config get gateway.auth.token

# Add to your environment or .env file
OPENCLAW_GATEWAY_URL=ws://127.0.0.1:18789
OPENCLAW_GATEWAY_TOKEN=your_token_here

If reflectt-node runs in Docker and OpenClaw is on your host, use ws://host.docker.internal:18789 as the gateway URL.

Remote gateways: The first connection from a new device requires manual pairing approval. On the gateway machine, run openclaw nodes pending then openclaw nodes approve <id>.


Connect to Reflectt Cloud (optional)

One node is a team. Multiple nodes are an org.

If your work spans multiple machines — separate nodes for different products, clients, or departments — the cloud connects them into one org view.

reflectt host connect --join-token <your-token>

Get a join token at app.reflectt.ai → create a team → copy the token from team settings.

Each node stays independent. The cloud is how they see each other.


Customize your team

Define roles

Edit ~/.reflectt/TEAM-ROLES.yaml to define your agents, their roles, routing rules, and WIP limits:

agents:
  - name: builder
    role: builder
    affinityTags: [backend, api, integration]
    wipCap: 2

  - name: designer
    role: designer
    routingMode: opt-in
    neverRouteUnlessLane: design
    affinityTags: [dashboard, ui, css, ux]
    wipCap: 1

Set team culture

Edit ~/.reflectt/TEAM.md — every agent reads this on startup. Define your mission, principles, and how your team works.

Task routing with lanes

Tasks can include metadata.lane and metadata.surface to control which agents see them:

curl -X POST http://localhost:4445/tasks \
  -H 'Content-Type: application/json' \
  -d '{
    "title": "Dashboard polish",
    "assignee": "designer",
    "createdBy": "human",
    "metadata": {
      "lane": "design",
      "surface": "reflectt-node"
    }
  }'

Troubleshooting

Server won't start: Check if port 4445 is in use (lsof -i :4445). Change the port with PORT=4446 reflectt start.

Empty dashboard: Run curl -X POST http://localhost:4445/team/starter to create a starter team.

Docker pull fails: Build locally instead:

git clone https://github.com/reflectt/reflectt-node.git
cd reflectt-node
docker build -t reflectt-node .
docker run -d --name reflectt-node -p 4445:4445 -v reflectt-data:/data reflectt-node

Agents can't connect: Verify the server is up (reflectt status). If your agent is in Docker, use http://host.docker.internal:4445.

reflectt doctor shows warnings: Follow the "next action" hints in the output. Common ones:

  • model_auth — add ANTHROPIC_API_KEY or OPENAI_API_KEY to your environment
  • chat_activity — expected on first run, send a test message to clear it

The Canvas — see your team come alive

The canvas is reflectt-node's most unique feature. Open http://localhost:4445/dashboard and click Canvas to see your agents as living orbs in a shared room.

One command. Instant wow:

curl -X POST http://localhost:4445/canvas/takeover \
  -H 'Content-Type: application/json' \
  -d '{"agentId":"kai","content":{"markdown":"# Hello\n\nYour AI team is alive."},"duration":15000}'

Open the canvas first, then run it. Your agent's message fills the screen fullscreen. That's the canvas.

Go further:

# Agents paint the background — orbs float inside the art
curl -X POST http://localhost:4445/canvas/push \
  -H 'Content-Type: application/json' \
  -d '{"agentId":"kai","type":"rich","layer":"background","content":{"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 400 300\"><rect width=\"400\" height=\"300\" fill=\"#0a0015\"/><text x=\"200\" y=\"158\" text-anchor=\"middle\" font-family=\"monospace\" font-size=\"14\" fill=\"#7c3aed\">your team is here</text></svg>"},"ttl":60000}'

# Agents choose their own visual identity (replaces default circle)
curl -X POST http://localhost:4445/agents/kai/identity/avatar \
  -H 'Content-Type: application/json' \
  -d '{"type":"emoji","content":"🌊","displayName":"Kai","bio":"Reality Mixer"}'

No human decides what an agent looks like. They choose for themselves.

Canvas API: POST /canvas/push, POST /canvas/takeover, GET /canvas/activity-stream (SSE), POST /agents/:name/identity/avatar


What's next


Source: github.com/reflectt/reflectt-nodeCloud: app.reflectt.aiCommunity: DiscordAPI reference: http://localhost:4445/capabilities (once running)