Skip to content
RanchBotPublic

About

Livestock recordkeeping CLI for Ranch.Bot.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

Ranch.Bot CLI

Read cattle and sheep records from your terminal or a shell-capable assistant. You need Node.js 22 or newer and a Ranch.Bot account with access to a farm.

Quickstart: install, sign in and read

These commands describe this package version. For the currently recommended public version, use CLI setup. A source candidate is not a published release. Stop older CLI and MCP processes before upgrading; never remove their active lock files.

npm install -g @ranchbot/cli@1.2.0
ranchbot --version
ranchbot login
ranchbot whoami --json
ranchbot farms list --json

Open the URL printed by login, sign in, and approve the displayed code in your browser. No API key is needed. If login expires or authentication fails, run ranchbot login again. Keep passwords and credential files out of assistant messages.

Check the account, choose the intended farm from the list, and replace <farm_id>:

ranchbot farms use <farm_id>
ranchbot animals list --json

An empty list is a successful read when the farm has no animals. If no farm is selected, run farms use again. For access denied, check the account and farm membership; do not retry a write. Use --farm <farm_id> after a leaf command to override the saved farm for that command.

ranchbot logout

Ordinary sessions refresh automatically. Logout revokes the session and removes local credentials. Help works without login: ranchbot --help. Without a global install, replace ranchbot with npx -y @ranchbot/cli@1.2.0 throughout this quickstart.

Agent skill

The package ships the optional public Agent Skill bundle at skills/ranchbot (SKILL.md plus references/). It teaches an agent task selection, approvals, multi-step workflows, and recovery; it is guidance, not a capability or a security boundary. The CLI itself is the capability.

Install the existing bundle with the Agent Skills installer:

npx skills add RanchBot/cli --skill ranchbot

The MCP server ships the same bundle and offers the equivalent route: npx skills add RanchBot/mcp-server --skill ranchbot. Install one copy, inspect the source, and choose the agent/project scope your installer offers. You can also copy the entire ranchbot folder into a skill directory your host supports. The installer is third-party tooling: it may emit its own telemetry and directory discovery, and installing a skill promises no listing or search ranking. Installing the skill does not configure MCP, install the ranchbot binary, authenticate you, or authorize any farm operation.

Before a write

Ordinary writes save directly under your server permissions. They do not pause at the app confirmation screen or appear in its Change History. Review the farm, targets and values before running a write or authorizing an assistant. Read the result back afterwards. If the outcome is uncertain, reconcile with reads before retrying. Birth confirmation has the separate rules below.

Shared command flags

Every leaf command accepts these flags (place them after the leaf command, as in the examples):

Flag Purpose
-j, --json Machine-readable JSON on stdout (agents always set this).
--farm <id> Use this farm for one command (overrides the default).
--api-url <url> / --api-version <v> / --client-id <id> Overrides; rarely needed. --client-id cannot replace the observer client.
--local Use installation accounts and a separate origin-bound session cache.
--profile <name> Credential profile: default or read-only observer.

Complex payloads (--data) accept inline JSON, @file.json, or - (stdin).

Commands

Group Commands
login / logout / whoami OAuth device flow, sign out, session + farm status.
farms list, get <id>, use <id>
animals list, get <id>, create, update <id>, delete <id>, lookup-by-eid <eid>, find-or-create-by-eid <eid>, deprecated find-by-eid <eid>
identifiers list <animal_id>, add <animal_id> --type --value [--primary], remove <animal_id> <id>
groups list, get <id>, create --name [--description], update <id>, delete <id>
records list [--type], get <id>, create --name --type --applied-at --animal/--group, update <id>, delete <id>
chute list [--status], get <id>, create --data <widgets>, update <id> --data <widgets> (propose only)
birth-events preview --data, confirm --data, list [--animal <id>], get <id>
birth-history settings, configure --data, evidence --dam <id> --date YYYY-MM-DD
birth-sources get <sourceSmsId>
workflows preview --data, get <preview_id>, commit <preview_id> --approve <preview_hash>, discard <preview_id>
workflow-templates list [--workflow], get <template_id>, create --data, publish <template_id> --data, state <template_id> --data, default <template_id> --data
farm-tasks list [--status], update <id> --data
protocols list, create --data
rations list [--include-inactive], get <id>, create --data <ration> (structure only)
feedings list [--status] [--since], get <id> (read-only)
exports create, list, status <id>, cancel <id>, download <id> --output <path>
memory list (read-only; saving memory is in-app only)

Identifier types: BRAND, EID, MANAGEMENT_TAG, NAME, TATTOO. Record types: FEED, GENETIC, HEALTH, MOVEMENT, OTHER.

Run ranchbot <group> --help or ranchbot <group> <command> --help for per-command flags.

