← Catalog

pi-remote-jobs

Project-configured remote jobs for Pi over SSH and systemd

Package

Install

Install with PiG

pig install npm:pi-remote-jobs

Install with Pi

pi install npm:pi-remote-jobs
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.2.0 (README.md). PiG does not review it.

Remote jobs for Pi

Install once for your Pi user:

pi install npm:pi-remote-jobs

Run /reload in existing Pi sessions. New sessions load it automatically. The package registers one tool, remote. File tools remain local. Linux execution hosts need SSH key authentication, bash, rsync, GNU coreutils and systemd. The SSH user must be allowed to create system services. The plugin does not install software or alter sshd.

Configure a project

Create .pi/remote.json in a trusted project:

{
  "hosts": [
    { "name": "build-server", "root": "/data/my-project", "cpus": "0-11" }
  ],
  "code_sync": { "paths": ["scripts/"], "exclude": ["__pycache__/"], "max_size": "5M" }
}

Host names are aliases in ~/.ssh/config. root defaults to the local project root, so use distinct remote roots for distinct projects. local: true runs on the Pi machine and always uses the local project root. reserve_gb subtracts from available memory when selecting a host. drain: true excludes a host from new automatic placements. CPU affinity defaults to all host CPUs; set cpus for reserved cores.

The optional placement object tunes host selection: gb_per_core (default 2) converts free memory into core-equivalents. A host ranks after every healthy host when its free memory after reserve_gb is below min_free_gb (default 4), when free space under the project root or Docker's data root is below min_disk_gb (default 50), or when its IO stall (/proc/pressure/io "full avg60", percent) exceeds max_io_pressure (default 20).

The nearest parent .pi directory defines the project boundary. A nested project without remote.json fails without contacting a host. Configuration is read on every call; adding or draining hosts needs no reload. There is no global server fallback. Environment variables do not override project selection.

The optional env object adds non-secret environment variables to jobs. Never put credentials there. unit_prefix normally derives from the local project root; leave it unchanged while jobs are running. The default job environment includes WORK=<remote-root>/.work, TMPDIR=$WORK/tmp and a tool PATH. Remote root paths currently must be absolute and contain no spaces or shell metacharacters.

Agent usage

remote({cmd: "python3 scripts/check.py", sync: ["src/component"], fetch: [".work/report.json"]})
remote({action: "wait", job: "build-server.0123456789"})
remote({action: "log", job: "build-server.0123456789", lines: 100})
remote({action: "hosts"})

The tool chooses a reachable host with the most spare capacity, then pins it per project and session. Capacity is the smaller of free cores and free memory / gb_per_core, multiplied by the share of time the host is not fully stalled on IO or memory (PSI "full avg60" of /proc/pressure/io and /proc/pressure/memory). Free cores are the idle cores of the allowed cpus set (iowait is not idle), sampled from /proc/stat over one second, minus the share of any run queue beyond the host's cores (1-minute load average above nproc). Ties go to more free memory, then fewer running jobs. remote({action: "hosts"}) shows load, idle cores, IO and memory stall, disk and the score. An explicit host affects only that call. A disappeared pinned host is replaced for new submissions. Jobs keep running after a connection drops or Pi exits. A call waits up to 290 seconds; the job has no tool-imposed time limit. Resume with wait. An unknown submission outcome returns its job id; inspect it before resubmitting.

Paths in sync and fetch are relative to the local project root. Sync directories are mirrored with --delete; fetch overwrites matching local files. Only name paths you own. Configured code directories are refreshed at most once per minute. Nothing is synced by default. Use stop only for your own jobs; Docker containers started by the job must be removed separately.

Host preparation and project-specific build rules belong to the project's own scripts and docs. This package does not change subagent concurrency or model caching.

Verification

Run the isolated configuration checks with Pi's installed loader:

node selftest.mjs /absolute/path/to/pi-coding-agent

These checks make no model requests and send no SSH commands. Execution and file transfer were also exercised against a configured Linux build host and from a real background subagent.