Skip to content

Coding

Stage: code. Done by: coder.

Your next step

In your vault folder, run uv run scat check and read what it says.

The people at the events supply the detail, in their own accounts; coding organises it into common, interrelated patterns, abstract rather than concrete, finding what is the same under different names and what only looked the same. Nothing here asks for more detail than a page needs.

A narrative is one story drawn from your field notes, kept on one page. You code it in place: write the account, link each stakeholder, concern, affordance or technology where the account names it, and add one row to the page's Edges told table for each edge the account tells. The tool checks the result and says in plain words what still disagrees. The home page defines the four node types, and the terms page every other word used here.

What this path needs

  • A vault folder from the template, set up as in Getting started. For a trial, a plain clone of the template needs no sign-in:

    git clone https://github.com/DynamicalSystemsGroup/scat-template
    cd scat-template
    uv sync
    

    The example below uses the template's example pages. For your own notes, first remove them, as Start your own content shows, so the vault holds only your pages. - A Markdown editor that opens the vault folder and shows [[links]] and page properties. Obsidian 1.9 or later is the worked example; the index pages are Obsidian Bases and show only there. - A terminal in the vault folder. - Field notes from a session, as in Facilitating scenarios or Facilitating architectures, and the stakeholders named by role in the planning guide. A stakeholder is a role, never a person; the check warns when the vault holds more than the cap set in scat.toml.

There is no account, key, server or assistant. You write every word, and the tool checks the result.

Worked example: Obsidian

The example codes one narrative in the template vault, groups-under-a-cap-pitch: it adds one link and one row, then runs the check until it says there is no problem. The same four steps of the coding loop apply on every narrative.

  1. In Obsidian: open the vault folder as a vault (Manage vaults, then Open next to Open folder as vault). The folders are affordance, concern, stakeholder, index, narrative and technology.

  2. In Obsidian: open narrative/groups-under-a-cap-pitch and read the account and the two rows of its Edges told table.

  3. In Obsidian: change the status property from done to draft, so you can edit it. The check runs on it again when you set done at the end.

  4. In Obsidian: in the last bullet of the account, the one that begins "Reason given", turn the words "the people in the data" into a link to the stakeholder workshop-participants:

    - Reason given: [[workshop-participants|the people in the data]] are stakeholders under the Chatham House rule, so [[anonymity|no individual is identifiable]].
    
  5. In Obsidian: add one row at the foot of the Edges told table:

    | [[workshop-participants]] | holds | [[anonymity]] | They appear only as stakeholders, so no individual is identifiable. |
    
  6. In a terminal: run uv run scat check groups-under-a-cap-pitch. A misspelt link is named with the line to change. A link written [[anonymit]] produces:

    attribution mode: disallowed
    warning [SCAT-END-NOPAGE] narrative/groups-under-a-cap-pitch.md:23:39 row 3 cell `to`: [[anonymit]] does not reach a page (no page is named anonymit)
      Fix (the coder chooses one):
        1. replace `[[anonymit]]` with `[[anonymity]]`
        2. run `scat stub anonymit --type concern` (REPL: `scat_tools.stub("anonymit", type="concern")`) to create a concern page
        3. delete the row
    0 errors, 1 warning
    

    Correct the link and run the check again until it reads no problems.

  7. In a terminal: the same check in the Python REPL (uv run python):

    import scat_tools
    print(scat_tools.check("groups-under-a-cap-pitch"))
    
    attribution mode: disallowed
    no problems
    
  8. In Obsidian: confirm that the account still matches your notes and that the row is a correct use of SCAT, then change status back to done.

  9. In a terminal: run uv run scat check for the whole vault and see no problems.

What the pages are

Page type Folder What it holds
stakeholder stakeholder/ a stakeholder, named by role
concern concern/ what a stakeholder cares about
affordance affordance/ what a tool or arrangement lets someone do
technology technology/ the thing that provides an affordance
narrative narrative/ one account, with the table of edges it tells
contributor contributor/ a person a narrative is attributed to; only where the attribution mode is required or optional
index pages index/ a list of the pages of one type

You write every page, or scat stub makes it empty. An edge is no page. It is one row of a narrative's Edges told table, of one of three types fixed by the layers they join:

