Quickstart
Validate an example, read an error and replay a scenario in ten minutes, without writing any code.
On this page
In short
In about ten minutes, without writing any code, you check a real HOS event, break it on purpose to read an error, then replay a hotel's morning and watch an early arrival become at risk, then safe.
- For
- Everyone: developers, product managers, curious hoteliers
- Time
- 10 minutes
- You need
- Node.js 22 or later, see Install · A terminal
- Status
- Draft
Why this matters
It is 11:40 in a hotel in Paris. A guest writes that they will arrive around 12:30, long before the 15:00 check-in. Their room, 204, is still dirty from the previous guest. The property management system (PMS) shows it clean, because a cleaning task was closed; but here, only the supervisor's inspection releases a room, and it has not happened yet.
Which system is right? HOS answers with factsFact (event)One thing that happened in a hotel system, such as a unit becoming clean, sent as a CloudEvent in the HOS format. It states what the source knows; it does not ask anyone to do anything., each published by the system that knows, and with rules that every system applies the same way. The tools check that systems publish and read those facts correctly. This Quickstart replays that morning.
Before you start
Make a folder for the files of this Quickstart, and go into it:
mkdir hos-quickstart
cd hos-quickstartmkdir hos-quickstart
cd hos-quickstartmkdir hos-quickstart
cd hos-quickstartThe commands below use npx @hos-ai/cli, which needs no install. If you installed hos, you can type hos instead. If PowerShell says running scripts is disabled, type npx.cmd instead of npx (see Install).
Validate an example event
Download an example that HOS publishes, a fact from a PMS:
curl.exe -O https://hos-ai.vercel.app/spec/0.1/examples/stay.expected.jsoncurl -O https://hos-ai.vercel.app/spec/0.1/examples/stay.expected.jsoncurl -O https://hos-ai.vercel.app/spec/0.1/examples/stay.expected.jsonValidate it:
Terminalnpx @hos-ai/cli validate stay.expected.jsonThe first time, npx asks to download the package: press Enter. Then:
Output✓ stay.expected.json: valid event stay.expectedWhat just happened. hos read the file, recognised an event of type
stay.expected, and checked it against the HOS 0.1 schemas and rules. The ✓ says it is valid: any HOS system can read it. This fact says that the PMS expects the staystay_1042today.What is in the file
A HOS event is a JSON object in the CloudEvents format. The envelope says who published it, when, about which property and what happened;
dataholds the detail. Openstay.expected.jsonin any text editor to read it. Concepts explains each field.Break it on purpose
Download another example, in which the housekeeping system reports that unit 204 is dirty:
curl.exe -O https://hos-ai.vercel.app/spec/0.1/examples/unit.status_changed.jsoncurl -O https://hos-ai.vercel.app/spec/0.1/examples/unit.status_changed.jsoncurl -O https://hos-ai.vercel.app/spec/0.1/examples/unit.status_changed.jsonOpen it, find the line
"current": "dirty", and replace the worddirtywithcleaning. Keep the quotes around it, and save.PowerShellnotepad unit.status_changed.jsonNotepad opens the file. Make the change, save with Ctrl+S, and close Notepad.
Command Promptnotepad unit.status_changed.jsonNotepad opens the file. Make the change, save with Ctrl+S, and close Notepad.
On macOS,
open -e unit.status_changed.jsonopens the file in TextEdit; save with Cmd+S. On Linux,nano unit.status_changed.jsonopens it in the terminal; save with Ctrl+O then Enter, and leave with Ctrl+X.Validate it again:
Terminalnpx @hos-ai/cli validate unit.status_changed.jsonTerminal $ npx @hos-ai/cli validate unit.status_changed.json ✗ unit.status_changed.json: invalid event unit.status_changed (1 error) error data.current is "cleaning", not one of: dirty, clean, inspected, unknown. Readiness as reported by the housekeeping authority. rule core/unit-status-model · at /data/currentRead the error. Every error of hos has the same parts:
✗, the file, and what it is: an invalid event of typeunit.status_changed, with one error.error: the level. An error makes the file invalid. Awarningor anotedoes not.- The message: the field,
data.current; the value found,"cleaning"; what HOS allows,dirty,clean,inspectedorunknown; and what the field means. rule core/unit-status-model: the rule of the specification the file breaks, here the unit status model of HOS Core.at /data/current: where the field is in the file, as a path from the top of the JSON.
Why it is an error. HOS gives the housekeeping status of a room four values, so every system reads a room the same way. A status of one vendor, such as "cleaning", does not travel as a HOS status: another system would not know whether the room can be sold.
Check it worked
hos also says it with its exit codeExit codeThe number a command returns when it ends, which scripts and CI read. hos returns 0 when everything is valid or passed, 1 when a file is invalid or a check failed, and 2 when the command is wrong or a file could not be read., which scripts and CI read. Right after the command, print it:
$LASTEXITCODEecho %ERRORLEVEL%echo $?It prints
1: a file is invalid. After the first step, it was0. Changecleaningback todirty, and the file is valid again.Replay a hotel's morning
hos carries the HOS conformance scenariosConformance scenarioA made-up sequence of deliveries, with the manifests of its producers and the expected outcome. A system replays it and compares its results with the expected ones.: made-up days in a hotel, each a series of facts from several systems, with the outcome HOS expects. List them:
Terminalnpx @hos-ai/cli conformance listOutputarrival-readiness Early arrival, unit not ready · 13 deliveries, 3 producers late-checkout Late check-out on a same-day turnover · 15 deliveries, 2 producers room-out-of-order Assigned unit out of order · 14 deliveries, 3 producersThe first one is the morning above. Download its 13 facts, in the order they were delivered, and the manifestsManifestA producer's declaration: the facts it publishes and for which properties, the values it is the authority for, how it delivers, replays and keeps them, and its known limitations. The producer signs it. of its three producersProducerA system that publishes HOS facts, such as a property management system (PMS) or a housekeeping app. Its manifest says what it publishes.: the PMS, the housekeeping system and the guest messaging platform.
curl.exe -O https://hos-ai.vercel.app/spec/0.1/conformance/arrival-readiness/events.jsonl curl.exe -O https://hos-ai.vercel.app/spec/0.1/conformance/arrival-readiness/producers/pms.json curl.exe -O https://hos-ai.vercel.app/spec/0.1/conformance/arrival-readiness/producers/housekeeping.json curl.exe -O https://hos-ai.vercel.app/spec/0.1/conformance/arrival-readiness/producers/messaging.jsoncurl -O https://hos-ai.vercel.app/spec/0.1/conformance/arrival-readiness/events.jsonl curl -O https://hos-ai.vercel.app/spec/0.1/conformance/arrival-readiness/producers/pms.json curl -O https://hos-ai.vercel.app/spec/0.1/conformance/arrival-readiness/producers/housekeeping.json curl -O https://hos-ai.vercel.app/spec/0.1/conformance/arrival-readiness/producers/messaging.jsoncurl -O https://hos-ai.vercel.app/spec/0.1/conformance/arrival-readiness/events.jsonl curl -O https://hos-ai.vercel.app/spec/0.1/conformance/arrival-readiness/producers/pms.json curl -O https://hos-ai.vercel.app/spec/0.1/conformance/arrival-readiness/producers/housekeeping.json curl -O https://hos-ai.vercel.app/spec/0.1/conformance/arrival-readiness/producers/messaging.jsonReplay the facts, with the three manifests, each after
-m:Terminalnpx @hos-ai/cli replay events.jsonl -m pms.json -m housekeeping.json -m messaging.jsonTerminal $ npx @hos-ai/cli replay events.jsonl -m pms.json -m housekeeping.json -m messaging.json 1 applied reservation.created · pms-000312 · urn:hos:pms:demo 2 applied stay.expected · pms-000421 · urn:hos:pms:demo stay_1042: expected, unit none, readiness unknown, situation none 3 applied stay.unit_assigned · pms-000422 · urn:hos:pms:demo stay_1042: expected, unit unit_204, readiness unknown, situation none 4 applied unit.status_changed · hk-002231 · urn:hos:housekeeping:demo stay_1042: expected, unit unit_204, readiness not_ready, situation none 5 duplicate unit.status_changed · hk-002231 · urn:hos:housekeeping:demo 6 applied housekeeping.task.created · hk-002232 · urn:hos:housekeeping:demo 7 undeclared_capability housekeeping.task.created · pms-000430 · urn:hos:pms:demo 8 applied housekeeping.task.completed · hk-002260 · urn:hos:housekeeping:demo 9 non_authoritative unit.status_changed · pms-000455 · urn:hos:pms:demo 10 applied guest.message.received · msg-000977 · urn:hos:messaging:demo stay_1042: expected, unit unit_204, readiness not_ready, situation at risk ▲ at risk: stay_1042 in unit unit_204, expected 2026-07-30T10:30:00Z, planned 2026-07-30T13:00:00Z 11 superseded guest.message.received · msg-000971 · urn:hos:messaging:demo 12 applied unit.status_changed · hk-002301 · urn:hos:housekeeping:demo stay_1042: expected, unit unit_204, readiness ready, situation resolved ▼ resolved: stay_1042, unit_ready 13 applied stay.checked_in · pms-000470 · urn:hos:pms:demo stay_1042: in_house, unit unit_204, readiness ready, situation resolved 13 deliveries: 9 applied, 1 duplicate, 1 undeclared_capability, 1 non_authoritative, 1 superseded · 2 situationsRead the timeline. Each numbered line is one delivered fact: its number, what a consumer does with it, its type, its id and the system that published it. The indented lines show the stay after the fact: its state, its unit, whether the unit is ready, and whether the arrival is at risk.
What a consumer does with a fact is its dispositionDispositionWhat a consumer does with a fact it receives: applied, or set aside as a duplicate, superseded by a later fact, non_authoritative when its producer is not the authority, or undeclared_capability when its producer did not declare it.. This morning has all five:
- 4, applied: the housekeeping system, the authority on cleaning, reports unit 204 dirty. The room is not ready.
- 5, duplicate: the same fact arrives a second time, as deliveries may repeat. It is ignored.
- 7, undeclared_capability: the PMS sends a housekeeping task, which its manifest does not declare. Undeclared means ignored.
- 9, non_authoritative: the PMS says the room is clean, because the task was closed. It is not the authority on cleaning: the disagreement is recorded, and the room stays not ready.
- 10: the guest announces an arrival at 10:30 UTC, 12:30 in Paris, before the planned 13:00 UTC, 15:00 in Paris. The room is not ready: ▲ the arrival is at risk.
- 11, superseded: an older message from the guest arrives late. It does not replace the newer one.
- 12: the housekeeping system reports the room inspected. ▼ The risk is resolved, before the guest arrives.
Why?
The dispositions follow the rules of HOS Events 0.1: every consumer must reach the same ones. Readiness and situations come from the reference projection, one way of reading arrivals that HOS gives as an example: a system may read arrivals differently and still follow HOS.
Check it worked
You have seen the three results the tools give:
- a ✓, and exit code 0: valid;
- a ✗ with the field, the value, the rule and the path, and exit code 1: invalid;
- a timeline in which the arrival becomes at risk at delivery 10 (▲), then resolved at delivery 12 (▼).
If it fails
- PowerShell asks for a
Uri: press Ctrl+C and typecurl.exe, notcurl. cannot read ... ENOENT: no such file or directory, with exit code 2: the file is not in the folder you are in. Check that the download worked, and that you are inhos-quickstart.- Every line of the replay is
undeclared_capability, after the messageno --manifest given: add the three manifests, each after-m. Not JSON: Unexpected token: the file was saved in another encoding, such as UTF-16, or with a byte order mark. Download it again, or save it as UTF-8 in your editor.
Next steps
- Your system receives HOS facts: test it against the scenarios, in any language. The Python example passes the normative level in about 130 lines, with the standard library only.
- Your system publishes HOS facts: check what it publishes, then sign and publish your manifest.
- You want to understand the ideas first: Concepts.
- Someone sent you a report: Read a HOS report.