Cognis
A java claw
Install / Use
/learn @rmukubvu/CognisREADME
Cognis
Cognis is a Java 21 autonomous agent runtime focused on practical execution: tool use, scheduling, memory, payment guardrails, and auditable operations for mobile-first workflows.
Cognis started from ideas inspired by NanoClaw/OpenClaw, then evolved into a Java-first MCP + mobile architecture.
Why Cognis
Cognis is positioned as a trusted autonomous operator:
- Guardrailed actions (payments policy + confirmation thresholds)
- Accountable execution (audit trail + dashboard metrics)
- Mobile-native interaction (WebSocket protocol with typing/streaming/ack)
- Local-first deployment (Docker, file-backed state, no managed cloud dependency required)
Architecture
clawmobile (mobile)
|
| WebSocket + HTTP
v
+-----------------------------+
| cognis-app (composition) |
| - GatewayServer (Undertow) |
| - CLI commands |
+--------------+--------------+
|
v
+----------------------------------------------------+
| cognis-core |
| |
| Agent Layer |
| ├── AgentOrchestrator (LLM loop, trace, heartbeat)|
| ├── AgentTool (spawn/await/steer/kill) |
| ├── AgentPool (semaphore concurrency cap)|
| ├── SubagentRegistry (persistent run tracking) |
| ├── TaskQueue (DAG dependency executor) |
| ├── CoordinatorTool (goal → task graph → LLM) |
| ├── TraceContext (traceId/spanId chain) |
| └── ZombieReaper (stale run detection) |
| |
| Infrastructure |
| ├── TopicMessageBus (pub/sub fan-out) |
| ├── SharedMemoryStore (namespaced agent memory) |
| ├── ProviderRouter (LLM provider fallback) |
| ├── ToolRegistry (tool dispatch) |
| └── Workflow/Cron/Payments/Observability |
+----------------------------------------------------+
|
v
File-backed stores
(.cognis/*, memory/*, uploads/*)
Multi-Agent Execution Model
Cognis uses a single-orchestrator + async subagent pool model. The parent LLM loop drives orchestration by calling agent tools; the framework handles concurrency, tracing, and fault recovery.
AgentOrchestrator (root)
│ TraceContext.root() → traceId propagated to all descendants
│
├─ AgentTool.spawn("research X") ──► AgentPool.submit() ──► child run (virtual thread)
│ child.traceId == root.traceId
├─ AgentTool.spawn("research Y") ──► AgentPool.submit() ──► child run (virtual thread)
│
├─ AgentTool.await_all([runA, runB]) ← blocks until both complete
│
└─ CoordinatorTool.decompose(goal)
│ planner LLM → JSON task graph [{id, prompt, role, dependsOn[]}]
└─ TaskQueue.submit(tasks)
├─ tasks with no deps → spawned immediately (parallel)
└─ tasks with dependsOn → CompletableFuture.allOf(...).thenCompose(spawn)
zero polling, event-driven chaining
Key properties:
MAX_DEPTH = 2: child agents can spawn grandchildren; deeper nesting is blockedAgentPool: semaphore-bounded — rejects spawns when at capacity (default 10 concurrent)SubagentRegistry: all runs persisted to.cognis/subagents/runs.jsonfor audit and recoveryZombieReaper: scheduled every 60s — marks RUNNING runs with stale heartbeats as FAILEDTraceContext:traceIdshared across entire spawn tree;spanIdunique per run; emitted in all observability events
Topic Message Bus
TopicMessageBus
├── publish("cron.workflow", msg) → fan-out to all "cron.workflow" subscribers (virtual threads)
├── publish("channel.whatsapp", msg)
└── subscribe("channel.whatsapp", handler) → returns subscriptionId for later unsubscribe
Verticals subscribe to topics they care about. Adding a new notification channel (e.g. email, push)
requires only a new subscribe() call — no changes to existing vertical code.
Shared Memory
Agents within the same spawn tree share facts via SharedMemoryStore without passing raw context strings:
field-intake agent → sharedMemory.write(parentRunId, "beneficiary_count", "47 at Juba site 3")
supply-matching agent ← getSummary(parentRunId) injected into system prompt automatically
Modules
cognis-core: domain logic, providers, tools, workflow, payments, observability, gateway primitivescognis-cli: command-line shell around core runtimecognis-app: executable app and wiring (providers, tools, gateway, stores)cognis-dashboard: React/Vite operations dashboard for metrics + audit trail
Documentation
- Migration plan:
docs/MIGRATION_PLAN.md - Operations runbook:
docs/OPERATIONS.md - MCP server bootstrap guide:
docs/MCP_SERVER.md - Contributing guide:
CONTRIBUTING.md - Mobile test client (React Native):
https://github.com/rmukubvu/clawmobile
Core Features
- Java 21 runtime (virtual threads for all subagent spawning)
- Multi-provider routing + fallback chains
openrouter,openai,anthropic,bedrock,bedrock_openai,openai_codex,github_copilot
- Multi-agent orchestration
agenttool:spawn,await,await_all,steer,kill,status,create,chat,listcoordinatortool: decomposes a goal via a planner LLM into a parallel task graph, executes viaTaskQueueTaskQueue: DAG dependency resolution (Kahn's topological sort) +CompletableFuturechaining, zero pollingAgentPool: semaphore-based concurrency cap (configurable, default 10 concurrent subagent runs)ZombieReaper: background daemon that terminates stalled subagent runs via heartbeat liveness checkTraceContext:traceId/spanId/parentSpanIdpropagated through every spawn chain and emitted in all audit events
- Shared memory
SharedMemoryStore: namespaced key-value store so parallel subagents share facts without string serialisation
- Pub/sub message bus
TopicMessageBus: topic-based fan-out with virtual-thread listener dispatch andsubscribe/unsubscribe
- Tooling
filesystem,shell,web,cron,message,memory,profile,notify,payments,workflow,vision(when configured)
- Typed result handling
AgentResultcarriesAgentStatus(SUCCESS,MAX_ITERATIONS,TOOL_ERROR) — callers no longer string-match timeout messages
- Mobile gateway
- HTTP upload/transcribe/files + WebSocket chat protocol
- Memory and context
- SQLite-backed conversation history (default), session summary, profile, long-term memory
- Payments guardrails
- policy limits, merchant/category allowlists, confirmation threshold, quiet hours, status and ledger tracking
- Observability
- append-only audit events with full trace IDs + derived dashboard metrics
- Dashboard
- KPI cards, execution snapshot, audit filtering, CSV export
Repository Layout
.
├── cognis-app/
├── cognis-cli/
├── cognis-core/
├── cognis-dashboard/
├── docker/
├── docker-compose.yml
├── Dockerfile
└── .env.example
Requirements
- Java 21
- Maven 3.9+
- Docker + Docker Compose (optional, recommended for quick start)
- Node 20+ (for
cognis-dashboard)
Quick Start (Docker)
- Create environment file:
cd /path/to/cognis
cp .env.example .env
If .env.example does not show in Finder, enable hidden files with Cmd+Shift+. or run ls -la.
- Optional helper: open the local env setup page to generate your
.envvalues.
- File location:
docs/env-setup.html - Open it directly in your browser (double-click in Finder or drag into a browser tab).

- Set at least one provider credential in
.env:
OPENROUTER_API_KEY=...
# or OPENAI_API_KEY=...
# or ANTHROPIC_API_KEY=...
# or Bedrock via IAM credentials/role:
# AWS_REGION=us-east-1
# AWS_ACCESS_KEY_ID=...
# AWS_SECRET_ACCESS_KEY=...
# AWS_SESSION_TOKEN=... # only for temporary credentials
# AWS_PROFILE=... # optional local profile alternative
# or Bedrock OpenAI-compatible endpoint (bearer token):
# COGNIS_PROVIDER=bedrock_openai
# AWS_BEARER_TOKEN=...
# BEDROCK_OPENAI_API_BASE=https://bedrock-runtime.us-east-1.amazonaws.com/openai/v1
- Start Cognis gateway + MCP server + dashboard:
docker compose up --build
Gateway default URL:
- HTTP:
http://127.0.0.1:8787 - WebSocket:
ws://127.0.0.1:8787/ws?client_id=<your-client-id> - MCP tools endpoint:
http://127.0.0.1:8791/mcp/tools - Operations dashboard:
http://127.0.0.1:4173
Persistent data:
./docker-data->/home/cognis/.cognisinside container
Useful Docker commands
# Run gateway in background
docker compose up -d --build
# Tail logs
docker compose logs -f cognis cognis-mcp-server cognis-dashboard
# Tail only SMS/MCP flow
docker compose logs -f cognis-mcp-server | rg "twilio|/mcp/call|ERROR|WARN"
# Tail tool + task execution path
docker compose logs -f cognis | rg "task_|tool_|ERROR|WARN"
# Stop
docker compose down
# Run one-off CLI prompt in container
docker compose run --rm cognis agent "hello from docker"
Dashboard audit quick filter:
- Open
http://127.0.0.1:4173. - In Audit Trail, set
ScopetoTool events only. - Optionally set
Typetotool_succeededand searchtwilio.send_sms.
In Action: Cognis + ClawMobile
End-to-end flow using the ClawMobile app connected to a local Cognis gateway.
- Open chat list and verify Cognis appears.
- Edit/connect the Cognis agent (
ws://localhost:8787/ws+ client id). - Open a Cognis conversation with starter prompts.
- Ask for a reminder and receive both ack + follow-up notification.
- Review the cleaner settings menu layout.
- Open Spending Controls from Settings and adjust limits.
| | | | |---|---|---| | <
Related Skills
node-connect
352.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
