Skip to content
Back to skills

Terminal Output

ASecurity

Load when changing anything a person reads — terminal views, colour, the help surface, Prime's preview, the agreement review screen, or the Markdown and HTML reports. Editing render/palette.ts, render/terminal.ts, render/prime.ts, render/agreement.ts, commands/review.ts, render/markdown.ts, render/html.ts, the help text in program.ts, or adding output to a command. Also load before introducing a colour role, hard-coding a hue, adding an emoji or spinner, putting a command in the short `--help...

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 6, 2026
ai-agentsgoshellgitapi

Works with

  • cursor
  • terminal
  • cli
  • api

Security analysis

A100/100

Scanned October 6, 2026

npx -y skills add vedntzz/The-Session --skill terminal-output --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Terminal Output?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Terminal Output
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vedntzz-terminal-output/badge)](https://www.skillsdirectory.com/skills/vedntzz-terminal-output)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: terminal-output
description: Load when changing anything a person reads — terminal views, colour, the help surface, Prime's preview, the agreement review screen, or the Markdown and HTML reports. Editing render/palette.ts, render/terminal.ts, render/prime.ts, render/agreement.ts, commands/review.ts, render/markdown.ts, render/html.ts, the help text in program.ts, or adding output to a command. Also load before introducing a colour role, hard-coding a hue, adding an emoji or spinner, putting a command in the short `--help` list, or interpolating an intent into a Markdown table.
---

# What a person reads

The terminal views, the help surface, colour, and the documents `week` writes
for somebody who was not there. The rationale is in
[Colour](../../../docs/decisions.md#colour) and
[Finding your way around](../../../docs/decisions.md#finding-your-way-around)
— this file is the rules a change has to hold to.

Any total printed here obeys the unpriced rule: **nought is not the same as
unknown**. That rule lives with the arithmetic, in the `measurement-rules`
skill under "A total nobody can work out" — load it before touching a figure.

## The order every view is in

Three rules, and they hold in `week <id>`, `week`, `scan` and the Markdown document
alike. They are what the views are *for*, not a house style:

1. **The first line says where the work went.** How many sessions, how many
   landed on the default branch, how many did not. `week <id>` says it as a
   sentence about one session; `week` and `scan` say it as counts.
2. **Drift comes before cost.** What went outside what was declared is the
   thing this tool measures that nothing else does. Every column, row and
   sentence about it precedes every one about money.
3. **A total in money is one dim line at the bottom, and nowhere else.** Never
   a heading, never the first figure, never bright, and never in a totals row
   as well — the Markdown table's cost cell in its totals row is deliberately
   empty, `week`'s source blocks carry no money at all, and the line under them
   is the only total. Per session, cost stays in the detail views: `week <id>`'s
   figure line, `week <id> --full`'s rows, the cost column of a table.

   `week`'s bottom line is the one figure there over the whole window rather
   than per source. Money is what a week is billed at, not a rate that moves
   with the mix of sources, so it is the one thing the blocks below do not
   split — and they carry none of it themselves, which is what keeps it the
   only total.

The reason is that the agents meter their own spend now, so a view that opened
on a dollar figure would be answering a question its reader has already had
answered. Money is still printed — a week nobody can put a figure on is a week
nobody can bill — but it closes a view rather than leading it.

`spentFigure` in `render/terminal/week.ts` is the one function that decides
whether a window's money reads `$0.00`, a figure, or an em dash. `week` and
`render/markdown.ts` both call it. Two copies of that two-clause test are two
chances for the terminal and the page somebody pastes into Notion to disagree
about what one week cost.

## Prime's preview

`prime` is a view before work starts, so it cannot lead with an outcome. It
opens with the developer's intent and the history supporting its suggestion.
`render/prime.ts` prints comparable and eligible declaration counts, every
proposed exact file with its reason, and supporting session ids for historical
suggestions. A named seed is labelled as named, never presented as a prediction.
The measurement rules for these counts live in the `measurement-rules` skill.

Tree coverage is always visible as proposed files over tracked files, with
`exact paths only`. Keep abstention reasons and the count of further candidates
omitted by the cap: a short list without either would conceal why it stopped.
Quote intent and path values so their boundaries remain visible. No confidence
score, generated explanation or claim that the suggestion is validated.

Under the suggestion, a `debt` line: this repo's owed files, quoted, at most
`DEBT_SHOWN` with a pointer to `session prime --debt` for the rest, each with
the number of sessions that drifted onto it. No money — the preview prints
none. A history too short to judge says `not enough history` with the count,
never `none`. It is a separate rule's answer printed beside the suggestion,
not part of it: nothing in the debt line changes what `--start` accepts.

`session prime --debt`, on its own, is the whole debt report (below, under
Naming a repository). It takes no intent and no other flag, and refuses them
by name rather than ignoring them.

The preview ends by saying **No session started** and gives the next action:
repeat with `--start` to accept, or add `--scope` to replace the suggested scope.
That next run recomputes; it does not accept a cached preview. `--scope`
replaces the whole list and requires `--start`. A successful start says the
suggested and accepted scopes were recorded separately. These are facts about
what the command did, not a second confirmation flow.

## How wide a view may be

`terminalWidth` in `render/terminal/text.ts` is the one place this is decided,
and it has the same shape and the same contract as `colorEnabled`: **what a
terminal gets adapts to that terminal, and what a pipe gets is fixed.** Fixed
here means *unconstrained* — it returns `undefined` off a pipe, a file or a CI
log, and every view then lays out exactly as it did before any of this existed.
That is what keeps the colourless render pinnable: a width read off whoever
happened to run the command would make the bytes in a bug report a fact about
their terminal.

It is measured once per run, at the command, beside the palette — neither
changes between two lines of the same run — and travels to the views as
`View.width`, absent in every test that only cares about layout.

Two rules for what a view does with it:

- **Prose wraps; tables do not.** A sentence has no column to be measured
  against, so `note` and `wrapSegments` fold it at the width and carry the same
  indent onto every continuation line. A table has columns, and every one of
  `week`'s is now a fixed shape or a figure whose digits cannot be dropped —
  the intent, which used to be the one that could give, is no longer a column.
  It has a line of its own and wraps into it like the prose it is.
- **There is a floor, and past it a view overflows on purpose.** `MIN_WIDTH`
  for prose. `week`'s figure line fits inside 80 columns with either `--class`
  or `--tokens` on, and overflows with both — the same way it overflowed with
  `--tokens` alone before the intent left the row. Anything added to that line
  takes from a budget nothing else can give back, since no column on it flexes
  any more.

Ink goes on **after** the wrap, never before. `wrapSegments` takes the runs of
a sentence with their inks, wraps the plain text, and inks each line's share of
each run — so an escape code never counts toward a width and no line ends
inside one. `test/terminal.test.ts` pins this the way `palette.test.ts` does:
stripping the tags out of the inked render gives back the plain render exactly.

## Naming a repository

`repoName` in `store/paths.ts` is the one place that knows `remote:` and
`path:` are prefixes, beside the `repoIdentity` that puts them on. They are how
the store tells two kinds of key apart and they are not how anybody refers to a
repository, so **no view prints them** — the debt report used to, and a reader met
`path:/private/tmp/…/scratchpad/demo` as a heading.

A remote key loses the prefix and nothing else; it is already the name everyone
uses. A path key keeps its whole path, with the home directory shortened to
`~`: two checkouts of one project share a last segment, and a report calling
them both `tool` would be pooling two answers under one name.

`session prime --debt` reads every log on the machine, and prints the repo the reader is
standing in **first**, marked `HERE`. Only that one moves. Sorting the rest by
how much each owes would be a league table across repositories, which `debtOf`
refuses to build — arriving at it by way of a sort in the view is the same
claim made quietly.

## The CLI surface

Written for somebody who has just watched an agent run for forty minutes. That
reader can hold about three facts, and every extra one pushes out a fact they
needed.

`session --help` lists four entry points: the bare screen, `start`, `week`, and
`help all`. The other commands are not hidden from the parser — they all run,
and `session help all` lists every one of them with its description. The short
list is a decision about what a first reader can use, not a claim about what
exists. `BRIEF_COMMANDS` in `program.ts` is the whole of it, and the list is
filtered out of the real command tree rather than written beside it, so a
command renamed cannot silently fall off.

The `help all` term is the **root command's own**. Commander gives every
command with subcommands an implicit `help` of its own, and the override that
renames ours is guarded on the parent rather than on the name — matched by name
it renamed those too, and `session hook --help` went out advertising a `session
hook help all` that does not exist.

`session help all` is built by walking `program.commands`, parents and
children. So is the sentence under the short help naming what it left out.
A hand-kept list would be one release away from being wrong, and that sentence
was: written out by hand it had already gone stale by three commands. The
command it points at — `session help all` — is kept whole when the sentence
wraps, since it is the one thing there the reader is meant to type.

`session` with no arguments is a **state screen, not a menu**: one sentence
about where the repo stands, then at most two commands. Which two depends on
the state, because in each state there is one obvious next move and at most one
other worth knowing. Commander would print the help here — the right answer to
"what is this" and the wrong one to "where am I".

Because the root has an action of its own, a name matching no subcommand would
arrive as a stray argument to it, and commander's answer was `error: too many
arguments. Expected 0 arguments but got 1` — true of the parse and no help to
somebody who did not think they were passing an argument. So the root declares
`[command]` and `unknownCommand` answers instead: what is wrong, what was
probably meant, and where the whole list is, in that order. The argument is
hidden from the root's own help through `visibleArguments`, and `usage` is set
by hand, or commander prints `[command] [command]` — once for the argument and
once for the subcommands it already knew about.

`didYouMean` offers a guess only when there is one. A prefix first — somebody
typing `sur` for `survival` has not made a typo, they have stopped early, and
no edit distance describes that — then the nearest name within one edit. The
distance is **Damerau**-Levenshtein: transposing two letters is the commonest
thing fingers do at a prompt, and plain Levenshtein scores it 2, which is the
difference between `session weke` being answered and being shrugged at. Two
edits is where a suggestion starts being wrong as often as it is right, and the
reader tries it before they read the rest of the line.

**`week` takes an id.** `session week` is the window; `session week <id>` is
one session of it, by the id or a prefix the row printed, and `session week
last` is the most recent closed one — `last` cannot be a prefix, since ids are
hex. What was `session show`. `--full` and `--tokens` apply to one session;
`--full` on the window is refused, and so is every flag that only cuts or
re-renders a window when an id is given, each named. `--days` is refused only
when typed, since commander fills its default.

`session week <id>` is three sentences and a bottom line: where the work ended
up, what was asked for, what went outside what was declared, and then the
session's id, the cost, the turns, and turns that produced nothing — that last one only where the diff can
say, which is a session that changed nothing. Every view reads it through
`emptyTurnsOf`, never off `cost.emptyTurns`; see the `measurement-rules` skill
under "Which turns produced nothing". The brief line simply stops at two
figures where the third is unknown, while `week <id> --full` spells the absence out
as `not measured`: a mark in a line read at a glance is a puzzle about the
tool, and the labelled view is where an absence belongs. `week`'s `no edits`
column says `unknown` — a word, since the intent no longer competes for the
room one costs — with a note under the blocks naming how many sessions could
not be counted. No view prints a count of calls that changed no files —
that figure is gone. The labelled layout is `--full`,
and `--tokens` implies it rather than being quietly ignored.

The outcome sentence is read off `outcome`, which by the time a view runs holds
what the repository says now rather than what the record was written with — see
`withOutcomes`. Four ends, four sentences, each saying only what its evidence
supports: a session still open has not landed and has not failed to, and one
that changed no files never had anything to land. `WHERE_IT_WENT` in
`render/terminal/brief.ts` is the whole of the wording. "Landed on the default
branch", never "shipped" — it is the plainest description of what `outcome.ts`
actually checked.

`--full` puts the same fact in its first labelled row. The intent stays above
it as the heading, because it is the title of the view rather than a row in it,
and cost and attribution close the view under the paths.

Nothing in the brief views is computed differently. They read the same
`intent`, `scope`, `drift` and `cost` the full view reads; what changed is how
much is said at once. Two consequences worth keeping:

- The **count** is always exact; the **paths** are what gets dropped. Three or
  fewer are named; past that the line gives the count and the two directories
  most of them are in. A sentence naming twelve paths is one nobody finishes,
  and the number in front of it is what decides whether to run `--full`.
- That rule is `summarizePaths` in `render/terminal/paths.ts`, and both views
  that name files go through it — `week <id>`'s sentence and `stop`'s `changed` and
  `outside` lines. Each supplies its own separator, a comma for prose and two
  spaces for a column; neither owns the threshold. Two copies of it would be
  two chances for a reader to learn the rule in one view and meet a different
  answer in the other. Note `--full` deliberately does not cap: it is the view
  somebody opens *because* they want every path.
- Where the paths are not named, one directory holding all of them reads `all
  in db/` rather than `mostly in db/`. "Mostly" would understate a fact the
  paths have already settled, and this line is all the reader gets.
- **Declared and primed intents are never shortened; a captured prompt is.**
  Prime keeps the developer's words; its assistance was with the scope.
  The same rule and
  the same code as the pull request body — `headOf` in
  `render/terminal/intent.ts`, first sentence or first line, whichever ends
  sooner — because two copies of it are two chances for the two views to
  disagree about where somebody's first sentence ended. A declaration is the
  promise the diff is held to, and a brief view showing half of it would be
  hiding the yardstick; it wraps instead, over as many lines as it needs.
  `MAX_INTENT` is 500, so before this a captured prompt reached `week <id>` as one
  sentence 568 columns wide, and the three sentences this view promises
  arrived as a wall.
- Where something **was** left out, the brief view says so and says where the
  rest is: the frame reads `Your first prompt began "…"` rather than `was`, and
  `REST_OF_IT` points at `session week <id> --full`, which holds every word. A
  captured prompt that is already whole keeps `was` and gets no pointer —
  "began" in front of all of it claims there is more, which is the same lie in
  the other direction, and a pointer under a view that left nothing out
  teaches the reader to ignore the pointer. The bare screen shortens the same
  way, with an ellipsis and no pointer: the session has not finished, so there
  is no `--full` to send anybody to.
- **`--full` is where a whole prompt lives.** It is where the brief views send
  a reader who wanted the rest of one, so nothing in it is ever shortened —
  the heading holds every character up to `MAX_INTENT`. It is flattened and
  wrapped instead, and the times move from its gutter to under it once it
  takes more than one line.
- A gutter note — the `←` hints — stays beside its row only while the whole
  row fits the width; past that it goes under the row, in the value column.
  `declared`'s `SCOPE_HINT` is the long one, and it put that row 32 columns
  past the edge while every other row in the view fitted.
- `--full`'s path rows wrap into the value column, blank where the label was,
  and the gutter note moves underneath once they do — there is no gutter left
  to put it in when the paths are using it. Wrapping is not capping: every path
  still prints, because `--full` is the view somebody opens *because* they want
  every path. A path longer than the room takes a line to itself and overflows,
  since a path cut in half is one the reader cannot copy.
- The four cases of the drift sentence — the third — are ordered by which fact
  the reader most needs: something went outside, here it is; nothing changed at
  all; nothing was declared, so the question cannot be asked; everything stayed
  inside. Note "changed nothing" comes before "declared nothing" — a session
  that changed nothing had nothing to go outside a scope, and sending that
  reader to `--scope` answers a question they do not have.

The brief views add **no colour roles**. The intent is `intent`, the drift
paths are `drift`, the framing is `meta`, and the money is left in the
terminal's own colour — the same roles doing the same jobs as in the labelled
layout. A view that needed a new role would be a view saying something the tool
does not otherwise say. The same goes for `scan`: paths are `path`, prompts are
`intent`, framing is `meta`.

The outcome line each view now leads with takes **no ink at all**. It is the
one line that is always there, and colouring what is always there says nothing
— the same argument that leaves the cost figure uncoloured. `merged` and
`abandoned` stay where they mark one row out of a table of them.

## The agreement review screen

`render/agreement.ts` is a pure function of the draft; `commands/review.ts`
owns the terminal. The rules the screen holds to:

- **Every term stays visible.** All accepted paths, all sensitive paths, the
  actions and the policy with its one-line meaning — never truncated to fit,
  never "and 4 more". What is not on screen was not reviewed. Prime's original
  scope sits above the accepted list, labelled as Prime's, so the two are never
  confused.
- **Line-oriented, not full-screen.** Cooked terminal input, no raw mode, no
  cursor codes, no redraw. Record text goes through `safeText` and is printed
  as `JSON.stringify` of itself, so a path or intent cannot move the cursor or
  hide a character.
- **It says what it does not do.** The screen says policy is checked only
  where `session hook install --repo` has run, for Edit, Write, MultiEdit,
  NotebookEdit and shell commands, and that a shell command it cannot read is asked about;
  it says no session has started until `accept`. Change that sentence in the commit that changes the reach.
- Colour is the existing roles — `intent`, `path`, `meta`. No new role.

`session hook check` is read by an editor, not a person: exactly one JSON line
or nothing, no colour, no trailing prose, and the reason strings obey the same
error style as the rest of the CLI — what happened, then what to do.

## Intent-source labels

`INTENT_MARKER`, `INTENT_NOTE` and `INTENT_LEGEND` in
`render/terminal/intent.ts` are the shared vocabulary. Declared has no marker,
primed has `+` for **scope reviewed with Prime**, and captured has `~` for a
first prompt recorded by the hook. The characters survive pipes and carry no
new colour role. Never describe a primed intent as generated or not composed
by the developer.

Week, Markdown and HTML use the same markers. Their legends name only sources
actually represented by rows, in `INTENT_SOURCES` order. Survival and `week`'s
blocks have a different contract: all three source blocks or lines print, even
when empty, and their samples stay separate.

The brief view labels Prime's scope assistance while keeping the intent whole.
`week <id> --full` displays the original `proposed` scope alongside the accepted
`declared` scope; an empty original proposal reads `no suggestion`. Never
replace one list with the other or use the proposal to decide drift. The
accepted scope is the yardstick; the original suggestion is the record of
what Prime offered.

## The week table

**One block per intent source — declared, primed, captured — and never a
total.** They are different evidence: Prime can lower drift mechanically by
putting historical misses into the accepted scope, so a figure over all three
moves whenever their mix moves and describes none of them. The same rule the
HTML page follows, and the measurement rules behind it are in the
`measurement-rules` skill under Intent source.

A source holding nothing **still prints its line** — `primed · no sessions` —
because dropping the empty arm leaves
the others reading as the whole answer, which is the pooled reading the split
exists to prevent. `blocks` walks `INTENT_SOURCES`, so a source added later is
printed by this view without anyone remembering to.

There is **no totals row**. `NO_POOL` says so at the top, under the window
line, where a reader looks for the total before deciding the view forgot one.

**A session is two lines.** The intent first, at the left margin, in the
`intent` ink; the id, the stamp, the class (`--class` only), the outcome and
the figures on a second line indented one level further. That indent is the
whole of what tells the two apart once colour is stripped, which is the render
that goes into a pipe and a bug report.

The intent is **not shortened for anybody who composed their own** — a
declaration is the promise the diff is held to, and a primed intent is the
developer's words as well, so both wrap over as many lines as they need.
Only a captured prompt is cut, by `headOf`, the one rule for where somebody's
first sentence ends, shared with `week <id>` and the pull request body.

Figures, left to right: `outside`, `turns`, `tokens` (`--tokens` only),
`no edits`, `cost`. Right-aligned so a column can be scanned, and the headings
sit over them with **nothing over the left block**: an id, a stamp and an
outcome are not figures to scan down a column, and three more headings above
them would make the reader find the four that are.

`outside` rather than `drift`, which is what this column used to read, and
`drift files` before that. A bare `drift` over a column of small integers reads
as a score; the unit that guarded against it cost six columns, and six was
exactly what stood between the old table and an eighty-column terminal. The
intent no longer competes for that room, so the heading can name what the
number counts again. `no edits` rather than `empty` for a plainer reason:
`empty` is also an outcome, and the two used to sit in one row saying different
things.

**Two absences, and they are not the same absence.** `UNKNOWN` — the word, not
a mark — where the record cannot supply a figure: which turns of a session that
changed files wrote nothing, a session with no turns on it, a model no rate
covers. `NOT_ASKED`, an em dash, where the question cannot be asked at all: a
session that declared no scope has no distance to measure, and the block's own
line says so. Never a nought for either. Every `unknown` in the cost column is
counted by one of the two notes under the blocks.

The row is trimmed rather than padded, so a row written off by a mark is struck
through to its last figure and no further. Both of its lines take the
`abandoned` ink and nothing else takes any — nothing inside a row that has been
written off gets to argue with the strike.

**`abandoned` is printed only where somebody marked it.** `cellsFor` and the
block counts both read `reportedOutcome`, never the field: a computed
`abandoned` reads `open`, which is what a branch nobody has pushed actually is.
Open is named and counted, and no rate in this view has it in a denominator —
there is no rate in this view at all.

The notes under the table sit in **two blocks with a blank line between them**:
what the table does not say, then the money and the two things that qualify it.
They had run to five dim sentences in a stack under a four-row table, which
reads as one paragraph nobody finishes. Every one of them is owed to the
reader, so none is dropped or folded into another — what they get instead is
the line that says they answer two different questions. It also leaves the
total where rule 3 wants it, with nothing between it and the end. `footnotes`
in `week.ts` is the whole of it, and it adds no blank line where either block
is empty.

The geometry lives in `render/terminal/week/table.ts`, the arithmetic and the
notes under the table in `week.ts`. The split is what keeps either under 400
lines; a reader chasing a misaligned column wants the first file and nothing
in the second.

Nothing in these views may be found by counting lines from either end. The
notes a week earns depend on what is in it, so a test reaching for `at(-2)` is
pinning how many notes one fixture happened to earn; find the note by what it
says.

## The id

`pr [id]`, `week [id]` and `mark <id>` all take one, and every view that prints
one prints the same eight characters, through `shortId` — `week`'s first
column, `week <id>`'s bottom line and its `id` row, `settle`, `mark`, `survival
--check` and `verify`. One width is the whole point: a prefix read off a week
row has to be a prefix those commands answer to, and until the column existed
the only way to write a pull request body for anything but the last session was
to open the JSONL. It is not a flag — a session nobody can name is missing
information, not a preference.

## How old the prices are

Every money figure is quoted at a rate somebody wrote down on a day.
`pricesChecked` is the one line that says which day: dim, under the figure it
dates, in `week`'s footer and at the foot of `week <id> --tokens`. It states the
date the bundled `rates.json` carries and where to override it, and stops
there — no threshold, no "these may be stale", no colour. Whether a fortnight
is stale depends on whether a vendor moved a price, which this tool cannot
know, and the reader holding the invoice can.

Printed only where there is a figure to date: a week nothing could be priced in
and a session whose model no rate covers both print no money, and a date under
either would read as an explanation of why the money is missing. `week --md`
carries none of it — the date belongs beside a figure being quoted, not in a
document about a week.

## Colour

Rationale: [Colour](../../../docs/decisions.md#colour).

`render/palette.ts` is the only file that knows an escape code, and the only
one that imports picocolors. Roles are named for what a thing *is* — `intent`,
`drift`, `waste`, `path`, `meta`, `merged`, `abandoned` — never for the ink
they get, so what the tool emphasises can be read off one file. `path` and
`meta` are both dim and are still two roles: the day one of them stops being
dim is a line here, not an audit of the layout code.

Only the 16 basic ANSI colours, and mostly attributes (bold, dim,
strikethrough). No 256-colour, no truecolor, no hex. The hues belong to
whoever configured the terminal — their red is legible on their background
because they picked it, and a hard-coded one is a guess about a background
this tool cannot see.

Red means *there is something here*: drift paths, and the waste figure only
when it is not zero. `$0.00` in red would teach the reader to ignore red, and
then the session that wasted $40 would go unread too. The cost figure itself
is never coloured — it is always there, and colouring what is always there
says nothing.

The `waste` ink survives in exactly one place: the `no edits` row of `session
show --full`, per session, where the reader asked for the detail. The aggregate
views dropped it when their money became a footnote — red inside a footnote
would make the footnote the loudest thing on the page, which is the arrangement
the ordering above exists to undo.

`colorEnabled` decides: `FORCE_COLOR` outranks everything either way, then
`NO_COLOR` (non-empty), then whether stdout is a TTY. Note this deliberately
differs from picocolors' own rule, which turns colour *on* under `CI` and on
Windows regardless of the stream — a CI log is a file somebody reads later.

The colourless render is the contract. It is what goes into pipes, files, CI
logs and bug reports, and `test/palette.test.ts` pins it byte for byte against
literals, plus asserts that stripping the codes out of the coloured render
gives back exactly the same bytes. Colour is an addition to a terminal, never
a change to the output. `plainPalette` is the same construction as
`ansiPalette` with the ink switched off, not a second hand-written table —
built the other way the two could come to disagree about what a role wraps.

## The pull request body

Rationale and a worked example:
[The pull request writes itself](../../../docs/decisions.md#the-pull-request-writes-itself).

`render/pr.ts` is pure — one session and the rates in, one Markdown string out,
no trailing newline, like `render/markdown.ts`. **No model writes any of it**,
and nothing here may ever call one: the document's whole claim is that it is a
transcription of the record, and its only sentences are the developer's own
intent and a few file lists.

Like Prime's preview, it does **not** lead with where the work went. The
document exists to open the pull request that would land it, so the summary
line is the intent. Everything after that is
the usual order: what was declared, what changed, what went outside it, and the
money last, unemphasised, on one line.

- **Primed and captured** intents are labelled in the summary line itself,
  not in a note under it, so the distinction survives into a `--template`
  that asked only for `{{intent}}`. `INTENT_NOTE` is the wording, shared with
  `week <id>`: primed says the scope was reviewed with Prime, captured says the
  words came from the first prompt.
- A **captured** intent is also shortened to its first sentence or first line,
  whichever ends sooner, with the whole text folded into a `<details>` block
  under it. **Declared and primed intents are never shortened and never get
  the block** — both keep the developer's words in full. Nothing is dropped and no model
  summarises anything: `headOf` in `render/terminal/intent.ts` is the only
  place where the head of a prompt is decided, shared with `week <id>` and the bare
  screen, and `summarize` is the only place this document spends it. The block
  is fenced, with the fence longer than any run of backticks in the prompt, so
  a `</details>` or a code block somebody pasted cannot break out of it — the
  same class of failure as an unescaped `|` in the week table. Templates get
  the short line as `{{intent}}` and the whole text as `{{intent_full}}`, and
  no block: the author places it.
- The drift section is **omitted entirely** when nothing went outside, and also
  when no scope was declared — whatever `drift` holds. Same rule `driftOf` and
  `week <id>` follow: without a declaration there is no distance to measure.
- File lists are **not** capped and must not go through `summarizePaths`: every
  path prints, one per line, grouped by directory and sorted inside each group.
  That cap is for a terminal line, and there is no line here — the file list is
  what a reviewer is reviewing. Sorting alone does not group, so the grouping is
  its own step. Paths stay whole; never a directory heading with bare filenames
  under it, which cannot be copied into a search.
- The cost line obeys the unpriced rule through `unpricedTokens`, the same
  function `week`, `scan` and `stop` name an unpriced model with. A session
  nothing was captured for says so rather than printing `$0.00 · 0 turns`.

**Stdout carries the document and nothing else** — no sweep notice, no
confirmation — because `session pr | gh pr create --body-file -` is what the
command is for. `--copy` and `--out` print what they did *instead of* the
document, since neither leaves anything to pipe.

`--template` fills `{{intent}}`, `{{scope}}`, `{{changed}}`, `{{drift}}` and
`{{cost}}`. Values arrive plain — no headings, no emphasis — since the author
supplied their own. An unknown placeholder is **refused by name**, every
unknown one at once, never left in the output: `{{autor}}` reaching a pull
request is found by a reviewer rather than by the person who could have fixed
it. `{{drift}}` always says something, unlike the default document which drops the
section, because a template's heading is not ours to drop — and it has
**three** states where the body has two: the paths, `Nothing went outside the
declared scope.`, and `NO_SCOPE` for a session that declared none. That last is
the one an implementation gets wrong, and it is the same string `{{scope}}` and
`## Declared scope` use.

A `--template` that will not open says **which** way it failed: missing (with
the note that the path is read from the working directory), a directory, or
permission denied, and anything else keeps the errno's own message. One
sentence over all of them sends half the readers to the wrong fix — a typo'd
path looks like a permissions fault, and a real file looks like a typo.

## Markdown

Rationale and a worked example:
[Handing the week to someone else](../../../docs/decisions.md#handing-the-week-to-someone-else).

`session week --md` writes the week for somebody who was not there — meeting
notes, a Slack post, a Notion or Confluence page. `--copy` puts it on the
clipboard instead of stdout, and implies `--md`, since a terminal table is not
what anybody pastes into a page.

A different document from the terminal table, not the same one with the escape
codes taken out. It leads with the figures that survive being read cold — what
shipped, what did not, what is still open, and how many files went outside the
plan — and the table comes after them.

It obeys the ordering rules above like every other view. The headline carries
no money at all; the columns are `Date`, `Work`, `Outcome`, `Unplanned`,
`Cost`, in `week`'s order with cost last; and what the week cost is the closing
line, through `spentFigure`. Every count in the headline is a count of
something observed, and nought of something observed is a fact — which is why
none of them can go absent the way the closing figure can.

`render/markdown.ts` is pure: sessions, rates and a clock in, one string out,
with no trailing newline. The clock is injected so the heading is a function of
its arguments. Plain Markdown throughout — no colour, no escape codes, no box
drawing, and `test/markdown.test.ts` asserts all three.

**The tick is the one place emoji are allowed.** The ban in Style is about a
terminal, where a glyph may not render and so cannot be relied on to carry
meaning. A Notion page is not that place, and a column of ticks is what
somebody skimming for "did anything ship" is looking for. Nothing else in the
document carries one, and nothing in a terminal view ever should.

Three things the table cannot survive, all handled in `workCell` in this order:
a newline ends a row wherever it falls; the width is measured before escaping,
so the limit counts characters a reader sees; and an unescaped `|` silently
splits a row into two cells and shifts everything right of it. That last one is
why nothing here interpolates an intent raw, and there is a test that a pipe in
an intent leaves the row with exactly five cells.

Every figure in the document is over the sessions the table lists, so the total
row is a total of the rows above it. That is a departure from `week`, where an
empty session's spend stays in the total: here the empty sessions are not rows,
and a total larger than the column under it is a table that visibly does not
add up. What they cost is stated in its own line below instead — disclosed, not
folded in.

The one cell that totals nothing is `Cost`, left empty on purpose, the same as
`week`'s. The closing line is the only total, so there is no second copy of it
sitting in the middle of the columns the table is read for.

A session with no figure is handled per row and per document, and there are two
kinds. A model with no rate reads `unpriced`; a session with **no turns on the
record** reads `not captured` — nothing was found to price it with, and no rate
would fill that. Never `$0.00` for the second: `start` and `stop` see the diff
whether or not an adapter saw anything, so that session may well have changed
files and been billed for them.

The closing figure is over the rest, and `coverageNote` above it says how much
of the table the money covers and what it leaves out, naming the two apart —
"below", since the figure it points at is the closing line. Both come off
`spendOf`'s counters, and they have to: a cell whose word no note underneath
counts is a hole the reader can see and the report will not admit to.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.