Skip to content

Add a use case and let the tool prove it

Scaffold a draft for an uncovered command, validate it, run its scenario against the real tool, and see the coverage move.

guaranteed Extensionintermediatemaintaineragentwrites state

Situation

A command gained a behaviour and nobody wrote down what a person does with it. The documentation will drift the day it is written by hand, and a paragraph proves nothing.

Scenario

setup: installed
given:
  - 'Majordomus installed; the skeleton seeds the use-case section with no use case yet'
steps:
  - id: nothing-yet
    run: ['usecase', 'list']
    note: 'the section exists and is empty'
    expect:
      exit: 0
      stdout_contains: ['use cases: 0 in']
  - id: the-gaps
    run: ['usecase', 'coverage']
    note: 'every public command is a target; a fresh policy reports gaps and fails on none'
    expect:
      exit: 0
      stdout_contains: ['^command +doctor +0 +0 +0 +gap +advisory']
  - id: scaffold
    run: ['usecase', 'scaffold', '--for', 'command:doctor']
    note: 'a draft from what the registry, the fixture and the claims already know; nothing in it is verified'
    expect:
      exit: 0
      stdout_contains: ['wrote: \.ai/repo/use-cases/doctor-draft\.md']
  - id: validate
    run: ['usecase', 'validate']
    note: 'the draft resolves: its command, setup and category exist'
    expect:
      exit: 0
      stdout_contains: ['usecase validate: 0 failure']
  - id: run-it
    run: ['usecase', 'run', 'doctor-draft']
    note: 'the scaffolded scenario executes the real command in a disposable repository'
    expect:
      exit: 0
      stdout_contains: ['doctor-draft +pass']
  - id: still-a-gap
    run: ['usecase', 'coverage']
    note: 'a draft never counts; coverage moves when the use case is active'
    expect:
      exit: 0
      stdout_contains: ['^command +doctor +0 +0 +0 +gap']
then:
  - 'a use case is a file; everything else (the page, the links, the tally) follows'
  - 'a draft can run but cannot cover: status is authored, maturity is observed'

Outcome

usecase scaffold writes a draft with the facts the tool already has, usecase run executes its scenario against the real tool and records the evidence, and usecase coverage says what is still missing. The draft counts for nothing until it is made active.

The scenario

Executed against the real tool, in a repository prepared by installed, every time this site is generated. What follows is not a description of what should happen; it is what happened.

given

  • Majordomus installed; the skeleton seeds the use-case section with no use case yet

when

  1. 1majordomus usecase list
  2. 2majordomus usecase coverage
  3. 3majordomus usecase scaffold --for command:doctor
  4. 4majordomus usecase validate
  5. 5majordomus usecase run doctor-draft
  6. 6majordomus usecase coverage

then

  • a use case is a file; everything else (the page, the links, the tally) follows
  • a draft can run but cannot cover: status is authored, maturity is observed

What the tool did

Evidence of the run this page was generated from: pass, 6 step(s). Output is normalised: the repository's path, timestamps, ids and durations are placeholders; nothing else is edited.

