Jian/ Docs

How Jian works

The gateway, hosts, workers, storage, and the lifecycle of an agent turn.

The gateway is the owner of the agent's state and execution. Closing a browser tab does not move or delete that state. Changing from a local gateway to a server gateway selects a different installation, with its own agents and credentials.

Two ways to run a gateway

PropertyDesktop local gatewayServer gateway
Started byThe desktop appYour process manager or containers
DatabaseEmbedded PGlite in the app's data directoryPostgreSQL
Run executionIn-process local executorPostgreSQL-backed pg-boss jobs
Network listenerLoopback only (127.0.0.1)Configured host/port, normally behind the web service
PanelMounted inside the desktop appWeb panel; desktop clients can connect too
Messaging channelsDisabledWhatsApp, Telegram, API channels
LifetimeWhile the app process runsWhile the server runs
Default time zoneThis computer's system zoneGateway environment/system configuration

Both run the same gateway services and HTTP contracts. Local mode changes storage, execution, and available channels; it is not a separate toy agent runtime.

Network topology

Desktop on this computer
  └─ local gateway (loopback)
       ├─ embedded database + agent workspaces
       └─ configured model providers / integrations

Browser or desktop connected to a server
  └─ HTTPS reverse proxy
       └─ jian-web :3000
            └─ gateway :4310
                 ├─ PostgreSQL + job queue
                 ├─ model providers / integrations
                 └─ tasks for connected machines
                        ↑ outbound HTTPS polling
                   Jian Remote on each machine

The production Compose stack publishes the web service, not the gateway or database. Its host port defaults to 4310, forwarded to web port 3000; the gateway's internal API still uses 4310. Development uses a different arrangement: web on 3000, gateway on 4310.

What happens when you send a message

  1. A panel, channel, schedule, or another agent supplies a request for a profile and conversation.
  2. The gateway authenticates it, validates the request, persists the message, and creates or finds its run. Request keys keep a retried submission from becoming another turn.
  3. The run snapshots the relevant profile and model choices. Jian builds model input from instructions, identity, relevant memories, history or a compaction summary, and discovery catalogs for skills and tools.
  4. The model can answer, load a skill, call a tool, request approval, or ask a question. Tool results become context for subsequent steps.
  5. Progress and outcomes are persisted. The panel follows that state; channel delivery has its own outcome.
  6. A run finishes, fails, is cancelled, or waits for a decision. An open objective can queue another slice of work. A qualifying completed turn can trigger a learning review.

A session is the durable conversation. A run is one execution turn. A tool call is one action inside a run. A new reply or automatic continuation can start another run in the same session.

Ownership and isolation

Agent-specificGateway-wide
Identity and instructionsProvider connections and credentials
Memories and custom skillsModel defaults
Conversations and historyMCP servers and GitHub connections
Schedules and channelsConnected machines
WorkspaceGateway authentication and encryption keys

Profiles do not receive each other's private records. They can exchange deliberate messages using agent collaboration. Shared integrations and machines are not private per-agent security compartments: every agent can reach the installation's connected machines.

Where the work happens

Gateway file and shell tools act in that profile's workspace on the gateway host. Remote tools act on the selected connected machine, as the local account running its worker. In a container deployment, a gateway path is a container path; it is not a file on the laptop displaying the panel.

The gateway does not run model weights merely because it runs locally. A cloud provider still receives model requests. For a separately hosted compatible model service, the gateway must be able to reach that service's endpoint.

Implementation reference

Local entry point, server entry point, and context assembly.

On this page