agentsclimarketplace

Farmos data model

Skill barkerd427/farmhand/skills/farmos-data-model

Use whenever you need to read or reason about how the homestead maps onto farmOS — which asset/log/quantity/term a real thing is, where an animal or plant currently *is* (location is computed from movement, not stored), how herds/flocks (groups) and pedigree (lineage) work, and which read tool answers a given question.From its SKILL.md

Install
npx -y skills add barkerd427/farmhand --skill farmos-data-model

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

9.0 KB, as published. Nobody here has run it

farmOS data model — the mental model the plugin speaks

farmOS is a generic Drupal app exposed over a JSON:API at {FARMOS_URL}/api. It does not know "Honeycrisp" or "Saanen" — it knows four primitives plus a taxonomy. This skill teaches that model so reads resolve to the right tool and nothing is guessed. Never hard-code field names or bundle lists — the enabled set varies per install; enumerate the live instance with introspect_schema (and list_terms for vocabularies).

Target instance: farmOS 4.0.2 (Drupal 11), JSON:API, US units (lb, gal, °F, acres, inches).

The four primitives

PrimitiveJSON:API typeWhat it is
Assetasset--{bundle}A thing that persists
Loglog--{bundle}A timestamped event
Quantityquantity--{bundle}A measurement attached to a log
Taxonomy termtaxonomy_term--{vocab}Controlled vocabulary (breeds, cultivars, seasons, units, categories)

Assets — asset--{bundle}

