@midfleet/agent
v0.4.56
Published
Midfleet Agent Wrapper - Turn any AI coding assistant into a dispatchable, nudge-able agent
Maintainers
Readme
@midfleet/agent
Midfleet Agent Wrapper - Turn any AI coding assistant into a dispatchable, nudge-able agent.
Features
- Auto-register agents with Midfleet
- Background heartbeats to maintain online status
- Real-time nudges via WebSocket -> runtime session input
- Handoff notifications injected directly into agent session
- Works with any AI assistant: OpenCode, Claude Code, Cursor, etc.
Installation
Homebrew (macOS/Linux)
brew tap Midfleet/midfleet
brew install midfleetnpm
npm install -g @midfleet/agent
# or
pnpm add -g @midfleet/agentQuick Start
1. Initialize Configuration
midfleet init
# Prompts for:
# - API Key (from midfleet.io/settings/api-keys)
# - Workspace
# - Default command (opencode, claude, etc.)2. Start an Agent
midfleet start --name backend-agent
# With options:
midfleet start \
--name backend-agent \
--command "opencode" \
--workdir ~/Dev/myproject \
--model claude-sonnet-43. List Running Agents
midfleet list
# Output:
# NAME STATUS SESSION PENDING
# backend-agent online midfleet-backend-agent 1 handoff4. Attach to Agent Session
midfleet attach backend-agent
# Opens runtime session - see the AI working
# Detach with: Ctrl+B, D5. Nudge an Agent
midfleet nudge backend-agent "Check the failing CI tests"6. Stop an Agent
midfleet stop backend-agentConfiguration
Config is stored at ~/.midfleet/config.json. During the rebrand, the CLI also reads the legacy
~/.agentmesh/config.json path for compatibility:
{
"apiKey": "am_live_xxxx",
"workspace": "midfleet",
"hubUrl": "https://midfleet.io",
"defaults": {
"command": "opencode",
"model": "openai/gpt-5.5"
},
"agents": []
}Newer configs are stored as named profiles so one machine can switch between accounts or workspaces without overwriting credentials:
{
"version": 2,
"activeProfile": "work",
"profiles": {
"work": {
"apiKey": "mf_live_xxxx",
"workspace": "midfleet",
"hubUrl": "https://midfleet.io",
"defaults": { "command": "opencode", "model": "openai/gpt-5.5" },
"agents": []
}
}
}Profile commands:
midfleet login --profile work --workspace midfleet
midfleet profile add midfleet1 \
--hub-url https://dashboard.midfleet.io \
--workspace usr_bbls-default \
--api-key "$MIDFLEET_API_KEY"
midfleet profile list
midfleet profile show work
midfleet profile use workUse a friendly profile name for each account, and store the workspace value that the key is
actually scoped to. For example, a cofounder profile can be named midfleet1 while its saved
workspace remains the canonical usr_bbls-default returned by the API.
For one-off commands, --profile selects a profile and --workspace temporarily overrides the
workspace for that command without changing the saved profile:
midfleet status --profile work --workspace staging
midfleet config show --profile work --workspace staging
midfleet workspace list --profile work --workspace staging
midfleet --profile midfleet1 agents list --json
ssh dev-agent-hetzner 'midfleet --profile midfleet1 agents list --json'Concurrent sessions on one machine
Config writes are serialized with an advisory lock and merge over the freshest on-disk profile, so parallel shells/agents cannot clobber each other's profiles. Two conventions keep this safe:
- Never rewrite a shared profile to point at a different environment. For local stack work, create a
dedicated profile instead:
midfleet profile add local-dev --hub-url https://hub.midfleet.local --workspace midfleetand invoke with--profile local-dev. - Use
--profile(or--workspacefor one command) to isolate mutations instead of switching the active profile back and forth.
Epic Refinement
Use a participant login to run the governed Epic refinement lifecycle. References may be Midfleet issue IDs or linked GitHub issue references; the Hub resolves them authoritatively in the selected workspace.
midfleet --profile work --workspace usr_example epic refinement start Midfleet/midfleet#1703
midfleet --profile work --workspace usr_example epic refinement status https://github.com/Midfleet/midfleet/issues/1703
midfleet --profile work --workspace usr_example epic refinement accept Midfleet/midfleet#1703
# After remediating a blocked or failed launch:
midfleet --profile work --workspace usr_example epic refinement retry Midfleet/midfleet#1703Add --json to any lifecycle command for the allowlisted epic-refinement-cli/v1 automation
contract. These commands require the selected profile's participant session and never use API keys,
agent tokens, or environment credentials as fallback authentication.
How It Works
- Start: Creates a runtime session running your AI assistant
- Register: Registers the agent with Midfleet
- Heartbeat: Sends heartbeats every 30s to maintain online status
- WebSocket: Listens for real-time events (handoffs, nudges, blockers)
- Inject: When events arrive, injects messages into the runtime session
The AI assistant sees the injected message as if you typed it, maintaining full conversation context.
Requirements
- Node.js 18+
- A Midfleet account with workspace access
Versioning
This package uses Semantic Versioning. Releases are fully automated — do not publish manually.
How to release
Update
versioninpackages/agent/package.jsonon thedevbranch (via PR).Run the publish workflow manually as a preflight from
devwith the same version. Manual runs build, lint, test, smoke the CLI, runnpm pack --dry-run, and perform a local package install smoke test (midfleet --version,--help,version --json,update-check --json) without publishing.Push a tag matching
agent-v<version>from the commit where the version was bumped:# After your version-bump PR is merged to dev and pulled locally: git tag agent-v0.2.1 <merge-commit-sha> git push origin agent-v0.2.1The
publish-agent.ymlGitHub Actions workflow triggers automatically and:- Builds, lints, tests, and smoke-tests the package
- Verifies
package.jsonversion matches the tag - Runs
npm pack --dry-run - Preflight-only local package install smoke (for manual runs)
- Publishes to npm as
@midfleet/agent - Creates a GitHub Release
- Updates the Homebrew formula in
Midfleet/homebrew-midfleetafter resolving the npmdist.tarballURL and verifying it uses the canonicalhttps://registry.npmjs.org/@midfleet/agent/-/*.tgzpath with no legacyagentmeshreferences. The formula includesmidfleet --version,--help,version --json, andupdate-check --jsonsmoke tests.
Rules
- Never run
npm publishmanually. It bypasses the version check and can publish a mismatched version (e.g. apackage.jsonthat says0.1.2getting published as0.2.0). - Never skip a version number. The Homebrew formula uses the version string; if the npm registry already has a higher version,
brew upgradewill not install the new formula. - The tag drives everything. The tag name (
agent-v0.2.1) is the source of truth — the workflow validates thatpackage.jsonmatches before publishing. - All work targets
dev.mainis for releases only, managed by the Product Owner. PRs must targetdev.
Version history incident
In Feb 2026, 0.2.0 was published manually with npm publish from a commit whose package.json said 0.1.2. This caused:
- npm registry to have
0.2.0as the latest version - The Homebrew formula to point at
0.2.0 - All subsequent CI-published versions (
0.1.3,0.1.4) to be lower than0.2.0, sobrew upgradeignored them - Workers already on
0.2.0unable to receive fixes
The fix was to bump past 0.2.0 → 0.2.1 using the correct automated pipeline.
March 2026: v0.3.0 manual publish (same mistake repeated)
Published 0.3.0 manually via npm publish during E2E verification of PR #304 (unique workdirs + deploy key cloning). The brew formula was also updated manually with an incorrect legacy tarball URL (404; correct is agent-0.3.0.tgz). Additional issues found: deploy key credential inactive, orphaned GitHub deploy key, missing repo_id on agent assignments, FK violation on HQ deploy-key endpoint.
Fix: Corrected brew formula URL + SHA. Tagged agent-v0.3.0 retroactively. Full post-mortem in ~/Dev/infra-docs/agent-release-ops.md.
License
MIT