Edge type Name it as from is a to is a
holds holds stakeholder concern
is addressed by addressed-by concern affordance
is provided by provided-by affordance technology

The tool builds the graph from the pages on every call and never holds it. Two narratives that tell the same edge each have a row, and the graph has one edge naming both. An edge is done when every narrative that tells it is done. A link is only "this page refers to that one"; only a row makes an edge. A narrative that mentions two nodes without a row for the pair has not told an edge, even if the notes would support one: the row is your statement that the account tells it.

The coding loop

Work each narrative round four steps, as often as it takes:

  1. Interpreting. Read the field notes and decide what they say. This is yours alone.
  2. Authoring. Write or revise the account on the narrative page. An assistant may draft it; the wording you keep is yours.
  3. Coding. Link each node where the account names it, and record each edge it tells. Link in the account only what the table holds.
  4. Reviewing. Run the check and fix what it reports. You confirm two things yourself: the account matches the field notes, and the coding is a correct use of SCAT.

The tool owns conformance: it checks structure only and cannot tell who is calling it. An assistant, where your participation terms allow one, may draft and run commands and decides nothing (see Data, rights and consent). You alone move a narrative into or out of done. The norms say what the tool requires, what is only guidance, and what done needs; What a node page holds says what a node page holds.

A narrative that links at least one node page, in a row or in its account, is read into the graph and the views. Until it does, they leave it out, and scat check says "excluded" and how to include it.

Done is not frozen: to change a done narrative, set it back to draft, edit, then set done again; the tool checks it again then.

Where narratives and their edges come from

Everything starts in the field notes, which you read. scat stub makes the empty narrative page and you write the account. A row of its Edges told table says "this account tells that a stakeholder holds that concern"; there is no other place an edge is written.

A narrative, start to finish

One narrative coded the way most people begin: writing first, recording edges as they come. The vault is a copy of the template, whose attribution mode is disallowed, so every check prints that mode first. Each $ line is a command you type, without the $; the lines under it are what the tool prints. Every command here is in the CLI reference.

Make the page

$ uv run scat stub saturday-at-the-tool-library --type narrative
created narrative/saturday-at-the-tool-library.md
$ uv run scat check saturday-at-the-tool-library
attribution mode: disallowed
warning [SCAT-UNCODED] narrative/saturday-at-the-tool-library.md body: the narrative links no node page, so it is excluded from the knowledge graph and every view
  Fix (the coder chooses one):
    1. link a node page where the account names one, as `[[<node-name>]]`, and record its row
    2. or tell an edge: a row of the table whose ends are links to node pages; if the node has no page, `scat stub <name> --type <type>` makes one
0 errors, 1 warning

The check does not fault an unfinished page; it notes what the page lacks.

Write the account

In Obsidian, write the account under the front matter, as it was told. Set kind to scenario or architecture, and, if you can tell, claim_type to actual or hypothetical (see claim type); neither is required. Change status to draft.

---
type: narrative
kind: scenario
status: draft
title: "Saturday at the tool library"
claim_type: actual
---

From the point of view of Workshop participants (about 10:20)

- Saturday, desk opens at 9. Three people ask for the same drill.
- Concern: "tools must come back in good order."
- The sign-out sheet lets us see who has what. It stops us seeing tools that are late.

Record the edges

record-edge writes the row, and makes the node pages the row names as stubs of the type the layer fixes. --told-by names the narrative:

$ uv run scat record-edge holds workshop-participants tools-come-back-in-good-order --told-by saturday-at-the-tool-library --note "Said twice in the first hour."
created concern/tools-come-back-in-good-order.md
changed narrative/saturday-at-the-tool-library.md
note: added `| [[workshop-participants]] | holds | [[tools-come-back-in-good-order]] | Said twice in the first hour. |` to narrative/saturday-at-the-tool-library.md at line 19
$ uv run scat record-edge addressed-by tools-come-back-in-good-order sign-out-sheet --told-by saturday-at-the-tool-library
created affordance/sign-out-sheet.md
changed narrative/saturday-at-the-tool-library.md
note: added `| [[tools-come-back-in-good-order]] | is addressed by | [[sign-out-sheet]] | |` to narrative/saturday-at-the-tool-library.md at line 20

