Socket API
The flockr socket, its JSON wire format, the bundled schema, and how scripts use it.
The flockr server listens on a local socket. The flockr CLI, agent integration hooks, and plugins all control flockr through it. Your own scripts can use it too.
The socket
| Session | Socket |
|---|---|
default | ~/.config/flockr/flockr.sock |
Named, for example work | ~/.config/flockr/sessions/work/flockr.sock |
Inside a flockr pane, FLOCKR_SOCKET_PATH holds the session's socket path. flockr status and flockr session list also print it.
Use the CLI first
Most methods have a CLI command that sends the request and prints the JSON response. In a script this is usually the simplest route:
pane=$(flockr pane split --current --direction right --no-focus | jq -r '.result.pane.pane_id')
flockr pane run "$pane" "just test"
flockr pane wait-output "$pane" --match "test result" --timeout 120000Read IDs from the JSON responses instead of guessing them. See the CLI reference.
Wire format
Requests and responses are JSON, one object per line. A request has an id, a method, and params:
{"id":"1","method":"ping","params":{}}A success response echoes the id and carries a result:
{"id":"1","result":{"type":"pong","version":"1.1.0","protocol":22,"capabilities":{...}}}An error response carries an error with a code and a message.
A minimal client in Python:
import json, os, socket
s = socket.socket(socket.AF_UNIX)
s.connect(os.environ["FLOCKR_SOCKET_PATH"])
s.sendall(json.dumps({"id": "1", "method": "agent.list", "params": {}}).encode() + b"\n")
print(s.makefile().readline())The schema
Every request, response, and event is described by a JSON Schema (draft 2020-12). It ships inside the binary:
flockr api schema # summary: protocol, schema version, sections
flockr api schema --json # the full schema
flockr api schema --output flockr-api.schema.jsonThe repository also has it at docs/next/api/flockr-api.schema.json. It has five sections: request, success_response, error_response, event, and subscription_event. The schema carries the protocol number (22 at the time of writing); flockr status shows the client's and server's protocol.
Methods
Methods are grouped by prefix. The schema lists every method and its params.
| Group | Methods |
|---|---|
| Server | ping, server.stop, server.reload_config, server.live_handoff, server.agent_manifests, server.reload_agent_manifests |
| Session | session.snapshot |
| Workspaces | workspace.create, .list, .get, .focus, .rename, .move, .move_block, .report_metadata, .close |
| Worktrees | worktree.list, .create, .open, .remove |
| Tabs | tab.create, .list, .get, .focus, .rename, .move, .close |
| Panes | pane.split, .swap, .move, .zoom, .layout, .list, .current, .get, .focus, .read, .send_text, .send_keys, .send_input, .wait_for_output, .close, .mark_read, .mark_unread, and more |
| Agent reporting | pane.report_agent, pane.report_agent_session, pane.release_agent, pane.report_metadata |
| Agents | agent.list, .get, .read, .explain, .send_keys, .rename, .focus, .start, .prompt, .wait |
| Layout | layout.export, .apply, .set_split_ratio, .select, .sort_by_age |
| Events | events.subscribe, events.wait |
| Notifications | notification.show |
| Integrations | integration.list, .install, .uninstall |
| Plugins | plugin.link, .list, .unlink, .enable, .disable, .action.list, .action.invoke, .log.list, .pane.open, .pane.focus, .pane.close |
| Commands | command.invoke |
Events
events.subscribe takes a list of subscriptions and streams events on the same connection. events.wait waits for one matching event, with an optional timeout_ms.
Event kinds include workspace_created, workspace_closed, workspace_focused, worktree_created, tab_created, tab_focused, pane_created, pane_closed, pane_focused, pane_exited, pane_agent_detected, pane_agent_status_changed, and layout_updated. Subscription events add pane.output_matched, pane.agent_status_changed, and pane.scroll_changed. The schema has the full list.
Live snapshot
flockr api snapshotPrints the whole session as JSON: spaces, tabs, panes, and agents with their state, working directory, and branch. It is the same data as the session.snapshot method.
How hooks and plugins use it
- Integration hooks read
FLOCKR_PANE_IDandFLOCKR_SOCKET_PATHfrom the pane's environment and sendpane.report_agent_session(and for some agentspane.report_agent) over the socket. You can do the same from a wrapper script withflockr pane report-agent. - Plugins run with
FLOCKR_SOCKET_PATHand otherFLOCKR_*variables set, and call the CLI or the socket. Plugins written for herdr also get theHERDR_*names; see flockr and herdr. - Display metadata:
pane.report_metadataandworkspace.report_metadataset titles, labels, and$nametokens for the sidebar.
Versions
After an update, the client and a running server can be different versions. Check flockr status before relying on a new method. A missing method means the server is older; it is not a reason to stop the server.
Last updated November 3, 2026