Tested by test/cases/94_use_cases.sh, which runs every scenario and refuses a step whose recorded output is not what it produced.

  1. the section exists and is empty

    use cases: 0 in .ai/repo/use-cases
    • exit 0
    • stdout_contains /use cases: 0 in/
  2. every public command is a target; a fresh policy reports gaps and fails on none

    command   init                                         0   0   0  gap      advisory
    command   update                                       0   0   0  gap      advisory
    command   doctor                                       0   0   0  gap      advisory
    command   watch                                        0   0   0  gap      advisory
    command   start                                        0   0   0  gap      advisory
    command   context                                      0   0   0  gap      advisory
    command   checkpoint                                   0   0   0  gap      advisory
    command   handover                                     0   0   0  gap      advisory
    command   check                                        0   0   0  gap      advisory
    command   finish                                       0   0   0  gap      advisory
    command   history                                      0   0   0  gap      advisory
    command   decision                                     0   0   0  gap      advisory
    command   question                                     0   0   0  gap      advisory
    command   prompt                                       0   0   0  gap      advisory
    command   evidence                                     0   0   0  gap      advisory
    command   skills                                       0   0   0  gap      advisory
    command   capture                                      0   0   0  gap      advisory
    command   search                                       0   0   0  gap      advisory
    command   doctrine                                     0   0   0  gap      advisory
    command   plan                                         0   0   0  gap      advisory
    command   version                                      0   0   0  gap      advisory
    command   session                                      0   0   0  gap      advisory
    command   knowledge                                    0   0   0  gap      advisory
    command   adr                                          0   0   0  gap      advisory
    command   usecase                                      0   0   0  gap      advisory
    command   rules                                        0   0   0  gap      advisory
    command   migrate                                      0   0   0  gap      advisory
    command   recover                                      0   0   0  gap      advisory
    command   bench                                        0   0   0  gap      advisory
    command   archive                                      0   0   0  gap      advisory
    usecase coverage: 30 target(s), 0 covered, 0 partial, 0 required gap(s)  (columns: use cases, executable, evidence)
    • exit 0
    • stdout_contains /^command +doctor +0 +0 +0 +gap +advisory/
  3. a draft from what the registry, the fixture and the claims already know; nothing in it is verified

    wrote: .ai/repo/use-cases/doctor-draft.md (draft; complete the narrative and the assertions, then set status: active)
    usecase scaffold: 1 draft(s) written
    • exit 0
    • stdout_contains /wrote: \.ai/repo/use-cases/doctor-draft\.md/
  4. the draft resolves: its command, setup and category exist

    OK   use-case    1 use case(s), 0 application(s) — every command, doctrine, claim, responsibility, application, category, setup and stdin resolves; every scenario step names a listed command
    usecase validate: 0 failure(s)
    • exit 0
    • stdout_contains /usecase validate: 0 failure/
  5. the scaffolded scenario executes the real command in a disposable repository

    doctor-draft                           pass  1 step(s)
    usecase run: 1 scenario(s), 0 failed, 0 unmet, 0 not run; evidence under .ai/local/evidence/use-cases/
    • exit 0
    • stdout_contains /doctor-draft +pass/
  6. a draft never counts; coverage moves when the use case is active

    command   init                                         0   0   0  gap      advisory
    command   update                                       0   0   0  gap      advisory
    command   doctor                                       0   0   0  gap      advisory
    command   watch                                        0   0   0  gap      advisory
    command   start                                        0   0   0  gap      advisory
    command   context                                      0   0   0  gap      advisory
    command   checkpoint                                   0   0   0  gap      advisory
    command   handover                                     0   0   0  gap      advisory
    command   check                                        0   0   0  gap      advisory
    command   finish                                       0   0   0  gap      advisory
    command   history                                      0   0   0  gap      advisory
    command   decision                                     0   0   0  gap      advisory
    command   question                                     0   0   0  gap      advisory
    command   prompt                                       0   0   0  gap      advisory
    command   evidence                                     0   0   0  gap      advisory
    command   skills                                       0   0   0  gap      advisory
    command   capture                                      0   0   0  gap      advisory
    command   search                                       0   0   0  gap      advisory
    command   doctrine                                     0   0   0  gap      advisory
    command   plan                                         0   0   0  gap      advisory
    command   version                                      0   0   0  gap      advisory
    command   session                                      0   0   0  gap      advisory
    command   knowledge                                    0   0   0  gap      advisory
    command   adr                                          0   0   0  gap      advisory
    command   usecase                                      0   0   0  gap      advisory
    command   rules                                        0   0   0  gap      advisory
    command   migrate                                      0   0   0  gap      advisory
    command   recover                                      0   0   0  gap      advisory
    command   bench                                        0   0   0  gap      advisory
    command   archive                                      0   0   0  gap      advisory
    usecase coverage: 30 target(s), 0 covered, 0 partial, 0 required gap(s)  (columns: use cases, executable, evidence)
    • exit 0
    • stdout_contains /^command +doctor +0 +0 +0 +gap/

Why the tool knows this

The chain from this page to the code: the use case names commands, rules and claims; each rule is dispatched from the registry and each claim names the test that proves it; the scenario above executed the commands. Nothing in this chain is prose about intent.

The rules that make it hold

Guarantees exercised

Related use cases

Computed from what they share: claims, rules, commands, category, applications. Nobody maintains this list.

The moments this answers

Searches the titles and descriptions of every page this site publishes.