Skip to main content

Herdr Core

@svendowideit/herdr-corev2026.11.28.1· MIT· 1d agoREPORTS
01README

Give an agent hands and eyes in a herdr-core session that stays running: terminals, files, commands, search, and the whole machine fleet, as swamp methods and data instead of a shell process per action. WHAT IT DOES

herdr-core (hc) is the persistent runtime behind the Herdr desktop app: a background server owns terminals, their programs, scrollback, files and a fleet of other machines. This extension turns that runtime into swamp methods — terminals, read, run, send, keys, wait, exec, file-read, file-write, file-edit, file-edit-lines, search, machines — so an agent can observe a live session, run tests where they belong, edit a file exactly once or replace a line range it found with search/read, and search a repo without spawning a shell per step. Every call is fan-out friendly: one terminals, read, exec or file-* call handles many targets and takes the swamp lock once. It also keeps the record of which pi session runs in which tab of which space, so a reboot can bring each one back where it was — and leave the ones a person quit alone, because a quit is an event and a host kill is an absence. Prefer it to cat, sed, rg, ssh or a terminal-scraping wrapper: the result is typed swamp data, the target can be another machine with --on, and the same session is visible in every Herdr client. Every method can emit one OTLP/HTTP span with swamp.route=herdr-core, swamp.outcome and swamp.method, resolved from @svendowideit/otel-settings when that contract is configured, then from the standard OTEL environment. Each method also appends one JSONL event for the Herdr activity panel, which shows routed vs bypassed tool calls live.

INSTALL

swamp extension pull @svendowideit/herdr-core

DEPENDENCIES

The herdr-core binary (or its hc alias) on PATH, or set herdrBin. It is installed by @svendowideit/herdr-app and shared by every Herdr install on the machine. Optional: @svendowideit/otel-settings — when its model has a resolved contract, spans use that endpoint, mesh and bearer token; without it the standard OTEL environment is used, and without either, tracing is a no-op that never fails a method.

RUN

# What is running, and where can it run? Read the live terminals and
# the connected machines before choosing a target.
swamp behavior run herdr-core status
swamp behavior run herdr-core terminals \
  --input all=true --input agent=pi

# Run a test in a terminal I can watch, and wait for its exit code.
# The terminal stays alive afterwards, so the output is still there.
swamp behavior run herdr-core run \
  --input 'argv:json=["npm","test"]' \
  --input cwd=/home/sven/src/swamp-project \
  --input name=test-run

# Search a repo, then replace one exact occurrence. Both calls return
# typed data; the edit is all-or-none and never leaves a half-written
# file.
swamp behavior run herdr-core search \
  --input pattern=agent-ide-control --input paths:json='["docs"]'
swamp behavior run herdr-core file-edit \
  --input path=docs/notes.md \
  --input 'edits:json=[{"old":"old sentence","new":"new sentence"}]'

# Do the same on another machine the server already knows about.
swamp behavior run herdr-core exec \
  --input machine=xeon \
  --input 'argv:json=["git","status","--short"]'

# Which pi session sits in which tab of which space, and would a restart
# bring it back? Read this before changing anything about sessions.
swamp behavior run herdr-core pi-sessions

# After a reboot, put the lost sessions back in the tabs they came from.
# Sessions a person quit, or killed, are left alone and reported as
# skipped; dryRun shows the plan without starting anything.
swamp behavior run herdr-core pi-resume \
  --input dryRun=true
swamp behavior run herdr-core pi-resume \
  --input only=tinygo

# Mark a terminal as a pi session by hand, which is what the addin does
# on session start: the labels are the record a restart reads.
swamp behavior run herdr-core label \
  --input target=t13 \
  --input 'labels:json={"pi.session":"<id>","pi.state":"running"}'

# Check whether tracing is live, then post one test span.
swamp behavior run herdr-core otel-status
swamp behavior run herdr-core otel-status \
  --input test=true

CONFIGURE

Global arguments, set on the model definition:

herdrBin              herdr-core binary or hc alias        (herdr-core)
defaultCwd            working directory for commands        (empty)
defaultMachine        machine to target by default          (empty)
maxOutputBytes        retained terminal/file/exec output    (200000)
otelEnabled           export OTLP spans                     (true)
otelModel             otel-settings model name              (otel)
otelVaultName         vault holding the OTLP bearer token   (empty)
otelTokenRef          vault/env key for the token           (OTEL_EXPORTER_OTLP_TOKEN)
otelEndpoint          explicit OTLP/HTTP traces endpoint    (empty)
otelMesh              preferred contract mesh               (empty)
otelServiceName       service.name for spans                (swamp-herdr-core)
otelTimeoutMs         maximum time for one span POST        (2500)
otelDebug             log the resolved endpoint and errors  (false)
eventLogEnabled       append JSONL activity events           (true)
eventLog              activity log for the Herdr panel      (~/.local/state/swamp-agent-ide/events.jsonl)

Per-call arguments are documented by swamp behavior type describe @svendowideit/herdr-core --json.

WHAT IT INSTALLS

Nothing on the host — no services, cron triggers, daemons or webhooks. It runs the existing herdr-core binary and writes swamp resources and data. It never edits herdr-core's own state files.

02Reports1
@svendowideit/terminal-sessionmethod
herdr_core_report.ts

Render a herdr-core method's run, commands, files, search, fleet and tracing data as a reviewable summary

herdr-coreterminalsummary
03Stats
A
100 / 100
Downloads
2
Archive size
56.1 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Docs keep secrets in a vault1/1earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License2/2earned
  • Verified public repository2/2earned
04Platforms
05Labels