Things that persist. Bundles include land, plant, animal, equipment, structure, water, sensor, group, material, product. Common fields: name, archived (the native live/archived boolean — assets have no status field; that's a log field), notes, flag, geometry (WKT), is_location, is_fixed, parent (hierarchy / lineage), location (current — computed, not set directly), image, data.

Logs — log--{bundle}

Timestamped events. Bundles include activity, observation, input, harvest, seeding, transplanting, maintenance, medical, birth, lab_test, purchase, sale. Common fields: name, timestamp, status (pending/done), asset (→ assets), location (→ location assets), geometry, is_movement, category (→ log_category terms), quantity (→ quantities), notes, flag, owner.

Quantities — quantity--{bundle}

Measurements that hang off a log: measure (count, weight, volume, length, area, temperature, value, rate, ratio, …), value, unit (→ unit term), label.

This instance's enabled quantity bundles are material, standard, test only — there is NO quantity--time here. (farmOS 4.x can enable quantity--time, but this install does not.) Day-to-day measurements (weight, volume, count, pH) use quantity--standard. Always confirm the live set with introspect_schema rather than assuming a bundle exists — the write layer reads the enabled bundles from the schema, never a hard-coded list.

API constraint to remember (see the recording-logs skill): a quantity is a standalone entity that must be created in its own request before a log can reference it. "Log a harvest with a weight" is ≥2 API calls. The convenience tools hide this.

Taxonomy terms — taxonomy_term--{vocab}

Breeds, cultivars, seasons, and units are terms, not free text. Key vocabs:

VocabHoldsExample terms
animal_typebreeds"Saanen", "Border Cheviot"
plant_typecultivars/varieties"Honeycrisp Apple", "Duke", "Legacy"
seasongrowing season / period a planting belongs to"2025", "Spring 2026"
unitmeasurement units"lb", "gal", "pH"
log_categorylog tags"withdrawal", "pre-harvest-interval"

A cultivar's ripening window is not a season term — it lives on the plant_type term's profile as ripening_season (see crop-and-breed-profiles). | crop_family, material_type | grouping / inputs | |

The term itself is where the canonical care/breed profile lives (get_term_profile). Resolve a name to its term id with resolve_term(vocab, name); enumerate a vocab with list_terms(vocab). Never invent a term id.

Movement IS location

An asset has no static location field you set. You record a log with is_movement: true and a location, and farmOS computes the current location from the latest movement log. Consequences:

  • "Where is X right now?" → current_location(asset) (computed from movement logs, not read off the asset).
  • "Where has X been?" → movement_history(asset).
  • "What has grazed this pasture?" → grazing_history(pasture).
  • To move something, you do not patch a location field — you create a movement: record_movement (any asset/group) or move_herd (a herd/flock group, compliance-aware). Both write an is_movement log--activity with the destination location.
  • Grazing rotation is just movement logs moving an animal or a herd/flock group onto a pasture land asset.

Groups & lineage

  • Group = herd/flock. An asset--group holds member animals. You move the group in one movement log and it fans out to every member — move the flock, not each ewe. Pass the group's id (with the group bundle) to move_herd / record_movement / harvest tools for a whole-group event.
  • Lineage = the parent relationship between animal assets — parent = [dam, sire]. It is native, applies to goats and sheep, and is queryable both directions with get_lineage(animal, depth?) (ancestors and descendants). get_animal(tag_or_id) returns an animal including its immediate lineage.
  • Off-farm ancestors (a dam/sire not on the property) are stored as animal assets with archived: true + a "reference" flag, so pedigree resolves without inflating herd counts. count_assets excludes archived/exited records, including these ancestors.

Which read tool answers which question

QuestionTool
List things of a type (active by default)list_assets(type, status?, filters?)
One asset by idget_asset(id)
Events for an asset / type / date rangelist_logs(asset?, type?, from?, to?, status?)
One log by idget_log(id)
Free-text "find anything" (assets + logs)search(term)
List a vocabularylist_terms(vocab)
Name → term idresolve_term(vocab, name)
Care/breed profile on a termget_term_profile(vocab, name)
An animal (incl. lineage)get_animal(tag_or_id)
Pedigree both directionsget_lineage(animal, depth?)
Where is it now / where has it beencurrent_location(asset) / movement_history(asset)
What grazed this pasturegrazing_history(pasture)
Inventory of a material/productinventory(item?)
Live counts (excludes archived/ancestors)count_assets(...)
Real field names / enabled bundlesintrospect_schema(type?)
Open withdrawal/PHI windowsexpiring_windows(...)

These are all reads — free, no confirmation. Writes live in the recording-logs skill.

Worked example — "the Honeycrisp apple in the lower orchard"

Goal: find the specific tree and answer "what's been done to it lately?"

  1. Resolve the cultivar term (optional sanity check). resolve_term("plant_type", "Honeycrisp Apple") → the plant_type term id.
  2. Find the asset, not the term. search("Honeycrisp") (fans out across assets + logs), or list_assets("plant", filters=…) filtered to plants whose plant_type is Honeycrisp. Multiple Honeycrisps? Disambiguate by current location, not a stored field:
    • For each candidate, current_location(<plant id>); keep the one whose computed location is the lower-orchard land asset.
  3. Read its recent activity. list_logs(asset=<plant id>, type="log--input") (sprays), list_logs(asset=<plant id>, type="log--harvest"), etc.
  4. Check compliance before advising a harvest. expiring_windows(kind="pre-harvest-interval") (or filtered to this asset) — any open harvest_ok_after window means harvest is not yet allowed.

Note the discipline: location is derived (current_location), and the cultivar is a resolved term, never a guessed string.

Worked example — "the Saanen doe Clover"

Goal: pull up the doe and her pedigree.

  1. Get the animal. get_animal("Clover") (resolves a tag or name/id to the asset--animal, returning immediate parent lineage).
  2. Confirm the breed term. Her animal_type should resolve to the "Saanen" term — resolve_term("animal_type", "Saanen") to verify the id matches.
  3. Full pedigree, both directions. get_lineage(<Clover's id>, depth=3) — ancestors (dam/sire, off-farm references included) and descendants (her kids).
  4. Where is she now? current_location(<Clover's id>) — computed from her latest movement log, e.g. the doe barn or a paddock land asset.

To record anything about Clover (a milk yield, a treatment, a move), switch to the recording-logs skill — that covers the quantity-before-log sequence and the compliance guardrails.

Keep looking

Skills are one crate of 609,689. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.