agentleFS
metagit-aimetagit-ai/metagit-cli/skills/metagit-sharing-state/SKILL.md

metagit-sharing-state

Skill4 starsChanged 12 days agoMITView on GitHub

Configure shared coordination state (objectives, handoffs, approvals, events) across multiple agents and machines via METAGIT_STATE_URL, optional DynamoDB / MongoDB DocumentStore backends, and the ops HTTP path. Use when Hermes subagents, CI runners, or humans must see the same objective queue without Syncthing JSON files.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use when more than one agent or machine must read/write the same objectives, handoffs, approvals, and event feed — without syncing …

    line 12
  2. Very specific:

    Prefer shared state (HTTP or cloud DocumentStore) over Syncthing for coordination JSON when agents run on separate machines.

    line 28
  3. Very specific:

    If backend is local but you expected remote/cloud, the MCP host is missing env/config.

    line 118
  4. Very specific:

    All use resolve_backend() — no separate remote MCP tools.

    line 129

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Metagit shared coordination state

Use when more than one agent or machine must read/write the same objectives, handoffs, approvals, and event feed — without syncing .metagit/sessions/*.json via Syncthing.

Full references:

  • docs/reference/sharing-state.md — HTTP ops contract
  • docs/reference/central-state-plane.md — plane backends, extras, org/workspace ids, Dynamo bootstrap

When to use

  • Hermes controller + subagents on different hosts
  • Human on Metagit Web + agents on MCP/CLI
  • CI runner updating objectives while developers use Cursor MCP
  • Org-scale coordination on DynamoDB / MongoDB (RFC-0015)

Prefer shared state (HTTP or cloud DocumentStore) over Syncthing for coordination JSON when agents run on separate machines. Keep Syncthing (or git) for .metagit.yml catalog edits only.

Backends

BackendExtraTypical use
local—Single machine default
http—Agents → metagit web serve via METAGIT_STATE_URL
memory—Tests only
dynamodbmetagit-cli[state-dynamodb]Direct cloud or ops-server-hosted
mongodbmetagit-cli[state-mongodb]Direct cloud or ops-server-hosted
uv tool install 'metagit-cli[state-dynamodb]'
uv tool install 'metagit-cli[state-mongodb]'

Coordinator setup (HTTP / deployment B)

On one host with the workspace manifest (local JSON or cloud DocumentStore on the server):

metagit web serve --host 127.0.0.1 --port 8787
# production: TLS reverse proxy + bearer token in front
# optional: METAGIT_STATE_BACKEND=dynamodb + table/region on this host only

Agents keep METAGIT_STATE_URL — they do not need cloud extras when the coordinator hosts Dynamo/Mongo.

Client setup (CLI, MCP, every agent host)

App config (~/.config/metagit/config.yml):

config:
  state:
    backend: http
    url: https://coordinator.example.com:8787
    token: your-bearer-token
    conflict_retries: 1
    org_id: ""            # optional plane partition
    workspace_id: ""

Or environment (overrides file — must be set on the MCP server process):

export METAGIT_AGENT_MODE=true
export METAGIT_STATE_URL=https://coordinator.example.com:8787
export METAGIT_STATE_TOKEN='…'
# optional plane identity:
# export METAGIT_STATE_ORG_ID=acme
# export METAGIT_STATE_WORKSPACE_ID=platform-ws

Deployment A (agents → cloud directly)

uv tool install 'metagit-cli[state-dynamodb]'
export METAGIT_STATE_BACKEND=dynamodb
export METAGIT_STATE_ORG_ID=acme
export METAGIT_STATE_WORKSPACE_ID=platform-ws
export METAGIT_STATE_DDB_TABLE=metagit-state
export METAGIT_STATE_DDB_REGION=us-east-1
# AWS credentials via IAM/env — never commit

Restart MCP after changing env (metagit mcp serve inherits the shell env).

Verify backend (MCP)

resources/read → metagit://gate/status

Check state_backend:

FieldMeaning
backendlocal | http | dynamodb | mongodb | memory
org_id / workspace_idPlane partitions
urlRemote ops base when http
token_configuredBearer token present (not the secret)
extrasWhether dynamodb/mongodb extras are importable
env_overridesWhich METAGIT_STATE_* vars are set

If backend is local but you expected remote/cloud, the MCP host is missing env/config.

MCP tools (unchanged names — remote-aware)

CoordinationMCP toolResource
Objectivesmetagit_objective_list, metagit_objective_upsert, metagit_objective_editmetagit://objectives
Approvalsmetagit_approval_request, metagit_approval_list, metagit_approval_resolvemetagit://approvals/pending
Handoffsmetagit_handoff_list, metagit_handoff_create, metagit_handoff_claim, metagit_handoff_completemetagit://handoffs/open
Events pollmetagit_eventsmetagit://events/recent?since=

All use resolve_backend() — no separate remote MCP tools.

CLI parity

metagit context objective list --json
metagit context handoff list --json
metagit context approval list --json

Anti-patterns

  • Mixed backends (some agents local, some remote/cloud) — objectives diverge silently
  • Syncthing .metagit/sessions/objectives.json and remote/cloud state on the same fleet
  • Forgetting to export METAGIT_STATE_* in the MCP launcher JSON (Cursor/Claude Desktop)
  • Committing AWS keys, Mongo URIs, or bearer tokens into git or .metagit.yml

Related skills

  • metagit-context-pack — session bootstrap + objective/approval CLI/MCP table
  • metagit-mcp-resources — resource read ladder including events poll
  • metagit-control-center — ongoing multi-repo coordination
  • metagit-agent-coordination — git isolation (branches/leases/worktrees); orthogonal to shared state JSON

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.