Capture stories and Scenarios
Write stories and Scenarios down, and change them until their Phase is released.
Capture a story #
In the browser app, New story asks who wants something, what they want to do, why, and where it sits, with the sentence building up as you answer. On the command line:
$ vendor/bin/barnspek create-story --area-of-business=reservations \
--area-of-business-meaning="booking and keeping rooms" \
--phase="first bookings" --phase-meaning="guests can book a room" \
--role=guest --role-meaning="choosing and securing somewhere to stay" \
--goal="book a room for a run of nights" --reward="have somewhere to stay" \
--stage=transact
Barn: …/hotel
Story created:
area of business: reservations (created)
role: guest (created)
story: book-a-room-for-a-run-of-nights (created)
stage: transact
story id: 01a1cb3e-…
An area of business, role or Phase that already exists is reused: give its title, and leave out the -meaning
flags, which are only needed for something new. --phase and --phase-meaning apply only when the area of
business is new; they default to “Phase 1”. --stage is optional and is one of establish, adjust,
transact, resolve or close.
$ vendor/bin/barnspek create-story --area-of-business=reservations --role=guest \
--goal="cancel their booking" --reward="are not held to a stay they will not take" \
--stage=resolve
Barn: …/hotel
Story created:
area of business: reservations (existing)
role: guest (existing)
story: cancel-their-booking (created)
stage: resolve
story id: 01a1cb3e-…
An area of business on its own #
To make an area of business and its first Phase before any story, and to add the next Phase later:
vendor/bin/barnspek create-area-of-business --title=Laundry --meaning="washing and returning linen" \
--phase="first loads" --phase-meaning="linen goes out and comes back"
vendor/bin/barnspek create-phase --area-of-business=laundry --title="..." --meaning="..."
Capture a Scenario #
In the browser app, New story offers to write the story’s happy path straight away, and + New Scenario on a story starts at the When. Nothing is saved until you save, and any new building block you describe on the way is created only then.
On the command line there are two ways. refine is a wizard for a person at a terminal. It asks which area of
business, role and story, then walks through the Scenario one question at a time, offering to reuse each existing subject, fact and
action or to make a new one.
$ vendor/bin/barnspek refine
Barn: …/hotel
Select an area of business:
[0] - reservations
[1] - Quit
>
For a script, an AI agent or a seed file, create-scenario takes the whole Scenario as JSON, so nothing
is interactive. Subjects, facts, actions and parameters are found or created as refine would; only the area of business,
role and story must already exist.
{
"area-of-business": "reservations",
"role": "guest",
"story": "book-a-room-for-a-run-of-nights",
"actionSentence": "book a room for three nights",
"actionParameters": {
"nights": {"meaning": "how many nights to stay", "type": "integer", "value": 3}
},
"given": [
{
"subject": "room",
"subjectMeaning": "a room the hotel lets to guests",
"fact": "is-available",
"factMeaning": "no booking holds the room on those nights"
}
],
"outcome": "accepted",
"then": [
{
"subject": "booking",
"subjectMeaning": "a guest's hold on a room for a run of nights",
"fact": "is-confirmed",
"factMeaning": "holds the room for the guest on these nights"
}
]
}
$ vendor/bin/barnspek create-scenario --file=scenario.json
Barn: …/hotel
Scenario saved: 01a1cb3e-…
| Key | Meaning |
|---|---|
area-of-business, role, story | Where the Scenario goes, by slug. They must already exist. |
actionSentence | The action, in words that finish “they will now…”. |
actionParameters | Details the action takes: each has a meaning, a type and a value for this Scenario. |
given, then | Lists of facts. Each names a subject and fact, with subjectMeaning and factMeaning when they are new, and parameters if the fact takes any. |
outcome | accepted or rejected: what the role expects to happen. |
A fact with no parameters is written the same way with parameters left out.
Change what you captured #
Until a Phase is released, everything in it can change, because the first wording is rarely the right one. Once it is released, a story changes only by elaboration.
Reword #
Reword a role, story, subject, fact, action, parameter or Phase. Give the new title or meaning, or a story’s new goal or reward.
$ vendor/bin/barnspek reword --area-of-business=reservations --story=book-a-room \
--goal="book a room for a run of nights"
Barn: …/hotel
Reworded story 'book-a-room' of role 'guest':
goal was: book a room
goal now: book a room for a run of nights
Restage #
$ vendor/bin/barnspek restage-story --area-of-business=reservations \
--story=book-a-room-for-a-run-of-nights --stage=transact
Barn: …/hotel
Restaged book-a-room-for-a-run-of-nights: transact
Add --clear instead of --stage to return a story to Unassigned.
Delete #
Delete a story with its Scenarios, a single Scenario, or a subject, fact, action or parameter that no Scenario uses. Barnspek
says what it would delete and does nothing until you agree; pass --yes to agree without being asked.
$ vendor/bin/barnspek delete --area-of-business=reservations \
--story=book-a-room-for-a-run-of-nights
Barn: …/hotel
This deletes story 'book-a-room-for-a-run-of-nights' of role 'guest'.
Nothing was deleted. Pass --yes to go ahead without being asked.
Examples #
A parameter can carry an example, shown on the glossary. It changes nothing that was released, so it can be set at any time, even after release. An empty example removes it.
$ vendor/bin/barnspek set-example --area-of-business=reservations \
--action=book-a-room-for-three-nights --parameter=nights --example=3
Barn: …/hotel
Set the example of parameter 'nights' of action 'book-a-room-for-three-nights':
example was: (none)
example now: 3