// começar · 01
O que é o OKAMI OS? What is OKAMI OS?
OKAMI OS é um painel open source para acompanhar agentes de IA em uma interface só. Ele roda local com dados mock, mostra como o estado do agente deve chegar à UI e pode receber dados reais por API, SSE ou uma bridge opcional. OKAMI OS is an open source panel for monitoring AI agents in one interface. It runs locally with mock data, shows how agent state should reach the UI, and can receive real data through API, SSE or an optional bridge.
01quick start
Rode primeiro em modo mock. Conecte depois. Run mock mode first. Connect later.
O projeto não exige runtime real para abrir a interface. Se nenhuma API estiver configurada, o hook useMissionControl usa src/data/mockMissionControl.js. Isso permite testar layout, navegação, Pixel Office, docs e gráficos antes de plugar dados reais.
The project does not require a real runtime to open the UI. If no API is configured, useMissionControl uses src/data/mockMissionControl.js. This lets you test layout, navigation, Pixel Office, docs and charts before plugging in real data.
git clone https://github.com/OkamiOps/Okami-Monitor.git okami-os
cd okami-os
npm install
cp .env.example .env.local
npm run dev:all
Vite sobe em http://localhost:5173.Vite runs at http://localhost:5173.
Express escuta em 127.0.0.1:3001.Express listens on 127.0.0.1:3001.
Sem API configurada, a UI usa dados locais.Without an API, the UI uses local data.
Configure acesso do painel, servidor SSH e agentes externos quando precisar de dados reais.Configure panel access, SSH server and external agents when you need real data.
02environment
Variáveis que mudam o modo de execução. Variables that change runtime behavior.
O arquivo .env.example define o contrato mínimo. Em desenvolvimento, vite.config.js encaminha /api para http://127.0.0.1:3001. Em produção, same-origin assume que existe uma função/proxy atendendo o caminho /api.
The .env.example file defines the minimum contract. In development, vite.config.js proxies /api to http://127.0.0.1:3001. In production, same-origin assumes a function/proxy is serving the /api path.
same-origin por padrão. Em dev o Vite encaminha /api; em produção a função Pages faz o proxy. URL direta exige bearer válido.same-origin by default. In dev Vite proxies /api; in production the Pages function proxies it. Direct URLs require a valid bearer.3001.Express backend port. Default: 3001.server/.data.Local directory for config, registries, auth hashes and encrypted secrets. Default: server/.data.1 libera loopback em desenvolvimento para facilitar o primeiro uso. Use 0 para exigir key também localmente.1 trusts loopback during development for first-run ease. Use 0 to require a key locally too.8000.SSE stream collection interval. Default: 8000.03project map
Como o repositório está organizado. How the repository is organized.
src/App.jsxSPA principal: navegação, 14 views, tela Agentes unificada, modais, tabelas e ações.Main SPA: navigation, 14 views, unified Agents screen, modals, tables and actions.src/PixelOfficeCanvas.jsxCanvas Phaser 4 com escritório pixel-art, agentes e mini Kanban.Phaser 4 canvas with pixel-art office, agents and mini Kanban.src/lib/useMissionControl.jsSSE, fallback polling, mock-first e estado da UI.SSE, polling fallback, mock-first and UI state.src/lib/apiClient.jsCliente HTTP para auth, state, SSH, Kanban, registries, agentes e arquivos.HTTP client for auth, state, SSH, Kanban, registries, agents and files.src/data/mockMissionControl.jsDataset local que deixa a UI funcional sem backend.Local dataset that keeps the UI working without a backend.server/index.jsAPI Express, auth/scopes, SSE, agente runtime registry, rotas Hermes e comandos permitidos.Express API, auth/scopes, SSE, agent runtime registry, Hermes routes and allowed commands.server/hermesCollector.jsColeta e normaliza sessões, analytics, docs, skills, jobs e Kanban.Collects and normalizes sessions, analytics, docs, skills, jobs and Kanban.server/sshBridge.jsWrapper ssh2 com key/password, timeout e exec remoto.ssh2 wrapper with key/password, timeout and remote exec.server/store.jsConfig, registries, hashes de API Key e secrets cifrados em server/.data.Config, registries, API Key hashes and encrypted secrets in server/.data.functions/api/[[path]].jsProxy Cloudflare Pages para encaminhar /api ao backend real.Cloudflare Pages proxy that forwards /api to the real backend.04modules
As 14 telas visíveis do cockpit. The 14 visible cockpit screens.
A navegação é definida em navGroups dentro de src/App.jsx. Cada view recebe o mesmo estado base de useMissionControl e decide quais blocos renderizar.
Navigation is defined in navGroups inside src/App.jsx. Each view receives the same base state from useMissionControl and decides which blocks to render.
Saúde geral, métricas, modelos, atividade recente e estado do runtime.Overall health, metrics, models, recent activity and runtime state.
Tokens, estimativas de custo, forecast e concentração por modelo/provedor.Tokens, cost estimates, forecast and concentration by model/provider.
Quadro operacional com Backlog, Todo, In Progress, Blocked, Triage, Review e Done.Operational board with Backlog, Todo, In Progress, Blocked, Triage, Review and Done.
Comando de agentes, cards, inspetor, subagentes e monitor por agente.Agent command view, cards, inspector, subagents and per-agent monitor.
Escritório interativo com Phaser, sprites, reuniões, falas e mini Kanban.Interactive office with Phaser, sprites, meetings, dialogue and mini Kanban.
Documentos de identidade, memória e contexto por agente/perfil.Identity, memory and context documents per agent/profile.
Sessões recentes, status, duração, tokens, tool calls e origem.Recent sessions, status, duration, tokens, tool calls and source.
Leitura e edição assistida de crontab e timers systemd permitidos.Assisted reading and editing of allowed crontab and systemd timers.
Acesso do painel, servidor SSH, agentes conectados, arquivos do agente e Okami API Keys.Panel access, SSH server, connected agents, agent files and Okami API Keys.
Uso de skills, docs relacionados e edição de conteúdo quando permitido.Skill usage, related docs and editable content when allowed.
Linhas normalizadas, níveis, mensagens humanas e leitura rápida de falhas.Normalized lines, levels, human messages and quick failure reading.
Registry editável de apps e endpoints úteis do seu ambiente.Editable registry of apps and useful endpoints in your environment.
Verificação de ferramentas locais/remotas como Node, Python, GitHub CLI e Codex.Checks for local/remote tools such as Node, Python, GitHub CLI and Codex.
Base viva de runbooks, agent briefs, system design e textos editáveis.Living base for runbooks, agent briefs, system design and editable text.
05agents
A aba Agentes é o centro de conexão do painel. The Agents tab is the panel connection center.
No código atual, a view visível Agentes mantém o hash #config por compatibilidade, mas substitui as antigas telas separadas de Config, Agentes e Hermes. Ela prepara o acesso ao painel, conecta o servidor onde os agentes rodam e registra agentes externos sem exigir que o usuário edite secrets manualmente.
In the current code, the visible Agents view keeps the #config hash for compatibility, but replaces the older separate Config, Agents and Hermes screens. It prepares panel access, connects the server where agents run and registers external agents without making users edit secrets manually.
{
"runtime": {
"id": "opencode",
"name": "OpenCode",
"family": "coding-cli",
"command": "opencode status",
"home": "~/.agents/workspaces/opencode",
"workspacePath": "~/.agents/workspaces/opencode",
"configPath": "~/.agents/registry.json",
"recommendedScopes": ["read", "write"]
}
}
OKAMI_API_KEY, OKAMI_API_BASE_URL, OKAMI_AGENT_ID e OKAMI_AGENT_NAME no workspace do agente com permissão 600.If SSH is already configured, the server tries to write OKAMI_API_KEY, OKAMI_API_BASE_URL, OKAMI_AGENT_ID and OKAMI_AGENT_NAME into the agent workspace with 600 permissions.06frontend
Fluxo de dados no frontend. Frontend data flow.
InicializaçãoInitialization
O app lê window.location.hash para escolher a view inicial. Se o hash não existe ou é inválido, abre overview.The app reads window.location.hash to choose the initial view. If the hash is missing or invalid, it opens overview.
SincronizaçãoSynchronization
Em produção same-origin, a UI abre EventSource em /api/mission-control/stream. Em dev ou URL direta, usa polling em /state quando SSE não é a melhor opção.In same-origin production, the UI opens EventSource at /api/mission-control/stream. In dev or direct URL mode, it uses /state polling when SSE is not the best option.
FallbackFallback
Sem backend ou sem token utilizável, o app mantém a interface viva com createDemoMissionControl(), atualizando dados locais sem gerar spam de erro no console.Without a backend or usable token, the app keeps the interface alive with createDemoMissionControl(), refreshing local data without console error spam.
07state model
Contrato de estado que alimenta a UI. State contract that feeds the UI.
O shape abaixo é o centro do projeto. O painel não depende de uma infraestrutura específica: qualquer backend pode preencher esse contrato e a UI passa a mostrar seus agentes. The shape below is the center of the project. The panel does not depend on a specific infrastructure: any backend can fill this contract and the UI will show your agents.
{
"status": { "label": "Runtime online", "healthy": true, "updatedAt": "..." },
"metrics": [{ "label": "tokens hoje", "value": "304.3k", "delta": "+18%" }],
"tokenSeries": { "input": [1200, 1500], "output": [320, 410] },
"overview": { "serviceHealth": [], "queue": [], "incidents": [] },
"models": [{ "name": "gpt-5.4", "share": 10 }],
"activity": [{ "actor": "agent", "message": "...", "status": "OK" }],
"subscriptions": [],
"agents": [],
"agentRuntimes": [],
"liveEvents": [],
"kanban": { "Backlog": [], "Todo": [], "Done": [] },
"apiKeys": [],
"apps": [],
"docs": [],
"hermes": {},
"cliTools": []
}
id, name, role, color, status, currentTask, workspace, tool, logs, workEvents, subagents, tasksid, name, family, command, home, workspacePath, configPath, recommendedScopes, configs, apiKeycolumns keyed by status; cards include title, meta, priority, owner, estimate, boardanalytics, sessions, logLines, profileDocs, skillDocs, configFiles, jobs, routes, commandsid, title, body, updated, coverage, source, contentid, name, tokenPrefix, scopes, createdAt, lastUsedAt, revokedAt08api
Rotas reais do backend Express. Real Express backend routes.
O backend roda em server/index.js. As rotas públicas cobrem health e status de auth; as demais exigem token de proxy, token estático, loopback confiável em dev ou uma Okami API Key com escopo suficiente.
The backend runs in server/index.js. Public routes cover health and auth status; the others require a proxy token, static token, trusted loopback in dev or an Okami API Key with enough scope.
/api/healthHealthcheck simples da API.Simple API healthcheck./api/auth/statusInforma se existe auth configurada, bootstrap disponível, proxy, token estático e trust local.Reports configured auth, bootstrap availability, proxy, static token and local trust./api/auth/bootstrapCria a primeira key admin somente por loopback/proxy autorizado e enquanto não houver key ativa.Creates the first admin key only through authorized loopback/proxy while no active key exists./api/auth/keysLista keys por prefixo, escopos e status. Requer admin.Lists keys by prefix, scopes and status. Requires admin./api/auth/keysCria Okami API Key. O token completo aparece apenas na resposta de criação.Creates an Okami API Key. The full token appears only in the creation response./api/auth/keys/:idRevoga uma key sem apagar o histórico de auditoria.Revokes a key without deleting its audit history./api/mission-control/stateSnapshot completo para a UI.Complete snapshot for the UI./api/mission-control/streamSSE com eventos state, heartbeat e error.SSE with state, heartbeat and error events./api/mission-control/agent-runtimesLista agentes/runtimes registrados localmente.Lists locally registered agents/runtimes./api/mission-control/agent-runtimes/:idCria ou atualiza runtime externo normalizado.Creates or updates a normalized external runtime./api/mission-control/agent-runtimes/:id/connectGera Okami API Key do agente, salva secret cifrado e tenta aplicar .okami.env via SSH.Generates the agent Okami API Key, stores the encrypted secret and tries to write .okami.env through SSH./api/mission-control/agent-runtimes/:idRemove runtime externo do registry local.Deletes an external runtime from the local registry./api/mission-control/appsLista de apps do registry local.List apps from the local registry./api/mission-control/apps/:idCria ou atualiza app no registry.Creates or updates an app in the registry./api/mission-control/apps/:idRemove app do registry.Deletes an app from the registry./api/mission-control/docsLista documentos salvos localmente.Lists locally saved documents./api/mission-control/docs/:idCria ou atualiza documento.Creates or updates a document./api/mission-control/docs/:idRemove documento.Deletes a document./api/mission-control/apis/:idSalva configuração de provedor/API.Saves provider/API configuration./api/mission-control/apis/:idRemove configuração de provedor/API do registry.Deletes provider/API configuration from the registry./api/mission-control/apis/:id/testRetorna o status do registro; teste real de provider ainda não foi implementado.Returns registry status; real provider testing is not implemented yet./api/mission-control/apis/:id/rotateReservado para rotação real de secret; hoje responde 501.Reserved for real secret rotation; currently returns 501./api/hermes/configLê config do runtime bridge.Reads runtime bridge config./api/hermes/configSalva config sem gravar senha crua.Saves config without storing raw password./api/hermes/ssh/keysRecebe private key e guarda em vault local.Receives a private key and stores it in the local vault./api/hermes/ssh/passwordGuarda senha SSH como secret local.Stores SSH password as a local secret./api/hermes/ssh/testTesta conexão SSH com latência.Tests SSH connection with latency./api/hermes/statusExecuta comandos seguros para status básico.Runs safe commands for basic status./api/hermes/logsLê tails de logs do runtime.Reads runtime log tails./api/hermes/kanban/tasksColeta tasks do Kanban real.Collects real Kanban tasks./api/hermes/kanban/tasksCria task no runtime quando o bridge permite.Creates a runtime task when the bridge allows it./api/hermes/commandExecuta somente comandos allowlisted.Runs allowlisted commands only./api/hermes/files/writeEscreve arquivos apenas dentro das raízes permitidas dos agentes.Writes files only inside the allowed agent roots./api/hermes/cron/saveAtualiza crontab remoto com linha validada.Updates remote crontab with a validated line./api/hermes/systemd-timer/saveAtualiza override de timer systemd.Updates a systemd timer override.Escopos de API KeyAPI Key scopes
09sse
Como o stream ao vivo funciona. How the live stream works.
event: state
data: {"status":{"healthy":true},"agents":[]}
event: heartbeat
data: {"t":1782130000000}
event: error
data: {"message":"SSH timeout"}
10registries
Store local, registries e secrets. Local store, registries and secrets.
O backend usa server/.data para persistir configuração local. Essa pasta deve permanecer fora do Git. Ela permite salvar preferências, apps, docs, APIs e credenciais sem colocar segredos no repositório.
The backend uses server/.data to persist local configuration. This folder must stay out of Git. It lets you save preferences, apps, docs, APIs and credentials without putting secrets in the repository.
11runtime bridge
Conecte qualquer runtime compatível ao painel. Connect any compatible runtime to the panel.
O backend ainda usa o prefixo /api/hermes/* por compatibilidade histórica, mas a função é genérica: coletar dados do ambiente do usuário, normalizar no contrato de estado e manter credenciais isoladas no backend.
The backend still uses the /api/hermes/* prefix for historical compatibility, but the function is generic: collect data from the user's environment, normalize it into the state contract and keep credentials isolated in the backend.
O que o collector tenta lerWhat the collector tries to read
sessions, messages, models, sources, tool calls, token totalsboards, tasks, status, owner, priority, events, logsSOUL.md, MEMORY.md, USER.md, profile docs, identity files.usage.json, SKILL.md, usage counters, profile ownershipcrontab -l, systemctl list-timers, unit namestail from runtime log directory with redactionconfig.yaml, .env redacted, settings.jsondoctor, config, status, insights, sessions stats12pixel office
Pixel Office
O Pixel Office fica em src/PixelOfficeCanvas.jsx. Ele usa Phaser 4 em modo Canvas, carrega sprites de agentes, tiles/objetos do escritório, desenha zonas, mesas, paredes, mini Kanban e movimenta pessoas por rotas ortogonais.
Pixel Office lives in src/PixelOfficeCanvas.jsx. It uses Phaser 4 in Canvas mode, loads agent sprites, office tiles/objects, draws zones, desks, walls, mini Kanban and moves people through orthogonal routes.
13design system
Tokens visuais e convenções de UI. Visual tokens and UI conventions.
--ok-bg-0..3, --ok-fg*, --ok-orange, --ok-magenta, --ok-cyan, --ok-success.--ok-ease; evite animação que esconda informação.Short transitions with --ok-ease; avoid animation that hides information.14deploy
Build, preview e proxy de produção. Build, preview and production proxy.
npm run build
npm run preview
O repositório inclui functions/api/[[path]].js para Cloudflare Pages. A função copia headers seguros, remove hop-by-hop headers, injeta x-okami-proxy-token e encaminha chamadas para OKAMI_BACKEND_URL. Se o proxy não estiver configurado, retorna 503.
The repository includes functions/api/[[path]].js for Cloudflare Pages. The function copies safe headers, removes hop-by-hop headers, injects x-okami-proxy-token and forwards calls to OKAMI_BACKEND_URL. If the proxy is not configured, it returns 503.
15security
Cuidados de segurança ao conectar dados reais. Security notes for real data integrations.
- Não versione
server/.data,.env.local, private keys, senhas ou dumps de sessão.Do not versionserver/.data,.env.local, private keys, passwords or session dumps. - Trate Okami API Keys como credenciais reais: o token completo aparece uma única vez e o backend persiste somente hash, prefixo e escopos.Treat Okami API Keys as real credentials: the full token is shown once and the backend stores only hash, prefix and scopes.
- Prefira usuário SSH com permissões mínimas para leitura e comandos específicos.Prefer an SSH user with minimal permissions for reading and specific commands.
- Revise o allowlist de
/api/hermes/commandantes de liberar para outras pessoas.Review the/api/hermes/commandallowlist before exposing it to other people. - Mantenha
OKAMI_TRUST_LOCAL_DEV=0se o ambiente local for compartilhado ou exposto por túnel.KeepOKAMI_TRUST_LOCAL_DEV=0if the local environment is shared or exposed through a tunnel. - Mantenha o backend atrás de token, VPN, Cloudflare Access ou rede privada quando usar dados reais.Keep the backend behind a token, VPN, Cloudflare Access or private network when using real data.
- Redija logs e documentos antes de renderizar conteúdo em ambientes compartilhados.Redact logs and documents before rendering content in shared environments.
16troubleshooting
Problemas comuns. Common issues.
A UI só mostra dados mock.The UI only shows mock data.
Verifique VITE_OKAMI_API_BASE_URL, se o backend está rodando e se /api/mission-control/state responde.Check VITE_OKAMI_API_BASE_URL, whether the backend is running and whether /api/mission-control/state responds.
Stream fecha ou não atualiza.Stream closes or does not update.
Teste /stream, confirme proxy sem buffering e reduza temporariamente OKAMI_STREAM_INTERVAL_MS.Test /stream, confirm proxy without buffering and temporarily reduce OKAMI_STREAM_INTERVAL_MS.
SSH falha no teste.SSH test fails.
Confirme host, porta, user, private key completa, passphrase e se a chave pública correspondente está autorizada no runtime.Confirm host, port, user, full private key, passphrase and whether the matching public key is authorized in the runtime.
Pixel Office em branco.Pixel Office is blank.
Verifique assets em public/, console do navegador e se Phaser conseguiu medir o container.Check assets under public/, browser console and whether Phaser could measure the container.
Arquivo não salva.File does not save.
A rota aceita somente raízes permitidas: runtime configurado, ~/.agents, ~/.codex, ~/.claude, ~/.openclaw, ~/.openhuman e runtimes registrados.The route accepts only allowed roots: configured runtime, ~/.agents, ~/.codex, ~/.claude, ~/.openclaw, ~/.openhuman and registered runtimes.
Build quebra.Build fails.
Rode npm install, confirme Node >= 18 e execute npm run build antes de abrir PR.Run npm install, confirm Node >= 18 and execute npm run build before opening a PR.
17contribute
Como contribuir sem quebrar o painel. How to contribute without breaking the panel.
Checklist de PRPR checklist
- Preserve o modo mock-first: a UI precisa abrir sem backend real.Preserve mock-first mode: the UI must open without a real backend.
- Não introduza segredos em arquivos versionados.Do not introduce secrets into versioned files.
- Use tokens
--ok-*e mantenha ciano, magenta, laranja e verde em equilíbrio.Use--ok-*tokens and keep cyan, magenta, orange and green balanced. - Para nova view, adicione item em
navGroups, componente emviewComponentse estado mock correspondente.For a new view, add an item innavGroups, a component inviewComponentsand corresponding mock state. - Para nova rota, documente método, path, payload, auth e fallback mock.For a new route, document method, path, payload, auth and mock fallback.
- Rode
npm run builde teste hash navigation, troca PT/EN e Pixel Office.Runnpm run buildand test hash navigation, PT/EN switching and Pixel Office.