The rows are in the page, which you can also edit by hand. Recording an edge the narrative already tells changes nothing, so you can repeat a command safely.

## Edges told

| from | type | to | note |
|---|---|---|---|
| [[workshop-participants]] | holds | [[tools-come-back-in-good-order]] | Said twice in the first hour. |
| [[tools-come-back-in-good-order]] | is addressed by | [[sign-out-sheet]] | |

In Obsidian, link each node where the account names it, with [[name|words as written]]. A row's own ends are links already:

From the point of view of [[workshop-participants|Workshop participants]] (about 10:20)

- Saturday, desk opens at 9. Three people ask for the same drill.
- Concern: "[[tools-come-back-in-good-order|tools must come back in good order]]."
- [[sign-out-sheet|The sign-out sheet]] lets us see who has what. It stops us seeing tools that are late.

Check one page, or a page and every page one link away, as you go: uv run scat check saturday-at-the-tool-library --neighborhood. It now asks only for a description (warning at draft, error at done).

The links in the account are a subset of the nodes the table holds. Link a second stakeholder, [[project-leads|project leads]], in the first bullet, with no row ending at it, and the check says:

warning [SCAT-LINK-NOTINTABLE] narrative/saturday-at-the-tool-library.md:11:75 link [[project-leads]]: the account links it but no row of the table has it as an end; the table is the coding of record
  Fix (the coder chooses one):
    1. record the row for it: run `scat record-edge <type> <from> <to> --told-by saturday-at-the-tool-library` ...
    2. or take the link out of the account: write `project-leads` without its brackets and keep the words

At done this is an error. Record the row, or take the brackets off:

$ uv run scat record-edge holds project-leads anonymity --told-by saturday-at-the-tool-library --note "They hear of the drills."
changed narrative/saturday-at-the-tool-library.md
note: added `| [[project-leads]] | holds | [[anonymity]] | They hear of the drills. |` to narrative/saturday-at-the-tool-library.md at line 21

A narrative that links two nodes of neighbouring layers, each already a row end, but has no row joining them, has a candidate: whether the account tells that edge is your judgement of the field notes, not a defect. uv run scat fingerprint saturday-at-the-tool-library --candidates lists the nodes the page links, the edges it tells (together its fingerprint) and, last, the candidates:

  candidates (linked, no row)
    holds: project-leads -> tools-come-back-in-good-order

Add a row if the account tells the edge, and leave it if it does not. Analysis shows the fingerprint as a drawing.

Set it to done

Setting done is judged as the page would stand at done. It is refused while it would fail, and nothing is written:

$ uv run scat set-status saturday-at-the-tool-library done
refused [SCAT-DONE-REFUSED] narrative/saturday-at-the-tool-library.md: 1 error(s) would stand at status done; status unchanged
  error [SCAT-FIELD] narrative/saturday-at-the-tool-library.md field `description`: missing on a page with status: done
    Fix (the coder chooses one):
      1. add the line `description: "<one sentence you write>"` (author)
      2. run `scat set-status saturday-at-the-tool-library draft` if the page is not finished

Add the line description: "Loans go unrecorded when the sheet runs out." to the front matter, then set it again:

$ uv run scat set-status saturday-at-the-tool-library done
changed narrative/saturday-at-the-tool-library.md
note: `status` set to done (was draft)
check of narrative/saturday-at-the-tool-library.md: no problems

done is your word that the account matches the field notes and the coding is right. The tool has checked only the structure.

Change a done narrative

record-edge and remove-edge refuse to touch a done narrative: changing it is your step. Set it to draft, make the change, set it to done again. The links stay when a row is removed, since they belong to the account, so the check then reports any link no row ends at: record a row for it or take the brackets off.

$ uv run scat set-status saturday-at-the-tool-library draft
$ uv run scat remove-edge workshop-participants tools-come-back-in-good-order
changed narrative/saturday-at-the-tool-library.md
note: removed the row at line 20 of narrative/saturday-at-the-tool-library.md
note: the links stay in the narratives; remove one by hand if the account no longer names it

Coding in increments