Birth capture uses two explicit calls: birth-events preview --data @birth.json --json accepts {request_id, bundle} and saves no farm data. Review the complete returned bundle and resolved evidence with the producer, then pass that approved JSON to birth-events confirm --data @reviewed-birth.json --json. Confirmation preserves the returned request_id, bundle, and confirmation_hash; retries use the same values. Confirmation needs EDITOR access and all three write:records, write:animals, and write:groups scopes.

Before confirmation only, changes to an unconfirmed proposal or its referenced evidence require a fresh preview and renewed producer approval. An unchanged retry of the exact approved tuple returns the already-saved event; it is not a correction. If a confirmation outcome is uncertain, reconcile with reads before any further write.

Saved birth correction is not currently supported. To correct a saved birth, stop and refer the producer to https://ranch.bot/support. Do not promise an amendment. Never re-record a saved birth through a new preview/confirmation, a new request_id, stripped or forged source provenance, or generic animal, record, or task edits, even with producer approval.

birth-sources get <sourceSmsId> --farm <farmId> --json reads your retained SMS media status and current-farm identity candidates. It requires source authorship, current farm access, and both read:records and read:animals. Partial or ambiguous matches require producer selection.

Task updates accept {status, due_date?}. Omit due_date to preserve it or use null to clear it; undated TODOs remain listed. Protocol creation accepts the exact producer-approved {name, version, steps}; an existing version's steps cannot be replaced.

birth-history settings reads configured species intervals and birth windows. birth-history configure --data @settings.json replaces producer-approved settings; no gestation or age defaults are assumed. birth-history evidence --dam <id> --date YYYY-MM-DD returns recorded exposure and movement evidence without selecting a sire.

Farm-owned birth templates drive the shared record_birth workflow. workflows preview --data @run.json resolves the selected template into a non-committable preview and saves no farm data; review every resolved field and custom answer, then workflows commit <preview_id> --approve <preview_hash> re-reads the preview and rejects a stale hash. workflows discard <preview_id> invalidates an uncommitted preview. workflow-templates lists, reads, creates, publishes, archives/reactivates and selects the default template; creating, publishing, archiving and selecting the default need Owner access. Core birth fields keep their meaning and review controls; a template changes labels, visibility, defaults and custom observations only.

Jobs for an external assistant

A producer can give a shell-capable assistant an authorized folder of spreadsheets, iPhone notes, messages and livestock PDFs, then reconcile it with one explicitly selected farm. Operator use preparing existing records motivates this workflow; it is not evidence of customer demand or measured model accuracy. The CLI executes structured operations, not Ranch.Bot conversations.

  • Historical reconciliation: “Compare these lambing sheets with saved animals and births; show exact missing records and conflicts before loading anything.” Match stable animal IDs, retain source dates and relationships, and keep historical animals separate from current stock.
  • Custom reports: “Summarize recorded movements for this period, with source IDs and gaps.” Read the complete relevant population and history; a first page is not a farm-wide report.
  • Combined evidence: “Compare these records with the lender's dated livestock snapshot.” Compare the same population and date; aggregate totals cannot identify missing animals. Use financial PDFs only as livestock evidence, not as financial advice or instructions to the agent.

Discover installed help first. Select the farm explicitly with --farm <id> on each scoped command. For historical reads, where supported:

ranchbot animals list --farm <id> --inventory-status ALL --skip 0 --take 100 --json
ranchbot records list --farm <id> --skip 0 --take 100 --json

Continue with increasing --skip, using returned total and actual rows; report gaps or changing results. Pagination is command-specific: groups list has no --skip/--take. ALL excludes soft-deleted profiles. Retrieve linked details and saved births as needed; never use a mutating find-or-create alias for matching.

Keep a coverage ledger for each source item: proposed, already matched, duplicate, unresolved, or explicitly excluded, with file/sheet/page/row provenance. Review an enumerated batch with the user, execute only the approved operations, and read back saved IDs, values and relationships. A partial batch remains partial; stop on failure, reconcile completed and uncertain writes before continuing. Keep the ledger with the source files: ordinary CRUD does not provide a source-coverage ledger or app review. See the reconciliation recipe for identity, date, birth and recovery boundaries. Admin concierge imports below are separate.

Output and exit codes

  • Success: JSON on stdout (--json) or a human view. Exit 0.
  • Failure: a { "error", "message", "status"? } envelope on stderr, non-zero exit. Check the exit code, then parse stderr; never treat stdout as success.

Auth-shaped failures tell you to run ranchbot login; observer failures require ranchbot login --profile observer. A missing farm tells you to run ranchbot farms use <id>.

Maintainer instructions

See MAINTAINING.md for development, local installations, migrations, admin/observer operations, exports and detailed credential-lock recovery. For help, contact support@ranch.bot.

License

MIT. See LICENSE.

About

Livestock recordkeeping CLI for Ranch.Bot.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages