Package Exports
- @midfleet/agent
- @midfleet/agent/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@midfleet/agent) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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 -> tmux send-keys
- 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 tmux 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": "claude-sonnet-4"
},
"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": "claude-sonnet-4" },
"agents": []
}
}
}Profile commands:
midfleet login --profile work --workspace midfleet
midfleet profile list
midfleet profile show work
midfleet profile use workFor 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 stagingHow It Works
- Start: Creates a tmux 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 via
tmux send-keys
The AI assistant sees the injected message as if you typed it, maintaining full conversation context.
Requirements
- tmux (must be installed and in PATH)
- 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.1
The
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