You stub something, fill it in, stub more, and the tool tells you what disagrees after every step. Depth first codes one narrative at a time, as above. Breadth first makes the nodes first (scat stub late-returns --type concern), links them in the account, then records the edges. Each link is reported, as a warning at draft, until a row ends at it:

$ uv run scat record-edge holds workshop-participants late-returns --told-by sunday-at-the-desk --note "Said as the main worry."
$ uv run scat record-edge addressed-by late-returns reminder-text --told-by sunday-at-the-desk
$ uv run scat check sunday-at-the-desk --neighborhood
attribution mode: disallowed
no problems

Linking a name before its page exists is the one thing that is an error at every status, because a link must reach a page. The message offers scat stub NAME --type ....

A mismatch is a link and an edge that disagree, at a row's end: the end is not a link, or links a name that is no page, or links a page that is not a node. The table has other faults too: a row in the wrong direction or between layers that are not neighbours, a row repeated within one narrative, a type the ontology does not know, a row that is not four cells. While the narrative is a stub or draft, each is a warning; at done, each is an error and set-status ... done refuses. This hand-written table has three of them:

| from | type | to | note |
|---|---|---|---|
| [[workshop-participants]] | holds | late-returns | |
| [[late-returns]] | holds | [[workshop-participants]] | |
| [[workshop-participants]] | holds | [[late-return]] | |
$ uv run scat check monday-at-the-desk
attribution mode: disallowed
warning [SCAT-END-NOLINK] narrative/monday-at-the-desk.md:16:39 row 1 cell `to`: `late-returns` is not a link; each end of a row is one link, `[[page-name]]`
  Fix (the coder chooses one):
    1. replace `late-returns` with `[[late-returns]]`
    2. delete the row
warning [SCAT-TABLE-LAYERS] narrative/monday-at-the-desk.md:17:1 row 2: `holds` joins a stakeholder to a concern, but [[late-returns]] is a concern page, and [[workshop-participants]] is a stakeholder page
  Fix (the coder chooses one):
    1. swap the two ends: replace `[[late-returns]] | [[workshop-participants]]` with `[[workshop-participants]] | [[late-returns]]`
    2. delete the row
warning [SCAT-END-NOPAGE] narrative/monday-at-the-desk.md:18:39 row 3 cell `to`: [[late-return]] does not reach a page (no page is named late-return)
  Fix (the coder chooses one):
    1. replace `[[late-return]]` with `[[late-returns]]`
    2. run `scat stub late-return --type concern` to create a concern page
    3. delete the row
0 errors, 3 warnings

Each message names the row and cell, says what is wrong and gives its fixes. Apply the first fix to each. Rows 2 and 3 then say what row 1 says, and a narrative tells an edge once, so delete them. The narrative passes and can be set to done.

Obsidian's table editor re-pads the columns when you click into a table. That is harmless: the tool reads a table whatever its spacing.

Relationship annotations

Two pages of one type can pull against each other, such as two concerns. Record that as a relationship annotation: a line in the body of one page, with a link to the other. It is not an edge, means nothing to the tool and stays out of every view. The link must still reach a page:

Pulls against [[anonymity]]: chasing a borrower for a late tool means knowing who they are.

Contributor pages and attributed_to

Where the vault's attribution mode is required or optional, a narrative can name the people it is attributed to. Each person has a contributor page in contributor/, outside the four layers, and the narrative names them in its attributed_to field: a list of quoted links to those pages.

attributed_to: ["[[ada-quill]]"]

A contributor page is no node and a link to one is no edge. Its title holds a name or handle, as the organiser records it. What each mode asks of a narrative:

Mode What the check says
required A narrative names its contributors. Without attributed_to, a draft gets a warning and done an error (SCAT-ATTR).
optional A narrative names its contributors or names none. The check asks for nothing.
disallowed No narrative names a contributor and the vault holds no contributor page. Either is an error at every status (SCAT-ATTR-DISALLOWED), and scat stub --type contributor refuses.

The norms state the same three cases. Every check prints the mode first. The mode belongs to the whole vault; the organiser sets it before the first session, and the tool never changes it.

With attribution = "required" in scat.toml, a draft narrative that names nobody is warned, and setting done is refused with SCAT-ATTR. Make the contributor page with scat stub, write the name in its title, and add the field to the narrative:

$ uv run scat stub ada-quill --type contributor
created contributor/ada-quill.md
$ uv run scat check saturday-at-the-tool-library
attribution mode: required
no problems

In a disallowed vault the same field is refused:

$ uv run scat check saturday-at-the-tool-library
attribution mode: disallowed
error [SCAT-ATTR-DISALLOWED] narrative/saturday-at-the-tool-library.md field `attributed_to`: present, and the vault's attribution mode is `disallowed`
  Fix (conformance, apply as written): delete the field `attributed_to` (all its lines): this vault's attribution mode is `disallowed`; the coder who wants contributors named changes `attribution` in scat.toml for the whole vault
1 error, 0 warnings

scat attribution lists each contributor page with the narratives that name it, and the narratives that name none; it refuses in a disallowed vault. See the CLI reference and the Python API reference.

Two pages for one node

Stage: synthesise. Done by: coder.

Looking across narratives is the synthesise stage's work: merge, rename, where-used and review belong to it, not to code. See the synthesis guide and the CLI reference. scat evidence <node> shows every narrative that links the node, with the paragraph around each link.

The operations

Stage: code. Done by: coder.

Every operation has two spellings that give the same messages: the Python REPL (uv run python, then import scat_tools once) and the command line. The CLI reference and the Python API reference hold every command with all its options. None writes a narrative's account.

check reads the vault and writes nothing, at three scopes: one page, the quickest; a page and every page one link away, after adding links; and the whole vault, before you commit. A page is named by its name (anonymity) or its path (concern/anonymity.md). Warnings do not block: a command exits with 0 unless there is an error.

scat_tools.check()
scat_tools.check("anonymity")
scat_tools.check("anonymity", neighborhood=True)
uv run scat check
uv run scat check anonymity
uv run scat check anonymity --neighborhood

stub makes one empty page of the type you name, stub-links makes the node pages that the ends of rows link and the vault lacks, status lists each page's status, and set-status moves a page between stub, draft and done.

record-edge and remove-edge need the project in the code stage. uv run scat which-stage says where it is. If it says another stage, this moves the project to code, signed with your name (a move the current stage does not list is refused, and nothing is written):

uv run scat set-stage --to code --by "Your Name"
scat_tools.stub("desk-notes-one", type="narrative")
scat_tools.record_edge("holds", "workshop-participants", "lending-desk-opens-on-time", ["desk-notes-one"], note="Said twice.")
scat_tools.remove_edge("workshop-participants", "lending-desk-opens-on-time")
uv run scat stub desk-notes-two --type narrative
uv run scat record-edge holds workshop-participants volunteers-are-easy-to-find --told-by desk-notes-two --note "Said twice."
uv run scat remove-edge workshop-participants volunteers-are-easy-to-find

How to read a message

Every message has the same parts:

error [SCAT-FIELD] narrative/saturday-at-the-tool-library.md field `description`: missing on a page with status: done
  Fix (the coder chooses one):
    1. add the line `description: "<one sentence you write>"` (author)
    2. run `scat set-status saturday-at-the-tool-library draft` if the page is not finished
  1. Severity. error blocks. warning does not. refused means a command did not run, and nothing was written.
  2. The rule id, in square brackets. Ids with DRAFT are the warnings a stub or draft gets; the same rule with DONE is the error at done.
  3. The file, the line and column, and the row and cell when it is a table.
  4. What is wrong, in one sentence.
  5. The fix. An exact command, or an exact line to write or delete. A fix marked (author) is a line only you can word.

Do what the fix says, then check again. The check looks at structure only. It does not judge what your notes say: a forgotten edge is graded by no rule, and only you know the account tells it.

Look at it in Obsidian

  • Backlinks. Open a concern: the panel lists every narrative that names it, which is how you ask "who tells this?".
  • Outgoing links. Open a narrative: the nodes it links, which with its table are its fingerprint.
  • Graph view. Each page is a dot and each link a line; narratives are dots too.
  • Index pages. The Bases in index/ list every page of one type.

Obsidian shows the vault. Only the tool checks it.

Hand over

Stage: report. Done by: coder.

When every narrative you made is done and the whole-vault check is clean, go on to Hand over and report.

Where next